diff options
| author | Xinhui | 2017-08-22 14:30:19 +0200 | 
|---|---|---|
| committer | Xinhui | 2017-08-22 14:52:49 +0200 | 
| commit | e44b43ba2d6aeab84a2aead6e01aa9cd71c2d6e5 (patch) | |
| tree | af22e3c373f8b3c9f37bfaeea937146e43abfb16 /spec/support/shared_context.rb | |
| parent | 9a281154ea20a6450bb53880f1dd77d5139075f1 (diff) | |
| download | chouette-core-e44b43ba2d6aeab84a2aead6e01aa9cd71c2d6e5.tar.bz2 | |
API - Rspec basic auth api controller
Diffstat (limited to 'spec/support/shared_context.rb')
| -rw-r--r-- | spec/support/shared_context.rb | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb new file mode 100644 index 000000000..c08ee6163 --- /dev/null +++ b/spec/support/shared_context.rb @@ -0,0 +1,8 @@ +shared_context 'iboo authenticated api user' do +  let(:api_key) { create(:api_key) } +  let(:user)    { create(:user, organisation: api_key.organisation ) } + +  before do +    request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user.username, api_key.token) +  end +end | 
