diff --git a/spec/features/plantings/planting_a_crop_spec.rb b/spec/features/plantings/planting_a_crop_spec.rb index 0ada46178..75cdbffd1 100644 --- a/spec/features/plantings/planting_a_crop_spec.rb +++ b/spec/features/plantings/planting_a_crop_spec.rb @@ -32,26 +32,30 @@ describe "Planting a crop", :js, :elasticsearch do it { expect(page).to have_optional 'input#planting_finished_at' } end - it "Creating a new planting" do - fill_autocomplete "crop", with: "mai" - select_from_autocomplete "maize" - within "form#new_planting" do - fill_in "When", with: "2014-06-15" - fill_in "How many?", with: 42 - select "cutting", from: "Planted from:" - select "semi-shade", from: "Sun or shade?" - fill_in "Tell us more about it", with: "It's rad." - click_button "Save" + describe "Creating a new planting" do + before do + fill_autocomplete "crop", with: "mai" + select_from_autocomplete "maize" + within "form#new_planting" do + fill_in "When", with: "2014-06-15" + fill_in "How many?", with: 42 + select "cutting", from: "Planted from:" + select "semi-shade", from: "Sun or shade?" + fill_in "Tell us more about it", with: "It's rad." + click_button "Save" + end end - expect(page).to have_content "planting was successfully created" - expect(page).to have_content "Not enough data" + it { expect(page).to have_content "planting was successfully created" } + it { expect(page).to have_content "Not enough data" } end - it "Clicking link to owner's profile" do - visit member_plantings_path(member) - click_link "View #{member}'s profile >>" - expect(current_path).to eq member_path(member) + describe "Clicking link to owner's profile" do + before do + visit member_plantings_path(member) + click_link "View #{member}'s profile >>" + end + it { expect(current_path).to eq member_path(member) } end describe "Progress bar status on planting creation" do diff --git a/spec/features/shared_examples/crop_suggest.rb b/spec/features/shared_examples/crop_suggest.rb index c4f253ec5..3b90b3a0d 100644 --- a/spec/features/shared_examples/crop_suggest.rb +++ b/spec/features/shared_examples/crop_suggest.rb @@ -6,7 +6,7 @@ shared_examples "crop suggest" do |resource| let!(:tomato) { create :tomato } let!(:roma) { create :roma } - before { [pea, pear, maize, tomato].each{|crop| crop.reindex } } + before { [pea, pear, maize, tomato].each(&:reindex) } scenario "placeholder text in crop auto suggest field" do expect(page).to have_selector("input[placeholder='e.g. lettuce']")