Sha256: c18b12c22231c7dbf83ec268761f489f51fffd0fc7ed27181773f5491f08688d

Contents?: true

Size: 982 Bytes

Versions: 2

Compression:

Stored size: 982 Bytes

Contents

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

<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
describe "/<%= plural_name %>/new.html" do
  before do
    assigns[:<%= file_name %>] = stub_model(<%= class_name %>,
      :new_record? => true<%= output_attributes.empty? ? '' : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
      :<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
<% end -%>
    )
  end

  it "should render new form" do
    render "<%= plural_name %>/new.html"

    response.should have_tag("form[action=?][method=post]", <%= plural_name %>_path) do
<% for attribute in output_attributes -%>
      with_tag("#<%= file_name %>_<%= attribute.name %>[name=?]", "<%= file_name %>[<%= attribute.name %>]")
<% end -%>
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
hashrocket-hashrocket-terraformation-0.0.0 rails_generators/terrascaffold/templates/view_new.html_spec.rb.erb
hashrocket-terraformation-0.0.0 rails_generators/terrascaffold/templates/view_new.html_spec.rb.erb