require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
+require 'mocha/mini_test'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in
Thread.current[:arvados_api_token] = auth['api_token']
end
- def teardown
+ teardown do
Thread.current[:arvados_api_token] = nil
Thread.current[:reader_tokens] = nil
- super
+ # Restore configuration settings changed during tests
+ $application_config.each do |k,v|
+ if k.match /^[^.]*$/
+ Rails.configuration.send (k + '='), v
+ end
+ end
end
end
begin
path = File.join(ApiServerForTests::ARV_API_SERVER_DIR,
'test', 'fixtures', "#{name}.yml")
- YAML.load(IO.read(path))
+ file = IO.read(path)
+ trim_index = file.index('# Test Helper trims the rest of the file')
+ file = file[0, trim_index] if trim_index
+ YAML.load(file)
end
end
end
make_ssl_cert
_system('bundle', 'exec', 'rake', 'db:test:load')
_system('bundle', 'exec', 'rake', 'db:fixtures:load')
- _system('bundle', 'exec', 'passenger', 'start', '-d', '-p3001',
+ _system('bundle', 'exec', 'passenger', 'start', '-d', '-p3000',
'--pid-file', SERVER_PID_PATH,
'--ssl',
'--ssl-certificate', 'self-signed.pem',
def check_counter action
@counter += 1
if @counter == 2
- # TODO: when existing mistakes are fixed, start failing broken
- # test cases like this:
- #
- # assert_equal 1, 2, "Multiple actions in functional test"
- #
- # Meanwhile, just warn (just once per test case):
- $stderr.puts " [WARNING: Multiple actions in functional test]"
+ assert_equal 1, 2, "Multiple actions in functional test"
end
end