Sha256: eeb14cd373eb372bbcfb34fdf3466040c00611ae227089c0a5a14777b017f49d

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 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|
      descendant.should be_instance_of(Class)
      descendant.ancestors.should 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

2 entries across 2 versions & 1 rubygems

Version Path
descendants_tracker-0.0.3 spec/unit/descendants_tracker/inherited_spec.rb
descendants_tracker-0.0.2 spec/unit/descendants_tracker/inherited_spec.rb