Sha256: 2ece85ff63a4f6a09a7a83325ea0b50babf2c50bc42756c2316db6aad38f4016

Contents?: true

Size: 1001 Bytes

Versions: 5

Compression:

Stored size: 1001 Bytes

Contents

require 'spec_helper'

<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
describe "<%= table_name %>/show.html.<%= options[:template_engine] %>" do
  before(:each) do
    @<%= file_name %> = assign(:<%= file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
      :<%= attribute.name %> => <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
<% end -%>
<% if !output_attributes.empty? -%>
    ))
<% end -%>
  end

  it "renders attributes in <p>" do
    render
<% for attribute in output_attributes -%>
<% if webrat? -%>
    rendered.should contain(<%= value_for(attribute) %>.to_s)
<% else -%>
    # Run the generator again with the --webrat-matchers flag if you want to use webrat matchers
    rendered.should match(/<%= eval(value_for(attribute)) %>/)
<% end -%>
<% end -%>
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-rails-2.2.0 lib/generators/rspec/scaffold/templates/show_spec.rb
rspec-rails-2.1.0 lib/generators/rspec/scaffold/templates/show_spec.rb
rspec-rails-2.0.1 lib/generators/rspec/scaffold/templates/show_spec.rb
rspec-rails-2.0.0 lib/generators/rspec/scaffold/templates/show_spec.rb
rspec-rails-2.0.0.rc lib/generators/rspec/scaffold/templates/show_spec.rb