state_machines-mongoid 0.1.0 → 0.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2084ec0e554c23254041e63aa0646f0cc9cf3d21
|
4
|
+
data.tar.gz: 26cf5deac7ccd94d7e69d5c45d51eb23f03174ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02359fa8bb84c95bb677be652e7a7c5978f58ee14ac3dc6d74a60314229ef7c092abdf3c4c568cda5fd985ba7bd51eb52c5ce436ea3754b7ea73b2f1696d89ef
|
7
|
+
data.tar.gz: 4565221a84bdb4781a5d0f847f2870ae78ce388c03979d91e84da3c86bebc7617e64edd8e614251175a818ef78b7615bedffe53672b63ef003a746b98e1a38a2
|
@@ -360,6 +360,10 @@ module StateMachines
|
|
360
360
|
self.class.state_machine(#{name.inspect}).send(:around_save, self) { super }
|
361
361
|
end
|
362
362
|
|
363
|
+
def update_document(*)
|
364
|
+
self.class.state_machine(#{name.inspect}).send(:around_save, self) { super }
|
365
|
+
end
|
366
|
+
|
363
367
|
def upsert(*)
|
364
368
|
self.class.state_machine(#{name.inspect}).send(:around_save, self) { super }
|
365
369
|
end
|
data/test/integration_test.rb
CHANGED
@@ -14,7 +14,7 @@ class IntegrationTest < BaseTestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_should_have_defaults
|
17
|
-
assert_equal({:action => :save}, StateMachines::Integrations::Mongoid.defaults)
|
17
|
+
assert_equal({:action => :save, :use_transactions => false}, StateMachines::Integrations::Mongoid.defaults)
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_should_have_a_locale_path
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class MachineWithMultipleTransitionsTest < BaseTestCase
|
4
|
+
def setup
|
5
|
+
@callbacks = []
|
6
|
+
|
7
|
+
@model = new_model
|
8
|
+
@machine = StateMachines::Machine.new(@model)
|
9
|
+
@machine.event :ignite do
|
10
|
+
transition :parked => :idling
|
11
|
+
end
|
12
|
+
@machine.event :shift_up do
|
13
|
+
transition :idling => :first_gear
|
14
|
+
end
|
15
|
+
@record = @model.new(state: 'parked')
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_should_run_before_callback_for_every_transition
|
19
|
+
before_count = 0
|
20
|
+
@machine.before_transition { before_count += 1 }
|
21
|
+
|
22
|
+
@record.ignite
|
23
|
+
assert_equal 1, before_count
|
24
|
+
@record.shift_up
|
25
|
+
assert_equal 2, before_count
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_should_run_after_callback_for_every_transition
|
29
|
+
after_count = 0
|
30
|
+
@machine.after_transition { after_count += 1 }
|
31
|
+
|
32
|
+
@record.ignite
|
33
|
+
assert_equal 1, after_count
|
34
|
+
@record.shift_up
|
35
|
+
assert_equal 2, after_count
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_machines-mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-02-
|
12
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: state_machines-activemodel
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- test/machine_with_initialized_state_test.rb
|
156
156
|
- test/machine_with_internationalization_test.rb
|
157
157
|
- test/machine_with_loopback_test.rb
|
158
|
+
- test/machine_with_multiple_callbacks_test.rb
|
158
159
|
- test/machine_with_non_column_state_attribute_defined_test.rb
|
159
160
|
- test/machine_with_non_column_state_attribute_undefined_test.rb
|
160
161
|
- test/machine_with_scopes_and_owner_subclass_test.rb
|
@@ -228,6 +229,7 @@ test_files:
|
|
228
229
|
- test/machine_with_initialized_state_test.rb
|
229
230
|
- test/machine_with_internationalization_test.rb
|
230
231
|
- test/machine_with_loopback_test.rb
|
232
|
+
- test/machine_with_multiple_callbacks_test.rb
|
231
233
|
- test/machine_with_non_column_state_attribute_defined_test.rb
|
232
234
|
- test/machine_with_non_column_state_attribute_undefined_test.rb
|
233
235
|
- test/machine_with_scopes_and_owner_subclass_test.rb
|