aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/shared_context.rb
blob: e9b0025a2167d60c14a9b0abae59be451bea078b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
shared_context 'iboo authenticated api user' do
  let(:api_key) { create(:api_key, organisation: organisation) }

  before do
    request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(api_key.organisation.code, api_key.token)
  end
end

shared_context 'iboo wrong authorisation api user' do
  let(:api_key) { create(:api_key, organisation: organisation) }

  before do
    request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials('fake code', api_key.token)
  end
end