Module: RSpec

Defined in:
lib/rspec/matchers.rb,
lib/rspec/matchers/be.rb,
lib/rspec/matchers/eq.rb,
lib/rspec/expectations.rb,
lib/rspec/matchers/dsl.rb,
lib/rspec/matchers/eql.rb,
lib/rspec/matchers/has.rb,
lib/rspec/matchers/have.rb,
lib/rspec/matchers/cover.rb,
lib/rspec/matchers/equal.rb,
lib/rspec/matchers/exist.rb,
lib/rspec/matchers/match.rb,
lib/rspec/matchers/change.rb,
lib/rspec/matchers/errors.rb,
lib/rspec/matchers/pretty.rb,
lib/rspec/matchers/include.rb,
lib/rspec/matchers/matcher.rb,
lib/rspec/matchers/satisfy.rb,
lib/rspec/matchers/be_close.rb,
lib/rspec/matchers/be_within.rb,
lib/rspec/expectations/differ.rb,
lib/rspec/expectations/errors.rb,
lib/rspec/matchers/be_kind_of.rb,
lib/rspec/matchers/respond_to.rb,
lib/rspec/expectations/handler.rb,
lib/rspec/expectations/version.rb,
lib/rspec/matchers/match_array.rb,
lib/rspec/matchers/raise_error.rb,
lib/rspec/matchers/throw_symbol.rb,
lib/rspec/expectations/fail_with.rb,
lib/rspec/matchers/block_aliases.rb,
lib/rspec/matchers/be_instance_of.rb,
lib/rspec/matchers/method_missing.rb,
lib/rspec/expectations/deprecation.rb,
lib/rspec/matchers/operator_matcher.rb,
lib/rspec/expectations/extensions/object.rb,
lib/rspec/matchers/generated_descriptions.rb,
lib/rspec/matchers/extensions/instance_eval_with_args.rb

Defined Under Namespace

Modules: Expectations, Matchers

Class Method Summary collapse

Class Method Details

.deprecate(method, alternate_method = nil, version = nil) ⇒ Object

Used internally by RSpec to display standard deprecation warnings. This is also defined in rspec-core, but we can’t assume it’s loaded since rspec-expectations should be usable w/o rspec-core.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rspec/expectations/deprecation.rb', line 7

def deprecate(method, alternate_method=nil, version=nil)
  version_string = version ? "rspec-#{version}" : "a future version of RSpec"

  message = <<-NOTICE

*****************************************************************
DEPRECATION WARNING: you are using deprecated behaviour that will
be removed from #{version_string}.

#{caller(0)[2]}

* #{method} is deprecated.
NOTICE
if alternate_method
  message << <<-ADDITIONAL
* please use #{alternate_method} instead.
ADDITIONAL
end

  message << "*****************************************************************"
  warn_deprecation(message)
end

.warn_deprecation(message) ⇒ Object

Used internally by RSpec to display custom deprecation warnings. This is also defined in rspec-core, but we can’t assume it’s loaded since rspec-expectations should be usable w/o rspec-core.



33
34
35
# File 'lib/rspec/expectations/deprecation.rb', line 33

def warn_deprecation(message)
  send :warn, message
end