Sha256: 9165777298171ae8963b71ec7262c894c182ef1842ec5248e09f8d623c2d5f8a

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'

describe "/<%= table_name %>/new.<%= default_file_extension %>" do
  include <%= controller_class_name %>Helper
  
  before do
    @<%= file_name %> = mock_model(<%= class_name %>)
    @<%= file_name %>.stub!(:new_record?).and_return(true)
<% for attribute in attributes -%>
    @<%= file_name %>.stub!(:<%= attribute.name %>).and_return(<%= attribute.default_value %>)
<% end -%>
    assigns[:<%= file_name %>] = @<%= file_name %>
  end

  it "should render new form" do
    render "/<%= table_name %>/new.<%= default_file_extension %>"
    
    response.should have_tag("form[action=?][method=post]", <%= table_name %>_path) do
<% for attribute in attributes -%><% unless attribute.name =~ /_id/ || [:datetime, :timestamp, :time, :date].index(attribute.type) -%>
      with_tag("<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>[name=?]", "<%= file_name %>[<%= attribute.name %>]")
<% end -%><% end -%>
    end
  end
end


Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
deckshuffler-0.0.2 vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec.rb