Permalink
Browse files

clean const_missing backtrace

  • Loading branch information...
1 parent aaf14d0 commit 277629e76f6832e6bbc638e3ddea60cdddd733bc @dchelimsky dchelimsky committed Mar 29, 2011
Showing with 27 additions and 1 deletion.
  1. +27 −1 lib/rspec/expectations/backward_compatibility.rb
@@ -3,7 +3,33 @@ module RSpec
module Expectations
module ConstMissing
def const_missing(name)
- name == :Rspec ? RSpec : super(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
+ while e.backtrace.first !~ Regexp.compile(__FILE__)
+ e.backtrace.shift
+ end
+ while e.backtrace.first =~ Regexp.compile(__FILE__)
+ e.backtrace.shift
+ end
+ raise e
+ end
+ end
end
end

0 comments on commit 277629e

Please sign in to comment.