Sha256: 7696cf5a66f754566a4a15f2c8e3cd877f026b468844ce8d222500ca2d6f22a8
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
# encoding: UTF-8 require 'spec_helper' describe ActiveData::Model do let(:model) do Class.new do include ActiveData::Model attribute :name attribute :count, default: 0 end end specify { expect { model.blablabla }.to raise_error NoMethodError } specify { model.i18n_scope.should == :active_data } specify { model.new.should_not be_persisted } specify { model.instantiate({}).should be_an_instance_of model } specify { model.instantiate({}).should be_persisted } context 'Fault tolerance' do specify{ expect { model.new(foo: 'bar') }.not_to raise_error } end describe '#instantiate' do context do subject(:instance) { model.instantiate(name: 'Hello', foo: 'Bar') } specify { subject.instance_variable_get(:@attributes).should == { name: 'Hello', count: nil } } end end describe '#==' do subject { model.new name: 'hello', count: 42 } it { should_not == nil } it { should_not == 'hello' } it { should_not == Object.new } it { should_not == model.new } it { should_not == model.new(name: 'hello1', count: 42) } it { should_not == model.new(name: 'hello', count: 42.1) } it { should == model.new(name: 'hello', count: 42) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_data-0.3.0 | spec/lib/active_data/model_spec.rb |
active_data-0.2.0 | spec/lib/active_data/model_spec.rb |