Sha256: 8dc87d0fec1eab91a48f1ce4a2b8c031cd4fc333809663e8ad2aee585a1c89af
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'spec_helper' shared_examples_for 'a nested model' do # clazz must be defined by the calling file let(:nested_model) { clazz.new } it 'has a parent model' do expect(nested_model).to respond_to(:parent_model) end it 'can change its parent model' do expect(nested_model).to respond_to(:parent_model=) nested_model.parent_model = :some_parent_model expect(nested_model.parent_model).to eq(:some_parent_model) nested_model.parent_model = :some_other_parent_model expect(nested_model.parent_model).to eq(:some_other_parent_model) end describe 'abstract instantiation' do context 'a new nested object' do let(:nested_model) { clazz.new } it 'starts with no parent model' do expect(nested_model.parent_model).to be_nil end end end it 'has access to its ancestors' do expect(nested_model).to respond_to(:get_ancestor) end it 'gets an ancestor based on type' do expect(clazz.instance_method(:get_ancestor).arity).to eq(1) end it 'raises and exception if an unknown ancestor type is requested' do expect { nested_model.get_ancestor(:bad_ancestor_type) }.to raise_exception(ArgumentError) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cuke_modeler-1.0.1 | spec/unit/shared/nested_models_unit_specs.rb |
cuke_modeler-1.0.0 | spec/unit/shared/nested_models_unit_specs.rb |