public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Require Mocha >= 0.9.3 which includes a MiniTest adapter
jeremy (author)
Sun Nov 23 14:48:36 -0800 2008
commit  e931012287df0bca83cae04d95c2e0835ae08758
tree    46af916792dbd3a74883b4e1b572dd432cee4a59
parent  5d3712a81e502f46b2745d238d9bb76fcdb31f5b
...
8
9
10
11
 
12
13
14
...
8
9
10
 
11
12
13
14
0
@@ -8,7 +8,7 @@ require 'yaml'
0
 require 'stringio'
0
 require 'test/unit'
0
 
0
-gem 'mocha', '>= 0.9.0'
0
+gem 'mocha', '>= 0.9.3'
0
 require 'mocha'
0
 
0
 begin
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 require 'rubygems'
0
 require 'test/unit'
0
 
0
-gem 'mocha', '>= 0.5.5'
0
+gem 'mocha', '>= 0.9.3'
0
 require 'mocha'
0
 
0
 require 'active_model'
...
1
2
3
4
5
6
7
8
 
9
10
11
12
13
14
15
16
17
18
19
 
 
 
 
 
 
20
21
22
...
 
 
 
 
 
 
1
 
2
3
 
 
 
 
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
0
@@ -1,22 +1,18 @@
0
-require 'test/unit/testcase'
0
-require 'active_support/testing/setup_and_teardown'
0
-require 'active_support/testing/assertions'
0
-require 'active_support/testing/deprecation'
0
-require 'active_support/testing/declarative'
0
-
0
 begin
0
-  gem 'mocha', '>= 0.9.0'
0
+  gem 'mocha', '>= 0.9.3'
0
   require 'mocha'
0
-
0
-  if defined?(MiniTest)
0
-    require 'active_support/testing/mocha_minitest_adapter'
0
-  end
0
 rescue LoadError
0
   # Fake Mocha::ExpectationError so we can rescue it in #run. Bleh.
0
   Object.const_set :Mocha, Module.new
0
   Mocha.const_set :ExpectationError, Class.new(StandardError)
0
 end
0
 
0
+require 'test/unit/testcase'
0
+require 'active_support/testing/setup_and_teardown'
0
+require 'active_support/testing/assertions'
0
+require 'active_support/testing/deprecation'
0
+require 'active_support/testing/declarative'
0
+
0
 module ActiveSupport
0
   class TestCase < ::Test::Unit::TestCase
0
     if defined? MiniTest
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 require 'rubygems'
0
 require 'test/unit'
0
-gem 'mocha', '>= 0.9.0'
0
+gem 'mocha', '>= 0.9.3'
0
 require 'mocha'
0
 
0
 $:.unshift "#{File.dirname(__FILE__)}/../lib"
...
3
4
5
 
6
 
 
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
3
4
5
6
7
8
9
10
11
12
 
13
 
 
 
14
 
 
15
16
17
0
@@ -3,18 +3,15 @@ $:.unshift File.dirname(__FILE__) + "/../../actionpack/lib"
0
 $:.unshift File.dirname(__FILE__) + "/../lib"
0
 $:.unshift File.dirname(__FILE__) + "/../builtin/rails_info"
0
 
0
+require 'rubygems'
0
 require 'test/unit'
0
+gem 'mocha', '>= 0.9.3'
0
+require 'mocha'
0
 require 'stringio'
0
 require 'active_support'
0
 
0
-# Wrap tests that use Mocha and skip if unavailable.
0
 def uses_mocha(test_name)
0
-  require 'rubygems'
0
-  gem 'mocha', '>= 0.5.5'
0
-  require 'mocha'
0
   yield
0
-rescue LoadError
0
-  $stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
0
 end
0
 
0
 if defined?(RAILS_ROOT)

Comments

brh Sun Nov 23 23:33:41 -0800 2008

Is mocha 0.9.3 even out yet? Rubyforge says the latest is 0.9.2.

floehopper Tue Nov 25 13:47:07 -0800 2008

Do you need me to release current Mocha HEAD as 0.9.3; or is this a typo; or are you expecting other changes in Mocha 0.9.3?

jeremy Tue Nov 25 13:59:31 -0800 2008

If you’re ready for 0.9.3, by all means :)

Otherwise, this is just saying that edge Rails needs the next release of Mocha for MiniTest compatibility.

mattbauer Mon Dec 15 12:39:34 -0800 2008

Won’t this code in test_case.rb cause a problem when the mocha gem is localized? In that case, the require ‘mocha’ statement will never be reached . I think this code snippet in test_case.rb


begin
  gem 'mocha', '>= 0.9.3'
  require 'mocha'
rescue LoadError
  # Fake Mocha::ExpectationError so we can rescue it in #run. Bleh.
  Object.const_set :Mocha, Module.new
  Mocha.const_set :ExpectationError, Class.new(StandardError)
end

Should be change to:


begin
  gem 'mocha', '>= 0.9.3'
rescue LoadError
ensure
  require 'mocha'
end

unless Object.const_defined?(:Mocha)
  # Fake Mocha::ExpectationError so we can rescue it in #run. Bleh.
  Object.const_set :Mocha, Module.new
  Mocha.const_set :ExpectationError, Class.new(StandardError)
end

jeremy Mon Dec 15 13:16:07 -0800 2008

Sure, could you work up a patch and post to lighthouse?