deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [3/11] git commit: Core: Fix tests to use rubygems boilerplate
Date Tue, 07 Aug 2012 17:17:48 GMT
Core: Fix tests to use rubygems boilerplate

* All tests should now work standalone under 1.8 ruby.
* Replaced ENV['API_FRONTEND'] variables Deltacloud.default_frontend
* Moved test_helper.rb from Rakefile to common.rb files


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/88eee70b
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/88eee70b
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/88eee70b

Branch: refs/heads/master
Commit: 88eee70baa7d22328c7fd79edd94cf36226d8871
Parents: 2b9fdad
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Fri Aug 3 15:09:40 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Aug 7 19:14:03 2012 +0200

----------------------------------------------------------------------
 server/Rakefile                                    |    4 --
 server/tests/cimi/collections/common.rb            |   31 +++++---------
 server/tests/deltacloud/base_collection_test.rb    |    4 +-
 .../collections/buckets_collection_test.rb         |    4 +-
 .../collections/drivers_collection_test.rb         |    4 +-
 .../hardware_profiles_collection_test.rb           |    4 +-
 .../collections/images_collection_test.rb          |    4 +-
 .../collections/instance_states_collection_test.rb |    4 +-
 .../collections/instances_collection_test.rb       |    4 +-
 .../deltacloud/collections/keys_collection_test.rb |    4 +-
 server/tests/deltacloud/collections_test.rb        |    4 +-
 server/tests/deltacloud/common.rb                  |   24 ++++--------
 server/tests/deltacloud/deltacloud_helper_test.rb  |    4 +-
 server/tests/deltacloud/drivers_test.rb            |    4 +-
 server/tests/deltacloud/rack_test.rb               |    8 +++-
 server/tests/deltacloud/server_test.rb             |   16 ++++---
 server/tests/ec2/common.rb                         |   29 ++++++++------
 server/tests/ec2/query_parser_test.rb              |    5 +-
 server/tests/ec2/server_test.rb                    |    5 +-
 server/tests/helpers/core_ext/array_test.rb        |    4 +-
 server/tests/helpers/core_ext/hash_test.rb         |    4 +-
 server/tests/helpers/core_ext/integer_test.rb      |    4 +-
 server/tests/helpers/core_ext/string_test.rb       |    4 +-
 server/tests/test_helper.rb                        |    5 ++
 24 files changed, 108 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/Rakefile
----------------------------------------------------------------------
diff --git a/server/Rakefile b/server/Rakefile
index 184fe6c..d1a2fad 100644
--- a/server/Rakefile
+++ b/server/Rakefile
@@ -159,7 +159,6 @@ namespace :test do
   end
 
   Rake::TestTask.new(:base) do |t|
-    t.ruby_opts << '-r./tests/test_helper.rb'   # Load SimpleCov when COVERAGE=1 is
set
     unless RUBY_VERSION < '1.9.0'
       t.loader = :testrb
     end
@@ -173,7 +172,6 @@ namespace :test do
   end
 
   Rake::TestTask.new(:ec2) do |t|
-    t.ruby_opts << '-r./tests/test_helper.rb'   # Load SimpleCov when COVERAGE=1 is
set
     unless RUBY_VERSION < '1.9.0'
       t.loader = :testrb
     end
@@ -184,8 +182,6 @@ namespace :test do
 
   namespace :cimi do
     Rake::TestTask.new(:models) do |t|
-      t.ruby_opts << '-r./tests/cimi/spec/spec_helper.rb'    # Load SimpleCov when
COVERAGE=1 is set
-      t.ruby_opts << '-r./tests/test_helper.rb'    # Load SimpleCov when COVERAGE=1
is set
       unless RUBY_VERSION < '1.9.0'
         t.loader = :testrb
       end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/cimi/collections/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/collections/common.rb b/server/tests/cimi/collections/common.rb
index 0706dc4..5948dde 100644
--- a/server/tests/cimi/collections/common.rb
+++ b/server/tests/cimi/collections/common.rb
@@ -1,26 +1,17 @@
 require_relative File.join('..', '..', '..', 'lib', 'deltacloud_rack.rb')
+require_relative '../../test_helper.rb'
 
-unless Time.respond_to? :be
-  require_relative '../../test_helper.rb'
-end
-
-# Set the default driver used for server API tests
-#
-ENV['API_DRIVER'] = 'mock'
-
-# Setup Deltacloud::API Sinatra instance
+# Setup CIMI::API Sinatra instance
 #
