Module: RSpec::Core::ConstMissing

Defined in:
lib/rspec/core/backward_compatibility.rb

Instance Method Summary collapse

Instance Method Details

#const_missing(name) ⇒ Object

Used to print deprecation warnings for Rspec and Spec constants (use RSpec instead)



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

def const_missing(name)
  case name
  when :Rspec, :Spec
    RSpec.warn_deprecation <<-WARNING
*****************************************************************
DEPRECATION WARNING: you are using a deprecated constant that will
be removed from a future version of RSpec.

#{caller(0)[2]}

* #{name} is deprecated.
* RSpec is the new top-level module in RSpec-2
*****************************************************************
WARNING
    RSpec
  else
    begin
      super
    rescue Exception => e
      e.backtrace.reject! {|l| l =~ Regexp.compile(__FILE__) }
      raise e
    end
  end
end