enum_state_machine 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/enum_state_machine.gemspec +2 -2
- data/lib/enum_state_machine/event.rb +1 -1
- data/lib/enum_state_machine/machine.rb +2 -2
- data/lib/enum_state_machine/state.rb +1 -1
- data/lib/enum_state_machine/version.rb +1 -1
- data/test/functional/state_machine_test.rb +20 -20
- data/test/test_helper.rb +15 -1
- data/test/unit/assertions_test.rb +1 -1
- data/test/unit/branch_test.rb +42 -42
- data/test/unit/callback_test.rb +27 -27
- data/test/unit/error_test.rb +2 -2
- data/test/unit/eval_helpers_test.rb +1 -1
- data/test/unit/event_collection_test.rb +10 -10
- data/test/unit/event_test.rb +38 -38
- data/test/unit/graph_test.rb +4 -4
- data/test/unit/helper_module_test.rb +1 -1
- data/test/unit/integrations/active_model_test.rb +1 -1
- data/test/unit/integrations/active_record_test.rb +15 -15
- data/test/unit/integrations/base_test.rb +2 -2
- data/test/unit/integrations_test.rb +2 -2
- data/test/unit/invalid_event_test.rb +1 -1
- data/test/unit/invalid_parallel_transition_test.rb +1 -1
- data/test/unit/invalid_transition_test.rb +3 -3
- data/test/unit/machine_collection_test.rb +15 -15
- data/test/unit/machine_test.rb +114 -114
- data/test/unit/matcher_helpers_test.rb +3 -3
- data/test/unit/matcher_test.rb +7 -7
- data/test/unit/node_collection_test.rb +13 -13
- data/test/unit/path_collection_test.rb +8 -8
- data/test/unit/path_test.rb +13 -13
- data/test/unit/state_collection_test.rb +10 -10
- data/test/unit/state_context_test.rb +10 -10
- data/test/unit/state_enum_test.rb +1 -1
- data/test/unit/state_machine_test.rb +2 -2
- data/test/unit/state_test.rb +52 -52
- data/test/unit/transition_collection_test.rb +41 -41
- data/test/unit/transition_test.rb +29 -29
- metadata +10 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78ed7ba2f679e68825759082d855929ad756f7e0f30edb94ee4d72e53eca0944
|
|
4
|
+
data.tar.gz: e6d003dd671876d6fb592da0c98c792f1c8a0534395e2922a623fdfa4da97aba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1964c15f5d62517b3cb984dc8daa1752a61608972348ac892e165e18199faddb3134426bb1d518f17cb6ad8cd55b6dd0e50b6833c445defc32aaf8e9c602daa4
|
|
7
|
+
data.tar.gz: 7f6e411c868bb71857e4cd15fbb6ac4ac63995e3c6ea16fdaadcd0da32d1f788bac24d84543c55467786a105e459ff5947ab9d00fc3a0425e4c396729373ac73
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.3.9
|
data/enum_state_machine.gemspec
CHANGED
|
@@ -23,9 +23,9 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
s.add_dependency "power_enum", "> 2.8"
|
|
24
24
|
|
|
25
25
|
s.add_development_dependency "rake"
|
|
26
|
-
s.add_development_dependency "minitest"
|
|
26
|
+
s.add_development_dependency "minitest"
|
|
27
27
|
s.add_development_dependency "simplecov"
|
|
28
28
|
s.add_development_dependency "yard"
|
|
29
|
-
s.add_development_dependency "sqlite3"
|
|
29
|
+
s.add_development_dependency "sqlite3"
|
|
30
30
|
s.add_development_dependency "ruby-graphviz"
|
|
31
31
|
end
|
|
@@ -60,7 +60,7 @@ module EnumStateMachine
|
|
|
60
60
|
# Output a warning if another event has a conflicting qualified name
|
|
61
61
|
if conflict = machine.owner_class.state_machines.detect {|other_name, other_machine| other_machine != @machine && other_machine.events[qualified_name, :qualified_name]}
|
|
62
62
|
name, other_machine = conflict
|
|
63
|
-
warn "Event #{qualified_name.inspect} for #{machine.name.inspect} is already defined in #{other_machine.name.inspect}"
|
|
63
|
+
Rails.logger.warn "Event #{qualified_name.inspect} for #{machine.name.inspect} is already defined in #{other_machine.name.inspect}"
|
|
64
64
|
else
|
|
65
65
|
add_actions
|
|
66
66
|
end
|
|
@@ -637,7 +637,7 @@ module EnumStateMachine
|
|
|
637
637
|
# attribute
|
|
638
638
|
initial_state = states.detect {|state| state.initial}
|
|
639
639
|
if !owner_class_attribute_default.nil? && (dynamic_initial_state? || !owner_class_attribute_default_matches?(initial_state))
|
|
640
|
-
warn(
|
|
640
|
+
Rails.logger.warn(
|
|
641
641
|
"Both #{owner_class.name} and its #{name.inspect} machine have defined "\
|
|
642
642
|
"a different default for \"#{attribute}\". Use only one or the other for "\
|
|
643
643
|
"defining defaults to avoid unexpected behaviors."
|
|
@@ -757,7 +757,7 @@ module EnumStateMachine
|
|
|
757
757
|
if block_given?
|
|
758
758
|
if !self.class.ignore_method_conflicts && conflicting_ancestor = owner_class_ancestor_has_method?(scope, method)
|
|
759
759
|
ancestor_name = conflicting_ancestor.name && !conflicting_ancestor.name.empty? ? conflicting_ancestor.name : conflicting_ancestor.to_s
|
|
760
|
-
warn "#{scope == :class ? 'Class' : 'Instance'} method \"#{method}\" is already defined in #{ancestor_name}, use generic helper instead or set EnumStateMachine::Machine.ignore_method_conflicts = true."
|
|
760
|
+
Rails.logger.warn "#{scope == :class ? 'Class' : 'Instance'} method \"#{method}\" is already defined in #{ancestor_name}, use generic helper instead or set EnumStateMachine::Machine.ignore_method_conflicts = true."
|
|
761
761
|
else
|
|
762
762
|
name = self.name
|
|
763
763
|
helper_module.class_eval do
|
|
@@ -74,7 +74,7 @@ module EnumStateMachine
|
|
|
74
74
|
# for a different attribute
|
|
75
75
|
if conflict = conflicting_machines.detect {|other_name, other_machine| other_machine.attribute != machine.attribute}
|
|
76
76
|
name, other_machine = conflict
|
|
77
|
-
warn "State #{qualified_name.inspect} for #{machine.name.inspect} is already defined in #{other_machine.name.inspect}"
|
|
77
|
+
Rails.logger.warn "State #{qualified_name.inspect} for #{machine.name.inspect} is already defined in #{other_machine.name.inspect}"
|
|
78
78
|
elsif conflicting_machines.empty?
|
|
79
79
|
# Only bother adding predicates when another machine for the same
|
|
80
80
|
# attribute hasn't already done so
|
|
@@ -241,7 +241,7 @@ class TrafficLight
|
|
|
241
241
|
end
|
|
242
242
|
end
|
|
243
243
|
|
|
244
|
-
class VehicleTest <
|
|
244
|
+
class VehicleTest < Minitest::Test
|
|
245
245
|
def setup
|
|
246
246
|
@vehicle = Vehicle.new
|
|
247
247
|
end
|
|
@@ -259,7 +259,7 @@ class VehicleTest < MiniTest::Test
|
|
|
259
259
|
end
|
|
260
260
|
end
|
|
261
261
|
|
|
262
|
-
class VehicleUnsavedTest <
|
|
262
|
+
class VehicleUnsavedTest < Minitest::Test
|
|
263
263
|
def setup
|
|
264
264
|
@vehicle = Vehicle.new
|
|
265
265
|
end
|
|
@@ -438,7 +438,7 @@ class VehicleUnsavedTest < MiniTest::Test
|
|
|
438
438
|
end
|
|
439
439
|
end
|
|
440
440
|
|
|
441
|
-
class VehicleParkedTest <
|
|
441
|
+
class VehicleParkedTest < Minitest::Test
|
|
442
442
|
def setup
|
|
443
443
|
@vehicle = Vehicle.new
|
|
444
444
|
end
|
|
@@ -489,7 +489,7 @@ class VehicleParkedTest < MiniTest::Test
|
|
|
489
489
|
end
|
|
490
490
|
end
|
|
491
491
|
|
|
492
|
-
class VehicleIdlingTest <
|
|
492
|
+
class VehicleIdlingTest < Minitest::Test
|
|
493
493
|
def setup
|
|
494
494
|
@vehicle = Vehicle.new
|
|
495
495
|
@vehicle.ignite
|
|
@@ -546,7 +546,7 @@ class VehicleIdlingTest < MiniTest::Test
|
|
|
546
546
|
end
|
|
547
547
|
end
|
|
548
548
|
|
|
549
|
-
class VehicleFirstGearTest <
|
|
549
|
+
class VehicleFirstGearTest < Minitest::Test
|
|
550
550
|
def setup
|
|
551
551
|
@vehicle = Vehicle.new
|
|
552
552
|
@vehicle.ignite
|
|
@@ -586,7 +586,7 @@ class VehicleFirstGearTest < MiniTest::Test
|
|
|
586
586
|
end
|
|
587
587
|
end
|
|
588
588
|
|
|
589
|
-
class VehicleSecondGearTest <
|
|
589
|
+
class VehicleSecondGearTest < Minitest::Test
|
|
590
590
|
def setup
|
|
591
591
|
@vehicle = Vehicle.new
|
|
592
592
|
@vehicle.ignite
|
|
@@ -626,7 +626,7 @@ class VehicleSecondGearTest < MiniTest::Test
|
|
|
626
626
|
end
|
|
627
627
|
end
|
|
628
628
|
|
|
629
|
-
class VehicleThirdGearTest <
|
|
629
|
+
class VehicleThirdGearTest < Minitest::Test
|
|
630
630
|
def setup
|
|
631
631
|
@vehicle = Vehicle.new
|
|
632
632
|
@vehicle.ignite
|
|
@@ -666,7 +666,7 @@ class VehicleThirdGearTest < MiniTest::Test
|
|
|
666
666
|
end
|
|
667
667
|
end
|
|
668
668
|
|
|
669
|
-
class VehicleStalledTest <
|
|
669
|
+
class VehicleStalledTest < Minitest::Test
|
|
670
670
|
def setup
|
|
671
671
|
@vehicle = Vehicle.new
|
|
672
672
|
@vehicle.ignite
|
|
@@ -729,7 +729,7 @@ class VehicleStalledTest < MiniTest::Test
|
|
|
729
729
|
end
|
|
730
730
|
end
|
|
731
731
|
|
|
732
|
-
class VehicleRepairedTest <
|
|
732
|
+
class VehicleRepairedTest < Minitest::Test
|
|
733
733
|
def setup
|
|
734
734
|
@vehicle = Vehicle.new
|
|
735
735
|
@vehicle.ignite
|
|
@@ -747,7 +747,7 @@ class VehicleRepairedTest < MiniTest::Test
|
|
|
747
747
|
end
|
|
748
748
|
end
|
|
749
749
|
|
|
750
|
-
class VehicleLockedTest <
|
|
750
|
+
class VehicleLockedTest < Minitest::Test
|
|
751
751
|
def setup
|
|
752
752
|
@vehicle = Vehicle.new
|
|
753
753
|
@vehicle.state = 'locked'
|
|
@@ -774,7 +774,7 @@ class VehicleLockedTest < MiniTest::Test
|
|
|
774
774
|
end
|
|
775
775
|
end
|
|
776
776
|
|
|
777
|
-
class VehicleWithParallelEventsTest <
|
|
777
|
+
class VehicleWithParallelEventsTest < Minitest::Test
|
|
778
778
|
def setup
|
|
779
779
|
@vehicle = Vehicle.new
|
|
780
780
|
end
|
|
@@ -810,7 +810,7 @@ class VehicleWithParallelEventsTest < MiniTest::Test
|
|
|
810
810
|
end
|
|
811
811
|
end
|
|
812
812
|
|
|
813
|
-
class VehicleWithEventAttributesTest <
|
|
813
|
+
class VehicleWithEventAttributesTest < Minitest::Test
|
|
814
814
|
def setup
|
|
815
815
|
@vehicle = Vehicle.new
|
|
816
816
|
@vehicle.state_event = 'ignite'
|
|
@@ -838,7 +838,7 @@ class VehicleWithEventAttributesTest < MiniTest::Test
|
|
|
838
838
|
end
|
|
839
839
|
end
|
|
840
840
|
|
|
841
|
-
class MotorcycleTest <
|
|
841
|
+
class MotorcycleTest < Minitest::Test
|
|
842
842
|
def setup
|
|
843
843
|
@motorcycle = Motorcycle.new
|
|
844
844
|
end
|
|
@@ -882,7 +882,7 @@ class MotorcycleTest < MiniTest::Test
|
|
|
882
882
|
end
|
|
883
883
|
end
|
|
884
884
|
|
|
885
|
-
class CarTest <
|
|
885
|
+
class CarTest < Minitest::Test
|
|
886
886
|
def setup
|
|
887
887
|
@car = Car.new
|
|
888
888
|
end
|
|
@@ -929,7 +929,7 @@ class CarTest < MiniTest::Test
|
|
|
929
929
|
end
|
|
930
930
|
end
|
|
931
931
|
|
|
932
|
-
class CarBackingUpTest <
|
|
932
|
+
class CarBackingUpTest < Minitest::Test
|
|
933
933
|
def setup
|
|
934
934
|
@car = Car.new
|
|
935
935
|
@car.reverse
|
|
@@ -972,7 +972,7 @@ class CarBackingUpTest < MiniTest::Test
|
|
|
972
972
|
end
|
|
973
973
|
end
|
|
974
974
|
|
|
975
|
-
class AutoShopAvailableTest <
|
|
975
|
+
class AutoShopAvailableTest < Minitest::Test
|
|
976
976
|
def setup
|
|
977
977
|
@auto_shop = AutoShop.new
|
|
978
978
|
end
|
|
@@ -990,7 +990,7 @@ class AutoShopAvailableTest < MiniTest::Test
|
|
|
990
990
|
end
|
|
991
991
|
end
|
|
992
992
|
|
|
993
|
-
class AutoShopBusyTest <
|
|
993
|
+
class AutoShopBusyTest < Minitest::Test
|
|
994
994
|
def setup
|
|
995
995
|
@auto_shop = AutoShop.new
|
|
996
996
|
@auto_shop.tow_vehicle
|
|
@@ -1013,7 +1013,7 @@ class AutoShopBusyTest < MiniTest::Test
|
|
|
1013
1013
|
end
|
|
1014
1014
|
end
|
|
1015
1015
|
|
|
1016
|
-
class TrafficLightStopTest <
|
|
1016
|
+
class TrafficLightStopTest < Minitest::Test
|
|
1017
1017
|
def setup
|
|
1018
1018
|
@light = TrafficLight.new
|
|
1019
1019
|
@light.state = 'stop'
|
|
@@ -1037,7 +1037,7 @@ class TrafficLightStopTest < MiniTest::Test
|
|
|
1037
1037
|
end
|
|
1038
1038
|
end
|
|
1039
1039
|
|
|
1040
|
-
class TrafficLightProceedTest <
|
|
1040
|
+
class TrafficLightProceedTest < Minitest::Test
|
|
1041
1041
|
def setup
|
|
1042
1042
|
@light = TrafficLight.new
|
|
1043
1043
|
@light.state = 'proceed'
|
|
@@ -1052,7 +1052,7 @@ class TrafficLightProceedTest < MiniTest::Test
|
|
|
1052
1052
|
end
|
|
1053
1053
|
end
|
|
1054
1054
|
|
|
1055
|
-
class TrafficLightCautionTest <
|
|
1055
|
+
class TrafficLightCautionTest < Minitest::Test
|
|
1056
1056
|
def setup
|
|
1057
1057
|
@light = TrafficLight.new
|
|
1058
1058
|
@light.state = 'caution'
|
data/test/test_helper.rb
CHANGED
|
@@ -8,7 +8,21 @@ require 'minitest'
|
|
|
8
8
|
require "minitest/autorun"
|
|
9
9
|
require 'enum_state_machine'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
def reset_rails_logger
|
|
12
|
+
Rails.logger = Logger.new(STDERR).tap do |logger|
|
|
13
|
+
logger.formatter = proc { |*, msg| "#{msg}\n" }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
reset_rails_logger
|
|
18
|
+
|
|
19
|
+
def set_rails_logger(io)
|
|
20
|
+
Rails.logger.instance_variable_get(:@logdev).tap do
|
|
21
|
+
Rails.logger.instance_variable_set(:@logdev, Logger::LogDevice.new(io))
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class Minitest::Test
|
|
12
26
|
def assert_nothing_raised
|
|
13
27
|
yield
|
|
14
28
|
rescue => ex
|
data/test/unit/branch_test.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
2
2
|
|
|
3
|
-
class BranchTest <
|
|
3
|
+
class BranchTest < Minitest::Test
|
|
4
4
|
def setup
|
|
5
5
|
@branch = EnumStateMachine::Branch.new(:from => :parked, :to => :idling)
|
|
6
6
|
end
|
|
@@ -27,7 +27,7 @@ class BranchTest < MiniTest::Test
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
class BranchWithNoRequirementsTest <
|
|
30
|
+
class BranchWithNoRequirementsTest < Minitest::Test
|
|
31
31
|
def setup
|
|
32
32
|
@object = Object.new
|
|
33
33
|
@branch = EnumStateMachine::Branch.new
|
|
@@ -62,7 +62,7 @@ class BranchWithNoRequirementsTest < MiniTest::Test
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
class BranchWithFromRequirementTest <
|
|
65
|
+
class BranchWithFromRequirementTest < Minitest::Test
|
|
66
66
|
def setup
|
|
67
67
|
@object = Object.new
|
|
68
68
|
@branch = EnumStateMachine::Branch.new(:from => :parked)
|
|
@@ -106,7 +106,7 @@ class BranchWithFromRequirementTest < MiniTest::Test
|
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
-
class BranchWithMultipleFromRequirementsTest <
|
|
109
|
+
class BranchWithMultipleFromRequirementsTest < Minitest::Test
|
|
110
110
|
def setup
|
|
111
111
|
@object = Object.new
|
|
112
112
|
@branch = EnumStateMachine::Branch.new(:from => [:idling, :parked])
|
|
@@ -125,7 +125,7 @@ class BranchWithMultipleFromRequirementsTest < MiniTest::Test
|
|
|
125
125
|
end
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
-
class BranchWithFromMatcherRequirementTest <
|
|
128
|
+
class BranchWithFromMatcherRequirementTest < Minitest::Test
|
|
129
129
|
def setup
|
|
130
130
|
@object = Object.new
|
|
131
131
|
@branch = EnumStateMachine::Branch.new(:from => EnumStateMachine::BlacklistMatcher.new([:idling, :parked]))
|
|
@@ -144,7 +144,7 @@ class BranchWithFromMatcherRequirementTest < MiniTest::Test
|
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
-
class BranchWithToRequirementTest <
|
|
147
|
+
class BranchWithToRequirementTest < Minitest::Test
|
|
148
148
|
def setup
|
|
149
149
|
@object = Object.new
|
|
150
150
|
@branch = EnumStateMachine::Branch.new(:to => :idling)
|
|
@@ -188,7 +188,7 @@ class BranchWithToRequirementTest < MiniTest::Test
|
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
|
|
191
|
-
class BranchWithMultipleToRequirementsTest <
|
|
191
|
+
class BranchWithMultipleToRequirementsTest < Minitest::Test
|
|
192
192
|
def setup
|
|
193
193
|
@object = Object.new
|
|
194
194
|
@branch = EnumStateMachine::Branch.new(:to => [:idling, :parked])
|
|
@@ -207,7 +207,7 @@ class BranchWithMultipleToRequirementsTest < MiniTest::Test
|
|
|
207
207
|
end
|
|
208
208
|
end
|
|
209
209
|
|
|
210
|
-
class BranchWithToMatcherRequirementTest <
|
|
210
|
+
class BranchWithToMatcherRequirementTest < Minitest::Test
|
|
211
211
|
def setup
|
|
212
212
|
@object = Object.new
|
|
213
213
|
@branch = EnumStateMachine::Branch.new(:to => EnumStateMachine::BlacklistMatcher.new([:idling, :parked]))
|
|
@@ -226,7 +226,7 @@ class BranchWithToMatcherRequirementTest < MiniTest::Test
|
|
|
226
226
|
end
|
|
227
227
|
end
|
|
228
228
|
|
|
229
|
-
class BranchWithOnRequirementTest <
|
|
229
|
+
class BranchWithOnRequirementTest < Minitest::Test
|
|
230
230
|
def setup
|
|
231
231
|
@object = Object.new
|
|
232
232
|
@branch = EnumStateMachine::Branch.new(:on => :ignite)
|
|
@@ -270,7 +270,7 @@ class BranchWithOnRequirementTest < MiniTest::Test
|
|
|
270
270
|
end
|
|
271
271
|
end
|
|
272
272
|
|
|
273
|
-
class BranchWithMultipleOnRequirementsTest <
|
|
273
|
+
class BranchWithMultipleOnRequirementsTest < Minitest::Test
|
|
274
274
|
def setup
|
|
275
275
|
@object = Object.new
|
|
276
276
|
@branch = EnumStateMachine::Branch.new(:on => [:ignite, :park])
|
|
@@ -285,7 +285,7 @@ class BranchWithMultipleOnRequirementsTest < MiniTest::Test
|
|
|
285
285
|
end
|
|
286
286
|
end
|
|
287
287
|
|
|
288
|
-
class BranchWithOnMatcherRequirementTest <
|
|
288
|
+
class BranchWithOnMatcherRequirementTest < Minitest::Test
|
|
289
289
|
def setup
|
|
290
290
|
@object = Object.new
|
|
291
291
|
@branch = EnumStateMachine::Branch.new(:on => EnumStateMachine::BlacklistMatcher.new([:ignite, :park]))
|
|
@@ -300,7 +300,7 @@ class BranchWithOnMatcherRequirementTest < MiniTest::Test
|
|
|
300
300
|
end
|
|
301
301
|
end
|
|
302
302
|
|
|
303
|
-
class BranchWithExceptFromRequirementTest <
|
|
303
|
+
class BranchWithExceptFromRequirementTest < Minitest::Test
|
|
304
304
|
def setup
|
|
305
305
|
@object = Object.new
|
|
306
306
|
@branch = EnumStateMachine::Branch.new(:except_from => :parked)
|
|
@@ -335,7 +335,7 @@ class BranchWithExceptFromRequirementTest < MiniTest::Test
|
|
|
335
335
|
end
|
|
336
336
|
end
|
|
337
337
|
|
|
338
|
-
class BranchWithMultipleExceptFromRequirementsTest <
|
|
338
|
+
class BranchWithMultipleExceptFromRequirementsTest < Minitest::Test
|
|
339
339
|
def setup
|
|
340
340
|
@object = Object.new
|
|
341
341
|
@branch = EnumStateMachine::Branch.new(:except_from => [:idling, :parked])
|
|
@@ -354,7 +354,7 @@ class BranchWithMultipleExceptFromRequirementsTest < MiniTest::Test
|
|
|
354
354
|
end
|
|
355
355
|
end
|
|
356
356
|
|
|
357
|
-
class BranchWithExceptFromMatcherRequirementTest <
|
|
357
|
+
class BranchWithExceptFromMatcherRequirementTest < Minitest::Test
|
|
358
358
|
def test_should_raise_an_exception
|
|
359
359
|
exception = assert_raises(ArgumentError) {
|
|
360
360
|
EnumStateMachine::Branch.new(:except_from => EnumStateMachine::AllMatcher.instance)
|
|
@@ -363,7 +363,7 @@ class BranchWithExceptFromMatcherRequirementTest < MiniTest::Test
|
|
|
363
363
|
end
|
|
364
364
|
end
|
|
365
365
|
|
|
366
|
-
class BranchWithExceptToRequirementTest <
|
|
366
|
+
class BranchWithExceptToRequirementTest < Minitest::Test
|
|
367
367
|
def setup
|
|
368
368
|
@object = Object.new
|
|
369
369
|
@branch = EnumStateMachine::Branch.new(:except_to => :idling)
|
|
@@ -398,7 +398,7 @@ class BranchWithExceptToRequirementTest < MiniTest::Test
|
|
|
398
398
|
end
|
|
399
399
|
end
|
|
400
400
|
|
|
401
|
-
class BranchWithMultipleExceptToRequirementsTest <
|
|
401
|
+
class BranchWithMultipleExceptToRequirementsTest < Minitest::Test
|
|
402
402
|
def setup
|
|
403
403
|
@object = Object.new
|
|
404
404
|
@branch = EnumStateMachine::Branch.new(:except_to => [:idling, :parked])
|
|
@@ -417,7 +417,7 @@ class BranchWithMultipleExceptToRequirementsTest < MiniTest::Test
|
|
|
417
417
|
end
|
|
418
418
|
end
|
|
419
419
|
|
|
420
|
-
class BranchWithExceptToMatcherRequirementTest <
|
|
420
|
+
class BranchWithExceptToMatcherRequirementTest < Minitest::Test
|
|
421
421
|
def test_should_raise_an_exception
|
|
422
422
|
exception = assert_raises(ArgumentError) {
|
|
423
423
|
EnumStateMachine::Branch.new(:except_to => EnumStateMachine::AllMatcher.instance)
|
|
@@ -426,7 +426,7 @@ class BranchWithExceptToMatcherRequirementTest < MiniTest::Test
|
|
|
426
426
|
end
|
|
427
427
|
end
|
|
428
428
|
|
|
429
|
-
class BranchWithExceptOnRequirementTest <
|
|
429
|
+
class BranchWithExceptOnRequirementTest < Minitest::Test
|
|
430
430
|
def setup
|
|
431
431
|
@object = Object.new
|
|
432
432
|
@branch = EnumStateMachine::Branch.new(:except_on => :ignite)
|
|
@@ -461,7 +461,7 @@ class BranchWithExceptOnRequirementTest < MiniTest::Test
|
|
|
461
461
|
end
|
|
462
462
|
end
|
|
463
463
|
|
|
464
|
-
class BranchWithExceptOnMatcherRequirementTest <
|
|
464
|
+
class BranchWithExceptOnMatcherRequirementTest < Minitest::Test
|
|
465
465
|
def test_should_raise_an_exception
|
|
466
466
|
exception = assert_raises(ArgumentError) {
|
|
467
467
|
EnumStateMachine::Branch.new(:except_on => EnumStateMachine::AllMatcher.instance)
|
|
@@ -470,7 +470,7 @@ class BranchWithExceptOnMatcherRequirementTest < MiniTest::Test
|
|
|
470
470
|
end
|
|
471
471
|
end
|
|
472
472
|
|
|
473
|
-
class BranchWithMultipleExceptOnRequirementsTest <
|
|
473
|
+
class BranchWithMultipleExceptOnRequirementsTest < Minitest::Test
|
|
474
474
|
def setup
|
|
475
475
|
@object = Object.new
|
|
476
476
|
@branch = EnumStateMachine::Branch.new(:except_on => [:ignite, :park])
|
|
@@ -485,7 +485,7 @@ class BranchWithMultipleExceptOnRequirementsTest < MiniTest::Test
|
|
|
485
485
|
end
|
|
486
486
|
end
|
|
487
487
|
|
|
488
|
-
class BranchWithConflictingFromRequirementsTest <
|
|
488
|
+
class BranchWithConflictingFromRequirementsTest < Minitest::Test
|
|
489
489
|
def test_should_raise_an_exception
|
|
490
490
|
exception = assert_raises(ArgumentError) {
|
|
491
491
|
EnumStateMachine::Branch.new(:from => :parked, :except_from => :parked)
|
|
@@ -494,7 +494,7 @@ class BranchWithConflictingFromRequirementsTest < MiniTest::Test
|
|
|
494
494
|
end
|
|
495
495
|
end
|
|
496
496
|
|
|
497
|
-
class BranchWithConflictingToRequirementsTest <
|
|
497
|
+
class BranchWithConflictingToRequirementsTest < Minitest::Test
|
|
498
498
|
def test_should_raise_an_exception
|
|
499
499
|
exception = assert_raises(ArgumentError) {
|
|
500
500
|
EnumStateMachine::Branch.new(:to => :idling, :except_to => :idling)
|
|
@@ -503,7 +503,7 @@ class BranchWithConflictingToRequirementsTest < MiniTest::Test
|
|
|
503
503
|
end
|
|
504
504
|
end
|
|
505
505
|
|
|
506
|
-
class BranchWithConflictingOnRequirementsTest <
|
|
506
|
+
class BranchWithConflictingOnRequirementsTest < Minitest::Test
|
|
507
507
|
def test_should_raise_an_exception
|
|
508
508
|
exception = assert_raises(ArgumentError) {
|
|
509
509
|
EnumStateMachine::Branch.new(:on => :ignite, :except_on => :ignite)
|
|
@@ -512,7 +512,7 @@ class BranchWithConflictingOnRequirementsTest < MiniTest::Test
|
|
|
512
512
|
end
|
|
513
513
|
end
|
|
514
514
|
|
|
515
|
-
class BranchWithDifferentRequirementsTest <
|
|
515
|
+
class BranchWithDifferentRequirementsTest < Minitest::Test
|
|
516
516
|
def setup
|
|
517
517
|
@object = Object.new
|
|
518
518
|
@branch = EnumStateMachine::Branch.new(:from => :parked, :to => :idling, :on => :ignite)
|
|
@@ -552,7 +552,7 @@ class BranchWithDifferentRequirementsTest < MiniTest::Test
|
|
|
552
552
|
end
|
|
553
553
|
end
|
|
554
554
|
|
|
555
|
-
class BranchWithNilRequirementsTest <
|
|
555
|
+
class BranchWithNilRequirementsTest < Minitest::Test
|
|
556
556
|
def setup
|
|
557
557
|
@object = Object.new
|
|
558
558
|
@branch = EnumStateMachine::Branch.new(:from => nil, :to => nil)
|
|
@@ -579,7 +579,7 @@ class BranchWithNilRequirementsTest < MiniTest::Test
|
|
|
579
579
|
end
|
|
580
580
|
end
|
|
581
581
|
|
|
582
|
-
class BranchWithImplicitRequirementTest <
|
|
582
|
+
class BranchWithImplicitRequirementTest < Minitest::Test
|
|
583
583
|
def setup
|
|
584
584
|
@branch = EnumStateMachine::Branch.new(:parked => :idling, :on => :ignite)
|
|
585
585
|
end
|
|
@@ -598,7 +598,7 @@ class BranchWithImplicitRequirementTest < MiniTest::Test
|
|
|
598
598
|
end
|
|
599
599
|
end
|
|
600
600
|
|
|
601
|
-
class BranchWithMultipleImplicitRequirementsTest <
|
|
601
|
+
class BranchWithMultipleImplicitRequirementsTest < Minitest::Test
|
|
602
602
|
def setup
|
|
603
603
|
@object = Object.new
|
|
604
604
|
@branch = EnumStateMachine::Branch.new(:parked => :idling, :idling => :first_gear, :on => :ignite)
|
|
@@ -650,7 +650,7 @@ class BranchWithMultipleImplicitRequirementsTest < MiniTest::Test
|
|
|
650
650
|
end
|
|
651
651
|
end
|
|
652
652
|
|
|
653
|
-
class BranchWithImplicitFromRequirementMatcherTest <
|
|
653
|
+
class BranchWithImplicitFromRequirementMatcherTest < Minitest::Test
|
|
654
654
|
def setup
|
|
655
655
|
@matcher = EnumStateMachine::BlacklistMatcher.new(:parked)
|
|
656
656
|
@branch = EnumStateMachine::Branch.new(@matcher => :idling)
|
|
@@ -665,7 +665,7 @@ class BranchWithImplicitFromRequirementMatcherTest < MiniTest::Test
|
|
|
665
665
|
end
|
|
666
666
|
end
|
|
667
667
|
|
|
668
|
-
class BranchWithImplicitToRequirementMatcherTest <
|
|
668
|
+
class BranchWithImplicitToRequirementMatcherTest < Minitest::Test
|
|
669
669
|
def setup
|
|
670
670
|
@matcher = EnumStateMachine::BlacklistMatcher.new(:idling)
|
|
671
671
|
@branch = EnumStateMachine::Branch.new(:parked => @matcher)
|
|
@@ -680,7 +680,7 @@ class BranchWithImplicitToRequirementMatcherTest < MiniTest::Test
|
|
|
680
680
|
end
|
|
681
681
|
end
|
|
682
682
|
|
|
683
|
-
class BranchWithImplicitAndExplicitRequirementsTest <
|
|
683
|
+
class BranchWithImplicitAndExplicitRequirementsTest < Minitest::Test
|
|
684
684
|
def setup
|
|
685
685
|
@branch = EnumStateMachine::Branch.new(:parked => :idling, :from => :parked)
|
|
686
686
|
end
|
|
@@ -702,7 +702,7 @@ class BranchWithImplicitAndExplicitRequirementsTest < MiniTest::Test
|
|
|
702
702
|
end
|
|
703
703
|
end
|
|
704
704
|
|
|
705
|
-
class BranchWithIfConditionalTest <
|
|
705
|
+
class BranchWithIfConditionalTest < Minitest::Test
|
|
706
706
|
def setup
|
|
707
707
|
@object = Object.new
|
|
708
708
|
end
|
|
@@ -728,7 +728,7 @@ class BranchWithIfConditionalTest < MiniTest::Test
|
|
|
728
728
|
end
|
|
729
729
|
end
|
|
730
730
|
|
|
731
|
-
class BranchWithMultipleIfConditionalsTest <
|
|
731
|
+
class BranchWithMultipleIfConditionalsTest < Minitest::Test
|
|
732
732
|
def setup
|
|
733
733
|
@object = Object.new
|
|
734
734
|
end
|
|
@@ -747,7 +747,7 @@ class BranchWithMultipleIfConditionalsTest < MiniTest::Test
|
|
|
747
747
|
end
|
|
748
748
|
end
|
|
749
749
|
|
|
750
|
-
class BranchWithUnlessConditionalTest <
|
|
750
|
+
class BranchWithUnlessConditionalTest < Minitest::Test
|
|
751
751
|
def setup
|
|
752
752
|
@object = Object.new
|
|
753
753
|
end
|
|
@@ -773,7 +773,7 @@ class BranchWithUnlessConditionalTest < MiniTest::Test
|
|
|
773
773
|
end
|
|
774
774
|
end
|
|
775
775
|
|
|
776
|
-
class BranchWithMultipleUnlessConditionalsTest <
|
|
776
|
+
class BranchWithMultipleUnlessConditionalsTest < Minitest::Test
|
|
777
777
|
def setup
|
|
778
778
|
@object = Object.new
|
|
779
779
|
end
|
|
@@ -792,7 +792,7 @@ class BranchWithMultipleUnlessConditionalsTest < MiniTest::Test
|
|
|
792
792
|
end
|
|
793
793
|
end
|
|
794
794
|
|
|
795
|
-
class BranchWithConflictingConditionalsTest <
|
|
795
|
+
class BranchWithConflictingConditionalsTest < Minitest::Test
|
|
796
796
|
def setup
|
|
797
797
|
@object = Object.new
|
|
798
798
|
end
|
|
@@ -818,7 +818,7 @@ class BranchWithConflictingConditionalsTest < MiniTest::Test
|
|
|
818
818
|
end
|
|
819
819
|
end
|
|
820
820
|
|
|
821
|
-
class BranchWithoutGuardsTest <
|
|
821
|
+
class BranchWithoutGuardsTest < Minitest::Test
|
|
822
822
|
def setup
|
|
823
823
|
@object = Object.new
|
|
824
824
|
end
|
|
@@ -848,7 +848,7 @@ begin
|
|
|
848
848
|
# Load library
|
|
849
849
|
require 'graphviz'
|
|
850
850
|
|
|
851
|
-
class BranchDrawingTest <
|
|
851
|
+
class BranchDrawingTest < Minitest::Test
|
|
852
852
|
def setup
|
|
853
853
|
@machine = EnumStateMachine::Machine.new(Class.new)
|
|
854
854
|
states = [:parked, :idling]
|
|
@@ -878,7 +878,7 @@ begin
|
|
|
878
878
|
end
|
|
879
879
|
end
|
|
880
880
|
|
|
881
|
-
class BranchDrawingWithFromRequirementTest <
|
|
881
|
+
class BranchDrawingWithFromRequirementTest < Minitest::Test
|
|
882
882
|
def setup
|
|
883
883
|
@machine = EnumStateMachine::Machine.new(Class.new)
|
|
884
884
|
states = [:parked, :idling, :first_gear]
|
|
@@ -899,7 +899,7 @@ begin
|
|
|
899
899
|
end
|
|
900
900
|
end
|
|
901
901
|
|
|
902
|
-
class BranchDrawingWithExceptFromRequirementTest <
|
|
902
|
+
class BranchDrawingWithExceptFromRequirementTest < Minitest::Test
|
|
903
903
|
def setup
|
|
904
904
|
@machine = EnumStateMachine::Machine.new(Class.new)
|
|
905
905
|
states = [:parked, :idling, :first_gear]
|
|
@@ -920,7 +920,7 @@ begin
|
|
|
920
920
|
end
|
|
921
921
|
end
|
|
922
922
|
|
|
923
|
-
class BranchDrawingWithoutFromRequirementTest <
|
|
923
|
+
class BranchDrawingWithoutFromRequirementTest < Minitest::Test
|
|
924
924
|
def setup
|
|
925
925
|
@machine = EnumStateMachine::Machine.new(Class.new)
|
|
926
926
|
states = [:parked, :idling, :first_gear]
|
|
@@ -941,7 +941,7 @@ begin
|
|
|
941
941
|
end
|
|
942
942
|
end
|
|
943
943
|
|
|
944
|
-
class BranchDrawingWithoutToRequirementTest <
|
|
944
|
+
class BranchDrawingWithoutToRequirementTest < Minitest::Test
|
|
945
945
|
def setup
|
|
946
946
|
@machine = EnumStateMachine::Machine.new(Class.new)
|
|
947
947
|
|
|
@@ -959,7 +959,7 @@ begin
|
|
|
959
959
|
end
|
|
960
960
|
end
|
|
961
961
|
|
|
962
|
-
class BranchDrawingWithNilStateTest <
|
|
962
|
+
class BranchDrawingWithNilStateTest < Minitest::Test
|
|
963
963
|
def setup
|
|
964
964
|
@machine = EnumStateMachine::Machine.new(Class.new)
|
|
965
965
|
|