-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from liveh2o/gt/add_errors_to_not_saved
Include response errors in RemoteRecordNotSaved exception
- Loading branch information
Showing
4 changed files
with
51 additions
and
3 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,31 @@ | ||
require "spec_helper" | ||
|
||
describe ::ActiveRemote::RemoteRecordNotSaved do | ||
let(:record) { ::Tag.new } | ||
|
||
before do | ||
record.errors[:base] << "Some error one!" | ||
record.errors[:base] << "Some error two!" | ||
end | ||
|
||
context "when an active remote record is used" do | ||
it "uses embedded errors in message" do | ||
expect { fail(::ActiveRemote::RemoteRecordNotSaved, record) } | ||
.to raise_error(ActiveRemote::RemoteRecordNotSaved, "Some error one!, Some error two!") | ||
end | ||
end | ||
|
||
context "when a string is used" do | ||
it "uses the string in the error message" do | ||
expect { fail(::ActiveRemote::RemoteRecordNotSaved, "something bad happened") } | ||
.to raise_error(ActiveRemote::RemoteRecordNotSaved, "something bad happened") | ||
end | ||
end | ||
|
||
context "when no message is used" do | ||
it "raises the error" do | ||
expect { raise(::ActiveRemote::RemoteRecordNotSaved) } | ||
.to raise_error(ActiveRemote::RemoteRecordNotSaved) | ||
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