Sha256: ab88a9afd38b05598ba7396faf5d4f9ef6cd2377139cda88d36aebf9ad662b9e

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

require 'helper'

describe Faraday::Response do
  describe "MysqlError" do
    before do
      stub_get('/api/1/BTCUSD/trades/fetch').
        to_return(status: 200, body: fixture('mysql_error'))
    end

    it "should raise MtGox::MysqlError" do
      expect { MtGox.trades }.to raise_error(MtGox::MysqlError)
    end
  end

  describe "Error" do
    before do
      stub_get('/api/1/BTCUSD/trades/fetch').
        to_return(status: 200, body: fixture('unknown_error.json'))
    end

    it "should raise MtGox::Error" do
      expect { MtGox.trades }.to raise_error(MtGox::Error)
    end

    describe "UnauthorizedError" do
      before do
        stub_get('/api/1/BTCUSD/trades/fetch').
          to_return(status: 403, body: fixture('error.json'))
      end

      it "should raise MtGox::UnauthorizedError" do
        expect { MtGox.trades }.to raise_error(MtGox::UnauthorizedError)
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mtgox-0.9.1 spec/faraday/response_spec.rb
mtgox-0.9.0 spec/faraday/response_spec.rb