Sha256: 4584720cb594e75bdc3e86cddbf3ac8920a7a8890b5c7f35ef72451c49f4befa

Contents?: true

Size: 701 Bytes

Versions: 4

Compression:

Stored size: 701 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

    expect(transition.to_state(:green)).to eq(:red)
  end

  it "finds to state for transition from any state" do
    states = {:any => :red}
    transition = described_class.new(machine, states: states)

    expect(transition.to_state(:green)).to eq(:red)
  end

  it "returns from state for cancelled transition" do
    transition = described_class.new(machine, cancelled: true)

    expect(transition.to_state(:green)).to eq(:green)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
finite_machine-0.11.3 spec/unit/transition/to_state_spec.rb
finite_machine-0.11.2 spec/unit/transition/to_state_spec.rb
finite_machine-0.11.1 spec/unit/transition/to_state_spec.rb
finite_machine-0.11.0 spec/unit/transition/to_state_spec.rb