debian-mirror-gitlab/spec/policies/identity_provider_policy_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
773 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe IdentityProviderPolicy do
2019-07-07 11:18:12 +05:30
subject(:policy) { described_class.new(user, provider) }
2019-12-21 20:55:43 +05:30
2019-07-07 11:18:12 +05:30
let(:user) { User.new }
let(:provider) { :a_provider }
describe '#rules' do
it { is_expected.to be_allowed(:link) }
it { is_expected.to be_allowed(:unlink) }
context 'when user is anonymous' do
let(:user) { nil }
it { is_expected.not_to be_allowed(:link) }
it { is_expected.not_to be_allowed(:unlink) }
end
%w[saml cas3].each do |provider_name|
context "when provider is #{provider_name}" do
let(:provider) { provider_name }
it { is_expected.to be_allowed(:link) }
it { is_expected.not_to be_allowed(:unlink) }
end
end
end
end