Sha256: ccb551cce204d0d0bd9d7b4bce5d71f082db64e8141f1d55b58663dab51a2d68

Contents?: true

Size: 793 Bytes

Versions: 17

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true
require File.dirname(__FILE__) + '/spec_helper'

RSpec.describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ExtendHandler" do
  before(:all) { parse_file :extend_handler_001, __FILE__ }

  it "includes modules at class scope" do
    expect(Registry.at(:B).class_mixins).to eq [P(:A)]
    expect(Registry.at(:B).instance_mixins).to be_empty
  end

  it "handles a module extending itself" do
    expect(Registry.at(:C).class_mixins).to eq [P(:C)]
    expect(Registry.at(:C).instance_mixins).to be_empty
  end

  it "extends module with correct namespace" do
    expect(Registry.at('Q::R::S').class_mixins.first.path).to eq 'A'
  end

  it "does not allow extending self if object is a class" do
    undoc_error "class Foo; extend self; end"
  end
end

Version data entries

17 entries across 16 versions & 4 rubygems

Version Path
yard-0.9.20 spec/handlers/extend_handler_spec.rb
yard-0.9.19 spec/handlers/extend_handler_spec.rb
yard-0.9.16 spec/handlers/extend_handler_spec.rb
yard-0.9.15 spec/handlers/extend_handler_spec.rb
yard-0.9.14 spec/handlers/extend_handler_spec.rb
yard-0.9.13 spec/handlers/extend_handler_spec.rb
yard-0.9.12 spec/handlers/extend_handler_spec.rb
yard-0.9.11 spec/handlers/extend_handler_spec.rb
yard-0.9.10 spec/handlers/extend_handler_spec.rb
yard-0.9.9 spec/handlers/extend_handler_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.4.0/gems/yard-0.9.8/spec/handlers/extend_handler_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.2.0/gems/yard-0.9.8/spec/handlers/extend_handler_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/yard-0.9.8/spec/handlers/extend_handler_spec.rb
yard-0.9.8 spec/handlers/extend_handler_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.7/spec/handlers/extend_handler_spec.rb
yard-0.9.7 spec/handlers/extend_handler_spec.rb
yard-0.9.6 spec/handlers/extend_handler_spec.rb