state_transition 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/state_transition/version.rb +1 -1
- data/lib/state_transition.rb +7 -0
- data/spec/state_transition_spec.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5d139653d0729ff569bc8da90d7e81d69489016
|
4
|
+
data.tar.gz: da010dd679fd1d2741ceccc6d66b54b0c60fc024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b55e298b75b9ee4dba5d16ba37811a3c1f920dea2e2bbd375e2e85692d48c2f382926a370ed8a59809c5710fecd4f3748385461440a40ca32f24ab86e4cdc530
|
7
|
+
data.tar.gz: 04c57124f7bed1cac79216c0dcac7e6888078bd87d11f2a4c058751689a188866c842429180259d047ddba2b1547e110ade0cfa0862fb5bc17c3f4d8594dd9a5
|
data/lib/state_transition.rb
CHANGED
@@ -23,6 +23,13 @@ module StateTransition
|
|
23
23
|
create_callbacks(data[:callbacks] || [])
|
24
24
|
end
|
25
25
|
|
26
|
+
def initialize_copy(org)
|
27
|
+
@callbacks = @callbacks.dup
|
28
|
+
@state_list = @state_list.dup
|
29
|
+
@state_graph = @state_graph.dup
|
30
|
+
@define_actions = @define_actions.dup
|
31
|
+
end
|
32
|
+
|
26
33
|
def have_state?(state)
|
27
34
|
@state_list.include?(state.to_sym)
|
28
35
|
end
|
@@ -12,8 +12,8 @@ describe StateTransition do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
describe "
|
16
|
-
before :
|
15
|
+
describe "state machine" do
|
16
|
+
before :each do
|
17
17
|
@sequence = []
|
18
18
|
@state = StateTransition::StateMachine.new({
|
19
19
|
initial: :first,
|
@@ -110,5 +110,15 @@ describe StateTransition do
|
|
110
110
|
lambda{ @state.three }.should raise_error(StandardError)
|
111
111
|
end
|
112
112
|
end
|
113
|
+
|
114
|
+
describe "about duplicated" do
|
115
|
+
it "should not influence state change" do
|
116
|
+
@copy = @state.dup
|
117
|
+
@state.add_action(name: 'test', from: 'hoge', to: 'piyo')
|
118
|
+
|
119
|
+
@copy.have_state?(:hoge).should be_false
|
120
|
+
@copy.have_state?(:piyo).should be_false
|
121
|
+
end
|
122
|
+
end
|
113
123
|
end
|
114
124
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_transition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- siman-man
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|