Sha256: 3c0dc085849e64f2096e14b9b716d262bb1462253196c7715ff57788dc816863
Contents?: true
Size: 1.67 KB
Versions: 5
Compression:
Stored size: 1.67 KB
Contents
<% if File.exist?(File.join %w[spec rails_helper.rb]) -%> require 'rails_helper' <% else -%> require 'spec_helper' <% end -%> <% output_attributes = attributes.reject{|attribute| [:created_at, :deleted_at, :updated_at].index(attribute.name) or attribute.password_digest? } -%> describe "<%= ns_table_name %>/show", <%= type_metatag(:view) %> do <% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%> let(:<%= ns_file_name %>) {create :<%= ns_file_name %>} <% else -%> let(:<%= ns_file_name %>) do <%= class_name %>.create!(<%= ')' if 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 <% end -%> before(:each) do <% if Rails.application.config.generators.options[:rails][:cancan] -%> allow(controller).to receive(:can?).and_return(true) <% end -%> assign :<%= ns_file_name %>, <%= ns_file_name %> end it "renders attributes in dl>dd" do render <% for attribute in output_attributes -%> <% if Rails.application.config.generators.options[:rails][:fixture_replacement] == :factory_bot -%> <% if attribute.reference? -%> assert_select 'dl>dd.<%= attribute.name %>', text: Regexp.new(<%= ns_file_name %>.<%= attribute.name %>.name) <% else -%> assert_select 'dl>dd.<%= attribute.name %>', text: Regexp.new(<%= ns_file_name %>.<%= attribute.name %>.to_s) <% end -%> <% else -%> assert_select 'dl>dd.<%= attribute.name %>', text: <%= value_for(attribute) %> <% end -%> <% end -%> end end
Version data entries
5 entries across 5 versions & 1 rubygems