aasm 3.0.20 → 3.0.21

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.0.21
4
+
5
+ * support nested ActiveRecord transactions ([@ozeias](https://github.com/ozeias))
6
+ * allow overwriting of events, can be very useful with inheritance ([@Intrepidd](https://github.com/Intrepidd))
7
+
3
8
  ## 3.0.20
4
9
 
5
10
  * added configuration option to disable automatic scope creation
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # AASM - Ruby state machines [![Build Status](https://secure.travis-ci.org/aasm/aasm.png)](http://travis-ci.org/aasm/aasm) [![Code Climate](https://codeclimate.com/github/aasm/aasm.png)](https://codeclimate.com/github/aasm/aasm) [![Coverage Status](https://coveralls.io/repos/aasm/aasm/badge.png?branch=master)](https://coveralls.io/r/aasm/aasm)
1
+ # AASM - Ruby state machines
2
+
3
+ [![Build Status](https://secure.travis-ci.org/aasm/aasm.png?branch=master)](http://travis-ci.org/aasm/aasm) [![Code Climate](https://codeclimate.com/github/aasm/aasm.png)](https://codeclimate.com/github/aasm/aasm) [![Coverage Status](https://coveralls.io/repos/aasm/aasm/badge.png?branch=master)](https://coveralls.io/r/aasm/aasm)
2
4
 
3
5
  This package contains AASM, a library for adding finite state machines to Ruby classes.
4
6
 
data/lib/aasm/base.rb CHANGED
@@ -48,9 +48,7 @@ module AASM
48
48
  def event(name, options={}, &block)
49
49
  # @clazz.aasm_event(name, options, &block)
50
50
 
51
- unless @state_machine.events.has_key?(name)
52
- @state_machine.events[name] = AASM::Event.new(name, options, &block)
53
- end
51
+ @state_machine.events[name] = AASM::Event.new(name, options, &block)
54
52
 
55
53
  # an addition over standard aasm so that, before firing an event, you can ask
56
54
  # may_event? and get back a boolean that tells you whether the guard method
@@ -132,7 +132,7 @@ module AASM
132
132
  end
133
133
 
134
134
  def aasm_fire_event(name, options, *args)
135
- transaction do
135
+ transaction(:requires_new => true) do
136
136
  super
137
137
  end
138
138
  end
data/lib/aasm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "3.0.20"
2
+ VERSION = "3.0.21"
3
3
  end
@@ -179,9 +179,10 @@ describe 'transitions with persistence' do
179
179
  end
180
180
 
181
181
  describe 'transactions' do
182
+ let(:worker) { Worker.create!(:name => 'worker', :status => 'sleeping') }
183
+ let(:transactor) { Transactor.create!(:name => 'transactor', :worker => worker) }
184
+
182
185
  it 'should rollback all changes' do
183
- worker = Worker.create!(:name => 'worker', :status => 'sleeping')
184
- transactor = Transactor.create!(:name => 'transactor', :worker => worker)
185
186
  transactor.should be_sleeping
186
187
  worker.status.should == 'sleeping'
187
188
 
@@ -189,6 +190,17 @@ describe 'transitions with persistence' do
189
190
  transactor.should be_running
190
191
  worker.reload.status.should == 'sleeping'
191
192
  end
192
- end
193
193
 
194
+ it "should rollback all changes in nested transaction" do
195
+ transactor.should be_sleeping
196
+ worker.status.should == 'sleeping'
197
+
198
+ Worker.transaction do
199
+ lambda { transactor.run! }.should raise_error(StandardError, 'failed on purpose')
200
+ end
201
+
202
+ transactor.should be_running
203
+ worker.reload.status.should == 'sleeping'
204
+ end
205
+ end
194
206
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.20
4
+ version: 3.0.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,27 +12,22 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-08-06 00:00:00.000000000 Z
15
+ date: 2013-08-27 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activerecord
19
- requirement: !ruby/object:Gem::Requirement
19
+ requirement: &70183071498180 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
- - - '='
22
+ - - =
23
23
  - !ruby/object:Gem::Version
24
24
  version: 3.2.12
25
25
  type: :development
26
26
  prerelease: false
27
- version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - '='
31
- - !ruby/object:Gem::Version
32
- version: 3.2.12
27
+ version_requirements: *70183071498180
33
28
  - !ruby/object:Gem::Dependency
34
29
  name: mongoid
35
- requirement: !ruby/object:Gem::Requirement
30
+ requirement: &70183071497520 !ruby/object:Gem::Requirement
36
31
  none: false
37
32
  requirements:
38
33
  - - ! '>='
@@ -40,15 +35,10 @@ dependencies:
40
35
  version: '0'
41
36
  type: :development
42
37
  prerelease: false
43
- version_requirements: !ruby/object:Gem::Requirement
44
- none: false
45
- requirements:
46
- - - ! '>='
47
- - !ruby/object:Gem::Version
48
- version: '0'
38
+ version_requirements: *70183071497520
49
39
  - !ruby/object:Gem::Dependency
50
40
  name: rake
51
- requirement: !ruby/object:Gem::Requirement
41
+ requirement: &70183071497060 !ruby/object:Gem::Requirement
52
42
  none: false
53
43
  requirements:
54
44
  - - ! '>='
@@ -56,15 +46,10 @@ dependencies:
56
46
  version: '0'
57
47
  type: :development
58
48
  prerelease: false
59
- version_requirements: !ruby/object:Gem::Requirement
60
- none: false
61
- requirements:
62
- - - ! '>='
63
- - !ruby/object:Gem::Version
64
- version: '0'
49
+ version_requirements: *70183071497060
65
50
  - !ruby/object:Gem::Dependency
66
51
  name: sdoc
67
- requirement: !ruby/object:Gem::Requirement
52
+ requirement: &70183071496640 !ruby/object:Gem::Requirement
68
53
  none: false
69
54
  requirements:
70
55
  - - ! '>='
@@ -72,15 +57,10 @@ dependencies:
72
57
  version: '0'
73
58
  type: :development
74
59
  prerelease: false
75
- version_requirements: !ruby/object:Gem::Requirement
76
- none: false
77
- requirements:
78
- - - ! '>='
79
- - !ruby/object:Gem::Version
80
- version: '0'
60
+ version_requirements: *70183071496640
81
61
  - !ruby/object:Gem::Dependency
82
62
  name: rspec
83
- requirement: !ruby/object:Gem::Requirement
63
+ requirement: &70183071496140 !ruby/object:Gem::Requirement
84
64
  none: false
85
65
  requirements:
86
66
  - - ~>
@@ -88,15 +68,10 @@ dependencies:
88
68
  version: '2.0'
89
69
  type: :development
90
70
  prerelease: false
91
- version_requirements: !ruby/object:Gem::Requirement
92
- none: false
93
- requirements:
94
- - - ~>
95
- - !ruby/object:Gem::Version
96
- version: '2.0'
71
+ version_requirements: *70183071496140
97
72
  - !ruby/object:Gem::Dependency
98
73
  name: rr
99
- requirement: !ruby/object:Gem::Requirement
74
+ requirement: &70183071495720 !ruby/object:Gem::Requirement
100
75
  none: false
101
76
  requirements:
102
77
  - - ! '>='
@@ -104,15 +79,10 @@ dependencies:
104
79
  version: '0'
105
80
  type: :development
106
81
  prerelease: false
107
- version_requirements: !ruby/object:Gem::Requirement
108
- none: false
109
- requirements:
110
- - - ! '>='
111
- - !ruby/object:Gem::Version
112
- version: '0'
82
+ version_requirements: *70183071495720
113
83
  - !ruby/object:Gem::Dependency
114
84
  name: sqlite3
115
- requirement: !ruby/object:Gem::Requirement
85
+ requirement: &70183071495260 !ruby/object:Gem::Requirement
116
86
  none: false
117
87
  requirements:
118
88
  - - ! '>='
@@ -120,15 +90,10 @@ dependencies:
120
90
  version: '0'
121
91
  type: :development
122
92
  prerelease: false
123
- version_requirements: !ruby/object:Gem::Requirement
124
- none: false
125
- requirements:
126
- - - ! '>='
127
- - !ruby/object:Gem::Version
128
- version: '0'
93
+ version_requirements: *70183071495260
129
94
  - !ruby/object:Gem::Dependency
130
95
  name: minitest
131
- requirement: !ruby/object:Gem::Requirement
96
+ requirement: &70183071494840 !ruby/object:Gem::Requirement
132
97
  none: false
133
98
  requirements:
134
99
  - - ! '>='
@@ -136,15 +101,10 @@ dependencies:
136
101
  version: '0'
137
102
  type: :development
138
103
  prerelease: false
139
- version_requirements: !ruby/object:Gem::Requirement
140
- none: false
141
- requirements:
142
- - - ! '>='
143
- - !ruby/object:Gem::Version
144
- version: '0'
104
+ version_requirements: *70183071494840
145
105
  - !ruby/object:Gem::Dependency
146
106
  name: ruby-debug-completion
147
- requirement: !ruby/object:Gem::Requirement
107
+ requirement: &70183071494420 !ruby/object:Gem::Requirement
148
108
  none: false
149
109
  requirements:
150
110
  - - ! '>='
@@ -152,15 +112,10 @@ dependencies:
152
112
  version: '0'
153
113
  type: :development
154
114
  prerelease: false
155
- version_requirements: !ruby/object:Gem::Requirement
156
- none: false
157
- requirements:
158
- - - ! '>='
159
- - !ruby/object:Gem::Version
160
- version: '0'
115
+ version_requirements: *70183071494420
161
116
  - !ruby/object:Gem::Dependency
162
117
  name: coveralls
163
- requirement: !ruby/object:Gem::Requirement
118
+ requirement: &70183071494000 !ruby/object:Gem::Requirement
164
119
  none: false
165
120
  requirements:
166
121
  - - ! '>='
@@ -168,12 +123,7 @@ dependencies:
168
123
  version: '0'
169
124
  type: :development
170
125
  prerelease: false
171
- version_requirements: !ruby/object:Gem::Requirement
172
- none: false
173
- requirements:
174
- - - ! '>='
175
- - !ruby/object:Gem::Version
176
- version: '0'
126
+ version_requirements: *70183071494000
177
127
  description: AASM is a continuation of the acts as state machine rails plugin, built
178
128
  for plain Ruby objects.
179
129
  email: scott@elitists.net, ttilley@gmail.com, aasm@mt7.de
@@ -273,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
223
  version: '0'
274
224
  requirements: []
275
225
  rubyforge_project:
276
- rubygems_version: 1.8.24
226
+ rubygems_version: 1.8.11
277
227
  signing_key:
278
228
  specification_version: 3
279
229
  summary: State machine mixin for Ruby objects