Sha256: 99911c673e5bf03b3fc9d45df5f4180c0d2be465130b0f362ae15152d521082f

Contents?: true

Size: 739 Bytes

Versions: 7

Compression:

Stored size: 739 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

class ProjectTier < ClassyEnum::Base
  class_attribute :inherited_properties
end

class ProjectTier::One < ProjectTier
  self.inherited_properties = [1,2,3]
end

class ProjectTier::Two < ProjectTier::One
  self.inherited_properties += [4,5,6]
end

describe 'Classy Enum inheritance' do
  it 'should inherit from the previous class' do
    ProjectTier::One.inherited_properties.should == [1,2,3]
    ProjectTier::Two.inherited_properties.should == [1,2,3,4,5,6]
  end

  it 'should instantiate the subclass' do
    ProjectTier::Two.build(:two).should == ProjectTier::Two.new
  end

  it 'should have the right index' do
    ProjectTier::Two.new.index.should == 2
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
classy_enum-3.2.0 spec/classy_enum_inheritance_spec.rb
classy_enum-3.1.3 spec/classy_enum_inheritance_spec.rb
classy_enum-3.1.2 spec/classy_enum_inheritance_spec.rb
classy_enum-3.1.1 spec/classy_enum_inheritance_spec.rb
classy_enum-3.1.0 spec/classy_enum_inheritance_spec.rb
classy_enum-3.0.1 spec/classy_enum_inheritance_spec.rb
classy_enum-3.0.0 spec/classy_enum_inheritance_spec.rb