From 045deb1ae48d902f48efd3ee1a7a0edc9ff6f45f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 23 Jan 2019 16:19:08 +1300 Subject: [PATCH] Add crop name to actions --- app/views/crops/_index_card.html.haml | 4 ++-- spec/features/harvests/harvesting_a_crop_spec.rb | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/crops/_index_card.html.haml b/app/views/crops/_index_card.html.haml index 99b4a1a7e..1c94573cf 100644 --- a/app/views/crops/_index_card.html.haml +++ b/app/views/crops/_index_card.html.haml @@ -31,6 +31,6 @@ days after planting - if can? :create, Planting - = link_to 'Plant this', new_planting_path(params: { crop_id: crop.id }), class: 'btn btn-primary' + = link_to "Plant #{crop.name}", new_planting_path(params: { crop_id: crop.id }), class: 'btn btn-primary' - if can? :create, Seed - = link_to 'Add seeds to stash', new_seed_path(params: { crop_id: crop.id }), class: 'btn btn-primary' + = link_to "Add #{crop.name} seeds to stash", new_seed_path(params: { crop_id: crop.id }), class: 'btn btn-primary' diff --git a/spec/features/harvests/harvesting_a_crop_spec.rb b/spec/features/harvests/harvesting_a_crop_spec.rb index 5f6d85fa2..afb182120 100644 --- a/spec/features/harvests/harvesting_a_crop_spec.rb +++ b/spec/features/harvests/harvesting_a_crop_spec.rb @@ -64,7 +64,9 @@ feature "Harvesting a crop", :js, :elasticsearch do scenario "Harvesting from crop page" do visit crop_path(maize) - click_link "Harvest this" + within '.crop-actions' do + click_link "Harvest #{maize.name}" + end within "form#new_harvest" do select plant_part.name, from: 'harvest[plant_part_id]' expect(page).to have_selector "input[value='maize']"