Sha256: b6952c41433c201b23190de55ccd8a1047e092478193d14d77e5e23606cbf742

Contents?: true

Size: 1002 Bytes

Versions: 37

Compression:

Stored size: 1002 Bytes

Contents

require 'spec_helper'
require 'volt/extra_core/array'

class TestClassAttributes
  class_attribute :some_data
end

class TestSubClassAttributes < TestClassAttributes
end

class TestSubClassAttributes2 < TestClassAttributes
end

describe 'extra_core class addons' do
  it 'should provide class_attributes that can be inherited' do
    expect(TestClassAttributes.some_data).to eq(nil)

    TestClassAttributes.some_data = 5
    expect(TestClassAttributes.some_data).to eq(5)
    expect(TestSubClassAttributes.some_data).to eq(5)
    expect(TestSubClassAttributes2.some_data).to eq(5)

    TestSubClassAttributes.some_data = 10
    expect(TestClassAttributes.some_data).to eq(5)
    expect(TestSubClassAttributes.some_data).to eq(10)
    expect(TestSubClassAttributes2.some_data).to eq(5)

    TestSubClassAttributes2.some_data = 15
    expect(TestClassAttributes.some_data).to eq(5)
    expect(TestSubClassAttributes.some_data).to eq(10)
    expect(TestSubClassAttributes2.some_data).to eq(15)
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
volt-0.9.5.pre3 spec/extra_core/class_spec.rb
volt-0.9.5.pre2 spec/extra_core/class_spec.rb
volt-0.9.5.pre1 spec/extra_core/class_spec.rb
volt-0.9.4 spec/extra_core/class_spec.rb
volt-0.9.4.pre5 spec/extra_core/class_spec.rb
volt-0.9.4.pre3 spec/extra_core/class_spec.rb
volt-0.9.4.pre2 spec/extra_core/class_spec.rb
volt-0.9.4.pre1 spec/extra_core/class_spec.rb
volt-0.9.3 spec/extra_core/class_spec.rb
volt-0.9.3.pre6 spec/extra_core/class_spec.rb
volt-0.9.3.pre5 spec/extra_core/class_spec.rb
volt-0.9.3.pre4 spec/extra_core/class_spec.rb
volt-0.9.3.pre3 spec/extra_core/class_spec.rb
volt-0.9.3.pre2 spec/extra_core/class_spec.rb
volt-0.9.3.pre1 spec/extra_core/class_spec.rb
volt-0.9.2 spec/extra_core/class_spec.rb
volt-0.9.1 spec/extra_core/class_spec.rb
volt-0.9.1.pre5 spec/extra_core/class_spec.rb
volt-0.9.1.pre4 spec/extra_core/class_spec.rb
volt-0.9.1.pre3 spec/extra_core/class_spec.rb