From 4e07b0d6208469c01583ab5076fafdd7bb36f4f9 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sat, 20 Apr 2019 09:42:28 +0000 Subject: [PATCH] Auto corrected by following Lint Ruby RSpec/LeadingSubject --- spec/services/crop_search_service_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/services/crop_search_service_spec.rb b/spec/services/crop_search_service_spec.rb index a73fd70d9..b918158a0 100644 --- a/spec/services/crop_search_service_spec.rb +++ b/spec/services/crop_search_service_spec.rb @@ -55,17 +55,18 @@ RSpec.describe CropSearchService, type: :service do let!(:white) { FactoryBot.create :crop, name: 'white mushroom', parent: mushroom_parent } describe 'biased to higher planting counts' do + subject { search('mushroom') } before do # Having plantings should bring these crops to the top of the search results FactoryBot.create_list :planting, 10, crop: white FactoryBot.create_list :planting, 4, crop: shitake Crop.reindex end - subject { search('mushroom') } it { expect(subject.first).to eq 'white mushroom' } it { expect(subject.second).to eq 'shitake mushroom' } end describe "biased to crops you've planted" do + subject { CropSearchService.search('mushroom', current_member: owner).map(&:name) } let(:owner) { FactoryBot.create :member } before do FactoryBot.create_list :planting, 10, crop: brown @@ -74,7 +75,6 @@ RSpec.describe CropSearchService, type: :service do FactoryBot.create :planting, crop: shitake, owner: owner Crop.reindex end - subject { CropSearchService.search('mushroom', current_member: owner).map(&:name) } it { expect(subject.first).to eq oyster.name } it { expect(subject.second).to eq shitake.name } end