Sha256: 0ecd6c4c03bb4cbca9d73f34dc1706865be3963277208ee0a1003dba5df71428

Contents?: true

Size: 1.21 KB

Versions: 82

Compression:

Stored size: 1.21 KB

Contents

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

describe "/<%= table_name %>/new.<%= default_file_extension %>" do
  include <%= controller_class_name %>Helper
  
  before(:each) 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 %>


    template.stub!(:object_url).and_return(<%= file_name %>_path(@<%= file_name %>)) 
    template.stub!(:collection_url).and_return(<%= file_name.pluralize %>_path) 
  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

82 entries across 82 versions & 22 rubygems

Version Path
spree-0.8.2 vendor/plugins/resource_controller/generators/scaffold_resource/templates/rspec/views/new_spec.rb
spree-0.8.3 vendor/plugins/resource_controller/generators/scaffold_resource/templates/rspec/views/new_spec.rb