Sha256: 969d179df5c287762028d96cab3c405480c66cdaecad6cb265c3cc259f2080e9

Contents?: true

Size: 965 Bytes

Versions: 3

Compression:

Stored size: 965 Bytes

Contents

require 'spec_helper'

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

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

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

3 entries across 3 versions & 1 rubygems

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