Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the track_scores option to the query #417

Merged
merged 3 commits into from
Sep 28, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests for track_scores
  • Loading branch information
dmitry committed Sep 27, 2016
commit 37cd7f417bc17f1c79e151f281887029b673e1ab
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