Commit 702bd872
Changed files (2)
app
views
tutorials
spec
views
tutorials
app/views/tutorials/index.html.erb
@@ -39,5 +39,6 @@
</div>
</div>
<div class="row">
+ <%= debug(@tutorials) %>
<div class="span12"> <%= paginate @tutorials %> </div>
</div>
spec/views/tutorials/index.html.erb_spec.rb
@@ -2,25 +2,23 @@ require 'spec_helper'
describe "tutorials/index" do
before(:each) do
- assign(:tutorials, [
- stub_model(Tutorial,
- :heading => "Heading",
- :description => "MyText",
- :url => "Url",
- :created_at => DateTime.new(2012, 9, 13)
- ),
- stub_model(Tutorial,
- :heading => "Heading",
- :description => "MyText",
- :url => "Url",
- :created_at => DateTime.new(2012, 9, 13)
- )
- ])
+ items = []
+ (1..2).each do |item|
+ items << FactoryGirl.build(:tutorial,
+ :heading => "Heading",
+ :description => "MyText",
+ :created_at => DateTime.new(2012, 9, 13)
+ )
+ end
+ assign(:tutorials, Kaminari.paginate_array(items).page(1))
+ render
end
- it "renders a list of tutorials" do
- render
- assert_select "h3", :text => "Heading September. 13, 2012", :count => 2
+ it "should display the text for each tutorial" do
assert_select "p", :text => "MyText".to_s, :count => 2
end
+
+ it "should display the heading for each tutorial" do
+ assert_select "h3", :text => "Heading September. 13, 2012", :count => 2
+ end
end