Sha256: 638ab1e03fab0ffe398797077a477ffa4d35ced371dec8a0cbe787932a77a5c6

Contents?: true

Size: 1.33 KB

Versions: 13

Compression:

Stored size: 1.33 KB

Contents

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

describe "YARD::Handlers::Ruby::#{RUBY18 ? "Legacy::" : ""}MixinHandler" do
  before(:all) { 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 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).should_not be_nil
  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
  
  it "should avoid including self for unresolved mixins of the same name" do
    P("ABC::DEF::FOO").mixins.should == [P("ABC::FOO")]
    P("ABC::DEF::BAR").mixins.should == [P("ABC::BAR")]
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
yard-0.6.1 spec/handlers/mixin_handler_spec.rb
yard-0.6.0 spec/handlers/mixin_handler_spec.rb
yard-0.5.8 spec/handlers/mixin_handler_spec.rb
yard-0.5.7 spec/handlers/mixin_handler_spec.rb
yard-0.5.6 spec/handlers/mixin_handler_spec.rb
yard-0.5.5 spec/handlers/mixin_handler_spec.rb
yard-0.5.4 spec/handlers/mixin_handler_spec.rb
yard-0.5.3 spec/handlers/mixin_handler_spec.rb
yard-0.5.2 spec/handlers/mixin_handler_spec.rb
yard-0.5.1p1 spec/handlers/mixin_handler_spec.rb
yard-0.5.1 spec/handlers/mixin_handler_spec.rb
yard-0.5.0 spec/handlers/mixin_handler_spec.rb
yard-0.4.0 spec/handlers/mixin_handler_spec.rb