Sha256: b088a6bf57296e56bac89dca19eef25952cb7c2274ede5b9caccf9a54798504f

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 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 %>/edit.html" do
  before do
    assigns[:<%= file_name %>] = @<%= file_name %> = stub_model(<%= class_name %>,
      :new_record? => false<%= 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 edit form" do
    render "<%= plural_name %>/edit.html"

    response.should have_tag("form[action=?][method=post]", <%= file_name %>_path(@<%= file_name %>)) 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_edit.html_spec.rb.erb
hashrocket-terraformation-0.0.0 rails_generators/terrascaffold/templates/view_edit.html_spec.rb.erb