deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [1/2] git commit: tests: change how we require files
Date Fri, 24 Aug 2012 17:55:42 GMT
Updated Branches:
  refs/heads/master 698b0581b -> e3a59a235


tests: change how we require files

That makes it possible to run one test case as

  bundle exec ruby tests/drivers/ec2/realms_test.rb

The idea is that individual test files just load enough to get to the
common.rb in their directory, which does the remaining setup


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

Branch: refs/heads/master
Commit: adc1828b8f5de1697e1f95fcbb4e5bdf2d859f93
Parents: 698b058
Author: David Lutterkort <lutter@redhat.com>
Authored: Thu Aug 23 20:23:35 2012 -0700
Committer: David Lutterkort <lutter@redhat.com>
Committed: Fri Aug 24 10:54:59 2012 -0700

----------------------------------------------------------------------
 server/tests/README.md                             |    4 +-
 server/tests/drivers/base/base_driver_test.rb      |    8 +++-
 server/tests/drivers/base/common.rb                |    1 +
 server/tests/drivers/base/library_test.rb          |    8 +++-
 server/tests/drivers/ec2/common.rb                 |    6 +--
 server/tests/drivers/ec2/images_test.rb            |    5 +-
 server/tests/drivers/ec2/instance_test.rb          |    4 +-
 server/tests/drivers/ec2/keys_test.rb              |    4 +-
 server/tests/drivers/ec2/realms_test.rb            |    5 +-
 server/tests/drivers/ec2/storage_snapshots_test.rb |    4 +-
 server/tests/drivers/google/buckets_test.rb        |    4 +-
 server/tests/drivers/google/common.rb              |    2 +
 server/tests/drivers/mock/common.rb                |    1 +
 server/tests/drivers/mock/images_test.rb           |    5 +-
 server/tests/drivers/mock/instances_test.rb        |    5 +-
 server/tests/drivers/mock/keys_test.rb             |    5 +-
 server/tests/drivers/mock/realms_test.rb           |    5 +-
 .../tests/drivers/mock/storage_snapshots_test.rb   |    5 +-
 server/tests/drivers/mock/storage_volumes_test.rb  |    5 +-
 server/tests/drivers/models/address_test.rb        |    6 +-
 server/tests/drivers/models/base_test.rb           |    6 ++-
 server/tests/drivers/models/blob_test.rb           |    6 +-
 server/tests/drivers/models/common.rb              |    3 +
 .../tests/drivers/models/hardware_profile_test.rb  |    9 ++--
 .../tests/drivers/models/instance_address_test.rb  |    6 +-
 .../tests/drivers/models/instance_profile_test.rb  |    6 +-
 server/tests/drivers/models/instance_test.rb       |    6 +-
 server/tests/drivers/models/keys_test.rb           |    6 +-
 server/tests/drivers/models/metrics_test.rb        |    6 +-
 server/tests/drivers/rhevm/common.rb               |    2 +
 server/tests/drivers/rhevm/images_test.rb          |    7 +--
 server/tests/drivers/rhevm/instance_test.rb        |    4 +-
 server/tests/drivers/rhevm/provider_test.rb        |    4 +-
 server/tests/drivers/rhevm/realms_test.rb          |    5 +-
 server/tests/test_helper.rb                        |   32 ++++++++------
 35 files changed, 112 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/README.md
----------------------------------------------------------------------
diff --git a/server/tests/README.md b/server/tests/README.md
index b870647..c5fb2fb 100644
--- a/server/tests/README.md
+++ b/server/tests/README.md
@@ -4,9 +4,9 @@ Deltacloud API tests guide
 Running tests
 -----------------------
 
-Each test can be run manually using the Ruby or 'testrb' tool:
+Each test can be run manually using:
 
-$ ruby tests/deltacloud/base_collection_test.rb
+$ bundle exec ruby tests/drivers/ec2/realms_test.rb
 
 In addition to manual run, you can use one of there Rake tasks:
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/base/base_driver_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/base/base_driver_test.rb b/server/tests/drivers/base/base_driver_test.rb
index 074c415..b303717 100644
--- a/server/tests/drivers/base/base_driver_test.rb
+++ b/server/tests/drivers/base/base_driver_test.rb
@@ -1,5 +1,9 @@
-require 'minitest/autorun'
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'drivers', 'base_driver.rb')
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative 'common'
+
+require_relative '../../../lib/deltacloud/drivers/base_driver'
 
 describe Deltacloud::BaseDriver do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/base/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/base/common.rb b/server/tests/drivers/base/common.rb
