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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 402286c5cd8a9288380d837b7faeb96429a5d5e0
4
- data.tar.gz: 45868b7761fa2ed0ffc42d7ab0c7ef637e52a668
3
+ metadata.gz: 5029171b777f00050a1716352f38a6d8336f51b3
4
+ data.tar.gz: d6b83b034f6c930f136307697c9c54d8d20a3fcf
5
5
  SHA512:
6
- metadata.gz: e5d7c42efeb5438ba6693008b2f92c9cffdcdced9982f550091e2c12b8f756d233a0d6ddb9f6517c9754bf8204c8e7ecdd96da4e9a6209b7bc3df1fd1e35c109
7
- data.tar.gz: dd23c1b785e7e917334ce577cd56412c1e1f6a6a30105edf827ab89296c9e1e77394a3762aeff67996401a8fbc887240a7a21ecd86ab178157fefd792accb670
6
+ metadata.gz: 47341842399bd8f3e6428602c7d13aed2c19c54f41ae63ecc491809dd8c1617b1374b1df300ebbed1598e2d8f1751540b1e1d93f7683eed24e8ab315877699b5
7
+ data.tar.gz: 768b6d0acb5ede97db9f890b804d5402585477886653a989f7ddb2ca304f4291af15668560c073252654dd52bb424eea193891a3e351abd0e3f8a846b8d27367
@@ -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.0 (not yet released)
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
@@ -288,7 +288,7 @@ in Rails 4.1+ for your state column:
288
288
  class Job < ActiveRecord::Base
289
289
  include AASM
290
290
 
291
- enum state {
291
+ enum state: {
292
292
  sleeping: 5,
293
293
  running: 99
294
294
  }
@@ -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.values.map {|e| e.transitions_from_state(current_state) }
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
@@ -1,3 +1,3 @@
1
1
  module AASM
2
- VERSION = "3.3.0"
2
+ VERSION = "3.3.1"
3
3
  end
@@ -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.0
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-06 00:00:00.000000000 Z
14
+ date: 2014-07-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake