state_machines 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/cssxfire.xml +9 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +12 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/state_machine2.iml +34 -0
- data/.idea/vcs.xml +9 -0
- data/.idea/workspace.xml +1156 -0
- data/.rspec +3 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +23 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/state_machines/assertions.rb +40 -0
- data/lib/state_machines/branch.rb +187 -0
- data/lib/state_machines/callback.rb +220 -0
- data/lib/state_machines/core.rb +25 -0
- data/lib/state_machines/core_ext/class/state_machine.rb +5 -0
- data/lib/state_machines/core_ext.rb +2 -0
- data/lib/state_machines/error.rb +13 -0
- data/lib/state_machines/eval_helpers.rb +87 -0
- data/lib/state_machines/event.rb +246 -0
- data/lib/state_machines/event_collection.rb +141 -0
- data/lib/state_machines/extensions.rb +148 -0
- data/lib/state_machines/helper_module.rb +17 -0
- data/lib/state_machines/integrations/base.rb +100 -0
- data/lib/state_machines/integrations.rb +113 -0
- data/lib/state_machines/machine.rb +2234 -0
- data/lib/state_machines/machine_collection.rb +84 -0
- data/lib/state_machines/macro_methods.rb +520 -0
- data/lib/state_machines/matcher.rb +123 -0
- data/lib/state_machines/matcher_helpers.rb +54 -0
- data/lib/state_machines/node_collection.rb +221 -0
- data/lib/state_machines/path.rb +120 -0
- data/lib/state_machines/path_collection.rb +90 -0
- data/lib/state_machines/state.rb +276 -0
- data/lib/state_machines/state_collection.rb +112 -0
- data/lib/state_machines/state_context.rb +138 -0
- data/lib/state_machines/transition.rb +470 -0
- data/lib/state_machines/transition_collection.rb +245 -0
- data/lib/state_machines/version.rb +3 -0
- data/lib/state_machines/yard.rb +8 -0
- data/lib/state_machines.rb +3 -0
- data/spec/errors/default_spec.rb +14 -0
- data/spec/errors/with_message_spec.rb +39 -0
- data/spec/helpers/helper_spec.rb +14 -0
- data/spec/internal/app/models/auto_shop.rb +31 -0
- data/spec/internal/app/models/car.rb +19 -0
- data/spec/internal/app/models/model_base.rb +6 -0
- data/spec/internal/app/models/motorcycle.rb +9 -0
- data/spec/internal/app/models/traffic_light.rb +47 -0
- data/spec/internal/app/models/vehicle.rb +123 -0
- data/spec/machine_spec.rb +3167 -0
- data/spec/matcher_helpers_spec.rb +39 -0
- data/spec/matcher_spec.rb +157 -0
- data/spec/models/auto_shop_spec.rb +41 -0
- data/spec/models/car_spec.rb +90 -0
- data/spec/models/motorcycle_spec.rb +44 -0
- data/spec/models/traffic_light_spec.rb +56 -0
- data/spec/models/vehicle_spec.rb +580 -0
- data/spec/node_collection_spec.rb +371 -0
- data/spec/path_collection_spec.rb +271 -0
- data/spec/path_spec.rb +488 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/state_collection_spec.rb +352 -0
- data/spec/state_context_spec.rb +442 -0
- data/spec/state_machine_spec.rb +29 -0
- data/spec/state_spec.rb +970 -0
- data/spec/support/migration_helpers.rb +50 -0
- data/spec/support/models.rb +6 -0
- data/spec/transition_collection_spec.rb +2199 -0
- data/spec/transition_spec.rb +1558 -0
- data/state_machines.gemspec +23 -0
- metadata +194 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
# Remove this file when refactoring is done
|
2
|
+
|
3
|
+
def assert(obj)
|
4
|
+
expect(obj).to be_truthy
|
5
|
+
end
|
6
|
+
|
7
|
+
def assert_equal(value, obj)
|
8
|
+
expect(obj).to eq(value)
|
9
|
+
end
|
10
|
+
|
11
|
+
def assert_not_equal(value, obj)
|
12
|
+
expect(obj).to_not eq(value)
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def assert_not_nil(obj)
|
17
|
+
expect(obj).to_not be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def assert_nil(obj)
|
21
|
+
expect(obj).to be_nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def assert_raise(exception, &block)
|
25
|
+
expect(block).to raise_error(exception)
|
26
|
+
end
|
27
|
+
|
28
|
+
def assert_nothing_thrown(&block)
|
29
|
+
expect(block).to_not raise_error
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def assert_nothing_raised(&block)
|
34
|
+
expect(block).to_not raise_error
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
def assert_same(value, obj)
|
39
|
+
expect(obj).to equal(value)
|
40
|
+
end
|
41
|
+
|
42
|
+
def assert_not_same(value, obj)
|
43
|
+
expect(obj).to_not equal(value)
|
44
|
+
end
|
45
|
+
|
46
|
+
def assert_instance_of(klass, obj)
|
47
|
+
expect(obj).to be_a klass
|
48
|
+
end
|
49
|
+
|
50
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../internal/app/models/model_base')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../internal/app/models/vehicle')
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../internal/app/models/car')
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + '/../internal/app/models/auto_shop')
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + '/../internal/app/models/motorcycle')
|
6
|
+
require File.expand_path(File.dirname(__FILE__) + '/../internal/app/models/traffic_light')
|