Sha256: 8649658fe1fbabfb4bf079b0a5e48b0e979d41f06597ed743aa0fbc356438a3a

Contents?: true

Size: 1017 Bytes

Versions: 7

Compression:

Stored size: 1017 Bytes

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 "/<%= table_name %>/show.<%= default_file_extension %>" do
  include <%= controller_class_name %>Helper
  before(:each) do
    assigns[:<%= file_name %>] = @<%= file_name %> = stub_model(<%= class_name %><%= output_attributes.empty? ? ')' : ',' %>
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
      :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
<% end -%>
<% if !output_attributes.empty? -%>
    )
<% end -%>
  end

  it "renders attributes in <p>" do
    render "/<%= table_name %>/show.<%= default_file_extension %>"
<% for attribute in output_attributes -%>
    response.should have_text(/<%= Regexp.escape(attribute.default_value).gsub(/^"|"$/, '')%>/)
<% end -%>
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dchelimsky-rspec-rails-1.1.99.1 generators/rspec_scaffold/templates/show_erb_spec.rb
dchelimsky-rspec-rails-1.1.99.2 generators/rspec_scaffold/templates/show_erb_spec.rb
dchelimsky-rspec-rails-1.1.99.3 generators/rspec_scaffold/templates/show_erb_spec.rb
dchelimsky-rspec-rails-1.1.99.4 generators/rspec_scaffold/templates/show_erb_spec.rb
dchelimsky-rspec-rails-1.1.99.5 generators/rspec_scaffold/templates/show_erb_spec.rb
dchelimsky-rspec-rails-1.1.99.6 generators/rspec_scaffold/templates/show_erb_spec.rb
dchelimsky-rspec-rails-1.1.99.7 generators/rspec_scaffold/templates/show_erb_spec.rb