Add new spec for deprecate_class!


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668923 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/spec/deprecation_spec.rb b/lib/rb/spec/deprecation_spec.rb
index bec299c..cb462b4 100644
--- a/lib/rb/spec/deprecation_spec.rb
+++ b/lib/rb/spec/deprecation_spec.rb
@@ -176,8 +176,26 @@
         end
       end
       deprecate_class! :DeprecationSpecOldClass => klass
-      DeprecationSpecOldClass.should eql(klass)
-      DeprecationSpecOldClass.new.foo.should == "foo"
+      ::DeprecationSpecOldClass.should eql(klass)
+      ::DeprecationSpecOldClass.new.foo.should == "foo"
+    ensure
+      Object.send :remove_const, :DeprecationSpecOldClass if Object.const_defined? :DeprecationSpecOldClass
+    end
+  end
+
+  it "should create a global constant even from inside a module" do
+    begin
+      klass = nil #define scoping
+      mod = Module.new do
+        klass = Class.new do
+          def foo
+            "foo"
+          end
+        end
+        deprecate_class! :DeprecationSpecOldClass => klass
+      end
+      ::DeprecationSpecOldClass.should eql(klass)
+      ::DeprecationSpecOldClass.new.foo.should == "foo"
     ensure
       Object.send :remove_const, :DeprecationSpecOldClass if Object.const_defined? :DeprecationSpecOldClass
     end