spec/base_spec.rb in crypto_arbitrer-0.0.3 vs spec/base_spec.rb in crypto_arbitrer-0.0.4
- old
+ new
@@ -1,8 +1,9 @@
require_relative '../lib/crypto_arbitrer.rb'
require 'webmock/rspec'
require 'csv'
+require 'ruby-debug'
RSpec.configure do |config|
config.include CryptoArbitrer::SpecHelper
end
describe CryptoArbitrer::Base do
@@ -47,9 +48,18 @@
end
it 'hits mt.gox for the btc to usd rate' do
stub = stub_crypto_arbitrer_get('http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast', 'mtgox.json')
subject.fetch_btc_usd
+ stub.should have_been_requested
+ end
+
+ it 'hits btce for the btc to usd rate when configured that way' do
+ CryptoArbitrer::Base.btc_usd_strategy = :btce
+ stub = stub_crypto_arbitrer_get("https://btc-e.com/exchange/btc_usd", "btce_btc_usd.html")
+ rate = subject.fetch_btc_usd
+ rate['buy'].should == 99.999
+ rate['sell'].should == 99.502
stub.should have_been_requested
end
it 'hits dolarparalelo for venezuelan bolivar' do
stub = stub_crypto_arbitrer_get('http://www.dolarparalelo.org/', 'dolarparalelo.html')