Sha256: c71f78017660a56a0525e9de989650f6ab1b7a6ae098bc7674c8578775e0386a

Contents?: true

Size: 586 Bytes

Versions: 2

Compression:

Stored size: 586 Bytes

Contents

# frozen_string_literal: true

RSpec.describe FiniteMachine::Transition, '#matches?' do
  let(:machine) { double(:machine) }

  it "matches from state" do
    states = {:green => :red}
    transition = described_class.new(machine, :event_name, states: states)

    expect(transition.matches?(:green)).to eq(true)
    expect(transition.matches?(:red)).to eq(false)
  end

  it "matches any state" do
    states = {FiniteMachine::ANY_STATE => :red}
    transition = described_class.new(machine, :event_name, states: states)

    expect(transition.matches?(:green)).to eq(true)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finite_machine-0.12.1 spec/unit/transition/matches_spec.rb
finite_machine-0.12.0 spec/unit/transition/matches_spec.rb