Sha256: 074694db9cbaa7c3cd912d6c2a61a60373e12a75b773e3eb099170b9a95e2c53

Contents?: true

Size: 931 Bytes

Versions: 14

Compression:

Stored size: 931 Bytes

Contents

require_relative '../../test_helper'

class NodeCollectionWithoutIndicesTest < StateMachinesTest
  def setup
    machine = StateMachines::Machine.new(Class.new)
    @collection = StateMachines::NodeCollection.new(machine, index: {})
  end

  def test_should_allow_adding_node
    @collection << Object.new
    assert_equal 1, @collection.length
  end

  def test_should_not_allow_keys_retrieval
    exception = assert_raises(ArgumentError) { @collection.keys }
    assert_equal 'No indices configured', exception.message
  end

  def test_should_not_allow_lookup
    @collection << Object.new
    exception = assert_raises(ArgumentError) { @collection[0] }
    assert_equal 'No indices configured', exception.message
  end

  def test_should_not_allow_fetching
    @collection << Object.new
    exception = assert_raises(ArgumentError) { @collection.fetch(0) }
    assert_equal 'No indices configured', exception.message
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
state_machines-0.5.0 test/unit/node_collection/node_collection_without_indices_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_without_indices_test .rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_without_indices_test .rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/node_collection/node_collection_without_indices_test .rb
state_machines-0.4.0 test/unit/node_collection/node_collection_without_indices_test.rb
state_machines-0.3.0 test/unit/node_collection/node_collection_without_indices_test.rb
state_machines-0.2.2 test/unit/node_collection/node_collection_without_indices_test .rb
state_machines-0.2.1 test/unit/node_collection/node_collection_without_indices_test .rb
state_machines-0.2.0 test/unit/node_collection/node_collection_without_indices_test .rb
state_machines-0.1.4 test/unit/node_collection/node_collection_without_indices_test .rb
state_machines-0.1.3 test/unit/node_collection/node_collection_without_indices_test .rb
state_machines-0.1.2 test/unit/node_collection/node_collection_without_indices_test .rb
state_machines-0.1.1 test/unit/node_collection/node_collection_without_indices_test .rb
state_machines-0.1.0 test/unit/node_collection/node_collection_without_indices_test .rb