From d1c58811ae1e0f83e4f17805298095c6eed2641c Mon Sep 17 00:00:00 2001 From: Ryan McGeary Date: Wed, 11 May 2011 20:31:04 -0400 Subject: [PATCH] Added explicit dependency on test-unit for better Ruby 1.9 support This will likely be a temporary solution before fully embracing Minitest --- lib/shoulda/context/context.rb | 4 ++-- shoulda-context.gemspec | 1 + test/shoulda/context_test.rb | 16 ++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/shoulda/context/context.rb b/lib/shoulda/context/context.rb index b255ff68..391dd507 100644 --- a/lib/shoulda/context/context.rb +++ b/lib/shoulda/context/context.rb @@ -73,7 +73,7 @@ def should(name_or_matcher, options = {}, &blk) if Shoulda::Context.current_context Shoulda::Context.current_context.should(name_or_matcher, options, &blk) else - context_name = self.name.gsub(/Test/, "") + context_name = self.name.gsub(/Test/, "") if self.name context = Shoulda::Context::Context.new(context_name, self) do should(name_or_matcher, options, &blk) end @@ -92,7 +92,7 @@ def should_not(matcher) if Shoulda::Context.current_context Shoulda::Context.current_context.should_not(matcher) else - context_name = self.name.gsub(/Test/, "") + context_name = self.name.gsub(/Test/, "") if self.name context = Shoulda::Context::Context.new(context_name, self) do should_not(matcher) end diff --git a/shoulda-context.gemspec b/shoulda-context.gemspec index fe5aa94e..765cb676 100644 --- a/shoulda-context.gemspec +++ b/shoulda-context.gemspec @@ -22,6 +22,7 @@ Gem::Specification.new do |s| s.add_development_dependency "mocha", "~> 0.9.10" s.add_development_dependency "rake" + s.add_development_dependency "test-unit", "~> 2.0" if s.respond_to? :specification_version then s.specification_version = 3 diff --git a/test/shoulda/context_test.rb b/test/shoulda/context_test.rb index 23cd43fd..191572cd 100644 --- a/test/shoulda/context_test.rb +++ b/test/shoulda/context_test.rb @@ -209,8 +209,8 @@ def negative_failure_message end end - def run_test - @test_suite.run(@test_result) { |event, name |} + def run_test_suite + @test_suite.run(@test_result) { |event, name| } end def setup @@ -249,19 +249,19 @@ def self.should_use_positive_matcher should "pass with a passing matcher" do @matcher.fail = false - run_test + run_test_suite assert_passed @test_result end should "fail with a failing matcher" do @matcher.fail = true - run_test + run_test_suite assert_failed_with @matcher.failure_message, @test_result end should "provide the subject" do @matcher.fail = false - run_test + run_test_suite assert_equal 'a subject', @matcher.subject end end @@ -273,19 +273,19 @@ def self.should_use_negative_matcher should "pass with a failing matcher" do @matcher.fail = true - run_test + run_test_suite assert_passed @test_result end should "fail with a passing matcher" do @matcher.fail = false - run_test + run_test_suite assert_failed_with @matcher.negative_failure_message, @test_result end should "provide the subject" do @matcher.fail = false - run_test + run_test_suite assert_equal 'a subject', @matcher.subject end end