Sha256: ce39965de987f21890d71e51cc95e07cbd8de035bd85ece374f4e31742cb9445
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
require_relative '../spec_helper' require 'dm-core/support/ext/object' describe DataMapper::Ext::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 expect(DataMapper::Ext::Object.full_const_get('Oi')).to eq Oi expect(DataMapper::Ext::Object.full_const_get('Foo::Bar')).to eq Foo::Bar end end describe ".full_const_set" do it 'sets constant value by FQ name in receiver namespace' do DataMapper::Ext::Object.full_const_set("HactiveSupport::MCU", HactiveSupport::MemoizeConsideredUseless) expect(DataMapper::Ext::Object.full_const_get('HactiveSupport::MCU')).to eq HactiveSupport::MemoizeConsideredUseless expect(DataMapper::Ext::Object.full_const_get(HactiveSupport, 'MCU')).to eq HactiveSupport::MemoizeConsideredUseless end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sbf-dm-core-1.3.0 | spec/unit/object_spec.rb |
sbf-dm-core-1.3.0.beta | spec/unit/object_spec.rb |