test/test_vegas_runner.rb in vegas-0.1.8 vs test/test_vegas_runner.rb in vegas-0.1.9
- old
+ new
@@ -1,10 +1,10 @@
-require File.join('.', File.dirname(__FILE__), 'test_helper.rb')
+require 'test_helper'
Vegas::Runner.class_eval do
remove_const :ROOT_DIR
- ROOT_DIR = File.join(File.dirname(__FILE__), 'tmp', '.vegas')
+ Vegas::Runner::ROOT_DIR = File.join(File.dirname(__FILE__), 'tmp', '.vegas')
end
describe 'Vegas::Runner' do
before do
FileUtils.rm_rf(File.join(File.dirname(__FILE__), 'tmp'))
@@ -128,12 +128,16 @@
describe 'with a simple rack app' do
before do
vegas(RackApp1, 'rack_app_1', {:skip_launch => true, :sessions => true})
end
- it "sets default rack handler to thin" do
- @vegas.rack_handler.should == Rack::Handler::Thin
+ it "sets default rack handler to thin when in ruby and WEBrick when in jruby" do
+ if Vegas::JRUBY
+ @vegas.rack_handler.should == Rack::Handler::WEBrick
+ else
+ @vegas.rack_handler.should == Rack::Handler::Thin
+ end
end
end
describe 'with a launch path specified as a proc' do
it 'evaluates the proc in the context of the runner' do
@@ -155,9 +159,33 @@
["--debug", "blah"])
@vegas.options[:launch_path].should == "?search=blah"
end
end
+ describe 'without environment' do
+
+ Vegas::Runner::ROOT_DIR = nil
+
+ before do
+ @app_dir = './test/tmp'
+ end
+
+ it 'should be ok with --app-dir' do
+ vegas(RackApp1, 'rack_app_1', {:skip_launch => true, :app_dir => @app_dir})
+ @vegas.app_dir.should == @app_dir
+ end
+
+ it 'should raise an exception without --app-dir' do
+ success = false
+ begin
+ vegas(RackApp1, 'rack_app_1', {:skip_launch => true})
+ rescue ArgumentError
+ success = true
+ end
+ success.should == true
+ end
+
+ end
end
end