Basic test working
This commit is contained in:
parent
2e03051735
commit
a45d654bb8
@ -1,20 +1,39 @@
|
||||
require "rubygems"
|
||||
require "test/unit"
|
||||
# gem install redgreen for colored test output
|
||||
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
|
||||
require "mocha"
|
||||
|
||||
require "active_support"
|
||||
# gem install redgreen for colored test output
|
||||
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
|
||||
|
||||
if ENV["TEST_MODE"] == "rails"
|
||||
require "active_support"
|
||||
silence_warnings do
|
||||
require "action_controller"
|
||||
require "action_controller/integration"
|
||||
end
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat")
|
||||
|
||||
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'."
|
||||
end
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../lib/webrat")
|
||||
|
@ -5,12 +5,21 @@ RAILS_ROOT = "." unless defined?(RAILS_ROOT)
|
||||
class VisitsTest < Test::Unit::TestCase
|
||||
|
||||
def setup
|
||||
if ENV["TEST_MODE"] == "rails"
|
||||
@session = ActionController::Integration::Session.new
|
||||
@session.stubs(:assert_response)
|
||||
@session.stubs(:get_via_redirect)
|
||||
@response = mock
|
||||
@session.stubs(:response).returns(@response)
|
||||
@response.stubs(:body).returns("")
|
||||
elsif ENV["TEST_MODE"] == "merb"
|
||||
@session = Merb::Test::RspecStory.new
|
||||
@session.stubs(:assert_response)
|
||||
@session.stubs(:get_via_redirect)
|
||||
@response = mock
|
||||
@session.stubs(:response).returns(@response)
|
||||
@response.stubs(:body).returns("")
|
||||
end
|
||||
end
|
||||
|
||||
def test_should_use_get
|
||||
|
Loading…
Reference in New Issue
Block a user