Upgraded Rails and RSpec
[monkeycharger.git] / vendor / plugins / rspec / rspec_on_rails / generators / rspec_scaffold / templates / index_erb_spec.rb
bloba55bc36a1b4f009baf394df6d2312204a2befbf6
1 require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
3 describe "/<%= table_name %>/index.<%= default_file_extension %>" do
4   include <%= controller_class_name %>Helper
5   
6   before do
7 <% [98,99].each do |id| -%>
8     <%= file_name %>_<%= id %> = mock_model(<%= class_name %>)
9 <% for attribute in attributes -%>
10     <%= file_name %>_<%= id %>.should_receive(:<%= attribute.name %>).and_return(<%= attribute.default_value %>)
11 <% end -%><% end %>
12     assigns[:<%= table_name %>] = [<%= file_name %>_98, <%= file_name %>_99]
13   end
15   it "should render list of <%= table_name %>" do
16     render "/<%= table_name %>/index.<%= default_file_extension %>"
17 <% for attribute in attributes -%><% unless attribute.name =~ /_id/ || [:datetime, :timestamp, :time, :date].index(attribute.type) -%>
18     response.should have_tag("tr>td", <%= attribute.default_value %>, 2)
19 <% end -%><% end -%>
20   end
21 end