-unless Deltacloud::config[:cimi]
-  Deltacloud::configure(:cimi) do |server|
-    server.root_url '/cimi'
-    server.version '1.0.0'
-    server.klass 'CIMI::API'
-    server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
-  end
-
-  Deltacloud.require_frontend!(:cimi)
+Deltacloud::configure(:cimi) do |server|
+  server.root_url '/cimi'
+  server.version '1.0.0'
+  server.klass 'CIMI::API'
+  server.default_driver :mock
+  server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
 end
 
-def root_url(url=''); Deltacloud.config[:cimi].root_url + url; end
+Deltacloud[:cimi].require!
+Deltacloud[:cimi].default_frontend!
+
 def formats; [ 'application/xml', 'application/json' ]; end
-def json; JSON::parse(response_body); end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/base_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/base_collection_test.rb b/server/tests/deltacloud/base_collection_test.rb
index 3e820d6..4978f16 100644
--- a/server/tests/deltacloud/base_collection_test.rb
+++ b/server/tests/deltacloud/base_collection_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative 'common.rb'
 
 describe Deltacloud::Collections::Base do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/collections/buckets_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/buckets_collection_test.rb b/server/tests/deltacloud/collections/buckets_collection_test.rb
index 9b4a40c..d1c40af 100644
--- a/server/tests/deltacloud/collections/buckets_collection_test.rb
+++ b/server/tests/deltacloud/collections/buckets_collection_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative File.join('..', 'common.rb')
 
 describe Deltacloud::Collections::Buckets do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/collections/drivers_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/drivers_collection_test.rb b/server/tests/deltacloud/collections/drivers_collection_test.rb
index e037ae1..922248b 100644
--- a/server/tests/deltacloud/collections/drivers_collection_test.rb
+++ b/server/tests/deltacloud/collections/drivers_collection_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative File.join('..', 'common.rb')
 
 describe Deltacloud::Collections::Drivers do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb b/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb
index 6ba449a..b307bdd 100644
--- a/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb
+++ b/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative File.join('..', 'common.rb')
 
 describe Deltacloud::Collections::HardwareProfiles do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/collections/images_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/images_collection_test.rb b/server/tests/deltacloud/collections/images_collection_test.rb
index b57eba3..cff0d33 100644
--- a/server/tests/deltacloud/collections/images_collection_test.rb
+++ b/server/tests/deltacloud/collections/images_collection_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative File.join('..', 'common.rb')
 
 describe Deltacloud::Collections::Images do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/collections/instance_states_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/instance_states_collection_test.rb b/server/tests/deltacloud/collections/instance_states_collection_test.rb
index bfcf7c9..dd8a507 100644
--- a/server/tests/deltacloud/collections/instance_states_collection_test.rb
+++ b/server/tests/deltacloud/collections/instance_states_collection_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative File.join('..', 'common.rb')
 
 describe Deltacloud::Collections::InstanceStates do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/collections/instances_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/instances_collection_test.rb b/server/tests/deltacloud/collections/instances_collection_test.rb
index d4c0c97..bc2c880 100644
--- a/server/tests/deltacloud/collections/instances_collection_test.rb
+++ b/server/tests/deltacloud/collections/instances_collection_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative File.join('..', 'common.rb')
 
 describe Deltacloud::Collections::Instances do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/collections/keys_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/keys_collection_test.rb b/server/tests/deltacloud/collections/keys_collection_test.rb
index 0ada149..10371d3 100644
--- a/server/tests/deltacloud/collections/keys_collection_test.rb
+++ b/server/tests/deltacloud/collections/keys_collection_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative File.join('..', 'common.rb')
 
 describe Deltacloud::Collections::Keys do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/collections_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections_test.rb b/server/tests/deltacloud/collections_test.rb
index 2d15c61..ec05682 100644
--- a/server/tests/deltacloud/collections_test.rb
+++ b/server/tests/deltacloud/collections_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative 'common.rb'
 
 describe Deltacloud do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/common.rb b/server/tests/deltacloud/common.rb
index 98b9884..8611715 100644
--- a/server/tests/deltacloud/common.rb
+++ b/server/tests/deltacloud/common.rb
@@ -1,22 +1,14 @@
-ENV['API_FRONTEND'] = 'cimi'
-
+require_relative '../test_helper.rb'
 require_relative File.join('..', '..', 'lib', 'deltacloud_rack.rb')
 
-# Set the default driver used for server API tests
-#
-ENV['API_DRIVER'] = 'mock'
-
 # Setup Deltacloud::API Sinatra instance
-#
-unless Deltacloud::config[:deltacloud]
-  Deltacloud::configure do |server|
-    server.root_url '/api'
-    server.version '1.0.0'
-    server.klass 'Deltacloud::API'
-    server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
-  end
 
