Plantings index should display finished at date instead of planted at under the finished column.

Added feature test for plantings index page.
This commit is contained in:
Yoong Kang Lim committed 2014-11-11 22:41:29 +11:00
1 parent 24d276da37
commit caad748d08
3 files changed
+17 -3

No files matched your search

+1 -1
View File
@@ -43,7 +43,7 @@
%td= planting.planted_at
%td
- if planting.finished and planting.finished_at
= planting.planted_at
= planting.finished_at
- elsif planting.finished
Yes (no date specified)
%td= planting.sunniness
@@ -71,6 +71,9 @@ feature "Planting a crop", :js => true do
end
expect(page).to have_content "Planting was successfully created"
expect(page).to have_content "Finished: August 30, 2014"
visit plantings_path
expect(page).to have_content "August 30, 2014"
end
scenario "Marking a planting as finished without a date" do
+13 -2
View File
@@ -8,8 +8,8 @@ describe "plantings/index" do
@tomato = FactoryGirl.create(:tomato)
@maize = FactoryGirl.create(:maize)
page = 1
per_page = 2
total_entries = 2
per_page = 3
total_entries = 3
plantings = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
FactoryGirl.create(:planting,
@@ -22,6 +22,13 @@ describe "plantings/index" do
:crop => @maize,
:description => '',
:planted_at => Time.local(2013, 1, 13)
),
FactoryGirl.create(:planting,
:garden => @garden,
:crop => @tomato,
:planted_at => Time.local(2013, 1, 13),
:finished_at => Time.local(2013, 1, 20),
:finished => true
)
])
end
@@ -40,6 +47,10 @@ describe "plantings/index" do
rendered.should contain 'January 13, 2013'
end
it "displays finished time" do
rendered.should contain 'January 20, 2013'
end
it "provides data links" do
render
rendered.should contain "The data on this page is available in the following formats:"