Sha256: fa045fab2e878e9336e08cf6b29ec44dc5a8dd5586a8b4a7cef846a5fb26bed9
Contents?: true
Size: 707 Bytes
Versions: 5
Compression:
Stored size: 707 Bytes
Contents
require 'spec_helper' describe WialonApi::Authorization do describe '.authorize' do let(:success) { Hashie::Mash.new(eid: 'sid') } let(:error) { Hashie::Mash.new(error: '8') } let(:credentials) { ['user', 'password'] } it 'bulds a WialonApi client if the credentials are correct' do allow(WialonApi::Api).to receive(:call).and_return(success) expect(WialonApi::Client).to receive(:new).with('sid') WialonApi.authorize(*credentials) end it 'raises an error if password or login do not match' do allow(WialonApi::Api).to receive(:call).and_return(error) expect { WialonApi.authorize(*credentials) }.to raise_error(WialonApi::Error) end end end
Version data entries
5 entries across 5 versions & 1 rubygems