Sha256: f2cc27a37199bcd8780b8ac898cfd92f1dd137853369be9a67236f44a790bfa9

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

describe Gocoin::Merchants::CurrencyConversions do
	
	before :each do

		@merchant_id = 'merchant_id'

		# Values for GET /merchants/:merchant_id/currency_conversions/:id API behavior (#get)
		@get_currency_conversion_id = 'get_currency_conversion_id'
		@get_route = "/merchants/#{@merchant_id}/currency_conversions/#{@get_currency_conversion_id}"
		@get_options = {}
		@get_api_return_hash = 'mock_get_api_return_hash'

		# Values for POST /merchants/:id/currency_conversions API behavior (#request)
		@request_params = {
		  base_currency: "BTC"
		}
		@request_route = "/merchants/#{@merchant_id}/currency_conversions"
		@request_options = {
			method: 'POST',
			payload: @request_params
		}
		@request_api_return_hash = 'mock_request_api_return_hash'

		# Values for GET /merchants/:merchant_id/currency_conversions (#list)
		@list_route = "/merchants/#{@merchant_id}/currency_conversions"
		@list_api_return_hash = 'mock_list_api_return_hash'

		@currency_conversions = Gocoin::Merchants::CurrencyConversions.new(@api = double(Gocoin::API))
		@api.stub(:client).and_return(Gocoin::Client.new)

		@api.stub(:request).and_return('Incorrect parameters provided to API#request')
		@api.stub(:request).with(@get_route, @get_options).and_return(@get_api_return_hash)
		@api.stub(:request).with(@request_route, @request_options).and_return(@request_api_return_hash)
		@api.stub(:request).with(@list_route, {}).and_return(@list_api_return_hash)
	end

	describe "'get' method" do

    it 'should return the correct result' do
    	@currency_conversions.get(@merchant_id, @get_currency_conversion_id).should == @get_api_return_hash
    end

	end

	describe "'list' method" do

    it 'should return the correct result' do
    	@currency_conversions.list(@merchant_id).should == @list_api_return_hash
    end

	end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gocoin-0.1.4 spec/gocoin/api/merchants/currency_conversions_spec.rb
gocoin-0.1.3 spec/gocoin/api/merchants/currency_conversions_spec.rb