I am trying to write a test with Rails 5 and use minitest. Here is my test code ...
@client = Coinbase::Wallet::Client.new(api_key: ENV['COINBASE_KEY'], api_secret: ENV['COINBASE_SECRET'])
sell_price = 4000
assert sell_price > last_buy_price * (1 + MoneyMakerThreshhold.find_buy.pct_change)
@client.stub :sell_price, "USD" do
{"base"=>"BTC", "currency"=>"USD", "amount"=>"#{sell_price}"}
end
svc = CryptoCurrencyService.new
svc.sell(last_transaction)
but when it esxecutes to below what prints, not my bullied selling price "4000", this is the actual selling price returned by the customer ...
def sell(last_transaction)
client = Coinbase::Wallet::Client.new(api_key: ENV['COINBASE_KEY'], api_secret: ENV['COINBASE_SECRET'])
sell_price = client.sell_price(currency: 'USD').amount
puts "buy: #{last_transaction.btc_price_in_usd} sellprice: #{sell_price} last:#{last_transaction.btc_price_in_usd}"
How do I make my layout work on things?
source
share