Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into prefix-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
svogt0511 committed Jan 26, 2023
2 parents e72c1ee + c4ce69e commit 9c23505
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/models/concerns/indexable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ def switch_index(options = {})
add: {
index: index_name,
alias: alias_name,
is_write_index: is_write_index,
},
},
],
Expand Down
4 changes: 1 addition & 3 deletions app/serializers/repository_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ class RepositorySerializer
end
end

attribute :subjects,

Proc.new { |object, params| } do |object|
attribute :subjects do |object|
if object.subjects?
Array.wrap(object.subjects).map { |subject|
subject.transform_keys! do |key|
Expand Down
16 changes: 16 additions & 0 deletions spec/requests/repositories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,17 @@
}
end

let(:empty_subject_attributes) do
{
"data" => {
"type" => "repositories",
"attributes" => {
"subjects" => nil,
},
},
}
end

it "updates the repository" do
put "/repositories/#{client.symbol}", update_attributes, headers
expect(json.dig("data", "attributes", "subjects")).to eq([
Expand All @@ -400,6 +411,11 @@
}
])
end

it "accepts an empty array" do
put "/repositories/#{client.symbol}", empty_subject_attributes, headers
expect(json.dig("data", "attributes", "subjects")).to match_array([])
end
end


Expand Down

0 comments on commit 9c23505

Please sign in to comment.