Added feature tests for on gardens, seeds and harvests for the card based thumbnails

This commit is contained in:
AELOGICA
2015-07-13 08:40:35 +08:00
committed by gsandoval
parent 611adc0728
commit aa3cf729c8
4 changed files with 26 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
%h3.panel-title
= link_to "#{garden.owner.login_name}'s garden", garden.owner
- if can? :edit, garden
%a.pull-right{:href => edit_garden_path(garden), :role => "button"}
%a.pull-right{:href => edit_garden_path(garden), :role => "button", :id => "edit_garden_glyphicon"}
%span.glyphicon.glyphicon-pencil{:title => "Edit"}
.panel-body{:id => "gardens_panel_body"}
.row

View File

@@ -3,7 +3,7 @@
%h3.panel-title
= link_to "#{harvest.owner.login_name}'s harvest", harvest.owner
- if can? :edit, harvest
%a.pull-right{:href => edit_harvest_path(harvest), :role => "button"}
%a.pull-right{:href => edit_harvest_path(harvest), :role => "button", :id => "edit_harvest_glyphicon"}
%span.glyphicon.glyphicon-pencil{:title => "Edit"}
.panel-body
.row

View File

@@ -45,6 +45,18 @@ feature "Planting a crop", :js => true do
expect(page).to have_content "Area must be greater than or equal to 0"
end
context "Clicking edit from the index page" do
background do
visit gardens_path
end
scenario "button on index to edit garden" do
first(".panel-title").click_link("edit_garden_glyphicon")
page.should have_content 'Edit garden'
end
end
scenario "Edit garden" do
visit new_garden_path
fill_in "Name", :with => "New garden"

View File

@@ -26,10 +26,18 @@ feature "Harvesting a crop", :js => true do
expect(page).to have_content "Harvest was successfully created"
end
scenario "Clicking link to owner's profile" do
visit harvests_by_owner_path(member)
click_link "View #{member}'s profile >>"
current_path.should eq member_path(member)
context "Clicking edit from the index page" do
let!(:harvest) { FactoryGirl.create(:harvest, :crop => maize, :owner => member) }
background do
visit harvests_path
end
scenario "button on index to edit harvest" do
click_link "edit_harvest_glyphicon"
current_path.should eq edit_harvest_path(harvest)
page.should have_content 'Editing harvest'
end
end
scenario "Harvesting from crop page" do
@@ -63,4 +71,3 @@ feature "Harvesting a crop", :js => true do
end
end