Sha256: 2bdd21763349db189f8c1e9962589d4b06231279e427bf902eb988793aa01046

Contents?: true

Size: 778 Bytes

Versions: 8

Compression:

Stored size: 778 Bytes

Contents

require 'spec_helper'

describe RedboothRuby::Client do
  let(:access_token) do
    {
      token: '_your_user_token_',
      secret: '_your_secret_token_'
    }
  end
  let(:client) { RedboothRuby::Client.new(session) }
  let(:session) { RedboothRuby::Session.new(access_token) }
  let(:valid_attributes) { JSON.parse('{}') }

  before :each do
    allow(RedboothRuby).to receive(:request).and_return(valid_attributes)
  end

  describe '#initialize' do
    it 'initializes attributes correctly' do
      expect(client.session).to eql(session)
    end
    it 'raises RedboothRuby::AuthenticationError if session is invalid' do
      allow(session).to receive(:valid?).and_return(false)

      expect{client}.to raise_error{ RedboothRuby::AuthenticationError }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
redbooth-ruby-0.2.3 spec/redbooth-ruby/client_spec.rb
redbooth-ruby-0.2.2 spec/redbooth-ruby/client_spec.rb
redbooth-ruby-0.2.1 spec/redbooth-ruby/client_spec.rb
redbooth-ruby-0.2.0 spec/redbooth-ruby/client_spec.rb
redbooth-ruby-0.1.4 spec/redbooth-ruby/client_spec.rb
redbooth-ruby-0.1.3 spec/redbooth-ruby/client_spec.rb
redbooth-ruby-0.1.1 spec/redbooth-ruby/client_spec.rb
redbooth-ruby-0.1.0 spec/redbooth-ruby/client_spec.rb