Sha256: 09a20d9ceb573c98cb78a81fb11d472a7f5c46617945dd4b586432dcb7088059

Contents?: true

Size: 1007 Bytes

Versions: 3

Compression:

Stored size: 1007 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

3 entries across 3 versions & 1 rubygems

Version Path
redbooth-ruby-0.0.5 spec/redbooth-ruby/user_spec.rb
redbooth-ruby-0.0.4 spec/redbooth-ruby/user_spec.rb
redbooth-ruby-0.0.3 spec/redbooth-ruby/user_spec.rb