projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
4058: If a portable data hash correpsonds to a single collection, automatically
[arvados.git]
/
apps
/
workbench
/
test
/
test_helper.rb
diff --git
a/apps/workbench/test/test_helper.rb
b/apps/workbench/test/test_helper.rb
index 5253676578e18b4eaf0692db37c1358b34c092d3..1a07e43be1fb51c5fe3c9a7796121ea684a9407c 100644
(file)
--- a/
apps/workbench/test/test_helper.rb
+++ b/
apps/workbench/test/test_helper.rb
@@
-38,7
+38,10
@@
class ActiveSupport::TestCase
teardown do
Thread.current[:arvados_api_token] = nil
teardown do
Thread.current[:arvados_api_token] = nil
+ Thread.current[:user] = nil
Thread.current[:reader_tokens] = nil
Thread.current[:reader_tokens] = nil
+ # Diagnostics suite doesn't run a server, so there's no cache to clear.
+ Rails.cache.clear unless (Rails.env == "diagnostics")
# Restore configuration settings changed during tests
$application_config.each do |k,v|
if k.match /^[^.]*$/
# Restore configuration settings changed during tests
$application_config.each do |k,v|
if k.match /^[^.]*$/
@@
-55,7
+58,7
@@
module ApiFixtureLoader
module ClassMethods
@@api_fixtures = {}
module ClassMethods
@@api_fixtures = {}
- def api_fixture(name)
+ def api_fixture(name
, *keys
)
# Returns the data structure from the named API server test fixture.
@@api_fixtures[name] ||= \
begin
# Returns the data structure from the named API server test fixture.
@@api_fixtures[name] ||= \
begin
@@
-63,10
+66,16
@@
module ApiFixtureLoader
'test', 'fixtures', "#{name}.yml")
YAML.load(IO.read(path))
end
'test', 'fixtures', "#{name}.yml")
YAML.load(IO.read(path))
end
+ keys.inject(@@api_fixtures[name]) { |hash, key| hash[key] }
end
end
end
end
- def api_fixture name
- self.class.api_fixture name
+ def api_fixture(name, *keys)
+ self.class.api_fixture(name, *keys)
+ end
+
+ def find_fixture(object_class, name)
+ object_class.find(api_fixture(object_class.to_s.pluralize.underscore,
+ name, "uuid"))
end
end
end
end