Skip to content

Commit

Permalink
Add errors specs to cover both RemoteRecordNotFound cases
Browse files Browse the repository at this point in the history
  • Loading branch information
film42 committed Apr 16, 2019
1 parent f9e6635 commit 565c9a6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/lib/active_remote/errors_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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
end

0 comments on commit 565c9a6

Please sign in to comment.