-  Deltacloud.require_frontend!
+Deltacloud::configure do |server|
+  server.root_url '/api'
+  server.version '1.0.0'
+  server.klass 'Deltacloud::API'
+  server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
+  server.default_driver :mock
 end
 
-def root_url; Deltacloud.config[:cimi].root_url; end
+Deltacloud.require_frontend!

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/deltacloud_helper_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/deltacloud_helper_test.rb b/server/tests/deltacloud/deltacloud_helper_test.rb
index 88c5ebb..a01bb7b 100644
--- a/server/tests/deltacloud/deltacloud_helper_test.rb
+++ b/server/tests/deltacloud/deltacloud_helper_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative 'common.rb'
 
 describe Deltacloud::Helpers::Application do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/drivers_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/drivers_test.rb b/server/tests/deltacloud/drivers_test.rb
index 3c21981..3143563 100644
--- a/server/tests/deltacloud/drivers_test.rb
+++ b/server/tests/deltacloud/drivers_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative 'common.rb'
 
 describe Deltacloud::Drivers do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/rack_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/rack_test.rb b/server/tests/deltacloud/rack_test.rb
index 34665f5..b5b1c77 100644
--- a/server/tests/deltacloud/rack_test.rb
+++ b/server/tests/deltacloud/rack_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative 'common.rb'
 
 describe Deltacloud do
@@ -23,6 +25,10 @@ describe Deltacloud do
     Deltacloud[:deltacloud].klass.must_equal Deltacloud::API
   end
 
+  it 'should not require already required frontend' do
+    Deltacloud.require_frontend!.must_equal false
+  end
+
   describe Deltacloud::Server do
 
     it 'should provide the correct root_url' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/deltacloud/server_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/server_test.rb b/server/tests/deltacloud/server_test.rb
index 816112a..9789ccb 100644
--- a/server/tests/deltacloud/server_test.rb
+++ b/server/tests/deltacloud/server_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+
 require_relative 'common.rb'
 
 describe Deltacloud::API do
@@ -20,13 +22,13 @@ describe Deltacloud::API do
 
   it 'must advertise current API version in response headers' do
     get root_url
-    headers['Server'].must_match /Apache-Deltacloud\/(\d+).(\d+).(\d+)/
+    headers['Server'].must_match(/Apache-Deltacloud\/(\d+).(\d+).(\d+)/)
     xml.root.name.must_equal 'api'
   end
 
   it 'must advertise current API driver in response headers' do
     get root_url
-    headers['X-Deltacloud-Driver'].must_equal ENV['API_DRIVER']
+    headers['X-Deltacloud-Driver'].must_equal Deltacloud[:deltacloud].default_driver.to_s
     xml.root.name.must_equal 'api'
   end
 
@@ -47,10 +49,10 @@ describe Deltacloud::API do
   it 'must support setting driver and provider using POST' do
     post root_url, { :driver => :ec2 }
     headers['Location'].wont_be_nil
-    headers['Location'].must_match /\/api;driver=ec2/
+    headers['Location'].must_match(/\/api;driver=ec2/)
     post root_url, { :provider => :test_provider }
     headers['Location'].wont_be_nil
-    headers['Location'].must_match /\/api;provider=test_provider/
+    headers['Location'].must_match(/\/api;provider=test_provider/)
   end
 
   it 'must support matrix parameters for changing API driver' do
@@ -76,7 +78,7 @@ describe Deltacloud::API do
     get root_url + ';driver=ec2'
     headers['X-Deltacloud-Driver'].must_equal 'ec2'
     get root_url
-    headers['X-Deltacloud-Driver'].must_equal ENV['API_DRIVER']
+    headers['X-Deltacloud-Driver'].must_equal Deltacloud[:deltacloud].default_driver.to_s
     xml.root.name.must_equal 'api'
   end
 
@@ -127,7 +129,7 @@ describe Deltacloud::API do
     get root_url
     status.must_equal 200
     headers['Content-Type'].must_equal 'text/html'
-    response_body.must_match /^<\!DOCTYPE html>/
+    response_body.must_match(/^<\!DOCTYPE html>/)
   end
 
   it 'must support media type negotiation for XML format' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/ec2/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/ec2/common.rb b/server/tests/ec2/common.rb
index 21787c1..3527523 100644
--- a/server/tests/ec2/common.rb
+++ b/server/tests/ec2/common.rb
@@ -1,19 +1,24 @@
-require_relative File.join('..', '..', 'lib', 'deltacloud_rack.rb')
+require 'rubygems'
+require 'require_relative'
+require 'minitest/autorun'
 
-# Set the default driver used for server API tests
-#
-ENV['API_DRIVER'] = 'mock'
+require_relative File.join('..', '..', 'lib', 'deltacloud_rack.rb')
+require_relative '../test_helper.rb'
 
 # Setup Deltacloud::API Sinatra instance
 #
