rubocop corrections
This commit is contained in:
1 parent
4b84df0af9
commit
4a7b752ace
4 files changed
+50
-39
No files matched your search
@@ -28,7 +28,7 @@ RSpec.describe StrikeMe::API::Account do
|
||||
expect(ENV).to receive(:[]).with('STRIKE_ACCOUNT_ID').and_return 'abc'
|
||||
stub_request(:get, %r{https://api.strike.me/v1/accounts/abc/profile})
|
||||
.to_return(status: 401, body: '{"data":{"status":401,"code":"UNAUTHORIZED","message":"Invalid or unspecified identity."}}', headers: {'Content-Type' => 'application/json'})
|
||||
expect{ subject.id }.to raise_error '[401, {}, ["Invalid or unspecified identity."]]'
|
||||
expect { subject.id }.to raise_error '[401, {}, ["Invalid or unspecified identity."]]'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,22 +42,23 @@ RSpec.describe StrikeMe::API::Account do
|
||||
it '#to_a properly returns the attributes' do
|
||||
expect(subject.to_a).to eq [
|
||||
{
|
||||
"currency" => "BTC",
|
||||
"current" => 0.00085408,
|
||||
"pending" => 2.3e-05,
|
||||
"outgoing" => 5.32e-06,
|
||||
"reserved" => 0.00234,
|
||||
"available" => 0.00085408,
|
||||
"total" => 0.00085408
|
||||
'currency' => 'BTC',
|
||||
'current' => 0.00085408,
|
||||
'pending' => 2.3e-05,
|
||||
'outgoing' => 5.32e-06,
|
||||
'reserved' => 0.00234,
|
||||
'available' => 0.00085408,
|
||||
'total' => 0.00085408
|
||||
}, {
|
||||
"currency" => "USDT",
|
||||
"current" => 50.04,
|
||||
"pending" => 40.06,
|
||||
"outgoing" => 60.15,
|
||||
"reserved" => 0.0,
|
||||
"available" => 0.0,
|
||||
"total" => 0.0
|
||||
}]
|
||||
'currency' => 'USDT',
|
||||
'current' => 50.04,
|
||||
'pending' => 40.06,
|
||||
'outgoing' => 60.15,
|
||||
'reserved' => 0.0,
|
||||
'available' => 0.0,
|
||||
'total' => 0.0
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
it '#btc returns the BTC balance' do
|
||||
@@ -65,20 +66,20 @@ RSpec.describe StrikeMe::API::Account do
|
||||
expect(btc).to be_present
|
||||
expect(btc).to be_a StrikeMe::API::Account::Balance
|
||||
expect(btc.attributes).to eq(
|
||||
"available" => 0.00085408,
|
||||
"currency" => "BTC",
|
||||
"current" => 0.00085408,
|
||||
"outgoing" => 5.32e-06,
|
||||
"pending" => 2.3e-05,
|
||||
"reserved" => 0.00234,
|
||||
"total" => 0.00085408
|
||||
'available' => 0.00085408,
|
||||
'currency' => 'BTC',
|
||||
'current' => 0.00085408,
|
||||
'outgoing' => 5.32e-06,
|
||||
'pending' => 2.3e-05,
|
||||
'reserved' => 0.00234,
|
||||
'total' => 0.00085408
|
||||
)
|
||||
end
|
||||
|
||||
it 'raises error when not authorized' do
|
||||
stub_request(:get, %r{https://api.strike.me/v1/balances})
|
||||
.to_return(status: 401, body: '{"data":{"status":403,"code":"FORBIDDEN","message":"Insufficient permissions."}}', headers: {'Content-Type' => 'application/json'})
|
||||
expect{ subject }.to raise_error '[403, {}, ["Insufficient permissions."]]'
|
||||
expect { subject }.to raise_error '[403, {}, ["Insufficient permissions."]]'
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user