Sha256: bf035be6a638447ba003c108f1ed958c458a99cc82612dae9deb21fec62387af

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe CampactUserService do
  subject { CampactUserService }

  describe '.session' do
    it 'should create Session instance with correct arguments' do
      options = { foo: 'bar', foo2: 'bar2' }
      client = double
      expect(CampactUserService::Client).to receive(:new).with(options).and_return(client)
      session_id = '123abcd'
      session_cookie_name = 'campact-session'
      session_api = double
      expect(CampactUserService::Session).to receive(:new).with(client, session_id, session_cookie_name).and_return(session_api)

      session = subject.session(session_id, session_cookie_name, options)

      expect(session).to be(session_api)
    end
  end

  describe '.account' do
    it 'should create Account instance with correct arguments' do
      options = { foo: 'bar', foo2: 'bar2' }
      client = double
      expect(CampactUserService::Client).to receive(:new).with(options).and_return(client)
      user_id = 'test@example.com'
      account_api = double
      expect(CampactUserService::Account).to receive(:new).with(client, user_id).and_return(account_api)

      account = subject.account(user_id, options)

      expect(account).to be(account_api)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
campact_user_service-4.0.0 spec/campact_user_service_spec.rb
campact_user_service-3.1.1 spec/campact_user_service_spec.rb
campact_user_service-3.1.0 spec/campact_user_service_spec.rb
campact_user_service-3.0.1 spec/campact_user_service_spec.rb
campact_user_service-3.0.0 spec/campact_user_service_spec.rb
campact_user_service-2.1.0 spec/campact_user_service_spec.rb
campact_user_service-2.0.1 spec/campact_user_service_spec.rb