state_machines-mongoid 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fedf8d86a63fa90c27d8b53ec06b1931a546eef6
4
- data.tar.gz: ef44e18220ddea7b4ce97150c9c6a4bce212a07d
3
+ metadata.gz: 2084ec0e554c23254041e63aa0646f0cc9cf3d21
4
+ data.tar.gz: 26cf5deac7ccd94d7e69d5c45d51eb23f03174ec
5
5
  SHA512:
6
- metadata.gz: d032c0f6a64c07d57890d1a41aa3b050d4321805b859cec4f04d0b57014b4e1fef1765f7559519ed8c7b1eabb825f5f823aa4907f01b2a7e5b5d4a414121e224
7
- data.tar.gz: 809fb648a49257d2340498ac8dd7eb43ba292ba1075450326c6365ea33a71cc4cf8cf06fdd93d82e1006284e41f040c046ed2682e15f133301496e830085f6f7
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
@@ -1,7 +1,7 @@
1
1
  module StateMachines
2
2
  module Integrations
3
3
  module Mongoid
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
6
6
  end
7
7
  end
@@ -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.0
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-11 00:00:00.000000000 Z
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