Sha256: fb54117ef843bb700b79eaf0d4ff1ec2c9acd5246cae857e58add3bedb20744d
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' <% def value_for_check(attribute) name = ":text" ([] << case attribute.type when :boolean "\"tr#tr\#{r.id}>td>img.\#{r.#{attribute.name} ? \"ico_true\" : \"ico_false\"}\"" else "\"tr#tr\#{r.id}>td\"" end << case attribute.type when :references, :belongs_to "#{name} => (r.#{attribute.name}.try(:name) || r.#{attribute.name}.try(:id))" when :boolean nil else "#{name} => r.#{attribute.name}" end << ":count => 1" ).compact.join(', ') end %> <% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%> describe "<%= ns_table_name %>/index.html.<%= options[:template_engine] %>" do before(:each) do @records = assign(:<%= table_name %>, FactoryGirl.create_list(:<%= ns_file_name %>, 2) ) assign(:<%= ns_file_name %>, Factory(:<%= ns_file_name %>) ) end it "renders a list of <%= ns_table_name %>" do render @records.each do |r| <% for attribute in output_attributes -%> assert_select <%= value_for_check(attribute) %> <% end -%> end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
leonardo-1.5.0 | lib/generators/leolay/templates/lib/templates/rspec/scaffold/index_spec.rb |