Sha256: f9323099e2e5569694cf17cd0a37a3ed530f64222c79af145174859a048f7543

Contents?: true

Size: 817 Bytes

Versions: 2

Compression:

Stored size: 817 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

2 entries across 2 versions & 1 rubygems

Version Path
yard-0.9.18 spec/handlers/extend_handler_spec.rb
yard-0.9.17 spec/handlers/extend_handler_spec.rb