deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [17/50] [abbrv] git commit: Core: Moved rack-test helpers to test_helper
Date Mon, 30 Jul 2012 14:29:17 GMT
Core: Moved rack-test helpers to test_helper

The rack-test helpers are now shared with EC2
frontend tests. To avoid code duplication test_helper
will be better place for them.


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

Branch: refs/heads/master
Commit: 020dde0177b7224bf83f83b0a81b6f62b5be207d
Parents: bf3a2f4
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Jul 26 16:18:21 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Fri Jul 27 14:24:58 2012 +0200

----------------------------------------------------------------------
 server/tests/deltacloud/common.rb |   16 ++--------------
 server/tests/test_helper.rb       |   12 ++++++++++++
 2 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/020dde01/server/tests/deltacloud/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/common.rb b/server/tests/deltacloud/common.rb
index 728ad57..d2f59e5 100644
--- a/server/tests/deltacloud/common.rb
+++ b/server/tests/deltacloud/common.rb
@@ -1,22 +1,8 @@
-require 'logger'
-require 'rack/test'
-require 'nokogiri'
-
 require_relative File.join('..', '..', 'lib', 'deltacloud_rack.rb')
 
-include Rack::Test::Methods
-
-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 root_url; Deltacloud.config[:deltacloud].root_url; end
-def formats; [ 'application/xml', 'application/json', 'text/html' ]; end
-
 # Set the default driver used for server API tests
 #
 ENV['API_DRIVER'] = 'mock'
-ENV['RACK_ENV']   = 'test'
 
 # Setup Deltacloud::API Sinatra instance
 #
@@ -30,3 +16,5 @@ unless Deltacloud::config[:deltacloud]
 
   Deltacloud.require_frontend!
 end
+
+def root_url; Deltacloud.config[:deltacloud].root_url; end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/020dde01/server/tests/test_helper.rb
----------------------------------------------------------------------
diff --git a/server/tests/test_helper.rb b/server/tests/test_helper.rb
index f97f570..5cb2b4b 100644
--- a/server/tests/test_helper.rb
+++ b/server/tests/test_helper.rb
@@ -1,3 +1,7 @@
+require 'rubygems'
+require 'logger'
+require 'rack/test'
+require 'nokogiri'
 require 'pp'
 require 'require_relative'
 
@@ -47,3 +51,11 @@ def record_retries(name='')
     }
   }
 end
+
+include Rack::Test::Methods
+
+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 formats; [ 'application/xml', 'application/json', 'text/html' ]; end


Mime
View raw message