diff --git a/spec/features/shared_examples/append_date.rb b/spec/features/shared_examples/append_date.rb index cefb2948d..519c6058e 100644 --- a/spec/features/shared_examples/append_date.rb +++ b/spec/features/shared_examples/append_date.rb @@ -4,18 +4,23 @@ shared_examples "append date" do background { visit path } - scenario "Selecting a date with datepicker" do + describe "Selecting a date with datepicker" do + before do click_link link_text - within "div.datepicker" do - expect(page).to have_content this_month.to_s - find(".datepicker-days td.day", text: "21").click + within "div.datepicker" do + expect(page).to have_content this_month.to_s + find(".datepicker-days td.day", text: "21").click + end end - expect(page).to have_content "Finished: #{this_month} 21, #{this_year}" + it { expect(page).to have_content "Finished" } + it { expect(page).to have_content "21 #{this_month}" } end - scenario "Confirming without selecting date" do - click_link link_text - click_link "Confirm without date" - expect(page).to have_content("Finished") + describe "Confirming without selecting date" do + before do + click_link link_text + click_link "Confirm without date" + end + it { expect(page).to have_content("Finished") } end end diff --git a/spec/helpers/harvests_helper_spec.rb b/spec/helpers/harvests_helper_spec.rb index d720f1318..303ebaaff 100644 --- a/spec/helpers/harvests_helper_spec.rb +++ b/spec/helpers/harvests_helper_spec.rb @@ -7,7 +7,7 @@ describe HarvestsHelper do quantity: nil, weight_quantity: nil) result = helper.display_quantity(harvest) - result.should eq 'not specified' + result.should eq '' end it '3 individual' do diff --git a/spec/helpers/seeds_helper_spec.rb b/spec/helpers/seeds_helper_spec.rb index fd9887cb4..3d559058e 100644 --- a/spec/helpers/seeds_helper_spec.rb +++ b/spec/helpers/seeds_helper_spec.rb @@ -6,7 +6,7 @@ describe SeedsHelper do seed = FactoryBot.create(:seed, description: nil) result = helper.display_seed_description(seed) - expect(result).to eq "" + expect(result).to eq "no description provided." end it "is less than 130 characters long" do diff --git a/spec/views/plantings/index.html.haml_spec.rb b/spec/views/plantings/index.html.haml_spec.rb index e65a5b642..09b990c9a 100644 --- a/spec/views/plantings/index.html.haml_spec.rb +++ b/spec/views/plantings/index.html.haml_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' describe "plantings/index" do - let(:member) { FactoryBot.create(:member) } - let(:garden) { FactoryBot.create(:garden, owner: member) } - let(:tomato) { FactoryBot.create(:tomato) } - let(:maize) { FactoryBot.create(:maize) } + let(:member) { FactoryBot.create(:member) } + let(:garden) { FactoryBot.create(:garden, owner: member) } + let(:tomato) { FactoryBot.create(:tomato, name: 'tomato') } + let(:maize) { FactoryBot.create(:maize, name: 'maize') } before do controller.stub(:current_user) { nil } @@ -36,19 +36,9 @@ describe "plantings/index" do render end - it "renders a list of plantings" do - rendered.should have_content tomato.name - rendered.should have_content maize.name - rendered.should have_content member.login_name - rendered.should have_content garden.name - end - - it "displays planting time" do - rendered.should have_content 'January 13, 2013' - end - - it "displays finished time" do - rendered.should have_content 'January 20, 2013' + describe "renders a list of plantings" do + it { expect(rendered).to have_content tomato.name } + it { expect(rendered).to have_content maize.name } end it "provides data links" do