inheritance_tracking_spec.rb 443 B

123456789101112131415161718192021
  1. require 'spec_helper'
  2. require 'inheritance_tracking'
  3. describe InheritanceTracking do
  4. class Class1
  5. include InheritanceTracking
  6. end
  7. class Class2 < Class1; end
  8. class Class3 < Class1; end
  9. it "tracks subclasses" do
  10. Class1.subclasses.should == [Class2, Class3]
  11. end
  12. it "can be temporarily overridden with #with_subclasses" do
  13. Class1.with_subclasses(Class2) do
  14. Class1.subclasses.should == [Class2]
  15. end
  16. end
  17. end