Sha256: 5ac26e3e3d2f389a3cd0369b8abb8a27a9f4e73988ae5400c464e61714a41894
Contents?: true
Size: 1.03 KB
Versions: 6
Compression:
Stored size: 1.03 KB
Contents
require 'dm-core/core_ext/object' describe Object do before :all do Object.send(:remove_const, :HactiveSupport) if defined?(HactiveSupport) module ::HactiveSupport class MemoizeConsideredUseless; end end Object.send(:remove_const, :Foo) if defined?(Foo) module ::Foo class Bar; end end Object.send(:remove_const, :Oi) if defined?(Oi) class ::Oi attr_accessor :foo end end describe "#full_const_get" do it 'returns constant by FQ name in receiver namespace' do Object.full_const_get("Oi").should == Oi Object.full_const_get("Foo::Bar").should == Foo::Bar end end describe "#full_const_set" do it 'sets constant value by FQ name in receiver namespace' do Object.full_const_set("HactiveSupport::MCU", HactiveSupport::MemoizeConsideredUseless) Object.full_const_get("HactiveSupport::MCU").should == HactiveSupport::MemoizeConsideredUseless HactiveSupport.full_const_get("MCU").should == HactiveSupport::MemoizeConsideredUseless end end end
Version data entries
6 entries across 6 versions & 1 rubygems