spec/fassbinder/response_spec.rb in fassbinder-0.0.8 vs spec/fassbinder/response_spec.rb in fassbinder-0.0.9
- old
+ new
@@ -19,16 +19,23 @@
request.batchify(asins)
request.get
end
describe ".new" do
- it "raises an error if response is not valid" do
- response = mock('Response')
- response.stub!(:valid?).and_return(false)
+ context "when response is not valid" do
+ it "raises an error" do
+ response = mock('Response')
+ response.stub!(:valid?).and_return(false)
+ response.stub!(:has_errors?).and_return(true)
+ response.stub!(:errors).and_return([{
+ 'Code' => 'AccountLimitExceeded',
+ 'Message' => 'YOU FAIL'
+ }])
- expect do
- Response.new(response, :us)
- end.to raise_error InvalidResponseError
+ expect do
+ Response.new(response, :us)
+ end.to raise_error InvalidResponse, 'YOU FAIL'
+ end
end
end
describe "#to_a" do
it "returns an array of books" do