Sha256: 71e97e2a01b2174dbbae41f3403148a3e00c340f6aa1b2c9cd8ed56622afaba3

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) + '/../lib/clickatell'

module Clickatell

  describe "Response parser" do
    before do
      Clickatell::API::Error.stubs(:parse).returns(Clickatell::API::Error.new('', ''))
    end
    
    it "should return hash for one-line success response" do
      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
      proc { Response.parse(stub('response', :body => 'ERR: 001, Authentication failed')) }.should raise_error(Clickatell::API::Error)
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clickatell-0.5.0 spec/response_spec.rb