deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 3/4] Mock: Removed unnecessary code in Cucumber environment file
Date Mon, 23 Jan 2012 11:23:21 GMT
From: Michal Fojtik <mfojtik@redhat.com>

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 tests/mock/support/env.rb |   44 +++++++++++---------------------------------
 1 files changed, 11 insertions(+), 33 deletions(-)

diff --git a/tests/mock/support/env.rb b/tests/mock/support/env.rb
index 5843811..5f97b89 100644
--- a/tests/mock/support/env.rb
+++ b/tests/mock/support/env.rb
@@ -1,48 +1,26 @@
-SERVER_DIR = File::expand_path(File::join(File::dirname(__FILE__), "../../../server"))
+require 'rubygems'
+require 'nokogiri'
 
+SERVER_DIR = File::expand_path(File::join(File::dirname(__FILE__), "../../../server"))
 $top_srcdir = SERVER_DIR
 $:.unshift File::join($top_srcdir, 'lib')
+Dir.chdir(SERVER_DIR)
 
 ENV['API_DRIVER'] = 'mock'
+ENV.delete('API_VERBOSE')
+load File.join($top_srcdir, 'lib', 'deltacloud', 'server.rb')
 
-Dir.chdir(SERVER_DIR)
-require 'rubygems'
-require 'nokogiri'
-require 'deltacloud/server'
 require 'rack/test'
 
-Sinatra::Application.set :environment, :test
-Sinatra::Application.set :root, SERVER_DIR
-
 CONFIG = {
   :username => 'mockuser',
   :password => 'mockpassword'
 }
 
-ENV['RACK_ENV']     = 'test'
-
-World do
-
-  include Rack::Test::Methods
-
-  def app
-    @app = Rack::Builder.new do
-      set :environment => :test
-      set :loggining => true
-      set :raise_errors => true
-      set :show_exceptions => true
-      run Sinatra::Application
-    end
-  end
-
-  def output_xml
-    Nokogiri::XML(last_response.body)
-  end
-
-  Before do
-    unless @no_header
-      header 'Accept', 'application/xml'
-    end
-  end
+def output_xml
+  Nokogiri::XML(last_response.body)
+end
 
+def app
+  Sinatra::Application
 end
-- 
1.7.4.4


Mime
View raw message