Added new fields to gardens index

This commit is contained in:
Skud committed 2013-10-25 23:01:23 +11:00
1 parent aee0adde43
commit dcf5855643
2 files changed
+15 -5

No files matched your search

+10
View File
@@ -26,6 +26,9 @@
%th Owner
%th Garden name
%th Description
%th Location
%th Area
%th Active?
%th Plantings
%th
@@ -35,6 +38,13 @@
%td= link_to garden.owner.login_name, garden.owner
%td= link_to garden.name, garden
%td= garden.description
%td
- if ! garden.location.blank?
= link_to garden.location, place_path(garden.location)
%td
- if garden.area
= pluralize(garden.area, garden.area_unit)
%td= garden.active ? "Yes" : "No"
%td
- if garden.plantings.empty?
None
+5 -5
View File
@@ -4,14 +4,12 @@ describe "gardens/index" do
before(:each) do
controller.stub(:current_user) { nil }
@owner = FactoryGirl.create(:member)
@garden = FactoryGirl.create(:garden, :owner => @owner)
page = 1
per_page = 2
total_entries = 2
gardens = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
FactoryGirl.create(:garden, :owner => @owner),
FactoryGirl.create(:garden, :owner => @owner)
])
pager.replace([@garden, @garden])
end
assign(:gardens, gardens)
end
@@ -19,7 +17,9 @@ describe "gardens/index" do
it "renders a list of gardens" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "tr>td", :text => "Springfield Community Garden".to_s, :count => 2
assert_select "tr>td", :text => @garden.name, :count => 2
assert_select "tr>td>a", :text => @garden.location, :count => 2
assert_select "tr>td", :text => pluralize(@garden.area, @garden.area_unit), :count => 2
end
end