test/test_helper.rb in vegas-0.1.7 vs test/test_helper.rb in vegas-0.1.8
- old
+ new
@@ -10,36 +10,36 @@
rescue LoadError
require 'rubygems'
dependencies.each {|f| require f }
end
-require File.join(File.dirname(__FILE__), '..', 'lib', 'vegas.rb')
-require File.join(File.dirname(__FILE__), 'apps.rb')
+require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'vegas.rb')
+require File.join(File.expand_path(File.dirname(__FILE__)), 'apps.rb')
module TestHelper
-
+
def vegas(*args, &block)
Vegas::Runner.any_instance.stubs(:daemonize!).once
Rack::Handler::Thin.stubs(:run).once
@vegas = Vegas::Runner.new(*args, &block)
end
-
+
def body
last_response.body.to_s
end
def instance_of(klass)
lambda {|obj| obj.is_a?(klass) }
end
-
+
def exist_as_file
lambda {|obj| File.exist?(obj) }
end
-
+
def have_matching_file_content(content_regex)
- lambda {|obj|
- File.exist?(obj) && File.read(obj).match(content_regex)
+ lambda {|obj|
+ File.exist?(obj) && File.read(obj).match(content_regex)
}
end
def html_body
body =~ /^\<html/ ? body : "<html><body>#{body}</body></html>"