Skip to content

Commit

Permalink
fix: options must not be part of doc_header
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgz committed Aug 7, 2024
1 parent de7120d commit 07125cc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/esse/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def doc_header
{ _id: id }.tap do |h|
h[:_type] = type if type
h[:routing] = routing if routing?
h.merge!(options)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/esse/repository/object_document_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def each_serialized_batch(lazy_attributes: false, **kwargs)
end
end

yield entries, **kwargs
yield entries, **collection_context
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/esse/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def routing
context 'when the document includes options' do
let(:options) { { foo: 'bar' } }

it { is_expected.to eq(_id: 1, _type: 'foo', routing: 'bar', foo: 'bar') }
it { is_expected.to eq(_id: 1, _type: 'foo', routing: 'bar') }
end
end

Expand Down
8 changes: 4 additions & 4 deletions spec/esse/repository/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
it 'yields serialized objects without arguments' do
expected_data = []
expect {
StatesIndex::State.each_serialized_batch { |hash| expected_data << hash }
StatesIndex::State.each_serialized_batch { |chunk| expected_data << chunk }
}.not_to raise_error
expect(expected_data).to match_array(
[
Expand Down Expand Up @@ -115,7 +115,7 @@
it 'yields serialized objects without arguments' do
expected_data = []
expect {
StatesIndex::State.each_serialized_batch { |hash| expected_data << hash }
StatesIndex::State.each_serialized_batch { |chunk| expected_data << chunk }
}.not_to raise_error
expect(expected_data).to match_array(
[
Expand All @@ -129,7 +129,7 @@
it 'yields serialized objects with a collection filter' do
expected_data = []
expect {
StatesIndex::State.each_serialized_batch(filter: ->(state) { state.id > 2 }) { |hash| expected_data << hash }
StatesIndex::State.each_serialized_batch(filter: ->(state) { state.id > 2 }) { |chunk| expected_data << chunk }
}.not_to raise_error
expect(expected_data).to match_array(
[
Expand All @@ -142,7 +142,7 @@
it 'yields serialized objects with document scope' do
expected_data = []
expect {
StatesIndex::State.each_serialized_batch(uppercase: true) { |hash| expected_data << hash }
StatesIndex::State.each_serialized_batch(uppercase: true) { |chunk| expected_data << chunk }
}.not_to raise_error
expect(expected_data).to match_array(
[
Expand Down

0 comments on commit 07125cc

Please sign in to comment.