Sha256: 4ddb91f0b4522c0a0c8585bacedf433f128d95fde482e71bfc3d9363ba3a9538

Contents?: true

Size: 946 Bytes

Versions: 3

Compression:

Stored size: 946 Bytes

Contents

require 'spec_helper'

describe Gocoin::Xrate do

	before :each do
		@host = 'fake.xrate.host'
		@route = '/prices'

		# Values for Xrate GET /prices API behavior (#get)
		@get_raw_request_config = {
      url: "https://#{@host}#{@route}",
      method: 'GET',
      headers: {},
      options: {}
		}
		@get_api_return_hash = 'mock_get_api_return_hash'

		@xrate = Gocoin::Xrate.new(@client = double(Gocoin::Client))

		@client.stub(:logger).and_return(Logger.new(STDOUT))
		@client.stub(:headers).and_return({ client: 'fake_header_hash_that_wont_be_used' })
		@client.stub(:options).and_return({ xrate_host: @host })


		@client.stub(:raw_request).and_return('Incorrect parameters provided to API#raw_request')
		@client.stub(:raw_request).with(@get_raw_request_config).and_return(@get_api_return_hash)
	end
  
  describe "'get' method" do

    it 'should make a raw_request' do
	  	@xrate.get.should == @get_api_return_hash
	  end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gocoin-0.1.4 spec/gocoin/xrate_spec.rb
gocoin-0.1.3 spec/gocoin/xrate_spec.rb
gocoin-0.1.2 spec/gocoin/xrate_spec.rb