aasm 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +1 -1
- data/lib/aasm/instance_base.rb +1 -1
- data/lib/aasm/version.rb +1 -1
- data/spec/models/foo.rb +2 -1
- data/spec/unit/inspection_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5029171b777f00050a1716352f38a6d8336f51b3
|
4
|
+
data.tar.gz: d6b83b034f6c930f136307697c9c54d8d20a3fcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47341842399bd8f3e6428602c7d13aed2c19c54f41ae63ecc491809dd8c1617b1374b1df300ebbed1598e2d8f1751540b1e1d93f7683eed24e8ab315877699b5
|
7
|
+
data.tar.gz: 768b6d0acb5ede97db9f890b804d5402585477886653a989f7ddb2ca304f4291af15668560c073252654dd52bb424eea193891a3e351abd0e3f8a846b8d27367
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,11 @@
|
|
4
4
|
|
5
5
|
* deprecated old aasm_* class methods (old-style DSL), in preparation for AASM v4.0.0
|
6
6
|
|
7
|
-
## 3.3.
|
7
|
+
## 3.3.1
|
8
|
+
|
9
|
+
* bugfix: permissible events will respect given `guards` (see [issue #150](https://github.com/aasm/aasm/issues/150))
|
10
|
+
|
11
|
+
## 3.3.0
|
8
12
|
|
9
13
|
* support for Rails 4.1 enum fields (see [issue #124](https://github.com/aasm/aasm/issues/124), thanks to [@bkon](https://github.com/bkon))
|
10
14
|
* bugfix: allow lazy-evaluation for Rails 3 scopes (see [issue #144](https://github.com/aasm/aasm/issues/144), thanks to [@laurens](https://github.com/laurens))
|
data/README.md
CHANGED
data/lib/aasm/instance_base.rb
CHANGED
@@ -35,7 +35,7 @@ module AASM
|
|
35
35
|
def states(options={})
|
36
36
|
if options[:permissible]
|
37
37
|
# ugliness level 1000
|
38
|
-
transitions = @instance.class.aasm.events.
|
38
|
+
transitions = @instance.class.aasm.events.values_at(*permissible_events).compact.map {|e| e.transitions_from_state(current_state) }
|
39
39
|
tos = transitions.map {|t| t[0] ? t[0].to : nil}.flatten.compact.map(&:to_sym).uniq
|
40
40
|
@instance.class.aasm.states.select {|s| tos.include?(s.name.to_sym)}
|
41
41
|
else
|
data/lib/aasm/version.rb
CHANGED
data/spec/models/foo.rb
CHANGED
@@ -3,13 +3,14 @@ class Foo
|
|
3
3
|
aasm do
|
4
4
|
state :open, :initial => true, :exit => :exit
|
5
5
|
state :closed, :enter => :enter
|
6
|
+
state :final
|
6
7
|
|
7
8
|
event :close, :success => :success_callback do
|
8
9
|
transitions :from => [:open], :to => [:closed]
|
9
10
|
end
|
10
11
|
|
11
12
|
event :null do
|
12
|
-
transitions :from => [:open], :to => :closed, :guard => :always_false
|
13
|
+
transitions :from => [:open], :to => [:closed, :final], :guard => :always_false
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -22,10 +22,12 @@ describe 'inspection for common cases' do
|
|
22
22
|
states = foo.aasm.states
|
23
23
|
expect(states).to include(:open)
|
24
24
|
expect(states).to include(:closed)
|
25
|
+
expect(states).to include(:final)
|
25
26
|
|
26
27
|
states = foo.aasm.states(:permissible => true)
|
27
28
|
expect(states).to include(:closed)
|
28
29
|
expect(states).not_to include(:open)
|
30
|
+
expect(states).not_to include(:final)
|
29
31
|
|
30
32
|
foo.close
|
31
33
|
expect(foo.aasm.states(:permissible => true)).to be_empty
|
@@ -77,7 +79,7 @@ end
|
|
77
79
|
describe 'aasm.states_for_select' do
|
78
80
|
it "should return a select friendly array of states" do
|
79
81
|
expect(Foo.aasm).to respond_to(:states_for_select)
|
80
|
-
expect(Foo.aasm.states_for_select).to eq([['Open', 'open'], ['Closed', 'closed']])
|
82
|
+
expect(Foo.aasm.states_for_select).to eq([['Open', 'open'], ['Closed', 'closed'], ['Final', 'final']])
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
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: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Barron
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-07-
|
14
|
+
date: 2014-07-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|