Sha256: c122b8835f18dde937e3ae71e60880d11fd47388c3c377b5b89c11167459b173
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 KB
Contents
require 'spec_helper' <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%> describe "<%= table_name %>/show.html.haml" do before(:each) do @<%= file_name %> = assign(:<%= file_name %>, john_q(:<%=model_name%>, :new_record? => true<%= 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 -%> <% if child_model? %> <%=parent_class%>.stub(:find).with(anything()) {john_q :<%=parent_name%>} <% end %> <% if belongs_to %> params[:<%=parent_id%>] = john_q(:<%=parent_name%>).id @<%= parent_name %> = assign(:<%=parent_name%>, john_q(:<%=parent_name%>)) <% 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
4 entries across 4 versions & 1 rubygems