Sha256: b2a1a1db7b6debaad97087c28a4b24f8aedab8e0a066c41592695016db9c5ca5

Contents?: true

Size: 908 Bytes

Versions: 43

Compression:

Stored size: 908 Bytes

Contents

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

describe "Module#remove_const" do
  it "removes the constant specified by a String or Symbol from the receiver's constant table" do
    ConstantSpecs::ModuleM::CS_CONST252 = :const252
    ConstantSpecs::ModuleM::CS_CONST252.should == :const252

    ConstantSpecs::ModuleM.send :remove_const, :CS_CONST252
    lambda { ConstantSpecs::ModuleM::CS_CONST252 }.should raise_error(NameError)

    ConstantSpecs::ModuleM::CS_CONST253 = :const253
    ConstantSpecs::ModuleM::CS_CONST253.should == :const253

    ConstantSpecs::ModuleM.send :remove_const, "CS_CONST253"
    lambda { ConstantSpecs::ModuleM::CS_CONST253 }.should raise_error(NameError)
  end

  it "returns the value of the removed constant" do
    ConstantSpecs::ModuleM::CS_CONST254 = :const254
    ConstantSpecs::ModuleM.send(:remove_const, :CS_CONST254).should == :const254
  end
end

Version data entries

43 entries across 43 versions & 3 rubygems

Version Path
opal-0.10.6 spec/opal/core/module/remove_const_spec.rb
opal-0.10.6.beta spec/opal/core/module/remove_const_spec.rb
opal-0.10.5 spec/opal/core/module/remove_const_spec.rb
opal-0.10.4 spec/opal/core/module/remove_const_spec.rb
opal-0.11.0.rc1 spec/opal/core/module/remove_const_spec.rb
opal-0.10.3 spec/opal/core/module/remove_const_spec.rb
opal-0.10.2 spec/opal/core/module/remove_const_spec.rb
opal-0.10.1 spec/opal/core/module/remove_const_spec.rb
opal-0.10.0 spec/opal/core/module/remove_const_spec.rb
opal-0.10.0.rc2 spec/opal/core/module/remove_const_spec.rb
opal-0.9.4 spec/opal/core/module/remove_const_spec.rb
opal-0.9.3 spec/opal/core/module/remove_const_spec.rb
opal-0.10.0.rc1 spec/opal/core/module/remove_const_spec.rb
opal-0.10.0.beta5 spec/opal/core/module/remove_const_spec.rb
opal-0.10.0.beta4 spec/opal/core/module/remove_const_spec.rb
opal-0.10.0.beta3 spec/opal/core/module/remove_const_spec.rb
opal-0.10.0.beta2 spec/opal/core/module/remove_const_spec.rb
opal-0.10.0.beta1 spec/opal/core/module/remove_const_spec.rb
opal-0.9.2 spec/opal/core/module/remove_const_spec.rb
opal-0.9.0 spec/opal/core/module/remove_const_spec.rb