Sha256: de4c6908780e156f9eede3e469050ee5f46bcad3b400b46c9f3816fb0609f360

Contents?: true

Size: 1.69 KB

Versions: 34

Compression:

Stored size: 1.69 KB

Contents

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

describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "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
  
  it "should raise undocumentable error if argument is variable" do
    undoc_error "module X; include invalid; end"
    Registry.at('X').mixins.should == []
  end
  
  it "should parse all other arguments before erroring out on undocumentable error" do
    undoc_error "module X; include invalid, Y; end"
    Registry.at('X').mixins.should == [P('Y')]
  end
end

Version data entries

34 entries across 34 versions & 4 rubygems

Version Path
challah-0.6.2 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.6.1 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.6.0 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.5.4 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.5.3 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.5.2 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.5.1 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.5.0 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.4.1 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.4.0 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.3.5 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.3.4 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.3.3 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.3.2 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.3.1 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.3.0 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.2.1 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
challah-0.2.0 vendor/bundle/gems/yard-0.7.5/spec/handlers/mixin_handler_spec.rb
yard-0.7.5 spec/handlers/mixin_handler_spec.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/yard-0.7.4/spec/handlers/mixin_handler_spec.rb