File: callback_by_default_test.rb

package info (click to toggle)
ruby-state-machines 0.100.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,600 kB
  • sloc: ruby: 18,854; sh: 17; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 789 bytes parent folder | download
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