new file mode 100644
index 0000000..46bc7db
--- /dev/null
+++ b/server/tests/drivers/base/common.rb
@@ -0,0 +1 @@
+require_relative '../../test_helper'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/base/library_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/base/library_test.rb b/server/tests/drivers/base/library_test.rb
index a4a7f2f..3dd7958 100644
--- a/server/tests/drivers/base/library_test.rb
+++ b/server/tests/drivers/base/library_test.rb
@@ -1,5 +1,9 @@
-require 'minitest/autorun'
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative 'common.rb'
+
+require_relative '../../../lib/deltacloud/api'
 
 describe 'Deltacloud API Library' do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/ec2/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/common.rb b/server/tests/drivers/ec2/common.rb
index aa2d790..26982dc 100644
--- a/server/tests/drivers/ec2/common.rb
+++ b/server/tests/drivers/ec2/common.rb
@@ -3,6 +3,8 @@
 require 'right_http_connection'
 require 'vcr'
 
+require_relative '../../test_helper.rb'
+
 # Freeze time, so EC2 signatures have all the same time
 # This will avoid IncorrectSignature exceptions
 
@@ -16,10 +18,6 @@ def credentials
   }
 end
 
-unless Time.respond_to? :be
-  require_relative '../../test_helper.rb'
-end
-
 Time.be(DateTime.parse("2012-07-30 11:05:00 +0000").to_s)
 
 VCR.configure do |c|

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/ec2/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/images_test.rb b/server/tests/drivers/ec2/images_test.rb
index ea864cd..31823a3 100644
--- a/server/tests/drivers/ec2/images_test.rb
+++ b/server/tests/drivers/ec2/images_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 describe 'Ec2Driver Images' do
@@ -46,4 +46,3 @@ describe 'Ec2Driver Images' do
   end
 
 end
-

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/ec2/instance_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/instance_test.rb b/server/tests/drivers/ec2/instance_test.rb
index c14afd9..ed50c7d 100644
--- a/server/tests/drivers/ec2/instance_test.rb
+++ b/server/tests/drivers/ec2/instance_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 describe 'Ec2Driver Instances' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/ec2/keys_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/keys_test.rb b/server/tests/drivers/ec2/keys_test.rb
index 936c907..ac66e23 100644
--- a/server/tests/drivers/ec2/keys_test.rb
+++ b/server/tests/drivers/ec2/keys_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 describe 'Ec2Driver Instances' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/ec2/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/realms_test.rb b/server/tests/drivers/ec2/realms_test.rb
index e3e60fb..5129fe2 100644
--- a/server/tests/drivers/ec2/realms_test.rb
+++ b/server/tests/drivers/ec2/realms_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 describe 'Ec2Driver Realms' do
@@ -41,4 +41,3 @@ describe 'Ec2Driver Realms' do
   end
 
 end
-

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/ec2/storage_snapshots_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/ec2/storage_snapshots_test.rb b/server/tests/drivers/ec2/storage_snapshots_test.rb
index 34205d9..912d09b 100644
--- a/server/tests/drivers/ec2/storage_snapshots_test.rb
+++ b/server/tests/drivers/ec2/storage_snapshots_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 describe 'Ec2Driver StorageSnapshots' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/google/buckets_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/google/buckets_test.rb b/server/tests/drivers/google/buckets_test.rb
index 551a0aa..b653f80 100644
--- a/server/tests/drivers/google/buckets_test.rb
+++ b/server/tests/drivers/google/buckets_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 require 'tempfile'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/google/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/google/common.rb b/server/tests/drivers/google/common.rb
index 7c65ab7..f30fd84 100644
--- a/server/tests/drivers/google/common.rb
+++ b/server/tests/drivers/google/common.rb
@@ -1,5 +1,7 @@
 require 'vcr'
 
