-
-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inclusion order of RSpec::Matchers in Test::Unit and MiniTest.
Due to a bug in ruby 1.9, RSpec::Matchers must be included in the superclass (MiniTest::Unit::TestCase) before it is included in a subclass (Test::Unit::TestCase) or we may get infinite recursion and a SystemStackError from our `super` call in our method_missing hook. See this gist for more info about the ruby 1.9 bug: https://gist.github.com/845896 Closes #67.
- Loading branch information
1 parent
0a29866
commit 790a849
Showing
5 changed files
with
42 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'spec_helper' | ||
|
||
shared_examples_for "a well-behaved method_missing hook" do | ||
it "raises a NoMethodError (and not SystemStackError) for an undefined method" do | ||
expect { subject.some_undefined_method }.to raise_error(NoMethodError) | ||
end | ||
end | ||
|
||
describe "RSpec::Matchers method_missing hook" do | ||
subject { self } | ||
it_behaves_like "a well-behaved method_missing hook" | ||
|
||
context 'when invoked in a Test::Unit::TestCase' do | ||
subject { Test::Unit::TestCase.new } | ||
it_behaves_like "a well-behaved method_missing hook" | ||
end | ||
|
||
context 'when invoked in a MiniTest::Unit::TestCase', :if => defined?(MiniTest) do | ||
subject { MiniTest::Unit::TestCase.new(nil) } | ||
it_behaves_like "a well-behaved method_missing hook" | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters