Sha256: b4017aaae87fb16200122c06fbb05407e3c794ada529f396737a11fa5fc91f63

Contents?: true

Size: 854 Bytes

Versions: 5

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

require 'helper'

class Nanoc::Int::IdentifiableCollectionTest < Nanoc::TestCase
  def setup
    super

    @one = Nanoc::Int::Item.new('Item One', {}, '/one')
    @two = Nanoc::Int::Item.new('Item Two', {}, '/two')

    @items = Nanoc::Int::ItemCollection.new({}, [@one, @two])
  end

  def test_change_item_identifier
    assert_equal @one, @items['/one']
    assert_nil @items['/foo']

    @one.identifier = '/foo'

    assert_nil @items['/one']
    assert_equal @one, @items['/foo']
  end

  def test_enumerable
    assert_equal @one, (@items.find { |i| i.identifier == '/one' })
  end

  def test_less_than_less_than
    assert_nil @items['/foo']

    foo = Nanoc::Int::Item.new('Item Foo', {}, '/foo')
    @items = Nanoc::Int::ItemCollection.new({}, [@one, @two, foo])

    assert_equal foo, @items['/foo']
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nanoc-4.8.10 test/base/test_item_array.rb
nanoc-4.8.9 test/base/test_item_array.rb
nanoc-4.8.8 test/base/test_item_array.rb
nanoc-4.8.7 test/base/test_item_array.rb
nanoc-4.8.6 test/base/test_item_array.rb