spec/praxis-blueprints/blueprint_spec.rb in praxis-blueprints-1.0.1 vs spec/praxis-blueprints/blueprint_spec.rb in praxis-blueprints-1.1.0

- old
+ new

@@ -2,11 +2,10 @@ describe Praxis::Blueprint do subject(:blueprint_class) { Person } - context 'deterministic examples' do it 'works' do person_1 = Person.example('person 1') person_2 = Person.example('person 1') @@ -291,63 +290,39 @@ its(:name) { should eq(name) } end end context '#render' do - let(:person) { Person.example } - let(:view_name) { :default } - subject(:output) { person.render(view_name) } + let(:person) { Person.example } + let(:view_name) { :default } + subject(:output) { person.render(view_name) } - context 'with a sub-attribute that is a blueprint' do + context 'with a sub-attribute that is a blueprint' do - it { should have_key(:name) } - it { should have_key(:address) } - it 'renders the sub-attribute correctly' do - output[:address].should have_key(:street) - output[:address].should have_key(:state) - end + it { should have_key(:name) } + it { should have_key(:address) } + it 'renders the sub-attribute correctly' do + output[:address].should have_key(:street) + output[:address].should have_key(:state) + end - it 'reports a dump error with the appropriate context' do - person.address.should_receive(:state).and_raise("Kaboom") - expect { - person.render(view_name, context: ['special_root']) - }.to raise_error(/Error while dumping attribute state of type Address for context special_root.address .*. Reason: .*Kaboom/) - end - end + it 'reports a dump error with the appropriate context' do + person.address.should_receive(:state).and_raise("Kaboom") + expect { + person.render(view_name, context: ['special_root']) + }.to raise_error(/Error while dumping attribute state of type Address for context special_root.address .*. Reason: .*Kaboom/) + end + end - context 'with sub-attribute that is an Attributor::Model' do - it { should have_key(:full_name) } - it 'renders the model correctly' do - output[:full_name].should be_kind_of(Hash) - output[:full_name].should have_key(:first) - output[:full_name].should have_key(:last) - end - end + context 'with sub-attribute that is an Attributor::Model' do + it { should have_key(:full_name) } + it 'renders the model correctly' do + output[:full_name].should be_kind_of(Hash) + output[:full_name].should have_key(:first) + output[:full_name].should have_key(:last) + end + end - - # context 'with circular references' do - # let(:view_name) { :master } - - # # TODO: think about circular references without caching - # around do |example| - # Praxis::Blueprint.caching_enabled = true - # example.run - # Praxis::Blueprint.caching_enabled = false - # end - - # it 'terminates' do - # expect { - # Person.example.render(:master) - # }.to_not raise_error - # end - - # it 'renders Praxis::Blueprint::CIRCULAR_REFERENCE_MARKER for circular references' do - # person.address.resident.should be(person) - # output[:address][:resident].should eq(Praxis::Blueprint::CIRCULAR_REFERENCE_MARKER) - # end - - # end - end end