Sha256: dcf75a9cf3239ab0cb9d7f1adc0f0c71fe66b70b38b2302b10eaa951f1a57f6d
Contents?: true
Size: 1010 Bytes
Versions: 3
Compression:
Stored size: 1010 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe Session::Relation, '#save' do subject { object.save(user) } include_context 'Session::Relation' let(:state) { subject.state(user) } context 'when an object is transient' do let(:user) { users.new(id: 3, name: 'John') } it_behaves_like 'a command method' specify { state.should be_created } end context 'when an object is persisted' do context 'when not dirty' do it_behaves_like 'a command method' specify { state.should be_persisted } end context 'when dirty' do before do user.name = 'John Doe' end it_behaves_like 'a command method' specify { state.should be_updated } end end context 'when an object is deleted' do before do object.delete(user) end specify do expect { subject }.to raise_error( Session::State::TransitionError, 'cannot save object with ROM::Session::State::Deleted state' ) end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
rom-0.2.0 | spec/unit/rom/session/relation/save_spec.rb |
rom-session-0.1.1 | spec/unit/rom/session/relation/save_spec.rb |
rom-session-0.1.0 | spec/unit/rom/session/relation/save_spec.rb |