From 19adabc55f973d647b4bcc91fb71ffc32f92e1c9 Mon Sep 17 00:00:00 2001 From: Anthony Atkinson Date: Thu, 23 Jul 2015 11:27:17 -0400 Subject: [PATCH] Test for required and optional field display on Planting form. --- spec/features/plantings/planting_a_crop_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/features/plantings/planting_a_crop_spec.rb b/spec/features/plantings/planting_a_crop_spec.rb index 808b70880..38a9e2672 100644 --- a/spec/features/plantings/planting_a_crop_spec.rb +++ b/spec/features/plantings/planting_a_crop_spec.rb @@ -14,6 +14,21 @@ feature "Planting a crop", :js => true do it_behaves_like "crop suggest", "planting" + it "has the required fields help text" do + expect(page).to have_content "* denotes a required field" + end + + it "displays required and optional fields properly" do + expect(page).to have_selector ".form-group.required", text: "What did you plant?" + expect(page).to have_selector ".form-group.required", text: "Where did you plant it?" + expect(page).to have_selector 'input#planting_planted_at[placeholder="optional"]' + expect(page).to have_selector 'input#planting_quantity[placeholder="optional"]' + expect(page).to have_selector 'select#planting_planted_from option', text: 'optional' + expect(page).to have_selector 'select#planting_sunniness option', text: 'optional' + expect(page).to have_selector 'textarea#planting_description[placeholder="optional"]' + expect(page).to have_selector 'input#planting_finished_at[placeholder="optional"]' + end + scenario "Creating a new planting" do fill_autocomplete "crop", :with => "mai" select_from_autocomplete "maize"