+require_relative '../../test_helper'
+
 def credentials
   {
     :user => 'GOOGXKQLYTEOZTILUBZ5',

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/mock/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/common.rb b/server/tests/drivers/mock/common.rb
new file mode 100644
index 0000000..46bc7db
--- /dev/null
+++ b/server/tests/drivers/mock/common.rb
@@ -0,0 +1 @@
+require_relative '../../test_helper'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/mock/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/images_test.rb b/server/tests/drivers/mock/images_test.rb
index 7165e65..2958ef9 100644
--- a/server/tests/drivers/mock/images_test.rb
+++ b/server/tests/drivers/mock/images_test.rb
@@ -1,6 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common'
 
 describe 'MockDriver Images' do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/mock/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/instances_test.rb b/server/tests/drivers/mock/instances_test.rb
index a104216..97ff0ac 100644
--- a/server/tests/drivers/mock/instances_test.rb
+++ b/server/tests/drivers/mock/instances_test.rb
@@ -1,6 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common'
 
 describe 'MockDriver Instances' do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/mock/keys_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/keys_test.rb b/server/tests/drivers/mock/keys_test.rb
index 296b909..9deb4c4 100644
--- a/server/tests/drivers/mock/keys_test.rb
+++ b/server/tests/drivers/mock/keys_test.rb
@@ -1,6 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common'
 
 describe 'MockDriver Keys' do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/mock/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/realms_test.rb b/server/tests/drivers/mock/realms_test.rb
index 046e5b5..3e57398 100644
--- a/server/tests/drivers/mock/realms_test.rb
+++ b/server/tests/drivers/mock/realms_test.rb
@@ -1,6 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common'
 
 describe 'MockDriver Realms' do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/mock/storage_snapshots_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/storage_snapshots_test.rb b/server/tests/drivers/mock/storage_snapshots_test.rb
index 83ab110..8b45fac 100644
--- a/server/tests/drivers/mock/storage_snapshots_test.rb
+++ b/server/tests/drivers/mock/storage_snapshots_test.rb
@@ -1,6 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common'
 
 describe 'MockDriver StorageSnapshots' do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/mock/storage_volumes_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/mock/storage_volumes_test.rb b/server/tests/drivers/mock/storage_volumes_test.rb
index 4285d2e..3cc77b9 100644
--- a/server/tests/drivers/mock/storage_volumes_test.rb
+++ b/server/tests/drivers/mock/storage_volumes_test.rb
@@ -1,6 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
+require_relative 'common'
 
 describe 'MockDriver StorageVolumes' do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/address_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/address_test.rb b/server/tests/drivers/models/address_test.rb
index 34a6a5f..6f9650c 100644
--- a/server/tests/drivers/models/address_test.rb
+++ b/server/tests/drivers/models/address_test.rb
@@ -1,7 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'address.rb')
+require_relative 'common.rb'
 
 describe Address do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/base_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/base_test.rb b/server/tests/drivers/models/base_test.rb
index a1cc873..e32468c 100644
--- a/server/tests/drivers/models/base_test.rb
+++ b/server/tests/drivers/models/base_test.rb
@@ -1,5 +1,7 @@
-require 'minitest/autorun'
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative 'common'
 
 describe BaseModel do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/blob_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/blob_test.rb b/server/tests/drivers/models/blob_test.rb
index 34a6a5f..d61cbff 100644
--- a/server/tests/drivers/models/blob_test.rb
+++ b/server/tests/drivers/models/blob_test.rb
@@ -1,7 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'address.rb')
+require_relative 'common'
 
 describe Address do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/common.rb b/server/tests/drivers/models/common.rb
new file mode 100644
index 0000000..885f276
--- /dev/null
+++ b/server/tests/drivers/models/common.rb
@@ -0,0 +1,3 @@
+require_relative '../../test_helper'
+
+require_relative '../../../lib/deltacloud/models'

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/hardware_profile_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/hardware_profile_test.rb b/server/tests/drivers/models/hardware_profile_test.rb
index 4f01e67..1a7838f 100644
--- a/server/tests/drivers/models/hardware_profile_test.rb
+++ b/server/tests/drivers/models/hardware_profile_test.rb
@@ -1,10 +1,11 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative 'common'
+
 require 'sinatra/base'
 require 'sinatra/rabbit'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'hardware_profile.rb')
-
 describe Deltacloud::HardwareProfile do
 
   before do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/instance_address_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/instance_address_test.rb b/server/tests/drivers/models/instance_address_test.rb
index 78ee160..ff07b49 100644
--- a/server/tests/drivers/models/instance_address_test.rb
+++ b/server/tests/drivers/models/instance_address_test.rb
@@ -1,7 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'instance_address.rb')
+require_relative 'common'
 
 describe InstanceAddress do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/instance_profile_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/instance_profile_test.rb b/server/tests/drivers/models/instance_profile_test.rb
index 6f5071e..f2373a0 100644
--- a/server/tests/drivers/models/instance_profile_test.rb
+++ b/server/tests/drivers/models/instance_profile_test.rb
@@ -1,7 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'instance_profile.rb')
+require_relative 'common'
 
 describe InstanceProfile do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/instance_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/instance_test.rb b/server/tests/drivers/models/instance_test.rb
