Sha256: e6d7526d6dafef6315fd77c616cec6721393872561dcbded5d3dab2abfa1b98d

Contents?: true

Size: 1.19 KB

Versions: 33

Compression:

Stored size: 1.19 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * controller_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]

    template.stub!(:object_url).and_return(<%= file_name %>_path(<%= file_name %>_99))
    template.stub!(:new_object_url).and_return(new_<%= file_name %>_path) 
    template.stub!(:edit_object_url).and_return(edit_<%= file_name %>_path(<%= 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

33 entries across 33 versions & 14 rubygems

Version Path
csmosx-resource_controller-0.6.6 generators/scaffold_resource/templates/rspec/views/index_spec.rb
csmosx-resource_controller-0.6.7 generators/scaffold_resource/templates/rspec/views/index_spec.rb
dkubb-resource_controller-0.6.5 generators/scaffold_resource/templates/rspec/views/index_spec.rb
giraffesoft-resource_controller-0.6.1 generators/scaffold_resource/templates/rspec/views/index_spec.rb
giraffesoft-resource_controller-0.6.5 generators/scaffold_resource/templates/rspec/views/index_spec.rb
maser-resource_controller-0.6.6 generators/scaffold_resource/templates/rspec/views/index_spec.rb
radar-resource_controller-0.6.6 generators/scaffold_resource/templates/rspec/views/index_spec.rb
strikeroff-resource_controller-0.6.6 generators/scaffold_resource/templates/rspec/views/index_spec.rb
viva-resource_controller-0.6.5.1 generators/scaffold_resource/templates/rspec/views/index_spec.rb
viva-resource_controller-0.6.5.2 generators/scaffold_resource/templates/rspec/views/index_spec.rb
viva-resource_controller-0.6.5 generators/scaffold_resource/templates/rspec/views/index_spec.rb
makandra_resource_controller-0.8.0 generators/scaffold_resource/templates/rspec/views/index_spec.rb
resources_controller-1.0.4 generators/scaffold_resource/templates/rspec/views/index_spec.rb
resources_controller-1.0.3 generators/scaffold_resource/templates/rspec/views/index_spec.rb
resources_controller-1.0.2 generators/scaffold_resource/templates/rspec/views/index_spec.rb
makandra_resource_controller-0.7.3 generators/scaffold_resource/templates/rspec/views/index_spec.rb
makandra_resource_controller-0.7.2 generators/scaffold_resource/templates/rspec/views/index_spec.rb
rd_resource_controller-1.0.1 generators/scaffold_resource/templates/rspec/views/index_spec.rb
rd_resource_controller-1.0.0 generators/scaffold_resource/templates/rspec/views/index_spec.rb
makandra_resource_controller-0.7.1 generators/scaffold_resource/templates/rspec/views/index_spec.rb