Sha256: 0d47bfa0eeded5e2c33fe81fe44f9ad17f3f82c818e0ee675c8d70b1c3f80477

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

module Roqua
  module CoreApi
    module Sessions
      describe AppSession do
        let(:session) { Fabricate :app_session }

        describe '#organization_session' do
          it 'creates a new organization when attributes are provided' do
            organization_attributes = double
            expect(session).to receive(:create_organization).with organization_attributes
            session.organization_session organization_attributes
          end

          it 'initializes an organization session with a newly created organization' do
            organization_attributes = double
            organization = double
            allow(session).to receive(:create_organization).with(organization_attributes).and_return organization
            expect(OrganizationSession).to receive(:new).with(organization, session.key, session.server)
            session.organization_session organization_attributes
          end

          it 'initializes an organization session with a given organization' do
            organization = Fabricate :organization
            expect(OrganizationSession).to receive(:new).with(organization, session.key, session.server)
            session.organization_session organization
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roqua-core-api-0.0.2 spec/lib/roqua/core_api/sessions/app_session_spec.rb