Sha256: 9cd54a1622f5459da0d6ca7d5627bcdddf7b443baf5368ff7dcea9a980bae3e7

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

# frozen_string_literal: true

module SuperIdentity
  # Mixin for stubbing IdE during test suites
  module TestStub
    def stub_ide(shared_token:, entitlements: [], **)
      host = ide_config[:host]
      url = "https://#{host}/api/subjects/#{shared_token}/attributes"

      attrs = entitlements.map do |v|
        { name: 'eduPersonEntitlement', value: v }
      end

      json = JSON.generate(attributes: attrs)
      WebMock::API.stub_request(:get, url).to_return(status: 200, body: json)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
super-identity-0.1.0 lib/super_identity/test_stub.rb