Sha256: 261da7bf0608539fc7339b9953e53d17367538a8f4dc7371e461c0c639a3d4cd
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' describe MemoryModel::Base do subject(:base) { MemoryModel::Base } it_should_behave_like "ActiveModel" do let(:model) do model = stub_const 'MyModel', Class.new(subject) model.new end end describe '.new' do it 'should raise an error' do expect { base.new }.to raise_error MemoryModel::InvalidCollectionError end end describe '.inherited' do subject(:model) { Class.new base } it "should add a new collection to the subclass" do model.send(:collection).should be_a MemoryModel::Collection end it 'should have a field set' do model.fields.should be_a MemoryModel::Base::Fieldable::FieldSet end it 'should have an id field' do model.fields.should include :id end end context "when inherited" do let(:model) do Class.new(base) do field :foo end end let(:value) { 'bar' } subject(:instance) { model.new(foo: value) } describe '.new' do it 'should have an id' do model.new.id.should be_present end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
memory_model-0.0.2 | spec/memory_model/base_spec.rb |
memory_model-0.0.1 | spec/memory_model/base_spec.rb |