mirror of
https://github.com/github/rails.git
synced 2026-02-07 04:35:20 -05:00
Wrap and skip tests using mocha.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5926 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -14,3 +14,13 @@ ActiveSupport::Deprecation.debug = true
|
||||
ActionController::Base.logger = nil
|
||||
ActionController::Base.ignore_missing_templates = false
|
||||
ActionController::Routing::Routes.reload rescue nil
|
||||
|
||||
|
||||
# Wrap tests that use Mocha and skip if unavailable.
|
||||
def uses_mocha(test_name)
|
||||
require 'mocha'
|
||||
require 'stubba'
|
||||
yield
|
||||
rescue LoadError
|
||||
$stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
|
||||
end
|
||||
|
||||
@@ -3,9 +3,7 @@ require File.dirname(__FILE__) + '/../abstract_unit'
|
||||
$:.unshift File.dirname(__FILE__) + '/../../../railties/lib'
|
||||
require 'action_controller/integration'
|
||||
|
||||
begin # rescue LoadError
|
||||
require 'mocha'
|
||||
require 'stubba'
|
||||
uses_mocha 'integration' do
|
||||
|
||||
# Stub process for testing.
|
||||
module ActionController
|
||||
@@ -149,6 +147,4 @@ end
|
||||
# class MockCGITest < Test::Unit::TestCase
|
||||
# end
|
||||
|
||||
rescue LoadError
|
||||
$stderr.puts "Skipping integration tests. `gem install mocha` and try again."
|
||||
end
|
||||
end # uses_mocha
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
require File.dirname(__FILE__) + '/../abstract_unit'
|
||||
|
||||
# gem install mocha
|
||||
require 'mocha'
|
||||
uses_mocha 'rescue' do
|
||||
|
||||
class RescueController < ActionController::Base
|
||||
def raises
|
||||
@@ -210,3 +209,5 @@ class RescueTest < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end # uses_mocha
|
||||
|
||||
Reference in New Issue
Block a user