Sha256: e350df2e250d1f1bb78b9c33c81d3a6dc66c4f932fae542fa63730542225be5e
Contents?: true
Size: 912 Bytes
Versions: 9
Compression:
Stored size: 912 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe Utils, '.const_get' do subject { described_class.const_get(name) } context "with a toplevel constant" do context "given as String" do let(:name) { 'Substation' } it { should == Substation } end context "given as Symbol" do let(:name) { :Substation } it { should == Substation } end end context "with a FQN toplevel constant" do let(:name) { '::Substation' } it { should == Substation } end context "with a nested constant" do let(:name) { 'Substation::Request' } it { should == Substation::Request } end context "with a non-existant nested constant" do let(:name) { 'Substation::Foo' } before do Substation.should_receive(:const_missing).with('Foo').and_raise(NameError) end specify do expect { subject }.to raise_error(NameError) end end end
Version data entries
9 entries across 9 versions & 1 rubygems