Sha256: cf564ac2566f659cf0ad1800b7f285dca2586802f8d732daad9154b16ff76a14

Contents?: true

Size: 716 Bytes

Versions: 10

Compression:

Stored size: 716 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe DescendantsTracker, '#inherited' do
  subject { Class.new(object) }

  let!(:object)    { Class.new(superklass).extend(self.class.described_class) }
  let(:superklass) { Class.new                                                }

  it 'delegates to the superclass #inherited method' do
    superklass.should_receive(:inherited) do |descendant|
      expect(descendant).to be_instance_of(Class)
      expect(descendant.ancestors).to include(object)
    end
    subject
  end

  it 'adds the descendant' do
    expect(object.descendants).to include(subject)
  end

  it 'sets up descendants in the child class' do
    expect(subject.descendants).to eql([])
  end
end

Version data entries

10 entries across 8 versions & 4 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/descendants_tracker-0.0.4/spec/unit/descendants_tracker/inherited_spec.rb
descendants_tracker-0.0.4 spec/unit/descendants_tracker/inherited_spec.rb