Sha256: a0aec438ccd738adbd0fb7c449fbdf72f9b7fd8ad36ea452053d4c93b2f380d0

Contents?: true

Size: 806 Bytes

Versions: 2

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

RSpec.describe FiniteMachine::EventsMap, '#choice_transition?' do
  it "checks if transition has many branches" do
    transition_a = double(:transition_a, matches?: true)
    transition_b = double(:transition_b, matches?: true)

    events_map = described_class.new
    events_map.add(:go, transition_a)
    events_map.add(:go, transition_b)

    expect(events_map.choice_transition?(:go, :green)).to eq(true)
  end

  it "checks that transition has no branches" do
    transition_a = double(:transition_a, matches?: false)
    transition_b = double(:transition_b, matches?: true)

    events_map = described_class.new
    events_map.add(:go, transition_a)
    events_map.add(:go, transition_b)

    expect(events_map.choice_transition?(:go, :green)).to eq(false)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finite_machine-0.12.1 spec/unit/events_map/choice_transition_spec.rb
finite_machine-0.12.0 spec/unit/events_map/choice_transition_spec.rb