-unless Deltacloud::config[:ec2]
-  Deltacloud::configure(:ec2) do |server|
-    server.root_url '/'
-    server.version '2012-04-01'
-    server.klass 'Deltacloud::EC2::API'
-    server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
-  end
-  Deltacloud.require_frontend! :ec2
+
+Deltacloud::configure(:ec2) do |server|
+  server.root_url '/'
+  server.version '2012-04-01'
+  server.klass 'Deltacloud::EC2::API'
+  server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
+  server.default_driver :mock
 end
 
+Deltacloud.require_frontend! :ec2
+
+Deltacloud[:ec2].require!
+Deltacloud[:ec2].default_frontend!
+
 def root_url; Deltacloud.config[:ec2].root_url; end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/ec2/query_parser_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/ec2/query_parser_test.rb b/server/tests/ec2/query_parser_test.rb
index 761e5bc..81db3f6 100644
--- a/server/tests/ec2/query_parser_test.rb
+++ b/server/tests/ec2/query_parser_test.rb
@@ -1,6 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+require_relative './common.rb'
 
-require_relative 'common.rb'
 require_relative File.join('..', '..', 'lib', 'deltacloud', 'api.rb')
 
 describe Deltacloud::EC2 do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/ec2/server_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/ec2/server_test.rb b/server/tests/ec2/server_test.rb
index cca030b..e851e6b 100644
--- a/server/tests/ec2/server_test.rb
+++ b/server/tests/ec2/server_test.rb
@@ -1,6 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
 
-require_relative 'common.rb'
+require_relative './common.rb'
 
 describe Deltacloud::EC2::API do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/helpers/core_ext/array_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/helpers/core_ext/array_test.rb b/server/tests/helpers/core_ext/array_test.rb
index a228bd5..6f75e2a 100644
--- a/server/tests/helpers/core_ext/array_test.rb
+++ b/server/tests/helpers/core_ext/array_test.rb
@@ -1,4 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
+require_relative '../../test_helper.rb'
 
 require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'core_ext.rb')
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/helpers/core_ext/hash_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/helpers/core_ext/hash_test.rb b/server/tests/helpers/core_ext/hash_test.rb
index d87042b..9793e45 100644
--- a/server/tests/helpers/core_ext/hash_test.rb
+++ b/server/tests/helpers/core_ext/hash_test.rb
@@ -1,5 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
 
+require_relative '../../test_helper.rb'
 require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'core_ext.rb')
 
 class TestHash < MiniTest::Unit::TestCase

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/helpers/core_ext/integer_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/helpers/core_ext/integer_test.rb b/server/tests/helpers/core_ext/integer_test.rb
index 5dd60f5..2882db1 100644
--- a/server/tests/helpers/core_ext/integer_test.rb
+++ b/server/tests/helpers/core_ext/integer_test.rb
@@ -1,5 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
 
+require_relative '../../test_helper.rb'
 require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'core_ext.rb')
 
 class TestInteger < MiniTest::Unit::TestCase

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/helpers/core_ext/string_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/helpers/core_ext/string_test.rb b/server/tests/helpers/core_ext/string_test.rb
index cc9a349..6481d70 100644
--- a/server/tests/helpers/core_ext/string_test.rb
+++ b/server/tests/helpers/core_ext/string_test.rb
@@ -1,5 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative'
 
+require_relative '../../test_helper.rb'
 require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'core_ext.rb')
 
 class TestString < MiniTest::Unit::TestCase

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88eee70b/server/tests/test_helper.rb
----------------------------------------------------------------------
diff --git a/server/tests/test_helper.rb b/server/tests/test_helper.rb
index 5cb2b4b..e7a7dea 100644
--- a/server/tests/test_helper.rb
+++ b/server/tests/test_helper.rb
@@ -1,5 +1,6 @@
 require 'rubygems'
 require 'logger'
+require 'minitest/autorun'
 require 'rack/test'
 require 'nokogiri'
 require 'pp'
@@ -44,6 +45,8 @@ class Time
   end
 end
 
+# Test helpers
+
 def record_retries(name='')
   {
     :before => Proc.new { |r, &block|
@@ -58,4 +61,6 @@ def status; last_response.status; end
 def headers; last_response.headers; end
 def response_body; last_response.body; end
 def xml; Nokogiri::XML(response_body); end
+def json; JSON::parse(response_body); end
 def formats; [ 'application/xml', 'application/json', 'text/html' ]; end
+def root_url(url=''); Deltacloud.default_frontend.root_url + url; end


Mime
View raw message