Merge pull request #67 from cephLpod/count2

Count2
This commit is contained in:
Skud
2012-12-16 00:54:38 -08:00
6 changed files with 27 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
- content_for :title, "Crops"
- c = 0
%p
= "Displaying #{@crops.length} crops"
%ul.thumbnails
.row
- @crops.each do |crop|

View File

@@ -1,5 +1,8 @@
= content_for :title, "Growstuff members"
%p
= "Displaying #{@members.length} members"
%ul.thumbnails
- @members.each do |m|
%li.span2

View File

@@ -1,6 +1,9 @@
= content_for :title, "Recent Growstuff member updates"
%p
= "Displaying #{@updates.length} updates"
- @updates.each do |update|
= render :partial => "single", :locals => { :update => update, :subject => true }
= render :partial => "single", :locals => { :update => update, :subject => true }
= link_to 'New Update', new_update_path

View File

@@ -20,7 +20,12 @@ describe "crops/index" do
assert_select "a", :text => "Maize"
assert_select "a", :text => "Tomato"
end
it "counts the number of crops" do
render
rendered.should contain "Displaying 2 crops"
end
context "logged out" do
it "doesn't show the new crop link if logged out" do
render

View File

@@ -27,4 +27,9 @@ describe "members/index" do
rendered.should contain "bob"
rendered.should_not contain "bob..."
end
it "counts the number of members" do
rendered.should contain "Displaying 2 members"
end
end

View File

@@ -29,4 +29,10 @@ describe "updates/index" do
assert_select "div.update>div.update-body",
:text => "MyText".to_s, :count => 2
end
it "counts the number of updates" do
render
rendered.should contain "Displaying 2 updates"
end
end