Sha256: 7eb14db259f8475ea0bbbf6679632b4b223c207cd914cfb0dfa05a1b79cc192b

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

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

describe "/<%= table_name %>/index.<%= default_file_extension %>" do
  include <%= controller_class_name %>Helper

  before(:each) do
<% [98,99].each do |id| -%>
    <%= file_name %>_<%= id %> = mock_model(<%= class_name %>)
<% for attribute in attributes -%>
    <%= file_name %>_<%= id %>.should_receive(:<%= attribute.name %>).and_return(<%= attribute.default_value %>)
<% end -%><% end %>
    assigns[:<%= table_name %>] = [<%= file_name %>_98, <%= file_name %>_99]
  end

  it "should render list of <%= table_name %>" do
    render "/<%= table_name %>/index.<%= default_file_extension %>"
<% for attribute in attributes -%><% unless attribute.name =~ /_id/ || [:datetime, :timestamp, :time, :date].index(attribute.type) -%>
    response.should have_tag("tr>td", <%= attribute.default_value %>, 2)
<% end -%><% end -%>
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picolena-0.1.6 rails_plugins/rspec_on_rails/generators/rspec_scaffold/templates/index_erb_spec.rb
picolena-0.1.7 rails_plugins/rspec_on_rails/generators/rspec_scaffold/templates/index_erb_spec.rb
picolena-0.1.8 rails_plugins/rspec_on_rails/generators/rspec_scaffold/templates/index_erb_spec.rb