Sha256: e905a90440d91212513f3c7c95f6ff679d11df94c8413723a2dcfb6d57b3d474

Contents?: true

Size: 955 Bytes

Versions: 2

Compression:

Stored size: 955 Bytes

Contents

module CryptoArbitrer
  module SpecHelper
    def stub_crypto_arbitrer_get(url, mock_name)
      stub_request(:get, url)
        .to_return(body: open(File.expand_path("../../../spec/mocks/#{mock_name}", __FILE__)).read)
    end
    def mock_crypto_arbitrer_requests!
      stub_crypto_arbitrer_get("http://www.eldolarblue.net/getDolarBlue.php?as=json", 'dolarblue.json')
      stub_crypto_arbitrer_get('http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast', 'mtgox.json')
      stub_crypto_arbitrer_get('http://www.dolarparalelo.org/', 'dolarparalelo.html')
      %w(ltc nmc nvc trc ppc ftc cnc).each do |crypto|
        stub_crypto_arbitrer_get("https://btc-e.com/exchange/#{crypto}_btc", "btce_#{crypto}_btc.html")
      end
      %w(uyu brl clp sgd eur).each do |currency|
        stub_crypto_arbitrer_get("http://rate-exchange.appspot.com/currency?from=usd&to=#{currency}",
          "rate_exchange_usd_#{currency}.json")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crypto_arbitrer-0.0.4 lib/crypto_arbitrer/spec_helper.rb
crypto_arbitrer-0.0.3 lib/crypto_arbitrer/spec_helper.rb