aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/plugins/rspec/lib/spec/interop
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/plugins/rspec/lib/spec/interop')
-rw-r--r--vendor/plugins/rspec/lib/spec/interop/test.rb32
-rw-r--r--vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb45
-rw-r--r--vendor/plugins/rspec/lib/spec/interop/test/unit/testresult.rb2
-rw-r--r--vendor/plugins/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb2
4 files changed, 54 insertions, 27 deletions
diff --git a/vendor/plugins/rspec/lib/spec/interop/test.rb b/vendor/plugins/rspec/lib/spec/interop/test.rb
index afa16137b..284eb32ce 100644
--- a/vendor/plugins/rspec/lib/spec/interop/test.rb
+++ b/vendor/plugins/rspec/lib/spec/interop/test.rb
@@ -1,4 +1,36 @@
+require 'spec'
+
+if Spec::Ruby.version.to_f >= 1.9
+ gem 'test-unit','= 1.2.3'
+end
+
require 'test/unit'
+
+if Spec::Ruby.version.to_f >= 1.9
+ require 'test/unit/version'
+ if Test::Unit::VERSION > '1.2.3'
+ raise <<-MESSAGE
+#{'*' * 50}
+Required: test-unit-1.2.3
+Loaded: test-unit-#{Test::Unit::VERSION}
+
+With ruby-1.9, rspec-#{Spec::VERSION::STRING} requires test-unit-1.2.3, and
+tries to force it with "gem 'test-unit', '= 1.2.3'" in:
+
+ #{__FILE__}
+
+Unfortunately, test-unit-#{Test::Unit::VERSION} was loaded anyway. While we are
+aware of this bug we have not been able to track down its source.
+Until we do, you have two alternatives:
+
+* uninstall test-unit-2.0.3
+* use 'script/spec' instead of 'rake spec'
+#{'*' * 50}
+MESSAGE
+ end
+end
+
+
require 'test/unit/testresult'
require 'spec/interop/test/unit/testcase'
diff --git a/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb b/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
index b32a820c1..dc10a2a64 100644
--- a/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
+++ b/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
@@ -5,8 +5,7 @@ module Test
# This extension of the standard Test::Unit::TestCase makes RSpec
# available from within, so that you can do things like:
#
- # require 'test/unit'
- # require 'spec'
+ # require 'spec/test/unit'
#
# class MyTest < Test::Unit::TestCase
# it "should work with Test::Unit assertions" do
@@ -23,39 +22,35 @@ module Test
extend Spec::Example::ExampleGroupMethods
include Spec::Example::ExampleMethods
- before(:each) {setup}
- after(:each) {teardown}
+ def self.suite
+ Test::Unit::TestSuiteAdapter.new(self)
+ end
- class << self
- def suite
- Test::Unit::TestSuiteAdapter.new(self)
- end
-
- def example_method?(method_name)
- should_method?(method_name) || test_method?(method_name)
- end
-
- def test_method?(method_name)
- method_name =~ /^test[_A-Z]./ && (
- instance_method(method_name).arity == 0 ||
- instance_method(method_name).arity == -1
- )
- end
+ def self.example_method?(method_name)
+ should_method?(method_name) || test_method?(method_name)
end
- def initialize(defined_description, &implementation)
- @_defined_description = defined_description
- @_implementation = implementation
+ def self.test_method?(method_name)
+ method_name =~ /^test./ && (
+ instance_method(method_name).arity == 0 ||
+ instance_method(method_name).arity == -1
+ )
+ end
- @_result = ::Test::Unit::TestResult.new
- # @method_name is important to set here because it "complies" with Test::Unit's interface.
+ before(:each) {setup}
+ after(:each) {teardown}
+
+ def initialize(description, &implementation)
+ super
# Some Test::Unit extensions depend on @method_name being present.
- @method_name = @_defined_description
+ @method_name = description.description
+ @_result = ::Test::Unit::TestResult.new
end
def run(ignore_this_argument=nil)
super()
end
+
end
end
end
diff --git a/vendor/plugins/rspec/lib/spec/interop/test/unit/testresult.rb b/vendor/plugins/rspec/lib/spec/interop/test/unit/testresult.rb
index 1386dc728..dddcfe868 100644
--- a/vendor/plugins/rspec/lib/spec/interop/test/unit/testresult.rb
+++ b/vendor/plugins/rspec/lib/spec/interop/test/unit/testresult.rb
@@ -1,6 +1,6 @@
class Test::Unit::TestResult
alias_method :tu_passed?, :passed?
def passed?
- return tu_passed? & ::Spec.run
+ return tu_passed? & ::Spec::Runner.run
end
end \ No newline at end of file
diff --git a/vendor/plugins/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb b/vendor/plugins/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb
index 7c0ed092d..912762f18 100644
--- a/vendor/plugins/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb
+++ b/vendor/plugins/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb
@@ -14,7 +14,7 @@ module Test
def run(*args)
return true unless args.empty?
- example_group.run
+ example_group.run(Spec::Runner.options)
end
def size