Sha256: d15f047c75a153dd12a9f78ca25e6ee9639acd178620dd2768893f6308ddc9d8

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

require 'spec_helper'

<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].include?(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

  subject do
    render "<%= plural_name %>/new.html"
    response
  end

  it "should render new form" do
    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

3 entries across 3 versions & 1 rubygems

Version Path
terraformation-0.2.2 rails_generators/terrascaffold/templates/view_new.html_spec.rb.erb
terraformation-0.2.1 rails_generators/terrascaffold/templates/view_new.html_spec.rb.erb
terraformation-0.2.0 rails_generators/terrascaffold/templates/view_new.html_spec.rb.erb