Sha256: c44b03ea0e6c7c4e405b35e3e2dceb871ea6cd44fe3f0690e7e187ab7121f8fe

Contents?: true

Size: 883 Bytes

Versions: 8

Compression:

Stored size: 883 Bytes

Contents

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

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

8 entries across 7 versions & 2 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/yard-0.9.2/spec/code_objects/code_object_list_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.1/spec/code_objects/code_object_list_spec.rb
yard-0.9.5 spec/code_objects/code_object_list_spec.rb
yard-0.9.4 spec/code_objects/code_object_list_spec.rb
yard-0.9.3 spec/code_objects/code_object_list_spec.rb
yard-0.9.2 spec/code_objects/code_object_list_spec.rb
yard-0.9.1 spec/code_objects/code_object_list_spec.rb
yard-0.9.0 spec/code_objects/code_object_list_spec.rb