aasm 3.3.2 → 3.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83a1f3168fccb10e8b1514ced2d81ec931c5c53a
4
- data.tar.gz: 216b3cdd8404f5b2cd963c99a975946848a06e69
3
+ metadata.gz: bfaa647a858b7edb82248c4eb3fc9ccc8ad25c3a
4
+ data.tar.gz: ef830c2521b024474530bce0c814763cadfd7688
5
5
  SHA512:
6
- metadata.gz: ea1641220521468b48b11ce9e8fb868a85d1e34d44ddc8256cb2a26ccc055f2cddcf3b557358a651239d2d6cc5d3bedf6f53e9baaf9122b6329c5d3cdd2ed25e
7
- data.tar.gz: 2f4e51a87d973d04a16cd64692d0fbcf48df87ab7ee8d412411ca7cb742005b68f7a7ee2ae3d953b0ab01bd8f7956ffd98dd95ba6eda0e3e9b7a6b3533eaa0ea
6
+ metadata.gz: 0651274c41ba3dbc905b8cab1e47a812d18e422d8c4045344c705a956246112e36e4bbb255c7107fbd03b8992504d4498b6c60c224dddd4bd6dca75372bcdeee
7
+ data.tar.gz: c5ac9cc392993b3e416578d20fcacff1ddec041e48d4aebe37425e29475b7b882ed1fd5423f89d1f030c4bed53e816000ca189adc9a9f48b97373356552ae4f7
@@ -4,6 +4,10 @@
4
4
 
5
5
  * deprecated old aasm_* class methods (old-style DSL), in preparation for AASM v4.0.0
6
6
 
7
+ ## 3.3.3
8
+
9
+ * bugfix: support reloading development environment in Rails (see [issue #148](https://github.com/aasm/aasm/issues/148))
10
+
7
11
  ## 3.3.2
8
12
 
9
13
  * bugfix: avoid conflicts with `failed` and `fired` event names (see [issue #157](https://github.com/aasm/aasm/issues/157)), thanks to [@MichaelXavier](https://github.com/MichaelXavier)
@@ -5,7 +5,7 @@ require "aasm/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "aasm"
7
7
  s.version = AASM::VERSION
8
- s.authors = ["Scott Barron", "Scott Petersen", "Travis Tilley", "Thorsten Boettger"]
8
+ s.authors = ["Scott Barron", "Travis Tilley", "Thorsten Boettger"]
9
9
  s.email = %q{scott@elitists.net, ttilley@gmail.com, aasm@mt7.de}
10
10
  s.homepage = %q{https://github.com/aasm/aasm}
11
11
  s.summary = %q{State machine mixin for Ruby objects}
@@ -28,7 +28,11 @@ module AASM
28
28
 
29
29
  def add_state(name, klass, options)
30
30
  set_initial_state(name, options)
31
- @states << AASM::State.new(name, klass, options) unless @states.include?(name)
31
+
32
+ # allow reloading, extending or redefining a state
33
+ @states.delete(name) if @states.include?(name)
34
+
35
+ @states << AASM::State.new(name, klass, options)
32
36
  end
33
37
 
34
38
  private
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "3.3.2"
2
+ VERSION = "3.3.3"
3
3
  end
@@ -0,0 +1,21 @@
1
+ class DoubleDefiner
2
+ include AASM
3
+
4
+ aasm do
5
+ state :started
6
+ state :finished
7
+
8
+ event :finish do
9
+ transitions :from => :started, :to => :finished
10
+ end
11
+
12
+ # simulating a reload
13
+ state :finished, :enter => :do_enter
14
+ event :finish do
15
+ transitions :from => :started, :to => :finished, :on_transition => :do_on_transition
16
+ end
17
+ end
18
+
19
+ def do_enter; end
20
+ def do_on_transition; end
21
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'callbacks for the new DSL' do
4
+ let(:definer) { DoubleDefiner.new }
5
+
6
+ it "allows extending states" do
7
+ expect(definer).to receive(:do_enter)
8
+ definer.finish
9
+ end
10
+
11
+ it "allows extending events" do
12
+ expect(definer).to receive(:do_on_transition)
13
+ definer.finish
14
+ end
15
+ end
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Barron
8
- - Scott Petersen
9
8
  - Travis Tilley
10
9
  - Thorsten Boettger
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2014-08-16 00:00:00.000000000 Z
13
+ date: 2014-08-20 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rake
@@ -144,6 +143,7 @@ files:
144
143
  - spec/models/bar.rb
145
144
  - spec/models/callback_new_dsl.rb
146
145
  - spec/models/conversation.rb
146
+ - spec/models/double_definer.rb
147
147
  - spec/models/father.rb
148
148
  - spec/models/foo.rb
149
149
  - spec/models/guardian.rb
@@ -177,6 +177,7 @@ files:
177
177
  - spec/unit/persistence/active_record_persistence_spec.rb
178
178
  - spec/unit/persistence/mongoid_persistance_spec.rb
179
179
  - spec/unit/persistence/sequel_persistence_spec.rb
180
+ - spec/unit/reloading_spec.rb
180
181
  - spec/unit/simple_example_spec.rb
181
182
  - spec/unit/state_spec.rb
182
183
  - spec/unit/subclassing_spec.rb
@@ -216,6 +217,7 @@ test_files:
216
217
  - spec/models/bar.rb
217
218
  - spec/models/callback_new_dsl.rb
218
219
  - spec/models/conversation.rb
220
+ - spec/models/double_definer.rb
219
221
  - spec/models/father.rb
220
222
  - spec/models/foo.rb
221
223
  - spec/models/guardian.rb
@@ -249,6 +251,7 @@ test_files:
249
251
  - spec/unit/persistence/active_record_persistence_spec.rb
250
252
  - spec/unit/persistence/mongoid_persistance_spec.rb
251
253
  - spec/unit/persistence/sequel_persistence_spec.rb
254
+ - spec/unit/reloading_spec.rb
252
255
  - spec/unit/simple_example_spec.rb
253
256
  - spec/unit/state_spec.rb
254
257
  - spec/unit/subclassing_spec.rb