Beef up tests for when rspec-expectations is not available.
Created by: myronmarston
Specifically, in #1826, we changed the conditional for whether or not to assign a generated description from RSpec::Matchers for examples with no doc string. Before #1826, the conditional was:
assign_generated_description if RSpec.configuration.expecting_with_rspec?
In #1826 it changed to:
assign_generated_description if defined?(::RSpec::Matchers)
We didn’t update the spec meant for that case to match, but it continued to pass (as a false positive) due to rspec/rspec-mocks#874. @samphippen’s fix in rspec/rspec-mocks#884 surfaced the issue (as the spec now failed) so I decided to improve the tests.
- The spec now simulates the
RSpec::Matchers
constant being undefined to simulate the correct condition. We also have to prevent it from being autoloaded. - The cukes for minitest/test-unit did not sufficiently cover this case,
because the aforementioned autoload would autoload RSpec::Matchers,
so we have to simulate rspec-expectations being completely uninstalled.
Then the cukes properly fail if we break the
if defined?(::RSpec::Matchers)
conditional.
@samphippen -- this is a better solution to what you were trying to solve in #1873.