index 62ca33b..26852ee 100644
--- a/server/tests/drivers/models/instance_test.rb
+++ b/server/tests/drivers/models/instance_test.rb
@@ -1,7 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'instance.rb')
+require_relative 'common'
 
 describe Instance do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/keys_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/keys_test.rb b/server/tests/drivers/models/keys_test.rb
index befc4bb..c64726f 100644
--- a/server/tests/drivers/models/keys_test.rb
+++ b/server/tests/drivers/models/keys_test.rb
@@ -1,7 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'key.rb')
+require_relative 'common'
 
 describe Key do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/models/metrics_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/models/metrics_test.rb b/server/tests/drivers/models/metrics_test.rb
index be8c581..a8cc0c3 100644
--- a/server/tests/drivers/models/metrics_test.rb
+++ b/server/tests/drivers/models/metrics_test.rb
@@ -1,7 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'base_model.rb')
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'models', 'metric.rb')
+require_relative 'common'
 
 describe Metric do
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/rhevm/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/common.rb b/server/tests/drivers/rhevm/common.rb
index 8e039e9..7406311 100644
--- a/server/tests/drivers/rhevm/common.rb
+++ b/server/tests/drivers/rhevm/common.rb
@@ -1,5 +1,7 @@
 require 'vcr'
 
+require_relative '../../test_helper'
+
 # Credentials used to access RHEV-M server
 #
 # NOTE: If these are changed, the VCR fixtures need to be re-recorded

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/rhevm/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/images_test.rb b/server/tests/drivers/rhevm/images_test.rb
index 7b165bf..43d06e4 100644
--- a/server/tests/drivers/rhevm/images_test.rb
+++ b/server/tests/drivers/rhevm/images_test.rb
@@ -1,7 +1,7 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
-require_relative 'common.rb'
+require_relative 'common'
 
 describe 'RhevmDriver Images' do
 
@@ -70,4 +70,3 @@ describe 'RhevmDriver Images' do
   end
 
 end
-

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/rhevm/instance_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/instance_test.rb b/server/tests/drivers/rhevm/instance_test.rb
index bdcae83..8edf5cb 100644
--- a/server/tests/drivers/rhevm/instance_test.rb
+++ b/server/tests/drivers/rhevm/instance_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 describe 'RhevmDriver Instances' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/rhevm/provider_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/provider_test.rb b/server/tests/drivers/rhevm/provider_test.rb
index 086cef5..9a9836d 100644
--- a/server/tests/drivers/rhevm/provider_test.rb
+++ b/server/tests/drivers/rhevm/provider_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 describe 'RHEV-M provider test' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/drivers/rhevm/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/realms_test.rb b/server/tests/drivers/rhevm/realms_test.rb
index 492d667..383473c 100644
--- a/server/tests/drivers/rhevm/realms_test.rb
+++ b/server/tests/drivers/rhevm/realms_test.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
 
-require_relative File.join('..', '..', '..', 'lib', 'deltacloud', 'api.rb')
 require_relative 'common.rb'
 
 describe 'RhevmDriver Realms' do
@@ -40,4 +40,3 @@ describe 'RhevmDriver Realms' do
   end
 
 end
-

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/adc1828b/server/tests/test_helper.rb
----------------------------------------------------------------------
diff --git a/server/tests/test_helper.rb b/server/tests/test_helper.rb
index 41d8758..a5128cf 100644
--- a/server/tests/test_helper.rb
+++ b/server/tests/test_helper.rb
@@ -6,6 +6,8 @@ require 'nokogiri'
 require 'pp'
 require 'require_relative' if RUBY_VERSION < '1.9'
 
+require_relative '../lib/deltacloud/api.rb'
+
 ENV['RACK_ENV'] = 'test'
 
 if ENV['COVERAGE']
@@ -24,24 +26,26 @@ require 'time'
 # Since 'timecop' gem has broken 'timezone' support, this small monkey-patching
 # on Time object seems to fix this issue.
 
-class Time
-  module TimeMock
-    attr_accessor :mock_time
+unless Time.respond_to? :be
+  class Time
+    module TimeMock
+      attr_accessor :mock_time
 
-    def mock_now
-      @mock_time || Time.original_now
-    end
+      def mock_now
+        @mock_time || Time.original_now
+      end
 
-    def be(a_time)
-      @mock_time = Time.parse(a_time)
-    end
+      def be(a_time)
+        @mock_time = Time.parse(a_time)
+      end
 
-  end
+    end
 
-  class << self
-    include TimeMock
-    alias_method :original_now, :now
-    alias_method :now, :mock_now
+    class << self
+      include TimeMock
+      alias_method :original_now, :now
+      alias_method :now, :mock_now
+    end
   end
 end
 


Mime
View raw message