aasm 4.11.1 → 4.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +15 -16
- data/Appraisals +44 -0
- data/CHANGELOG.md +14 -0
- data/CONTRIBUTING.md +24 -0
- data/Gemfile +4 -21
- data/README.md +53 -32
- data/Rakefile +6 -1
- data/TESTING.md +25 -0
- data/aasm.gemspec +3 -0
- data/gemfiles/rails_3.2.gemfile +13 -0
- data/gemfiles/rails_4.0.gemfile +8 -9
- data/gemfiles/rails_4.2.gemfile +9 -9
- data/gemfiles/rails_4.2_mongoid_5.gemfile +5 -9
- data/gemfiles/rails_5.0.gemfile +7 -16
- data/lib/aasm/aasm.rb +9 -3
- data/lib/aasm/base.rb +3 -1
- data/lib/aasm/configuration.rb +4 -0
- data/lib/aasm/core/event.rb +17 -3
- data/lib/aasm/core/state.rb +7 -0
- data/lib/aasm/core/transition.rb +9 -0
- data/lib/aasm/persistence.rb +0 -3
- data/lib/aasm/persistence/active_record_persistence.rb +1 -1
- data/lib/aasm/persistence/mongoid_persistence.rb +48 -9
- data/lib/aasm/state_machine.rb +4 -2
- data/lib/aasm/state_machine_store.rb +5 -2
- data/lib/aasm/version.rb +1 -1
- data/lib/motion-aasm.rb +0 -1
- data/spec/generators/active_record_generator_spec.rb +42 -39
- data/spec/generators/mongoid_generator_spec.rb +4 -6
- data/spec/models/{invalid_persistor.rb → active_record/invalid_persistor.rb} +0 -2
- data/spec/models/{silent_persistor.rb → active_record/silent_persistor.rb} +0 -2
- data/spec/models/{transactor.rb → active_record/transactor.rb} +0 -2
- data/spec/models/{validator.rb → active_record/validator.rb} +0 -2
- data/spec/models/{worker.rb → active_record/worker.rb} +0 -0
- data/spec/models/callbacks/basic.rb +5 -2
- data/spec/models/guard_with_params.rb +1 -1
- data/spec/models/mongoid/invalid_persistor_mongoid.rb +39 -0
- data/spec/models/mongoid/silent_persistor_mongoid.rb +39 -0
- data/spec/models/mongoid/validator_mongoid.rb +100 -0
- data/spec/models/multiple_transitions_that_differ_only_by_guard.rb +31 -0
- data/spec/models/parametrised_event.rb +7 -0
- data/spec/models/simple_multiple_example.rb +12 -0
- data/spec/models/sub_class.rb +34 -0
- data/spec/spec_helper.rb +0 -33
- data/spec/spec_helpers/active_record.rb +7 -0
- data/spec/spec_helpers/dynamoid.rb +33 -0
- data/spec/spec_helpers/mongoid.rb +7 -0
- data/spec/spec_helpers/redis.rb +7 -0
- data/spec/spec_helpers/remove_warnings.rb +1 -0
- data/spec/spec_helpers/sequel.rb +7 -0
- data/spec/unit/api_spec.rb +76 -73
- data/spec/unit/callbacks_spec.rb +5 -0
- data/spec/unit/event_spec.rb +12 -0
- data/spec/unit/guard_with_params_spec.rb +4 -0
- data/spec/unit/localizer_spec.rb +55 -53
- data/spec/unit/multiple_transitions_that_differ_only_by_guard_spec.rb +14 -0
- data/spec/unit/override_warning_spec.rb +8 -0
- data/spec/unit/persistence/active_record_persistence_multiple_spec.rb +452 -448
- data/spec/unit/persistence/active_record_persistence_spec.rb +523 -501
- data/spec/unit/persistence/dynamoid_persistence_multiple_spec.rb +4 -9
- data/spec/unit/persistence/dynamoid_persistence_spec.rb +4 -9
- data/spec/unit/persistence/mongoid_persistence_multiple_spec.rb +83 -9
- data/spec/unit/persistence/mongoid_persistence_spec.rb +85 -9
- data/spec/unit/persistence/redis_persistence_spec.rb +3 -7
- data/spec/unit/persistence/sequel_persistence_multiple_spec.rb +4 -9
- data/spec/unit/persistence/sequel_persistence_spec.rb +4 -9
- data/spec/unit/simple_multiple_example_spec.rb +28 -0
- data/spec/unit/subclassing_multiple_spec.rb +37 -2
- data/spec/unit/subclassing_spec.rb +17 -2
- metadata +66 -28
- data/gemfiles/rails_3.2_stable.gemfile +0 -15
- data/gemfiles/rails_4.0_mongo_mapper.gemfile +0 -16
- data/gemfiles/rails_4.2_mongo_mapper.gemfile +0 -17
- data/lib/aasm/persistence/mongo_mapper_persistence.rb +0 -163
- data/spec/models/mongo_mapper/complex_mongo_mapper_example.rb +0 -37
- data/spec/models/mongo_mapper/no_scope_mongo_mapper.rb +0 -21
- data/spec/models/mongo_mapper/simple_mongo_mapper.rb +0 -23
- data/spec/models/mongo_mapper/simple_new_dsl_mongo_mapper.rb +0 -25
- data/spec/unit/persistence/mongo_mapper_persistence_multiple_spec.rb +0 -149
- data/spec/unit/persistence/mongo_mapper_persistence_spec.rb +0 -96
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if defined?(Dynamoid)
|
4
|
+
describe 'dynamoid' do
|
6
5
|
|
7
6
|
Dir[File.dirname(__FILE__) + "/../../models/dynamoid/*.rb"].sort.each do |f|
|
8
7
|
require File.expand_path(f)
|
@@ -132,9 +131,5 @@ describe 'dynamoid' do
|
|
132
131
|
end
|
133
132
|
end
|
134
133
|
|
135
|
-
rescue LoadError
|
136
|
-
puts "------------------------------------------------------------------------"
|
137
|
-
puts "Not running Dynamoid multiple-specs because dynamoid gem is not installed!!!"
|
138
|
-
puts "------------------------------------------------------------------------"
|
139
134
|
end
|
140
135
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if defined?(Dynamoid)
|
4
|
+
describe 'dynamoid' do
|
6
5
|
|
7
6
|
Dir[File.dirname(__FILE__) + "/../../models/dynamoid/*.rb"].sort.each do |f|
|
8
7
|
require File.expand_path(f)
|
@@ -81,9 +80,5 @@ describe 'dynamoid' do
|
|
81
80
|
end
|
82
81
|
end
|
83
82
|
|
84
|
-
rescue LoadError
|
85
|
-
puts "------------------------------------------------------------------------"
|
86
|
-
puts "Not running Dynamoid specs because dynamoid gem is not installed!!!"
|
87
|
-
puts "------------------------------------------------------------------------"
|
88
83
|
end
|
89
84
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if defined?(Mongoid::Document)
|
4
|
+
describe 'mongoid' do
|
6
5
|
|
7
6
|
Dir[File.dirname(__FILE__) + "/../../models/mongoid/*.rb"].sort.each do |f|
|
8
7
|
require File.expand_path(f)
|
@@ -72,6 +71,85 @@ describe 'mongoid' do
|
|
72
71
|
|
73
72
|
end
|
74
73
|
|
74
|
+
describe 'transitions with persistence' do
|
75
|
+
|
76
|
+
it "should work for valid models" do
|
77
|
+
valid_object = MultipleValidatorMongoid.create(:name => 'name')
|
78
|
+
expect(valid_object).to be_sleeping
|
79
|
+
valid_object.status = :running
|
80
|
+
expect(valid_object).to be_running
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should not store states for invalid models' do
|
84
|
+
validator = MultipleValidatorMongoid.create(:name => 'name')
|
85
|
+
expect(validator).to be_valid
|
86
|
+
expect(validator).to be_sleeping
|
87
|
+
|
88
|
+
validator.name = nil
|
89
|
+
expect(validator).not_to be_valid
|
90
|
+
expect { validator.run! }.to raise_error(Mongoid::Errors::Validations)
|
91
|
+
expect(validator).to be_sleeping
|
92
|
+
|
93
|
+
validator.reload
|
94
|
+
expect(validator).not_to be_running
|
95
|
+
expect(validator).to be_sleeping
|
96
|
+
|
97
|
+
validator.name = 'another name'
|
98
|
+
expect(validator).to be_valid
|
99
|
+
expect(validator.run!).to be_truthy
|
100
|
+
expect(validator).to be_running
|
101
|
+
|
102
|
+
validator.reload
|
103
|
+
expect(validator).to be_running
|
104
|
+
expect(validator).not_to be_sleeping
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should not store states for invalid models silently if configured' do
|
108
|
+
validator = MultipleSilentPersistorMongoid.create(:name => 'name')
|
109
|
+
expect(validator).to be_valid
|
110
|
+
expect(validator).to be_sleeping
|
111
|
+
|
112
|
+
validator.name = nil
|
113
|
+
expect(validator).not_to be_valid
|
114
|
+
expect(validator.run!).to be_falsey
|
115
|
+
expect(validator).to be_sleeping
|
116
|
+
|
117
|
+
validator.reload
|
118
|
+
expect(validator).not_to be_running
|
119
|
+
expect(validator).to be_sleeping
|
120
|
+
|
121
|
+
validator.name = 'another name'
|
122
|
+
expect(validator).to be_valid
|
123
|
+
expect(validator.run!).to be_truthy
|
124
|
+
expect(validator).to be_running
|
125
|
+
|
126
|
+
validator.reload
|
127
|
+
expect(validator).to be_running
|
128
|
+
expect(validator).not_to be_sleeping
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should store states for invalid models if configured' do
|
132
|
+
persistor = MultipleInvalidPersistorMongoid.create(:name => 'name')
|
133
|
+
expect(persistor).to be_valid
|
134
|
+
expect(persistor).to be_sleeping
|
135
|
+
|
136
|
+
persistor.name = nil
|
137
|
+
expect(persistor).not_to be_valid
|
138
|
+
expect(persistor.run!).to be_truthy
|
139
|
+
expect(persistor).to be_running
|
140
|
+
|
141
|
+
persistor = MultipleInvalidPersistorMongoid.find(persistor.id)
|
142
|
+
persistor.valid?
|
143
|
+
expect(persistor).to be_valid
|
144
|
+
expect(persistor).to be_running
|
145
|
+
expect(persistor).not_to be_sleeping
|
146
|
+
|
147
|
+
persistor.reload
|
148
|
+
expect(persistor).to be_running
|
149
|
+
expect(persistor).not_to be_sleeping
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
75
153
|
describe "complex example" do
|
76
154
|
it "works" do
|
77
155
|
record = ComplexMongoidExample.new
|
@@ -122,9 +200,5 @@ describe 'mongoid' do
|
|
122
200
|
end
|
123
201
|
end
|
124
202
|
|
125
|
-
rescue LoadError
|
126
|
-
puts "--------------------------------------------------------------------------"
|
127
|
-
puts "Not running Mongoid multiple-specs because mongoid gem is not installed!!!"
|
128
|
-
puts "--------------------------------------------------------------------------"
|
129
203
|
end
|
130
204
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if defined?(Mongoid::Document)
|
4
|
+
describe 'mongoid' do
|
6
5
|
|
7
6
|
Dir[File.dirname(__FILE__) + "/../../models/mongoid/*.rb"].sort.each do |f|
|
8
7
|
require File.expand_path(f)
|
@@ -85,9 +84,86 @@ describe 'mongoid' do
|
|
85
84
|
|
86
85
|
end
|
87
86
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
87
|
+
describe 'transitions with persistence' do
|
88
|
+
|
89
|
+
it 'should work for valid models' do
|
90
|
+
valid_object = ValidatorMongoid.create(:name => 'name')
|
91
|
+
expect(valid_object).to be_sleeping
|
92
|
+
valid_object.status = :running
|
93
|
+
expect(valid_object).to be_running
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should not store states for invalid models' do
|
97
|
+
validator = ValidatorMongoid.create(:name => 'name')
|
98
|
+
expect(validator).to be_valid
|
99
|
+
expect(validator).to be_sleeping
|
100
|
+
|
101
|
+
validator.name = nil
|
102
|
+
expect(validator).not_to be_valid
|
103
|
+
expect { validator.run! }.to raise_error(Mongoid::Errors::Validations)
|
104
|
+
expect(validator).to be_sleeping
|
105
|
+
|
106
|
+
validator.reload
|
107
|
+
expect(validator).not_to be_running
|
108
|
+
expect(validator).to be_sleeping
|
109
|
+
|
110
|
+
validator.name = 'another name'
|
111
|
+
expect(validator).to be_valid
|
112
|
+
expect(validator.run!).to be_truthy
|
113
|
+
expect(validator).to be_running
|
114
|
+
|
115
|
+
validator.reload
|
116
|
+
expect(validator).to be_running
|
117
|
+
expect(validator).not_to be_sleeping
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'should not store states for invalid models silently if configured' do
|
121
|
+
validator = SilentPersistorMongoid.create(:name => 'name')
|
122
|
+
expect(validator).to be_valid
|
123
|
+
expect(validator).to be_sleeping
|
124
|
+
|
125
|
+
validator.name = nil
|
126
|
+
expect(validator).not_to be_valid
|
127
|
+
expect(validator.run!).to be_falsey
|
128
|
+
expect(validator).to be_sleeping
|
129
|
+
|
130
|
+
validator.reload
|
131
|
+
expect(validator).not_to be_running
|
132
|
+
expect(validator).to be_sleeping
|
133
|
+
|
134
|
+
validator.name = 'another name'
|
135
|
+
expect(validator).to be_valid
|
136
|
+
expect(validator.run!).to be_truthy
|
137
|
+
expect(validator).to be_running
|
138
|
+
|
139
|
+
validator.reload
|
140
|
+
expect(validator).to be_running
|
141
|
+
expect(validator).not_to be_sleeping
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'should store states for invalid models if configured' do
|
145
|
+
persistor = InvalidPersistorMongoid.create(:name => 'name')
|
146
|
+
expect(persistor).to be_valid
|
147
|
+
expect(persistor).to be_sleeping
|
148
|
+
|
149
|
+
persistor.name = nil
|
150
|
+
|
151
|
+
expect(persistor).not_to be_valid
|
152
|
+
expect(persistor.run!).to be_truthy
|
153
|
+
expect(persistor).to be_running
|
154
|
+
|
155
|
+
persistor = InvalidPersistorMongoid.find(persistor.id)
|
156
|
+
|
157
|
+
persistor.valid?
|
158
|
+
expect(persistor).to be_valid
|
159
|
+
expect(persistor).to be_running
|
160
|
+
expect(persistor).not_to be_sleeping
|
161
|
+
|
162
|
+
persistor.reload
|
163
|
+
expect(persistor).to be_running
|
164
|
+
expect(persistor).not_to be_sleeping
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
92
168
|
end
|
93
169
|
end
|
@@ -1,9 +1,7 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
|
2
|
-
|
3
|
-
|
4
|
-
require 'redis-objects'
|
5
|
-
require 'logger'
|
6
|
-
require 'spec_helper'
|
3
|
+
if defined?(Redis::Objects)
|
4
|
+
describe 'redis' do
|
7
5
|
|
8
6
|
before(:all) do
|
9
7
|
Redis.current = Redis.new(host: '127.0.0.1', port: 6379)
|
@@ -71,7 +69,5 @@ describe 'redis' do
|
|
71
69
|
end
|
72
70
|
end
|
73
71
|
|
74
|
-
rescue LoadError
|
75
|
-
puts "Not running Redis specs because sequel gem is not installed!!!"
|
76
72
|
end
|
77
73
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if defined?(Sequel)
|
4
|
+
describe 'sequel' do
|
6
5
|
|
7
6
|
Dir[File.dirname(__FILE__) + "/../../models/sequel/*.rb"].sort.each do |f|
|
8
7
|
require File.expand_path(f)
|
@@ -145,9 +144,5 @@ describe 'sequel' do
|
|
145
144
|
end
|
146
145
|
end
|
147
146
|
|
148
|
-
rescue LoadError
|
149
|
-
puts "------------------------------------------------------------------------"
|
150
|
-
puts "Not running Sequel multiple-specs because sequel gem is not installed!!!"
|
151
|
-
puts "------------------------------------------------------------------------"
|
152
147
|
end
|
153
148
|
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if defined?(Sequel)
|
4
|
+
describe 'sequel' do
|
6
5
|
|
7
6
|
Dir[File.dirname(__FILE__) + "/../../models/sequel/*.rb"].sort.each do |f|
|
8
7
|
require File.expand_path(f)
|
@@ -92,9 +91,5 @@ describe 'sequel' do
|
|
92
91
|
end
|
93
92
|
end
|
94
93
|
|
95
|
-
rescue LoadError
|
96
|
-
puts "------------------------------------------------------------------------"
|
97
|
-
puts "Not running Sequel specs because sequel gem is not installed!!!"
|
98
|
-
puts "------------------------------------------------------------------------"
|
99
94
|
end
|
100
95
|
end
|
@@ -60,4 +60,32 @@ describe 'state machine' do
|
|
60
60
|
expect(SimpleMultipleExample::STATE_PROCESSING).to eq(:processing)
|
61
61
|
expect(SimpleMultipleExample::STATE_RUNNING).to eq(:running)
|
62
62
|
end
|
63
|
+
|
64
|
+
context 'triggers binding_events in bindind_state_machine' do
|
65
|
+
it 'does persist' do
|
66
|
+
expect(simple).to be_sleeping
|
67
|
+
expect(simple).to be_answered
|
68
|
+
expect(simple).to receive(:start!).and_call_original
|
69
|
+
simple.ask!
|
70
|
+
expect(simple).to be_asked
|
71
|
+
expect(simple).to be_processing
|
72
|
+
expect(simple).to receive(:stop!).and_call_original
|
73
|
+
simple.answer!
|
74
|
+
expect(simple).to be_sleeping
|
75
|
+
expect(simple).to be_answered
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'does not persist' do
|
79
|
+
expect(simple).to be_sleeping
|
80
|
+
expect(simple).to be_answered
|
81
|
+
expect(simple).to receive(:start).and_call_original
|
82
|
+
simple.ask
|
83
|
+
expect(simple).to be_asked
|
84
|
+
expect(simple).to be_processing
|
85
|
+
expect(simple).to receive(:stop).and_call_original
|
86
|
+
simple.answer
|
87
|
+
expect(simple).to be_sleeping
|
88
|
+
expect(simple).to be_answered
|
89
|
+
end
|
90
|
+
end
|
63
91
|
end
|
@@ -19,7 +19,7 @@ describe 'subclassing with multiple state machines' do
|
|
19
19
|
expect(SuperClassMultiple.aasm(:right).states).not_to include(:archived)
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
22
|
+
it 'should have the same events as its parent' do
|
23
23
|
expect(SubClassMultiple.aasm(:left).events).to eq(SuperClassMultiple.aasm(:left).events)
|
24
24
|
expect(SubClassMultiple.aasm(:right).events).to eq(SuperClassMultiple.aasm(:right).events)
|
25
25
|
end
|
@@ -35,5 +35,40 @@ describe 'subclassing with multiple state machines' do
|
|
35
35
|
expect(son.aasm(:left).current_state).to eq(:ended)
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
it 'should allow the child to modify its left state machine' do
|
39
|
+
son = SubClassMultiple.new
|
40
|
+
expect(son.left_called_after).to eq(nil)
|
41
|
+
expect(son.right_called_after).to eq(nil)
|
42
|
+
son.foo
|
43
|
+
expect(son.left_called_after).to eq(true)
|
44
|
+
expect(son.right_called_after).to eq(nil)
|
45
|
+
global_callbacks = SubClassMultiple.aasm(:left).state_machine.global_callbacks
|
46
|
+
expect(global_callbacks).to_not be_empty
|
47
|
+
expect(global_callbacks[:after_all_transitions]).to eq :left_after_all_event
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should allow the child to modify its right state machine' do
|
51
|
+
son = SubClassMultiple.new
|
52
|
+
expect(son.right_called_after).to eq(nil)
|
53
|
+
expect(son.left_called_after).to eq(nil)
|
54
|
+
son.close
|
55
|
+
expect(son.right_called_after).to eq(true)
|
56
|
+
expect(son.left_called_after).to eq(nil)
|
57
|
+
global_callbacks = SubClassMultiple.aasm(:right).state_machine.global_callbacks
|
58
|
+
expect(global_callbacks).to_not be_empty
|
59
|
+
expect(global_callbacks[:after_all_transitions]).to eq :right_after_all_event
|
60
|
+
end
|
39
61
|
|
62
|
+
it 'should not modify the parent left state machine' do
|
63
|
+
super_class_event = SuperClassMultiple.aasm(:left).events.select { |event| event.name == :foo }.first
|
64
|
+
expect(super_class_event.options).to be_empty
|
65
|
+
expect(SuperClassMultiple.aasm(:left).state_machine.global_callbacks).to be_empty
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should not modify the parent right state machine' do
|
69
|
+
super_class_event = SuperClassMultiple.aasm(:right).events.select { |event| event.name == :close }.first
|
70
|
+
expect(super_class_event.options).to be_empty
|
71
|
+
expect(SuperClassMultiple.aasm(:right).state_machine.global_callbacks).to be_empty
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -13,7 +13,7 @@ describe 'subclassing' do
|
|
13
13
|
expect(SuperClass.aasm.states).not_to include(:foo)
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
16
|
+
it 'should have the same events as its parent' do
|
17
17
|
expect(SubClass.aasm.events).to eq(SuperClass.aasm.events)
|
18
18
|
end
|
19
19
|
|
@@ -27,5 +27,20 @@ describe 'subclassing' do
|
|
27
27
|
expect(son.aasm.current_state).to eq(:ended)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
it 'should allow the child to modify its state machine' do
|
31
|
+
son = SubClass.new
|
32
|
+
expect(son.called_after).to eq(nil)
|
33
|
+
son.foo
|
34
|
+
expect(son.called_after).to eq(true)
|
35
|
+
global_callbacks = SubClass.aasm.state_machine.global_callbacks
|
36
|
+
expect(global_callbacks).to_not be_empty
|
37
|
+
expect(global_callbacks[:after_all_transitions]).to eq :after_all_event
|
38
|
+
end
|
31
39
|
|
40
|
+
it 'should not modify the parent state machine' do
|
41
|
+
super_class_event = SuperClass.aasm.events.select { |event| event.name == :foo }.first
|
42
|
+
expect(super_class_event.options).to be_empty
|
43
|
+
expect(SuperClass.aasm.state_machine.global_callbacks).to be_empty
|
44
|
+
end
|
45
|
+
|
46
|
+
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: 4.
|
4
|
+
version: 4.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thorsten Boettger
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: concurrent-ruby
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.0'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: rake
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,6 +81,20 @@ dependencies:
|
|
67
81
|
- - ">="
|
68
82
|
- !ruby/object:Gem::Version
|
69
83
|
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: appraisal
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
70
98
|
- !ruby/object:Gem::Dependency
|
71
99
|
name: pry
|
72
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,8 +120,10 @@ files:
|
|
92
120
|
- ".gitignore"
|
93
121
|
- ".travis.yml"
|
94
122
|
- API
|
123
|
+
- Appraisals
|
95
124
|
- CHANGELOG.md
|
96
125
|
- CODE_OF_CONDUCT.md
|
126
|
+
- CONTRIBUTING.md
|
97
127
|
- Gemfile
|
98
128
|
- HOWTO
|
99
129
|
- LICENSE
|
@@ -101,13 +131,12 @@ files:
|
|
101
131
|
- README.md
|
102
132
|
- README_FROM_VERSION_3_TO_4.md
|
103
133
|
- Rakefile
|
134
|
+
- TESTING.md
|
104
135
|
- aasm.gemspec
|
105
136
|
- callbacks.txt
|
106
|
-
- gemfiles/rails_3.
|
137
|
+
- gemfiles/rails_3.2.gemfile
|
107
138
|
- gemfiles/rails_4.0.gemfile
|
108
|
-
- gemfiles/rails_4.0_mongo_mapper.gemfile
|
109
139
|
- gemfiles/rails_4.2.gemfile
|
110
|
-
- gemfiles/rails_4.2_mongo_mapper.gemfile
|
111
140
|
- gemfiles/rails_4.2_mongoid_5.gemfile
|
112
141
|
- gemfiles/rails_5.0.gemfile
|
113
142
|
- lib/aasm.rb
|
@@ -126,7 +155,6 @@ files:
|
|
126
155
|
- lib/aasm/persistence/base.rb
|
127
156
|
- lib/aasm/persistence/core_data_query_persistence.rb
|
128
157
|
- lib/aasm/persistence/dynamoid_persistence.rb
|
129
|
-
- lib/aasm/persistence/mongo_mapper_persistence.rb
|
130
158
|
- lib/aasm/persistence/mongoid_persistence.rb
|
131
159
|
- lib/aasm/persistence/plain_persistence.rb
|
132
160
|
- lib/aasm/persistence/redis_persistence.rb
|
@@ -157,6 +185,7 @@ files:
|
|
157
185
|
- spec/models/active_record/derivate_new_dsl.rb
|
158
186
|
- spec/models/active_record/false_state.rb
|
159
187
|
- spec/models/active_record/gate.rb
|
188
|
+
- spec/models/active_record/invalid_persistor.rb
|
160
189
|
- spec/models/active_record/localizer_test_model.rb
|
161
190
|
- spec/models/active_record/no_direct_assignment.rb
|
162
191
|
- spec/models/active_record/no_scope.rb
|
@@ -164,13 +193,17 @@ files:
|
|
164
193
|
- spec/models/active_record/provided_and_persisted_state.rb
|
165
194
|
- spec/models/active_record/reader.rb
|
166
195
|
- spec/models/active_record/readme_job.rb
|
196
|
+
- spec/models/active_record/silent_persistor.rb
|
167
197
|
- spec/models/active_record/simple_new_dsl.rb
|
168
198
|
- spec/models/active_record/thief.rb
|
199
|
+
- spec/models/active_record/transactor.rb
|
169
200
|
- spec/models/active_record/transient.rb
|
201
|
+
- spec/models/active_record/validator.rb
|
170
202
|
- spec/models/active_record/with_enum.rb
|
171
203
|
- spec/models/active_record/with_enum_without_column.rb
|
172
204
|
- spec/models/active_record/with_false_enum.rb
|
173
205
|
- spec/models/active_record/with_true_enum.rb
|
206
|
+
- spec/models/active_record/worker.rb
|
174
207
|
- spec/models/active_record/writer.rb
|
175
208
|
- spec/models/basic_two_state_machines_example.rb
|
176
209
|
- spec/models/callbacks/basic.rb
|
@@ -199,17 +232,16 @@ files:
|
|
199
232
|
- spec/models/guardian.rb
|
200
233
|
- spec/models/guardian_multiple.rb
|
201
234
|
- spec/models/initial_state_proc.rb
|
202
|
-
- spec/models/invalid_persistor.rb
|
203
|
-
- spec/models/mongo_mapper/complex_mongo_mapper_example.rb
|
204
|
-
- spec/models/mongo_mapper/no_scope_mongo_mapper.rb
|
205
|
-
- spec/models/mongo_mapper/simple_mongo_mapper.rb
|
206
|
-
- spec/models/mongo_mapper/simple_new_dsl_mongo_mapper.rb
|
207
235
|
- spec/models/mongoid/complex_mongoid_example.rb
|
236
|
+
- spec/models/mongoid/invalid_persistor_mongoid.rb
|
208
237
|
- spec/models/mongoid/mongoid_relationships.rb
|
209
238
|
- spec/models/mongoid/no_scope_mongoid.rb
|
239
|
+
- spec/models/mongoid/silent_persistor_mongoid.rb
|
210
240
|
- spec/models/mongoid/simple_mongoid.rb
|
211
241
|
- spec/models/mongoid/simple_new_dsl_mongoid.rb
|
242
|
+
- spec/models/mongoid/validator_mongoid.rb
|
212
243
|
- spec/models/multi_transitioner.rb
|
244
|
+
- spec/models/multiple_transitions_that_differ_only_by_guard.rb
|
213
245
|
- spec/models/namespaced_multiple_example.rb
|
214
246
|
- spec/models/no_initial_state.rb
|
215
247
|
- spec/models/not_auto_loaded/process.rb
|
@@ -221,7 +253,6 @@ files:
|
|
221
253
|
- spec/models/sequel/sequel_multiple.rb
|
222
254
|
- spec/models/sequel/sequel_simple.rb
|
223
255
|
- spec/models/silencer.rb
|
224
|
-
- spec/models/silent_persistor.rb
|
225
256
|
- spec/models/simple_custom_example.rb
|
226
257
|
- spec/models/simple_example.rb
|
227
258
|
- spec/models/simple_multiple_example.rb
|
@@ -232,11 +263,14 @@ files:
|
|
232
263
|
- spec/models/sub_classing.rb
|
233
264
|
- spec/models/super_class.rb
|
234
265
|
- spec/models/this_name_better_not_be_in_use.rb
|
235
|
-
- spec/models/transactor.rb
|
236
266
|
- spec/models/valid_state_name.rb
|
237
|
-
- spec/models/validator.rb
|
238
|
-
- spec/models/worker.rb
|
239
267
|
- spec/spec_helper.rb
|
268
|
+
- spec/spec_helpers/active_record.rb
|
269
|
+
- spec/spec_helpers/dynamoid.rb
|
270
|
+
- spec/spec_helpers/mongoid.rb
|
271
|
+
- spec/spec_helpers/redis.rb
|
272
|
+
- spec/spec_helpers/remove_warnings.rb
|
273
|
+
- spec/spec_helpers/sequel.rb
|
240
274
|
- spec/unit/api_spec.rb
|
241
275
|
- spec/unit/basic_two_state_machines_example_spec.rb
|
242
276
|
- spec/unit/callback_multiple_spec.rb
|
@@ -258,6 +292,7 @@ files:
|
|
258
292
|
- spec/unit/inspection_spec.rb
|
259
293
|
- spec/unit/localizer_spec.rb
|
260
294
|
- spec/unit/memory_leak_spec.rb
|
295
|
+
- spec/unit/multiple_transitions_that_differ_only_by_guard_spec.rb
|
261
296
|
- spec/unit/namespaced_multiple_example_spec.rb
|
262
297
|
- spec/unit/new_dsl_spec.rb
|
263
298
|
- spec/unit/override_warning_spec.rb
|
@@ -265,8 +300,6 @@ files:
|
|
265
300
|
- spec/unit/persistence/active_record_persistence_spec.rb
|
266
301
|
- spec/unit/persistence/dynamoid_persistence_multiple_spec.rb
|
267
302
|
- spec/unit/persistence/dynamoid_persistence_spec.rb
|
268
|
-
- spec/unit/persistence/mongo_mapper_persistence_multiple_spec.rb
|
269
|
-
- spec/unit/persistence/mongo_mapper_persistence_spec.rb
|
270
303
|
- spec/unit/persistence/mongoid_persistence_multiple_spec.rb
|
271
304
|
- spec/unit/persistence/mongoid_persistence_spec.rb
|
272
305
|
- spec/unit/persistence/redis_persistence_spec.rb
|
@@ -319,6 +352,7 @@ test_files:
|
|
319
352
|
- spec/models/active_record/derivate_new_dsl.rb
|
320
353
|
- spec/models/active_record/false_state.rb
|
321
354
|
- spec/models/active_record/gate.rb
|
355
|
+
- spec/models/active_record/invalid_persistor.rb
|
322
356
|
- spec/models/active_record/localizer_test_model.rb
|
323
357
|
- spec/models/active_record/no_direct_assignment.rb
|
324
358
|
- spec/models/active_record/no_scope.rb
|
@@ -326,13 +360,17 @@ test_files:
|
|
326
360
|
- spec/models/active_record/provided_and_persisted_state.rb
|
327
361
|
- spec/models/active_record/reader.rb
|
328
362
|
- spec/models/active_record/readme_job.rb
|
363
|
+
- spec/models/active_record/silent_persistor.rb
|
329
364
|
- spec/models/active_record/simple_new_dsl.rb
|
330
365
|
- spec/models/active_record/thief.rb
|
366
|
+
- spec/models/active_record/transactor.rb
|
331
367
|
- spec/models/active_record/transient.rb
|
368
|
+
- spec/models/active_record/validator.rb
|
332
369
|
- spec/models/active_record/with_enum.rb
|
333
370
|
- spec/models/active_record/with_enum_without_column.rb
|
334
371
|
- spec/models/active_record/with_false_enum.rb
|
335
372
|
- spec/models/active_record/with_true_enum.rb
|
373
|
+
- spec/models/active_record/worker.rb
|
336
374
|
- spec/models/active_record/writer.rb
|
337
375
|
- spec/models/basic_two_state_machines_example.rb
|
338
376
|
- spec/models/callbacks/basic.rb
|
@@ -361,17 +399,16 @@ test_files:
|
|
361
399
|
- spec/models/guardian.rb
|
362
400
|
- spec/models/guardian_multiple.rb
|
363
401
|
- spec/models/initial_state_proc.rb
|
364
|
-
- spec/models/invalid_persistor.rb
|
365
|
-
- spec/models/mongo_mapper/complex_mongo_mapper_example.rb
|
366
|
-
- spec/models/mongo_mapper/no_scope_mongo_mapper.rb
|
367
|
-
- spec/models/mongo_mapper/simple_mongo_mapper.rb
|
368
|
-
- spec/models/mongo_mapper/simple_new_dsl_mongo_mapper.rb
|
369
402
|
- spec/models/mongoid/complex_mongoid_example.rb
|
403
|
+
- spec/models/mongoid/invalid_persistor_mongoid.rb
|
370
404
|
- spec/models/mongoid/mongoid_relationships.rb
|
371
405
|
- spec/models/mongoid/no_scope_mongoid.rb
|
406
|
+
- spec/models/mongoid/silent_persistor_mongoid.rb
|
372
407
|
- spec/models/mongoid/simple_mongoid.rb
|
373
408
|
- spec/models/mongoid/simple_new_dsl_mongoid.rb
|
409
|
+
- spec/models/mongoid/validator_mongoid.rb
|
374
410
|
- spec/models/multi_transitioner.rb
|
411
|
+
- spec/models/multiple_transitions_that_differ_only_by_guard.rb
|
375
412
|
- spec/models/namespaced_multiple_example.rb
|
376
413
|
- spec/models/no_initial_state.rb
|
377
414
|
- spec/models/not_auto_loaded/process.rb
|
@@ -383,7 +420,6 @@ test_files:
|
|
383
420
|
- spec/models/sequel/sequel_multiple.rb
|
384
421
|
- spec/models/sequel/sequel_simple.rb
|
385
422
|
- spec/models/silencer.rb
|
386
|
-
- spec/models/silent_persistor.rb
|
387
423
|
- spec/models/simple_custom_example.rb
|
388
424
|
- spec/models/simple_example.rb
|
389
425
|
- spec/models/simple_multiple_example.rb
|
@@ -394,11 +430,14 @@ test_files:
|
|
394
430
|
- spec/models/sub_classing.rb
|
395
431
|
- spec/models/super_class.rb
|
396
432
|
- spec/models/this_name_better_not_be_in_use.rb
|
397
|
-
- spec/models/transactor.rb
|
398
433
|
- spec/models/valid_state_name.rb
|
399
|
-
- spec/models/validator.rb
|
400
|
-
- spec/models/worker.rb
|
401
434
|
- spec/spec_helper.rb
|
435
|
+
- spec/spec_helpers/active_record.rb
|
436
|
+
- spec/spec_helpers/dynamoid.rb
|
437
|
+
- spec/spec_helpers/mongoid.rb
|
438
|
+
- spec/spec_helpers/redis.rb
|
439
|
+
- spec/spec_helpers/remove_warnings.rb
|
440
|
+
- spec/spec_helpers/sequel.rb
|
402
441
|
- spec/unit/api_spec.rb
|
403
442
|
- spec/unit/basic_two_state_machines_example_spec.rb
|
404
443
|
- spec/unit/callback_multiple_spec.rb
|
@@ -420,6 +459,7 @@ test_files:
|
|
420
459
|
- spec/unit/inspection_spec.rb
|
421
460
|
- spec/unit/localizer_spec.rb
|
422
461
|
- spec/unit/memory_leak_spec.rb
|
462
|
+
- spec/unit/multiple_transitions_that_differ_only_by_guard_spec.rb
|
423
463
|
- spec/unit/namespaced_multiple_example_spec.rb
|
424
464
|
- spec/unit/new_dsl_spec.rb
|
425
465
|
- spec/unit/override_warning_spec.rb
|
@@ -427,8 +467,6 @@ test_files:
|
|
427
467
|
- spec/unit/persistence/active_record_persistence_spec.rb
|
428
468
|
- spec/unit/persistence/dynamoid_persistence_multiple_spec.rb
|
429
469
|
- spec/unit/persistence/dynamoid_persistence_spec.rb
|
430
|
-
- spec/unit/persistence/mongo_mapper_persistence_multiple_spec.rb
|
431
|
-
- spec/unit/persistence/mongo_mapper_persistence_spec.rb
|
432
470
|
- spec/unit/persistence/mongoid_persistence_multiple_spec.rb
|
433
471
|
- spec/unit/persistence/mongoid_persistence_spec.rb
|
434
472
|
- spec/unit/persistence/redis_persistence_spec.rb
|