1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
# frozen_string_literal: true
require 'test_helper'
class CallbackByDefaultTest < StateMachinesTest
def setup
@callback = StateMachines::Callback.new(:before) {}
end
def test_should_have_type
assert_equal :before, @callback.type
end
def test_should_not_have_a_terminator
assert_nil @callback.terminator
end
def test_should_have_a_branch_with_all_matcher_requirements
assert_equal StateMachines::AllMatcher.instance, @callback.branch.event_requirement
assert_equal StateMachines::AllMatcher.instance, @callback.branch.state_requirements.first[:from]
assert_equal StateMachines::AllMatcher.instance, @callback.branch.state_requirements.first[:to]
end
def test_should_not_have_any_known_states
assert_empty @callback.known_states
end
end
|