# frozen_string_literal: true RSpec.describe StrikeMe::API::Account::Balances do subject { StrikeMe::API::Account.new.balances } context 'good response' do let(:server_response) do [ { 'currency' => 'BTC', 'current' => '0.003169', 'pending' => '0', 'outgoing' => '0', 'reserved' => '0', 'available' => '0.003169', 'total' => '0.00316976' }, { 'currency' => 'USDT', 'current' => '50.73', 'pending' => '0.00', 'outgoing' => '0.00', 'reserved' => '0.00', 'available' => '50.73', 'total' => '50.73' } ] end before { allow_any_instance_of(StrikeMe::API::Client).to receive(:get).and_return double(success?: true, body: server_response) } it '#to_a returns a simple object representation, where number string inputs are real numbers' do expected = [ { 'currency' => 'BTC', 'current' => 0.003169, 'pending' => 0.0, 'outgoing' => 0.0, 'reserved' => 0.0, 'available' => 0.003169, 'total' => 0.00316976 }, { 'currency' => 'USDT', 'current' => 50.73, 'pending' => 0.0, 'outgoing' => 0.0, 'reserved' => 0.0, 'available' => 50.73, 'total' => 50.73 } ] expect(subject.to_a).to eq expected end end end