diff options
| author | Xinhui | 2017-08-25 17:13:24 +0200 |
|---|---|---|
| committer | Xinhui | 2017-08-25 17:13:24 +0200 |
| commit | 0777d35ff4460cf07c34e69ee7c10c0270a446bf (patch) | |
| tree | b2d850bbce3c8669ee6c636fa93e91c5a6a662bc /spec/support/shared_context.rb | |
| parent | 5dda0f5286043823acab68a73d84437a3cbd803f (diff) | |
| parent | 1d7db2b6c254ac55105c08ee177580036b0377f3 (diff) | |
| download | chouette-core-0777d35ff4460cf07c34e69ee7c10c0270a446bf.tar.bz2 | |
Merge branch 'master' into staging
Diffstat (limited to 'spec/support/shared_context.rb')
| -rw-r--r-- | spec/support/shared_context.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb new file mode 100644 index 000000000..e9b0025a2 --- /dev/null +++ b/spec/support/shared_context.rb @@ -0,0 +1,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 |
