35 lines
1.2 KiB
Ruby
35 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe StrikeMe::API::Account do
|
|
subject { described_class.new }
|
|
|
|
describe 'profile' do
|
|
subject { described_class.new.profile }
|
|
|
|
it 'works with STRIKE_ACCOUNT_ID' do
|
|
allow(ENV).to receive(:[])
|
|
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: 200, body: '{"id":"abc44"}')
|
|
expect(subject.id).to eq 'abc44'
|
|
end
|
|
|
|
it 'works with STRIKE_ACCOUNT_HANDLE without account id' do
|
|
allow(ENV).to receive(:[])
|
|
allow(ENV).to receive(:fetch)
|
|
expect(ENV).to receive(:fetch).with('STRIKE_ACCOUNT_HANDLE').and_return 'abcd'
|
|
stub_request(:get, %r{https://api.strike.me/v1/accounts/handles/abcd/profile})
|
|
.to_return(status: 200, body: '{"id":"abc44"}')
|
|
expect(subject.id).to eq 'abc44'
|
|
end
|
|
end
|
|
|
|
describe 'balances' do
|
|
subject { described_class.new.balances }
|
|
|
|
before { stub_request(:get, 'https://api.strike.me/v1/balances').to_return(status: 200, body: []) }
|
|
|
|
it { is_expected.to be_an_instance_of StrikeMe::API::Account::Balances }
|
|
end
|
|
end
|