Skip to content

Commit

Permalink
Add tests for track_scores
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry committed Sep 27, 2016
1 parent ae9ccca commit 37cd7f4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/chewy/query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@
specify { expect(subject.offset { 20 / 2 }.criteria.request_body[:body]).to include(from: 10) }
end

describe '#track_scores' do
specify { expect(subject.track_scores(true)).to be_a described_class }
specify { expect(subject.track_scores(true)).not_to eq(subject) }
specify { expect(subject.track_scores(true).criteria.request_options).to include(track_scores: true) }
specify { expect { subject.track_scores(true) }.not_to change { subject.criteria.request_options } }
specify { expect(subject.track_scores(false).criteria.request_body[:body]).to include(track_scores: false) }
end

describe '#script_fields' do
specify { expect(subject.script_fields(distance: 'test()')).to be_a described_class }
specify { expect(subject.script_fields(distance: 'test()')).not_to eq(subject) }
Expand Down

0 comments on commit 37cd7f4

Please sign in to comment.