Sha256: 1af73ea536a51093cfe898e12ca0c2cc6ef9c536d506bc11d5020cb0e3c1897b
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
Contents
# encoding: utf-8 require 'spec_helper' RSpec.describe FiniteMachine::Event, '#next_transition' do let(:object) { described_class } subject(:event) { object.new(machine, name: :test) } describe "matches transition by name" do let(:machine) { double(:machine) } it "finds matching transition" do transition_a = double(:transition_a, current?: false) transition_b = double(:transition_b, current?: true) event << transition_a event << transition_b expect(event.next_transition).to eq(transition_b) end end describe "fails to find" do let(:machine) { double(:machine) } it "choses first available transition" do transition_a = double(:transition_a, current?: false) transition_b = double(:transition_b, current?: false) event << transition_a event << transition_b expect(event.next_transition).to eq(transition_a) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
finite_machine-0.10.2 | spec/unit/event/next_transition_spec.rb |
finite_machine-0.10.1 | spec/unit/event/next_transition_spec.rb |