Merge remote-tracking branch 'origin/master' into 1971-show-image-thumbnails
[arvados.git] / services / api / test / test_helper.rb
1 ENV["RAILS_ENV"] = "test"
2 require File.expand_path('../../config/environment', __FILE__)
3 require 'rails/test_help'
4
5 class ActiveSupport::TestCase
6   # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7   #
8   # Note: You'll currently still have to declare fixtures explicitly in integration tests
9   # -- they do not yet inherit this setting
10   fixtures :all
11
12   def expect_json
13     self.request.headers["Accept"] = "text/json"
14   end
15
16   def authorize_with(api_client_auth_name)
17     self.request.env['HTTP_AUTHORIZATION'] = "OAuth2 #{api_client_authorizations(api_client_auth_name).api_token}"
18   end
19
20   # Add more helper methods to be used by all tests here...
21 end
22
23 class ActionDispatch::IntegrationTest
24   def jresponse
25     @jresponse ||= ActiveSupport::JSON.decode @response.body
26   end
27 end
28
29 # Ensure permissions are computed from the test fixtures.
30 User.invalidate_permissions_cache