Sha256: 2add6589978c950e3e378b58ee3621c6081d986b670ab9c6a89706b47d0bfa1d

Contents?: true

Size: 676 Bytes

Versions: 59

Compression:

Stored size: 676 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../fixtures/constants', __FILE__)

describe "Module#const_missing" do
  it "is called when an undefined constant is referenced via literal form" do
    ConstantSpecs::ClassA::CS_CONSTX.should == :CS_CONSTX
  end

  it "is called when an undefined constant is referenced via #const_get" do
    ConstantSpecs::ClassA.const_get(:CS_CONSTX).should == :CS_CONSTX
  end

  it "raises NameError and includes the name of the value that wasn't found" do
    lambda {
      ConstantSpecs.const_missing("HelloMissing")
    }.should raise_error(NameError, /ConstantSpecs::HelloMissing/)
  end
end

Version data entries

59 entries across 59 versions & 3 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/core/module/const_missing_spec.rb
opal-0.4.4 spec/rubyspec/core/module/const_missing_spec.rb
opal-0.4.3 spec/rubyspec/core/module/const_missing_spec.rb
opal-0.4.2 spec/rubyspec/core/module/const_missing_spec.rb