Sha256: eb7b1552fbbe0d141452d80d69067c8059c6eec36101b1efa431cf603488639a

Contents?: true

Size: 921 Bytes

Versions: 1

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

require 'lims-core/subclass_tracker'


module SubclassTrackerTest
  class A
    extend  Lims::Core::SubclassTracker
  end

  class B < A
  end

  class B2 < A
  end

  class C < B
  end

  module M
    extend Lims::Core::SubclassTracker
  end

  class N
    include M
  end

  class N2
    include M
  end

  class O < N
  end

  class O2 < N2
  end

  describe Lims::Core::SubclassTracker do
    context "track classes" do
      subject { A }

      it "responds to subclasses" do
        subject.should respond_to(:subclasses)
      end

      it "list its children" do
        subject.subclasses.should == [B, B2,  C]
      end
    end

    context "track modules" do
      subject { M }
      it "responds to subclasses" do
        subject.should respond_to(:subclasses)
      end

      it "list its children" do
        subject.subclasses.should == [N, N2, O, O2]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lims-core-3.2.3 spec/subclass_tracker_sperc.rb