diff options
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/api_key.rb | 4 | ||||
| -rw-r--r-- | spec/support/json_helper.rb | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/api_key.rb b/spec/support/api_key.rb index 9353fac15..561e1f796 100644 --- a/spec/support/api_key.rb +++ b/spec/support/api_key.rb @@ -1,5 +1,9 @@ module ApiKeyHelper + def authorization_token_header(key) + {'Authorization' => "Token token=#{key}"} + end + def get_api_key Api::V1::ApiKey.first_or_create( :referential_id => referential.id, :name => "test") end diff --git a/spec/support/json_helper.rb b/spec/support/json_helper.rb new file mode 100644 index 000000000..a383981a0 --- /dev/null +++ b/spec/support/json_helper.rb @@ -0,0 +1,11 @@ +module Support + module JsonHelper + def json_response_body + JSON.parse(response.body) + end + end +end + +RSpec.configure do | config | + config.include Support::JsonHelper, type: :request +end |
