Skip to content

Commit

Permalink
Added explicit dependency on test-unit for better Ruby 1.9 support
Browse files Browse the repository at this point in the history
This will likely be a temporary solution before fully embracing Minitest
  • Loading branch information
rmm5t authored and Jason Morrison committed Nov 2, 2011
1 parent 20b4bf3 commit d1c5881
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/shoulda/context/context.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions shoulda-context.gemspec
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions test/shoulda/context_test.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d1c5881

Please sign in to comment.