diff --git a/app/views/gardens/_actions.html.haml b/app/views/gardens/_actions.html.haml index 5aec0ba35..a6f85a2e4 100644 --- a/app/views/gardens/_actions.html.haml +++ b/app/views/gardens/_actions.html.haml @@ -23,6 +23,6 @@ Delete - if can?(:edit, @garden) && can?(:create, Photo) = link_to new_photo_path(type: "garden", id: @garden.id), - class: 'btn btn-primary' do + class: 'btn btn-primary' do %span.glyphicon.glyphicon-camera{ title: "Add Photo" } Add Photo diff --git a/spec/features/photos/new_photo_spec.rb b/spec/features/photos/new_photo_spec.rb index 0f0c8af2c..1c13b2793 100644 --- a/spec/features/photos/new_photo_spec.rb +++ b/spec/features/photos/new_photo_spec.rb @@ -13,7 +13,7 @@ feature "new photo page" do scenario "add photo" do visit planting_path(planting) - click_link "Add photo" + click_link('Add photo', match: :first) expect(page).to have_text planting.crop.name end end diff --git a/spec/views/gardens/show.html.haml_spec.rb b/spec/views/gardens/show.html.haml_spec.rb index 015333ae0..7130e2e4f 100644 --- a/spec/views/gardens/show.html.haml_spec.rb +++ b/spec/views/gardens/show.html.haml_spec.rb @@ -50,6 +50,10 @@ describe "gardens/show" do rendered.should have_content "Plant something" end + it "shows an 'add photo' button" do + rendered.should have_content "Add photo" + end + it "links to the right crop in the planting link" do assert_select("a[href='#{new_planting_path}?garden_id=#{@garden.id}']") end