lib/rspec/expectations/syntax.rb in rspec-expectations-2.11.2 vs lib/rspec/expectations/syntax.rb in rspec-expectations-2.11.3

- old
+ new

@@ -55,10 +55,12 @@ def should_not(matcher=nil, message=nil, &block) ::RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block) end end + + ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if expect_enabled? end # @api private # Disables the `should` syntax. def disable_should(syntax_host = default_should_host) @@ -66,10 +68,12 @@ syntax_host.module_eval do undef should undef should_not end + + ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should end # @api private # Enables the `expect` syntax. def enable_expect(syntax_host = ::RSpec::Matchers) @@ -80,19 +84,23 @@ target << target_block if block_given? raise ArgumentError.new("You must pass an argument or a block to #expect but not both.") unless target.size == 1 ::RSpec::Expectations::ExpectationTarget.new(target.first) end end + + ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if should_enabled? end # @api private # Disables the `expect` syntax. def disable_expect(syntax_host = ::RSpec::Matchers) return unless expect_enabled?(syntax_host) syntax_host.module_eval do undef expect end + + ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should end # @api private # Indicates whether or not the `should` syntax is enabled. def should_enabled?(syntax_host = default_should_host)