state_machines-activemodel 0.5.0 → 0.5.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 +5 -5
- data/.travis.yml +38 -16
- data/Appraisals +4 -0
- data/gemfiles/active_model_5.2.gemfile +11 -0
- data/lib/state_machines/integrations/active_model/version.rb +1 -1
- data/state_machines-activemodel.gemspec +1 -1
- data/test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb +7 -1
- data/test/machine_with_dirty_attribute_and_state_events_test.rb +7 -1
- data/test/machine_with_dirty_attributes_and_custom_attribute_test.rb +6 -0
- data/test/machine_with_dirty_attributes_during_loopback_test.rb +7 -25
- data/test/machine_with_dirty_attributes_test.rb +6 -0
- data/test/test_helper.rb +0 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a65ab5931d785bfe167675a0232d773e7512535bfa35f9425836927d112216f
|
4
|
+
data.tar.gz: 52d09ca9cac1fb9d5536817fcff391e26da9b08c8e1ec6d22d2c60c6d9f143b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b30f78d8a2bb57b60f0d4e9efcce549b4aadcb4727014aa39f727497f6413a159d877d8d6cbb21c9a7d30f80c94cc7fb3cd4f0448b13c4cdde92ac50ccb5205
|
7
|
+
data.tar.gz: b8ed3d456e734a6ab8e10afd1743c290a761d6c1149c7fb8bcc3812991683a43ce2a3748b0bab0dfc4a3c332a0eaa7bb2e2a5ecc712c10efcc1b246a6dd5b3f7
|
data/.travis.yml
CHANGED
@@ -4,42 +4,64 @@ cache: bundler
|
|
4
4
|
|
5
5
|
rvm:
|
6
6
|
- 2.1
|
7
|
-
- 2.2.
|
8
|
-
- 2.3.
|
9
|
-
- 2.4.
|
7
|
+
- 2.2.9
|
8
|
+
- 2.3.6
|
9
|
+
- 2.4.3
|
10
|
+
- 2.5.0
|
10
11
|
- jruby
|
11
12
|
- rbx-2
|
12
13
|
|
13
14
|
gemfile:
|
14
|
-
- gemfiles/active_model_4.1.gemfile
|
15
15
|
- gemfiles/active_model_4.2.gemfile
|
16
16
|
|
17
17
|
matrix:
|
18
18
|
include:
|
19
|
+
- gemfile: gemfiles/active_model_4.1.gemfile
|
20
|
+
rvm: 2.1
|
21
|
+
- gemfile: gemfiles/active_model_4.1.gemfile
|
22
|
+
rvm: 2.2.9
|
23
|
+
- gemfile: gemfiles/active_model_4.1.gemfile
|
24
|
+
rvm: 2.3.6
|
19
25
|
- gemfile: gemfiles/active_model_5.0.gemfile
|
20
|
-
rvm: 2.2.
|
26
|
+
rvm: 2.2.9
|
21
27
|
- gemfile: gemfiles/active_model_5.0.gemfile
|
22
|
-
rvm: 2.3.
|
28
|
+
rvm: 2.3.6
|
23
29
|
- gemfile: gemfiles/active_model_5.0.gemfile
|
24
|
-
rvm: 2.4.
|
30
|
+
rvm: 2.4.3
|
31
|
+
- gemfile: gemfiles/active_model_5.0.gemfile
|
32
|
+
rvm: 2.5.0
|
33
|
+
- gemfile: gemfiles/active_model_5.1.gemfile
|
34
|
+
rvm: 2.2.9
|
25
35
|
- gemfile: gemfiles/active_model_5.1.gemfile
|
26
|
-
rvm: 2.
|
36
|
+
rvm: 2.3.6
|
27
37
|
- gemfile: gemfiles/active_model_5.1.gemfile
|
28
|
-
rvm: 2.3
|
38
|
+
rvm: 2.4.3
|
29
39
|
- gemfile: gemfiles/active_model_5.1.gemfile
|
30
|
-
rvm: 2.
|
40
|
+
rvm: 2.5.0
|
41
|
+
- gemfile: gemfiles/active_model_5.2.gemfile
|
42
|
+
rvm: 2.2.9
|
43
|
+
- gemfile: gemfiles/active_model_5.2.gemfile
|
44
|
+
rvm: 2.3.6
|
45
|
+
- gemfile: gemfiles/active_model_5.2.gemfile
|
46
|
+
rvm: 2.4.3
|
47
|
+
- gemfile: gemfiles/active_model_5.2.gemfile
|
48
|
+
rvm: 2.5.0
|
31
49
|
- gemfile: gemfiles/active_model_edge.gemfile
|
32
|
-
rvm: 2.2.
|
50
|
+
rvm: 2.2.9
|
33
51
|
- gemfile: gemfiles/active_model_edge.gemfile
|
34
|
-
rvm: 2.3.
|
52
|
+
rvm: 2.3.6
|
35
53
|
- gemfile: gemfiles/active_model_edge.gemfile
|
36
|
-
rvm: 2.4.
|
54
|
+
rvm: 2.4.3
|
55
|
+
- gemfile: gemfiles/active_model_edge.gemfile
|
56
|
+
rvm: 2.5.0
|
37
57
|
allow_failures:
|
38
58
|
- rvm: jruby
|
39
59
|
- rvm: rbx-2
|
40
60
|
- gemfile: gemfiles/active_model_edge.gemfile
|
41
|
-
rvm: 2.2.
|
61
|
+
rvm: 2.2.9
|
62
|
+
- gemfile: gemfiles/active_model_edge.gemfile
|
63
|
+
rvm: 2.3.6
|
42
64
|
- gemfile: gemfiles/active_model_edge.gemfile
|
43
|
-
rvm: 2.3
|
65
|
+
rvm: 2.4.3
|
44
66
|
- gemfile: gemfiles/active_model_edge.gemfile
|
45
|
-
rvm: 2.
|
67
|
+
rvm: 2.5.0
|
data/Appraisals
CHANGED
@@ -15,6 +15,10 @@ appraise 'active_model_5.1' do
|
|
15
15
|
gem 'activemodel', github: 'rails/rails', branch: '5-1-stable'
|
16
16
|
end
|
17
17
|
|
18
|
+
appraise 'active_model_5.2' do
|
19
|
+
gem 'activemodel', github: 'rails/rails', branch: '5-2-stable'
|
20
|
+
end
|
21
|
+
|
18
22
|
appraise 'active_model_edge' do
|
19
23
|
gem 'activemodel', github: 'rails/rails', branch: 'master'
|
20
24
|
end
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
spec.required_ruby_version = '>= 2.0.0'
|
20
20
|
spec.add_dependency 'state_machines', '>= 0.5.0'
|
21
|
-
spec.add_dependency 'activemodel', '>= 4.1', '<
|
21
|
+
spec.add_dependency 'activemodel', '>= 4.1', '< 6.0'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '>= 1.6'
|
24
24
|
spec.add_development_dependency 'rake', '>= 10'
|
@@ -6,6 +6,12 @@ class MachineWithDirtyAttributeAndCustomAttributesDuringLoopbackTest < BaseTestC
|
|
6
6
|
include ActiveModel::Dirty
|
7
7
|
model_attribute :status
|
8
8
|
define_attribute_methods [:status]
|
9
|
+
|
10
|
+
def save
|
11
|
+
super.tap do
|
12
|
+
changes_applied
|
13
|
+
end
|
14
|
+
end
|
9
15
|
end
|
10
16
|
@machine = StateMachines::Machine.new(@model, :status, initial: :parked)
|
11
17
|
@machine.event :park
|
@@ -21,6 +27,6 @@ class MachineWithDirtyAttributeAndCustomAttributesDuringLoopbackTest < BaseTestC
|
|
21
27
|
end
|
22
28
|
|
23
29
|
def test_should_not_track_attribute_changes
|
24
|
-
|
30
|
+
assert_nil @record.changes['status']
|
25
31
|
end
|
26
32
|
end
|
@@ -5,6 +5,12 @@ class MachineWithDirtyAttributeAndStateEventsTest < BaseTestCase
|
|
5
5
|
@model = new_model do
|
6
6
|
include ActiveModel::Dirty
|
7
7
|
define_attribute_methods [:state]
|
8
|
+
|
9
|
+
def save
|
10
|
+
super.tap do
|
11
|
+
changes_applied
|
12
|
+
end
|
13
|
+
end
|
8
14
|
end
|
9
15
|
@machine = StateMachines::Machine.new(@model, action: :save, initial: :parked)
|
10
16
|
@machine.event :ignite
|
@@ -18,6 +24,6 @@ class MachineWithDirtyAttributeAndStateEventsTest < BaseTestCase
|
|
18
24
|
end
|
19
25
|
|
20
26
|
def test_should_not_track_attribute_change
|
21
|
-
|
27
|
+
assert_nil @record.changes['state']
|
22
28
|
end
|
23
29
|
end
|
@@ -6,6 +6,12 @@ class MachineWithDirtyAttributesAndCustomAttributeTest < BaseTestCase
|
|
6
6
|
include ActiveModel::Dirty
|
7
7
|
model_attribute :status
|
8
8
|
define_attribute_methods [:status]
|
9
|
+
|
10
|
+
def save
|
11
|
+
super.tap do
|
12
|
+
changes_applied
|
13
|
+
end
|
14
|
+
end
|
9
15
|
end
|
10
16
|
@machine = StateMachines::Machine.new(@model, :status, initial: :parked)
|
11
17
|
@machine.event :ignite
|
@@ -5,32 +5,14 @@ class MachineWithDirtyAttributesDuringLoopbackTest < BaseTestCase
|
|
5
5
|
@model = new_model do
|
6
6
|
include ActiveModel::Dirty
|
7
7
|
define_attribute_methods [:state]
|
8
|
-
end
|
9
|
-
@machine = StateMachines::Machine.new(@model, initial: :parked)
|
10
|
-
@machine.event :park
|
11
|
-
|
12
|
-
@record = @model.create
|
13
|
-
|
14
|
-
@transition = StateMachines::Transition.new(@record, @machine, :park, :parked, :parked)
|
15
|
-
@transition.perform
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_should_not_include_state_in_changed_attributes
|
19
|
-
assert_equal [], @record.changed
|
20
|
-
end
|
21
8
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
def setup
|
28
|
-
@model = new_model do
|
29
|
-
include ActiveModel::Dirty
|
30
|
-
model_attribute :status
|
31
|
-
define_attribute_methods [:status]
|
9
|
+
def save
|
10
|
+
super.tap do
|
11
|
+
changes_applied
|
12
|
+
end
|
13
|
+
end
|
32
14
|
end
|
33
|
-
@machine = StateMachines::Machine.new(@model,
|
15
|
+
@machine = StateMachines::Machine.new(@model, initial: :parked)
|
34
16
|
@machine.event :park
|
35
17
|
|
36
18
|
@record = @model.create
|
@@ -44,6 +26,6 @@ class MachineWithDirtyAttributeAndCustomAttributesDuringLoopbackTest < BaseTestC
|
|
44
26
|
end
|
45
27
|
|
46
28
|
def test_should_not_track_attribute_changes
|
47
|
-
|
29
|
+
assert_nil @record.changes['state']
|
48
30
|
end
|
49
31
|
end
|
@@ -5,6 +5,12 @@ class MachineWithDirtyAttributesTest < BaseTestCase
|
|
5
5
|
@model = new_model do
|
6
6
|
include ActiveModel::Dirty
|
7
7
|
define_attribute_methods [:state]
|
8
|
+
|
9
|
+
def save
|
10
|
+
super.tap do
|
11
|
+
changes_applied
|
12
|
+
end
|
13
|
+
end
|
8
14
|
end
|
9
15
|
@machine = StateMachines::Machine.new(@model, initial: :parked)
|
10
16
|
@machine.event :ignite
|
data/test/test_helper.rb
CHANGED
@@ -32,7 +32,6 @@ class BaseTestCase < MiniTest::Test
|
|
32
32
|
|
33
33
|
def initialize(attrs = {})
|
34
34
|
attrs.each { |attr, value| send("#{attr}=", value) }
|
35
|
-
@changed_attributes = {}
|
36
35
|
end
|
37
36
|
|
38
37
|
def attributes
|
@@ -40,7 +39,6 @@ class BaseTestCase < MiniTest::Test
|
|
40
39
|
end
|
41
40
|
|
42
41
|
def save
|
43
|
-
@changed_attributes = {}
|
44
42
|
true
|
45
43
|
end
|
46
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_machines-activemodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.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:
|
12
|
+
date: 2018-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: state_machines
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
version: '4.1'
|
35
35
|
- - "<"
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
37
|
+
version: '6.0'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: '4.1'
|
45
45
|
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '6.0'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: bundler
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- gemfiles/active_model_4.2.gemfile
|
135
135
|
- gemfiles/active_model_5.0.gemfile
|
136
136
|
- gemfiles/active_model_5.1.gemfile
|
137
|
+
- gemfiles/active_model_5.2.gemfile
|
137
138
|
- gemfiles/active_model_edge.gemfile
|
138
139
|
- lib/state_machines-activemodel.rb
|
139
140
|
- lib/state_machines/integrations/active_model.rb
|
@@ -185,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
186
|
version: '0'
|
186
187
|
requirements: []
|
187
188
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.7.3
|
189
190
|
signing_key:
|
190
191
|
specification_version: 4
|
191
192
|
summary: ActiveModel integration for State Machines
|