Upgraded Rails and RSpec
[monkeycharger.git] / vendor / plugins / rspec / rspec_on_rails / generators / rspec_scaffold / templates / new_erb_spec.rb
blob8a335f5f34c62bbce9921f9851532297a3e8b63c
1 require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
3 describe "/<%= table_name %>/new.<%= default_file_extension %>" do
4   include <%= controller_class_name %>Helper
5   
6   before do
7     @<%= file_name %> = mock_model(<%= class_name %>)
8     @<%= file_name %>.stub!(:new_record?).and_return(true)
9 <% for attribute in attributes -%>
10     @<%= file_name %>.stub!(:<%= attribute.name %>).and_return(<%= attribute.default_value %>)
11 <% end -%>
12     assigns[:<%= file_name %>] = @<%= file_name %>
13   end
15   it "should render new form" do
16     render "/<%= table_name %>/new.<%= default_file_extension %>"
17     
18     response.should have_tag("form[action=?][method=post]", <%= table_name %>_path) do
19 <% for attribute in attributes -%><% unless attribute.name =~ /_id/ || [:datetime, :timestamp, :time, :date].index(attribute.type) -%>
20       with_tag("<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>[name=?]", "<%= file_name %>[<%= attribute.name %>]")
21 <% end -%><% end -%>
22     end
23   end
24 end