Sha256: 2ea3298c75829f88e1f0dcbc32efb3c31a050073966e5c53045c8b1c2335b17b

Contents?: true

Size: 977 Bytes

Versions: 3

Compression:

Stored size: 977 Bytes

Contents

require 'spec_helper'

describe CrewCheck::RoleDetermination do
  let(:admin_teams) do
    [
      'launchacademy/experience engineers'
    ]
  end

  let(:guest_lecturer_team) do
    'launchacademy/guest lecturer'
  end

  let(:role_map) do
    {
      'admin' => admin_teams,
      'users' => ['launchacademy/students'],
      'educator' => [guest_lecturer_team]
    }
  end

  let(:role_determination) do
    CrewCheck::RoleDetermination.new(admin_teams, role_map)
  end

  it 'calculates the list of effective roles' do
    expect(role_determination.roles).to eq(['admin'])
  end

  it 'allows for multiple roles' do
    admin_teams << guest_lecturer_team
    expect(role_determination.roles).to eq(['admin', 'educator'])
  end

  it 'returns an empty set if a team is not found' do
    other_teams = ['launchacademy/something crazy']
    role_determination = CrewCheck::RoleDetermination.new(other_teams, role_map)
    expect(role_determination.roles).to eq([])
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omniauth-crew-check-0.0.4 spec/unit/crew_check/role_determination_spec.rb
omniauth-crew-check-0.0.3 spec/unit/crew_check/role_determination_spec.rb
omniauth-crew-check-0.0.2 spec/unit/crew_check/role_determination_spec.rb