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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b22515a8243f2b3c2b2a3add22b3ffc39aac00a
4
- data.tar.gz: cec1e3e10169e953134e8efaab57314b9a9b539c
3
+ metadata.gz: b5d139653d0729ff569bc8da90d7e81d69489016
4
+ data.tar.gz: da010dd679fd1d2741ceccc6d66b54b0c60fc024
5
5
  SHA512:
6
- metadata.gz: 47957db32525246bfd51584d58b1a9204d17e2a8836f965d9ae45bf38603dfe7010a4b7cc168f129f6dd1ef517f3bb878c04da5f97f23a330d1f66c027f2ad29
7
- data.tar.gz: 29cdc113a112f6ce1b42480294f4dbd0e95efba38dde074b5ba403e0b0b17b1c4e4cfac199814f1a228312bb49b3e01f7c8c19056b546f1708c8c1b0c677d919
6
+ metadata.gz: b55e298b75b9ee4dba5d16ba37811a3c1f920dea2e2bbd375e2e85692d48c2f382926a370ed8a59809c5710fecd4f3748385461440a40ca32f24ab86e4cdc530
7
+ data.tar.gz: 04c57124f7bed1cac79216c0dcac7e6888078bd87d11f2a4c058751689a188866c842429180259d047ddba2b1547e110ade0cfa0862fb5bc17c3f4d8594dd9a5
@@ -1,3 +1,3 @@
1
1
  module StateTransition
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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 "init state" do
16
- before :all do
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.3
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-08-28 00:00:00.000000000 Z
11
+ date: 2013-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler