Sha256: b3d6f307a61a6e7d7ee45bdf46fdecd2200f7d04e384205a8607dc7550ee77fa

Contents?: true

Size: 839 Bytes

Versions: 13

Compression:

Stored size: 839 Bytes

Contents

require "spec_helper"
require "gds-sso/bearer_token"

describe GDS::SSO::MockBearerToken do
  it "updates the permissions of the user" do
    # setup - ensure extra mock permissions required are nil and
    # call .locate to create the dummy user initially
    GDS::SSO::Config.additional_mock_permissions_required = nil
    dummy_user = subject.locate("ABC")
    expect(dummy_user.permissions).to match_array(%w[signin])

    # add an extra permission
    GDS::SSO::Config.additional_mock_permissions_required = "extra_permission"

    # ensure the dummy user is returned
    expect(GDS::SSO).to receive(:test_user).and_return(dummy_user)

    # call .locate again...this should update our permissions
    dummy_user_two = subject.locate("ABC")
    expect(dummy_user_two.permissions).to match_array(%w[signin extra_permission])
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gds-sso-19.1.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-19.0.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-18.1.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-18.0.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-17.1.1 spec/unit/mock_bearer_token_spec.rb
gds-sso-17.1.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-17.0.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-16.1.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-16.0.2 spec/unit/mock_bearer_token_spec.rb
gds-sso-16.0.1 spec/unit/mock_bearer_token_spec.rb
gds-sso-16.0.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-15.1.0 spec/unit/mock_bearer_token_spec.rb
gds-sso-15.0.1 spec/unit/mock_bearer_token_spec.rb