All but 3 merb tests pass

This commit is contained in:
Gwyn Morfey 2008-04-18 13:37:03 +01:00
parent a45d654bb8
commit b9f6affa3f
9 changed files with 23 additions and 51 deletions

View File

@ -2,7 +2,7 @@ require File.dirname(__FILE__) + "/helper"
class ChecksTest < Test::Unit::TestCase class ChecksTest < Test::Unit::TestCase
def setup def setup
@session = ActionController::Integration::Session.new @session = test_session
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@session.stubs(:response).returns(@response=mock) @session.stubs(:response).returns(@response=mock)
@ -72,7 +72,7 @@ end
class UnchecksTest < Test::Unit::TestCase class UnchecksTest < Test::Unit::TestCase
def setup def setup
@session = ActionController::Integration::Session.new @session = test_session
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@session.stubs(:response).returns(@response=mock) @session.stubs(:response).returns(@response=mock)

View File

@ -3,7 +3,7 @@ require File.dirname(__FILE__) + "/helper"
class ChoosesTest < Test::Unit::TestCase class ChoosesTest < Test::Unit::TestCase
def setup def setup
@session = ActionController::Integration::Session.new @session = test_session
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@session.stubs(:response).returns(@response=mock) @session.stubs(:response).returns(@response=mock)

View File

@ -2,7 +2,7 @@ require File.dirname(__FILE__) + "/helper"
class ClicksButtonTest < Test::Unit::TestCase class ClicksButtonTest < Test::Unit::TestCase
def setup def setup
@session = ActionController::Integration::Session.new @session = test_session
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@page = Webrat::Page.new(@session) @page = Webrat::Page.new(@session)

View File

@ -2,7 +2,7 @@ require File.dirname(__FILE__) + "/helper"
class ClicksLinkTest < Test::Unit::TestCase class ClicksLinkTest < Test::Unit::TestCase
def setup def setup
@session = ActionController::Integration::Session.new @session = test_session
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@session.stubs(:response).returns(@response=mock) @session.stubs(:response).returns(@response=mock)

View File

@ -2,7 +2,7 @@ require File.dirname(__FILE__) + "/helper"
class FillsInTest < Test::Unit::TestCase class FillsInTest < Test::Unit::TestCase
def setup def setup
@session = ActionController::Integration::Session.new @session = test_session
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@session.stubs(:response).returns(@response=mock) @session.stubs(:response).returns(@response=mock)

View File

@ -5,35 +5,16 @@ require "mocha"
# gem install redgreen for colored test output # gem install redgreen for colored test output
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
if ENV["TEST_MODE"] == "rails" if ["rails","merb"].include?(ENV["TEST_MODE"])
require "active_support" require File.join(File.dirname(__FILE__), "helper_#{ENV["TEST_MODE"]}.rb")
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 else
raise "Please set the environment variable TEST_MODE to either 'rails' or 'merb'." 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")
def test_session
return ActionController::Integration::Session.new if ENV["TEST_MODE"] == "rails"
return Merb::Test::RspecStory.new if ENV["TEST_MODE"] == "merb"
raise "Unknown test type #{ENV["TEST_MODE"]}"
end

View File

@ -5,7 +5,7 @@ RAILS_ROOT = "." unless defined?(RAILS_ROOT)
class ReloadsTest < Test::Unit::TestCase class ReloadsTest < Test::Unit::TestCase
def setup def setup
@session = ActionController::Integration::Session.new @session = test_session
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@response = mock @response = mock

View File

@ -2,7 +2,7 @@ require File.dirname(__FILE__) + "/helper"
class SelectsTest < Test::Unit::TestCase class SelectsTest < Test::Unit::TestCase
def setup def setup
@session = ActionController::Integration::Session.new @session = test_session
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@session.stubs(:response).returns(@response=mock) @session.stubs(:response).returns(@response=mock)

View File

@ -5,21 +5,12 @@ RAILS_ROOT = "." unless defined?(RAILS_ROOT)
class VisitsTest < Test::Unit::TestCase class VisitsTest < Test::Unit::TestCase
def setup def setup
if ENV["TEST_MODE"] == "rails" @session = test_session
@session = ActionController::Integration::Session.new
@session.stubs(:assert_response) @session.stubs(:assert_response)
@session.stubs(:get_via_redirect) @session.stubs(:get_via_redirect)
@response = mock @response = mock
@session.stubs(:response).returns(@response) @session.stubs(:response).returns(@response)
@response.stubs(:body).returns("") @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