Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract specs for Session::Relation#save and add #new
- Loading branch information
Showing
4 changed files
with
34 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'spec_helper' | ||
|
||
describe Session::Relation, '#save' do | ||
subject { users.save(user).state(user) } | ||
|
||
include_context 'Session::Relation' | ||
|
||
context 'when an object is new' do | ||
let(:user) { users.new(:id => 3, :name => 'John') } | ||
|
||
it { should be_created } | ||
end | ||
|
||
context 'when an object is persisted' do | ||
context 'when not dirty' do | ||
it { should be_persisted } | ||
end | ||
|
||
context 'when dirty' do | ||
before do | ||
user.name = 'John Doe' | ||
end | ||
|
||
it { should be_updated } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters