Sha256: 36c6764f7a9a4abcc78266387074bef62cd12b64df4bbf22ddeab891ba06d150

Contents?: true

Size: 1006 Bytes

Versions: 8

Compression:

Stored size: 1006 Bytes

Contents

require 'spec_helper'

describe RedboothRuby::User, vcr: 'users' do
  include_context 'authentication'

  let(:user) do
    RedboothRuby::User.show(session: session, id: 1)
  end

  describe '#initialize' do
    subject { user }

    it { expect(subject.email).to eql('example_frank@redbooth.com') }
    it { expect(subject.id).to eql(1) }
    it { expect(subject.first_name).to eql('Frank') }
    it { expect(subject.last_name).to eql('Kramer') }
  end

  describe '.show' do
    subject { RedboothRuby::User.show(session: session, id: 1) }

    it 'makes a new GET request using the correct API endpoint to receive a specific user' do
      expect(RedboothRuby).to receive(:request).with(:get, nil, "users/1", {}, { session: session }).and_call_original
      subject
    end

    it { expect(subject.email).to eql('example_frank@redbooth.com') }
    it { expect(subject.id).to eql(1) }
    it { expect(subject.first_name).to eql('Frank') }
    it { expect(subject.last_name).to eql('Kramer') }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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