Sha256: 4b1f1a499e7a5ef8550340b310a91928381070adf1438b45b4d59053cbc43585

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

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

describe "YARD::Handlers::Ruby::#{RUBY18 ? "Legacy::" : ""}MixinHandler" do
  before { parse_file :mixin_handler_001, __FILE__ }
  
  it "should handle includes from classes or modules" do
    Registry.at(:X).instance_mixins.should include(P(:A))
    Registry.at(:Y).instance_mixins.should include(P(:A))
  end

  it "should handle includes in class << self" do
    Registry.at(:Y).class_mixins.should include(P(:A))
  end
  
  it "should handle includes for complex namespaces" do
  end
  
  it "should handle includes for modules that don't yet exist" do
    Registry.at(:X).instance_mixins.should include(P(nil, :NOTEXIST))
  end
  
  it "should set the type of non-existing modules to :module" do
    P(:NOTEXIST).type.should == :module
  end
  
  it "should handle includes with multiple parameters" do
    Registry.at(:X)
  end
  
  it "should handle complex include statements" do
    P(:Y).instance_mixins.should include(P('B::C'))
    P(:Y).instance_mixins.should include(P(:B))
  end
  
  it "should treat a mixed in Constant by taking its value as the real object name" do
    P(:Y).instance_mixins.should include(Registry.at('B::D'))
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yard-0.2.3.2 spec/handlers/mixin_handler_spec.rb
yard-0.2.3.3 spec/handlers/mixin_handler_spec.rb
yard-0.2.3 spec/handlers/mixin_handler_spec.rb