Sha256: 3904d9455de9e8b537843b44bdce724ff505be2aeb5d6aa28cf0a7a7574d8d01
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
<% if File.exist?(File.join %w[spec rails_helper.rb]) -%> require 'rails_helper' <% else -%> require 'spec_helper' <% end -%> <% module_namespacing do -%> describe <%= class_name %>, type: :model do <% if options[:fixture_replacement] == :factory_girl -%> subject { create :<%= singular_name %> } <% else -%> before :each do @valid_attrs = { } end subject { <%= class_name %>.create @valid_attrs } <% end -%> it { should be_valid } describe :class do it 'should respond to :ordered' do <% if options[:fixture_replacement] == :factory_girl -%> create :<%= singular_name %> create :<%= singular_name %> <% else -%> <%= class_name %>.create @valid_attrs <%= class_name %>.create @valid_attrs <% end -%> <% attribute = attributes.detect{|a| a.name == 'position'} || attributes.detect{|a| a.name == 'name'} || attributes.detect{|a| a.name == 'title'} || attributes.first -%> expect(<%= class_name %>.ordered).to eq <%= class_name %>.order(:<%=attribute.name %>) end end end <% end -%>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_record_model_and_rspec_enhanced_templates-1.0.3 | lib/templates/rspec/model/model_spec.rb |