1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
require 'spec_helper'
shared_examples_for "a well-behaved method_missing hook" do
include TestUnitIntegrationSupport
it "raises a NoMethodError (and not SystemStackError) for an undefined method" do
with_test_unit_loaded do
expect { subject.some_undefined_method }.to raise_error(NoMethodError)
end
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.allocate }
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.allocate }
it_behaves_like "a well-behaved method_missing hook"
end
end
|