webrat/test/helper.rb

40 lines
932 B
Ruby
Raw Normal View History

2008-03-02 20:14:52 +00:00
require "rubygems"
require "test/unit"
2008-04-18 12:19:13 +00:00
require "mocha"
2008-03-02 20:14:52 +00:00
# gem install redgreen for colored test output
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
2008-04-18 12:19:13 +00:00
if ENV["TEST_MODE"] == "rails"
require "active_support"
silence_warnings do
require "action_controller"
require "action_controller/integration"
end
2008-04-04 13:19:14 +00:00
2008-04-18 12:19:13 +00:00
class ActionController::Integration::Session
def flunk(message)
raise message
end
end
elsif ENV["TEST_MODE"] == "merb"
require 'merb-core'
require 'merb_stories'
#require 'spec' #makes mocha cry
module Merb
module Test
class RspecStory
include Merb::Test::ControllerHelper
include Merb::Test::RouteHelper
include Merb::Test::ViewHelper
end
end
end
else
raise "Please set the environment variable TEST_MODE to either 'rails' or 'merb'."
2008-04-04 13:19:14 +00:00
end
2008-03-02 20:14:52 +00:00
require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat")