Sha256: 7ec81478925e7dba1079aa4fdea9709344c48d8c6d752850ced6c0c498aa9ff1
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' <% 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 -%> <%= singular_name %>1 = create :<%= singular_name %> <%= singular_name %>2 = create :<%= singular_name %> <% else -%> <%= singular_name %>1 = <%= class_name %>.create @valid_attrs <%= singular_name %>2 = <%= 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.1 | lib/templates/rspec/model/model_spec.rb |