Tidy up specs

This commit is contained in:
Brenda Wallace
2019-04-04 10:50:56 +13:00
parent e465b6f19c
commit e5c0edb0d0
2 changed files with 21 additions and 17 deletions

View File

@@ -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

View File

@@ -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']")