spec/aptible/auth_spec.rb in aptible-auth-0.1.4 vs spec/aptible/auth_spec.rb in aptible-auth-0.2.0

- old
+ new

@@ -15,10 +15,37 @@ end end it 'should expose the server public key' do get = double 'get' - Aptible::Auth::Client.any_instance.stub(:get) { get } + Aptible::Auth.any_instance.stub(:get) { get } expect(get).to receive :public_key described_class.public_key + end + + describe '#initialize' do + it 'should be a HyperResource instance' do + expect(subject).to be_a HyperResource + end + end + + describe '#bearer_token' do + it 'should accept an Aptible::Auth::Token' do + token = Aptible::Auth::Token.new + token.stub(:access_token) { 'abtible_auth_token' } + subject.stub(:token) { token } + expect(subject.bearer_token).to eq token.access_token + end + + it 'should accept an Fridge::AccessToken' do + token = Fridge::AccessToken.new + token.stub(:to_s) { 'fridge_access_token' } + subject.stub(:token) { token } + expect(subject.bearer_token).to eq token.to_s + end + + it 'should accept a String' do + subject.stub(:token) { 'token' } + expect(subject.bearer_token).to eq 'token' + end end end