Sha256: 7198814c2fbccbe028c9b6041dd041921d2189cdd10c03220ca090c69a2fc7bc

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

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 %>/index.html" do
  before do
    assigns[:<%= plural_name %>] = [
<% [1,2].each_with_index do |id, model_index| -%>
      stub_model(<%= class_name %><%= output_attributes.empty? ? (model_index == 1 ? ')' : '),') : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
        :<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
<% end -%>
<% if !output_attributes.empty? -%>
      <%= model_index == 1 ? ')' : '),' %>
<% end -%>
<% end -%>
    ]
  end

  it "should render list of <%= plural_name %>" do
    render "<%= plural_name %>/index.html"
<% for attribute in output_attributes -%>
    response.should have_tag("tr>td", <%= attribute.default.inspect %>.to_s, 2)
<% 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_index.html_spec.rb.erb
hashrocket-terraformation-0.0.0 rails_generators/terrascaffold/templates/view_index.html_spec.rb.erb