Sha256: b074d3ac521fd7de325e9c5cd46e484cc376d9aa1f763643e92afa3f1b3aff6e

Contents?: true

Size: 509 Bytes

Versions: 10

Compression:

Stored size: 509 Bytes

Contents

require 'jactive_support/core_ext/module'

class Base
  def self.inherited(other)
    other.instance_variable_set('@thename', other.name || '')
  end
end

Test2 = Class.new(Base)

describe Module, 'define_class' do
  it "normal dynamic class does not have access to name in inherited" do
    Test2.instance_variable_get('@thename').should eq('')
  end
  
  it "should have access to name even in inherited" do
    Object.define_class('Test', Base).instance_variable_get('@thename').should eq('Test')
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jactive_support-2.1.2 spec/core_ext/module_spec.rb
jactive_support-3.0.0 spec/core_ext/module_spec.rb
jactive_support-3.0.0.pre2 spec/core_ext/module_spec.rb
jactive_support-3.0.0.pre1 spec/core_ext/module_spec.rb
jactive_support-2.1.1 spec/core_ext/module_spec.rb
jactive_support-2.1.0 spec/core_ext/module_spec.rb
jactive_support-2.0.0 spec/core_ext/module_spec.rb
jactive_support-1.0.2 spec/core_ext/module_spec.rb
jactive_support-1.0.1-universal-java-1.6 spec/core_ext/module_spec.rb
jactive_support-1.0.0-universal-java-1.6 spec/core_ext/module_spec.rb