state_machines-audit_trail 1.0.2 → 2.0.0
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 +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -3
- data/README.md +8 -4
- data/lib/state_machines-audit_trail.rb +1 -0
- data/lib/state_machines/audit_trail/backend.rb +15 -7
- data/lib/state_machines/audit_trail/backend/active_record.rb +4 -6
- data/lib/state_machines/audit_trail/transition_auditing.rb +3 -1
- data/lib/state_machines/audit_trail/version.rb +1 -1
- data/spec/helpers/active_record.rb +45 -13
- data/spec/helpers/mongoid.yml +1 -1
- data/spec/lib/state_machines/audit_trail/backend/active_record_spec.rb +15 -2
- data/spec/lib/state_machines/audit_trail/backend/mongoid_spec.rb +98 -98
- data/state_machines-audit_trail.gemspec +3 -3
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8bdbceb8f20cf398d79321289977826d2ebe3a3
|
4
|
+
data.tar.gz: 52121baac211285206c9c5a5439072a8766b8417
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1344549ca014caea0917f4828355955519a103a4491b58823e52168259f4b4a6892eb135d9f72f9982337475978810ded1656ecc047d2fe5cbb803ed77b06530
|
7
|
+
data.tar.gz: 07d84647e61176676c060a0627c5af092041ebad291004991bc84dec9bb2ef18dae6d4cbd69d0c9db97e627f475a60ccd01bf1ff75f06b4d2286a86f712b72f2
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
state_machines-audit_trail
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -56,7 +56,7 @@ will generate the `SubscriptionStateTransition` model and an accompanying migrat
|
|
56
56
|
|
57
57
|
```ruby
|
58
58
|
class Subscription < ActiveRecord::Base
|
59
|
-
|
59
|
+
state_machine :state, initial: :start do
|
60
60
|
audit_trail
|
61
61
|
...
|
62
62
|
```
|
@@ -64,6 +64,10 @@ class Subscription < ActiveRecord::Base
|
|
64
64
|
### That's it!
|
65
65
|
`audit_trail` will register an `after_transition` callback that is used to log all transitions including the initial state if there is one.
|
66
66
|
|
67
|
+
## Upgrading from state_machine-audit_trail
|
68
|
+
|
69
|
+
See the wiki, https://github.com/state-machines/state_machines-audit_trail/wiki/Converting-from-former-state_machine-audit_trail-to-state_machines-audit_trail
|
70
|
+
|
67
71
|
## Configuration options
|
68
72
|
|
69
73
|
### `:initial` - turn off initial state logging
|
@@ -110,7 +114,7 @@ audit_trail context: [:field1, :field2]
|
|
110
114
|
Store `Subscription` `user` in `Transition` fields `user_id` and `user_name`:
|
111
115
|
```ruby
|
112
116
|
class Subscription < ActiveRecord::Base
|
113
|
-
|
117
|
+
state_machine :state, initial: :start do
|
114
118
|
audit_trail context: :user
|
115
119
|
...
|
116
120
|
end
|
@@ -132,7 +136,7 @@ Sometimes it can be useful to store dynamically computed information, such as th
|
|
132
136
|
|
133
137
|
```ruby
|
134
138
|
class Subscription < ActiveRecord::Base
|
135
|
-
|
139
|
+
state_machine :state, initial: :start do
|
136
140
|
audit_trail :context: :plan_time_remaining
|
137
141
|
...
|
138
142
|
|
@@ -146,7 +150,7 @@ Store method results that interrogate the transition for information such as `ev
|
|
146
150
|
|
147
151
|
```ruby
|
148
152
|
class Subscription < ActiveRecord::Base
|
149
|
-
|
153
|
+
state_machine :state, initial: :start do
|
150
154
|
audit_trail :context: :user_name
|
151
155
|
...
|
152
156
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class StateMachines::AuditTrail::Backend < Struct.new(:transition_class, :owner_class, :
|
1
|
+
class StateMachines::AuditTrail::Backend < Struct.new(:transition_class, :owner_class, :options)
|
2
2
|
|
3
3
|
autoload :Mongoid, 'state_machines/audit_trail/backend/mongoid'
|
4
4
|
autoload :ActiveRecord, 'state_machines/audit_trail/backend/active_record'
|
@@ -18,9 +18,9 @@ class StateMachines::AuditTrail::Backend < Struct.new(:transition_class, :owner_
|
|
18
18
|
namespace = transition.namespace
|
19
19
|
end
|
20
20
|
fields = {namespace: namespace, event: transition.event ? transition.event.to_s : nil, from: transition.from, to: transition.to}
|
21
|
-
[context].
|
21
|
+
[*options[:context]].each { |field|
|
22
22
|
fields[field] = resolve_context(object, field, transition)
|
23
|
-
}
|
23
|
+
}
|
24
24
|
|
25
25
|
# begin
|
26
26
|
persist(object, fields)
|
@@ -38,11 +38,11 @@ class StateMachines::AuditTrail::Backend < Struct.new(:transition_class, :owner_
|
|
38
38
|
# To add a new ORM, implement something similar to lib/state_machines/audit_trail/backend/active_record.rb
|
39
39
|
# and return from here the appropriate object based on which ORM the transition_class is using
|
40
40
|
#
|
41
|
-
def self.create_for(transition_class, owner_class,
|
41
|
+
def self.create_for(transition_class, owner_class, options = {})
|
42
42
|
if Object.const_defined?('ActiveRecord') && transition_class.ancestors.include?(::ActiveRecord::Base)
|
43
|
-
return StateMachines::AuditTrail::Backend::ActiveRecord.new(transition_class, owner_class,
|
43
|
+
return StateMachines::AuditTrail::Backend::ActiveRecord.new(transition_class, owner_class, options)
|
44
44
|
elsif Object.const_defined?('Mongoid') && transition_class.ancestors.include?(::Mongoid::Document)
|
45
|
-
return StateMachines::AuditTrail::Backend::Mongoid.new(transition_class, owner_class,
|
45
|
+
return StateMachines::AuditTrail::Backend::Mongoid.new(transition_class, owner_class, options)
|
46
46
|
else
|
47
47
|
raise 'Not implemented. Only support for ActiveRecord and Mongoid is implemented. Pull requests welcome.'
|
48
48
|
end
|
@@ -60,7 +60,15 @@ class StateMachines::AuditTrail::Backend < Struct.new(:transition_class, :owner_
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def resolve_context(object, context, transition)
|
63
|
-
|
63
|
+
# ---------------
|
64
|
+
# TODO: remove this check after we set a minimum version of Rails/ActiveRecord to 5.1+. At that time, the argument will be removed and the arity check will be enough. - rosskevin
|
65
|
+
# Don't send params to Rails 5+ associations because it triggers a ton of deprecation messages.
|
66
|
+
# @see https://github.com/state-machines/state_machines-audit_trail/issues/6
|
67
|
+
# check if activerecord && the context is an association
|
68
|
+
skip_args = object.is_a?(::ActiveRecord::Base) && object.class.reflections.keys.include?(context.to_s)
|
69
|
+
# ---------------
|
70
|
+
|
71
|
+
if object.method(context).arity != 0 && !skip_args
|
64
72
|
object.send(context, transition)
|
65
73
|
else
|
66
74
|
object.send(context)
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'state_machines-activerecord'
|
2
2
|
|
3
3
|
class StateMachines::AuditTrail::Backend::ActiveRecord < StateMachines::AuditTrail::Backend
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(transition_class, owner_class, context = nil)
|
4
|
+
def initialize(transition_class, owner_class, options = {})
|
5
|
+
super
|
7
6
|
@association = transition_class.to_s.tableize.split('/').last.to_sym
|
8
|
-
|
9
|
-
|
10
|
-
owner_class.has_many(@association, class_name: transition_class.to_s) unless owner_class.reflect_on_association(@association)
|
7
|
+
assoc_options = {class_name: transition_class.to_s}.merge(options.slice(:as))
|
8
|
+
owner_class.has_many(@association, assoc_options) unless owner_class.reflect_on_association(@association)
|
11
9
|
end
|
12
10
|
|
13
11
|
def persist(object, fields)
|
@@ -12,6 +12,7 @@ module StateMachines::AuditTrail::TransitionAuditing
|
|
12
12
|
#
|
13
13
|
# options:
|
14
14
|
# - :class - custom state transition class
|
15
|
+
# - :owner_class - the class which is to own the persisted transition objects
|
15
16
|
# - :context - methods to call/store in field of same name in the state transition class
|
16
17
|
# - :initial - if false, won't log null => initial state transition upon instantiation
|
17
18
|
#
|
@@ -21,9 +22,10 @@ module StateMachines::AuditTrail::TransitionAuditing
|
|
21
22
|
raise ":class option[#{options[:class]}] must be a class (not a string)." unless options[:class].is_a? Class
|
22
23
|
end
|
23
24
|
transition_class = options[:class] || default_transition_class
|
25
|
+
owner_class = options[:owner_class] || self.owner_class
|
24
26
|
|
25
27
|
# backend implements #log to store transition information
|
26
|
-
@backend = StateMachines::AuditTrail::Backend.create_for(transition_class,
|
28
|
+
@backend = StateMachines::AuditTrail::Backend.create_for(transition_class, owner_class, options.slice(:context, :as))
|
27
29
|
|
28
30
|
# Initial state logging can be turned off. Very useful for a model with multiple state_machines using a single TransitionState object for logging
|
29
31
|
unless options[:initial] == false
|
@@ -171,6 +171,38 @@ class ARModelWithMultipleStateMachines < ActiveRecord::Base
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
+
class ARResourceStateTransition < ActiveRecord::Base
|
175
|
+
belongs_to :resource, polymorphic: true
|
176
|
+
end
|
177
|
+
|
178
|
+
class ARFirstModelWithPolymorphicStateTransition < ActiveRecord::Base
|
179
|
+
state_machine :state, :initial => :pending do
|
180
|
+
audit_trail class: ARResourceStateTransition, as: :ar_resource
|
181
|
+
|
182
|
+
event :start do
|
183
|
+
transition :pending => :in_progress
|
184
|
+
end
|
185
|
+
|
186
|
+
event :finish do
|
187
|
+
transition :in_progress => :complete
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
class ARSecondModelWithPolymorphicStateTransition < ActiveRecord::Base
|
193
|
+
state_machine :state, :initial => :pending do
|
194
|
+
audit_trail class: ARResourceStateTransition, as: :ar_resource
|
195
|
+
|
196
|
+
event :start do
|
197
|
+
transition :pending => :in_progress
|
198
|
+
end
|
199
|
+
|
200
|
+
event :finish do
|
201
|
+
transition :in_progress => :complete
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
174
206
|
module SomeModule
|
175
207
|
class ARModelStateTransition < ActiveRecord::Base
|
176
208
|
belongs_to :ar_model
|
@@ -215,20 +247,19 @@ def create_model_table(owner_class, multiple_state_machines = false, state_colum
|
|
215
247
|
end
|
216
248
|
|
217
249
|
|
218
|
-
%w(ARModel ARModelNoInitial ARModelWithContext ARModelWithMultipleContext).each do |name|
|
250
|
+
%w(ARModel ARModelNoInitial ARModelWithContext ARModelWithMultipleContext ARFirstModelWithPolymorphicStateTransition ARSecondModelWithPolymorphicStateTransition).each do |name|
|
219
251
|
create_model_table(name.constantize)
|
220
252
|
end
|
221
253
|
|
222
254
|
create_model_table(ARModelWithNamespace, false, :foo_state)
|
223
255
|
create_model_table(ARModelWithMultipleStateMachines, true)
|
224
256
|
|
225
|
-
|
226
|
-
|
227
|
-
class_name = "#{owner_class.name}#{state.to_s.camelize}Transition"
|
257
|
+
def create_transition_table(owner_class_name, state, add_context: false, polymorphic: false)
|
258
|
+
class_name = "#{owner_class_name}#{state.to_s.camelize}Transition"
|
228
259
|
ActiveRecord::Base.connection.create_table(class_name.tableize) do |t|
|
229
260
|
|
230
|
-
|
231
|
-
t.integer
|
261
|
+
t.references "#{owner_class_name.demodulize.underscore}", index: false, polymorphic: polymorphic
|
262
|
+
# t.integer owner_class_name.foreign_key
|
232
263
|
t.string :namespace
|
233
264
|
t.string :event
|
234
265
|
t.string :from
|
@@ -242,12 +273,13 @@ def create_transition_table(owner_class, state, add_context = false)
|
|
242
273
|
end
|
243
274
|
|
244
275
|
%w(ARModel ARModelNoInitial).each do |name|
|
245
|
-
create_transition_table(name
|
276
|
+
create_transition_table(name, :state)
|
246
277
|
end
|
247
278
|
|
248
|
-
create_transition_table(ARModelWithNamespace, :foo_state, false)
|
249
|
-
create_transition_table(ARModelWithContext, :state, true)
|
250
|
-
create_transition_table(ARModelWithMultipleContext, :state, true)
|
251
|
-
create_transition_table(ARModelWithMultipleStateMachines, :first)
|
252
|
-
create_transition_table(ARModelWithMultipleStateMachines, :second)
|
253
|
-
create_transition_table(ARModelWithMultipleStateMachines, :third)
|
279
|
+
create_transition_table("ARModelWithNamespace", :foo_state, add_context: false)
|
280
|
+
create_transition_table("ARModelWithContext", :state, add_context: true)
|
281
|
+
create_transition_table("ARModelWithMultipleContext", :state, add_context: true)
|
282
|
+
create_transition_table("ARModelWithMultipleStateMachines", :first)
|
283
|
+
create_transition_table("ARModelWithMultipleStateMachines", :second)
|
284
|
+
create_transition_table("ARModelWithMultipleStateMachines", :third)
|
285
|
+
create_transition_table("ARResource", :state, polymorphic: true)
|
data/spec/helpers/mongoid.yml
CHANGED
@@ -147,7 +147,7 @@ describe StateMachines::AuditTrail::Backend::ActiveRecord do
|
|
147
147
|
|
148
148
|
context 'wants to log a single context' do
|
149
149
|
before(:each) do
|
150
|
-
StateMachines::AuditTrail::Backend.create_for(ARModelWithContextStateTransition, ARModelWithContext, :context)
|
150
|
+
StateMachines::AuditTrail::Backend.create_for(ARModelWithContextStateTransition, ARModelWithContext, context: :context)
|
151
151
|
end
|
152
152
|
|
153
153
|
let!(:target) { ARModelWithContext.create! }
|
@@ -161,7 +161,7 @@ describe StateMachines::AuditTrail::Backend::ActiveRecord do
|
|
161
161
|
|
162
162
|
context 'wants to log multiple context fields' do
|
163
163
|
before(:each) do
|
164
|
-
StateMachines::AuditTrail::Backend.create_for(ARModelWithMultipleContextStateTransition, ARModelWithMultipleContext, [:context, :second_context, :context_with_args])
|
164
|
+
StateMachines::AuditTrail::Backend.create_for(ARModelWithMultipleContextStateTransition, ARModelWithMultipleContext, context: [:context, :second_context, :context_with_args])
|
165
165
|
end
|
166
166
|
|
167
167
|
let!(:target) { ARModelWithMultipleContext.create! }
|
@@ -264,6 +264,19 @@ describe StateMachines::AuditTrail::Backend::ActiveRecord do
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
|
+
context 'polymorphic' do
|
268
|
+
it 'creates polymorphic state transitions' do
|
269
|
+
m1 = ARFirstModelWithPolymorphicStateTransition.create!
|
270
|
+
m2 = ARSecondModelWithPolymorphicStateTransition.create!
|
271
|
+
m2.start!
|
272
|
+
m2.finish!
|
273
|
+
|
274
|
+
expect(m1.ar_resource_state_transitions.count).to eq(1)
|
275
|
+
expect(m2.ar_resource_state_transitions.count).to eq(3)
|
276
|
+
expect(ARResourceStateTransition.count).to eq(4)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
267
280
|
private
|
268
281
|
|
269
282
|
def assert_transition(state_transition, event, from, to)
|
@@ -1,98 +1,98 @@
|
|
1
|
-
# reset integrations so that something like ActiveRecord is not loaded and conflicting
|
2
|
-
require 'state_machines'
|
3
|
-
StateMachines::Integrations.reset
|
4
|
-
|
5
|
-
require 'spec_helper'
|
6
|
-
require 'state_machines-mongoid'
|
7
|
-
require 'helpers/mongoid'
|
8
|
-
|
9
|
-
describe StateMachines::AuditTrail::Backend::Mongoid do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
1
|
+
# # reset integrations so that something like ActiveRecord is not loaded and conflicting
|
2
|
+
# require 'state_machines'
|
3
|
+
# StateMachines::Integrations.reset
|
4
|
+
#
|
5
|
+
# require 'spec_helper'
|
6
|
+
# require 'state_machines-mongoid'
|
7
|
+
# require 'helpers/mongoid'
|
8
|
+
#
|
9
|
+
# describe StateMachines::AuditTrail::Backend::Mongoid do
|
10
|
+
#
|
11
|
+
# context '#create_for' do
|
12
|
+
# it 'should create a Mongoid backend' do
|
13
|
+
# backend = StateMachines::AuditTrail::Backend.create_for(MongoidTestModelStateTransition, MongoidTestModel)
|
14
|
+
# expect(backend).to be_instance_of(StateMachines::AuditTrail::Backend::Mongoid)
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# context 'single state machine' do
|
19
|
+
# let!(:target) { MongoidTestModel.create! }
|
20
|
+
#
|
21
|
+
# it 'should populate all fields' do
|
22
|
+
# target.start!
|
23
|
+
# last_transition = MongoidTestModelStateTransition.where(:mongoid_test_model_id => target.id).last
|
24
|
+
#
|
25
|
+
# expect(last_transition.event).to eq 'start'
|
26
|
+
# expect(last_transition.from).to eq 'waiting'
|
27
|
+
# expect(last_transition.to).to eq 'started'
|
28
|
+
# expect(last_transition.created_at).to be_within(10.seconds).of(DateTime.now)
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# it 'should log multiple events' do
|
32
|
+
# expect { target.start && target.stop && target.start }.to change(MongoidTestModelStateTransition, :count).by(3)
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# it 'do nothing on failed transition' do
|
36
|
+
# expect { target.stop }.not_to change(MongoidTestModelStateTransition, :count)
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# context 'multiple state machines' do
|
41
|
+
# let!(:target) { MongoidTestModelWithMultipleStateMachines.create! }
|
42
|
+
#
|
43
|
+
# it 'should log a state transition for the affected state machine' do
|
44
|
+
# expect { target.begin_first! }.to change(MongoidTestModelWithMultipleStateMachinesFirstTransition, :count).by(1)
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# it 'should not log a state transition for the unaffected state machine' do
|
48
|
+
# expect { target.begin_first! }.not_to change(MongoidTestModelWithMultipleStateMachinesSecondTransition, :count)
|
49
|
+
# end
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# context 'on an object with a state machine having an initial state' do
|
53
|
+
# let(:target_class) { MongoidTestModelWithMultipleStateMachines }
|
54
|
+
# let(:state_transition_class) { MongoidTestModelWithMultipleStateMachinesFirstTransition }
|
55
|
+
#
|
56
|
+
# it 'should log a state transition for the inital state' do
|
57
|
+
# expect { target_class.create! }.to change(state_transition_class, :count).by(1)
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# it 'should only set the :to state for the initial transition' do
|
61
|
+
# target_class.create!
|
62
|
+
# initial_transition = state_transition_class.last
|
63
|
+
# expect(initial_transition.event).to be_nil
|
64
|
+
# expect(initial_transition.from).to be_nil
|
65
|
+
# expect(initial_transition.to).to eq 'beginning'
|
66
|
+
# expect(initial_transition.created_at).to be_within(10.seconds).of(DateTime.now)
|
67
|
+
# end
|
68
|
+
# end
|
69
|
+
#
|
70
|
+
# context 'on an object with a state machine not having an initial state' do
|
71
|
+
# let(:target_class) { MongoidTestModelWithMultipleStateMachines }
|
72
|
+
# let(:state_transition_class) { MongoidTestModelWithMultipleStateMachinesSecondTransition }
|
73
|
+
#
|
74
|
+
# it 'should not log a transition when the object is created' do
|
75
|
+
# expect { target_class.create! }.not_to change(state_transition_class, :count)
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# it 'should log a transition for the first event' do
|
79
|
+
# expect { target_class.create.begin_second! }.to change(state_transition_class, :count).by(1)
|
80
|
+
# end
|
81
|
+
#
|
82
|
+
# it 'should not set a value for the :from state on the first transition' do
|
83
|
+
# target_class.create.begin_second!
|
84
|
+
# first_transition = state_transition_class.last
|
85
|
+
# expect(first_transition.event).to eq 'begin_second'
|
86
|
+
# expect(first_transition.from).to be_nil
|
87
|
+
# expect(first_transition.to).to eq 'beginning_second'
|
88
|
+
# expect(first_transition.created_at).to be_within(10.seconds).of(DateTime.now)
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# context 'on a class using STI' do
|
93
|
+
# it 'should properly grab the class name from STI models' do
|
94
|
+
# m = MongoidTestModelDescendant.create!
|
95
|
+
# expect { m.start! }.not_to raise_error
|
96
|
+
# end
|
97
|
+
# end
|
98
|
+
# end
|
@@ -22,12 +22,12 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency('state_machines-mongoid')
|
23
23
|
s.add_development_dependency('rake')
|
24
24
|
s.add_development_dependency('rspec', '>= 3.0.0')
|
25
|
-
s.add_development_dependency('activerecord', '>=
|
25
|
+
s.add_development_dependency('activerecord', '>= 5.0.0')
|
26
26
|
s.add_development_dependency('sqlite3')
|
27
|
-
s.add_development_dependency('mongoid', '>=
|
27
|
+
s.add_development_dependency('mongoid', '>= 6.0.0.beta')
|
28
28
|
s.add_development_dependency('bson_ext')
|
29
29
|
s.add_development_dependency('generator_spec')
|
30
|
-
s.add_development_dependency('rails', '>=
|
30
|
+
s.add_development_dependency('rails', '>= 5.0.0')
|
31
31
|
|
32
32
|
s.files = `git ls-files`.split($/).reject { |f| f =~ /^samples\// }
|
33
33
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_machines-audit_trail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Ross
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-10-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: state_machines
|
@@ -88,14 +88,14 @@ dependencies:
|
|
88
88
|
requirements:
|
89
89
|
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
91
|
+
version: 5.0.0
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
98
|
+
version: 5.0.0
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: sqlite3
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,14 +116,14 @@ dependencies:
|
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
119
|
+
version: 6.0.0.beta
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
126
|
+
version: 6.0.0.beta
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: bson_ext
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,14 +158,14 @@ dependencies:
|
|
158
158
|
requirements:
|
159
159
|
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
161
|
+
version: 5.0.0
|
162
162
|
type: :development
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
166
|
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
168
|
+
version: 5.0.0
|
169
169
|
description: Log transitions on a state_machines to support auditing and business
|
170
170
|
process analytics.
|
171
171
|
email:
|
@@ -178,6 +178,8 @@ extra_rdoc_files: []
|
|
178
178
|
files:
|
179
179
|
- ".gitignore"
|
180
180
|
- ".rspec"
|
181
|
+
- ".ruby-gemset"
|
182
|
+
- ".ruby-version"
|
181
183
|
- ".travis.yml"
|
182
184
|
- Gemfile
|
183
185
|
- LICENSE
|
@@ -221,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
223
|
version: '0'
|
222
224
|
requirements: []
|
223
225
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.6.7
|
225
227
|
signing_key:
|
226
228
|
specification_version: 4
|
227
229
|
summary: Log transitions on a state_machines to support auditing and business process
|