Sha256: 3e8e5be262ecf3838c19f33ad235d2dd3f01f7c37f71527ac45825ee3560f2f0

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 Bytes

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe Typetalk::Api::User do

  let(:api) { Typetalk::Api.new }

  describe '#get_profile', :vcr do
    it 'should get the correct resource' do
      response = api.get_profile
      expect(response).to be_a(Hashie::Mash)
      expect(response.account.name).to eq('typetalk-rubygem-tester')
      expect(response.account.fullName).to eq('Rubygem Tester')
    end

    it 'should raise error when access_token is wrong' do
      api.get_access_token
      expect{ api.get_profile(token: '(WRONG_ACCESS_TOKEN)') }.to raise_error(Typetalk::InvalidRequest)
    end

    it 'should raise error when scope is wrong' do
      r = api.get_access_token(scope: 'topic.read,topic.post')
      expect{ api.get_profile(token: r.access_token) }.to raise_error(Typetalk::InvalidRequest)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typetalk-0.0.3 spec/typetalk/api/user_spec.rb
typetalk-0.0.2 spec/typetalk/api/user_spec.rb
typetalk-0.0.1 spec/typetalk/api/user_spec.rb