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