Module: Statecraft::RSpec::Matchers

Defined in:
lib/statecraft/rspec/matchers.rb

Overview

The example-facing surface: requiring statecraft/rspec includes this module into every example group, so specs call the factories bare. Record-level matchers consult guards (a prediction with the metadata you pass); class-level matchers answer the graph's shape only. rubocop:disable Naming/PredicatePrefix -- have_* is RSpec's matcher idiom, not a predicate

Instance Method Summary collapse

Instance Method Details

#allow_event(event_name) ⇒ Object



11
12
13
# File 'lib/statecraft/rspec/matchers.rb', line 11

def allow_event(event_name)
  AllowEvent.new(event_name)
end

#allow_transition_to(target_state) ⇒ Object



19
20
21
# File 'lib/statecraft/rspec/matchers.rb', line 19

def allow_transition_to(target_state)
  AllowTransitionTo.new(target_state)
end

#have_edge(from_state, to_state) ⇒ Object



27
28
29
# File 'lib/statecraft/rspec/matchers.rb', line 27

def have_edge(from_state, to_state)
  HaveEdge.new(from_state, to_state)
end

#have_initial_state(state_name) ⇒ Object



31
32
33
# File 'lib/statecraft/rspec/matchers.rb', line 31

def have_initial_state(state_name)
  HaveInitialState.new(state_name)
end

#have_transitioned_to(state_name) ⇒ Object



23
24
25
# File 'lib/statecraft/rspec/matchers.rb', line 23

def have_transitioned_to(state_name)
  HaveTransitionedTo.new(state_name)
end

#refuse_event(event_name) ⇒ Object



15
16
17
# File 'lib/statecraft/rspec/matchers.rb', line 15

def refuse_event(event_name)
  RefuseEvent.new(event_name)
end

#transition(record) ⇒ Object



35
36
37
# File 'lib/statecraft/rspec/matchers.rb', line 35

def transition(record)
  Transition.new(record)
end