spec/response_spec.rb in clickatell-0.4.1 vs spec/response_spec.rb in clickatell-0.5.0
- old
+ new
@@ -3,21 +3,18 @@
module Clickatell
describe "Response parser" do
before do
- @raw_response = stub('response')
- Clickatell::API::Error.stub!(:parse).and_return(Clickatell::API::Error.new('', ''))
+ Clickatell::API::Error.stubs(:parse).returns(Clickatell::API::Error.new('', ''))
end
it "should return hash for one-line success response" do
- @raw_response.stub!(:body).and_return('k1: foo k2: bar')
- Response.parse(@raw_response).should == {'k1' => 'foo', 'k2' => 'bar'}
+ Response.parse(stub('response', :body => 'k1: foo k2: bar')).should == {'k1' => 'foo', 'k2' => 'bar'}
end
it "should raise API::Error if response contains an error message" do
- @raw_response.stub!(:body).and_return('ERR: 001, Authentication failed')
- proc { Response.parse(@raw_response) }.should raise_error(Clickatell::API::Error)
+ proc { Response.parse(stub('response', :body => 'ERR: 001, Authentication failed')) }.should raise_error(Clickatell::API::Error)
end
end
end
\ No newline at end of file