Sha256: 54ee6e3b8ac20a03fc332b9ee3277badfe05ef5e6d27863cb95610bf4a6c750f

Contents?: true

Size: 920 Bytes

Versions: 21

Compression:

Stored size: 920 Bytes

Contents

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

RSpec.describe YARD::CodeObjects::CodeObjectList do
  before { Registry.clear }

  describe "#push" do
    it "only allows CodeObjects::Base, String or Symbol" do
      list = CodeObjectList.new(nil)
      expect { list.push(:hash => 1) }.to raise_error(ArgumentError)
      list << "Test"
      list << :Test2
      list << ModuleObject.new(nil, :YARD)
      expect(list.size).to eq 3
    end
  end

  it "added value should be a proxy if parameter was String or Symbol" do
    list = CodeObjectList.new(nil)
    list << "Test"
    expect(list.first.class).to eq Proxy
  end

  it "contains a unique list of objects" do
    obj = ModuleObject.new(nil, :YARD)
    list = CodeObjectList.new(nil)

    list << P(:YARD)
    list << obj
    expect(list.size).to eq 1

    list << :Test
    list << "Test"
    expect(list.size).to eq 2
  end
end

Version data entries

21 entries across 20 versions & 4 rubygems

Version Path
yard-0.9.24 spec/code_objects/code_object_list_spec.rb
yard-0.9.23 spec/code_objects/code_object_list_spec.rb
yard-0.9.22 spec/code_objects/code_object_list_spec.rb
yard-0.9.21 spec/code_objects/code_object_list_spec.rb
yard-0.9.20 spec/code_objects/code_object_list_spec.rb
yard-0.9.19 spec/code_objects/code_object_list_spec.rb
yard-0.9.16 spec/code_objects/code_object_list_spec.rb
yard-0.9.15 spec/code_objects/code_object_list_spec.rb
yard-0.9.14 spec/code_objects/code_object_list_spec.rb
yard-0.9.13 spec/code_objects/code_object_list_spec.rb
yard-0.9.12 spec/code_objects/code_object_list_spec.rb
yard-0.9.11 spec/code_objects/code_object_list_spec.rb
yard-0.9.10 spec/code_objects/code_object_list_spec.rb
yard-0.9.9 spec/code_objects/code_object_list_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.4.0/gems/yard-0.9.8/spec/code_objects/code_object_list_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.2.0/gems/yard-0.9.8/spec/code_objects/code_object_list_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/yard-0.9.8/spec/code_objects/code_object_list_spec.rb
yard-0.9.8 spec/code_objects/code_object_list_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.7/spec/code_objects/code_object_list_spec.rb
yard-0.9.7 spec/code_objects/code_object_list_spec.rb