Merge branch 'master' into aasm4

This commit is contained in:
Thorsten Böttger 2014-05-18 12:50:35 +02:00
commit 887a1658da
4 changed files with 17 additions and 4 deletions

View File

@ -14,9 +14,10 @@
* deprecated old aasm_* class methods (old-style DSL), in preparation for AASM v4.0.0
## 3.2.0 (not yet released)
## 3.2.0
* support [Sequel](http://sequel.jeremyevans.net/) (see [issue #119](https://github.com/aasm/aasm/issues/119), thanks to [@godfat](https://github.com/godfat))
* may not fire an unknown event (see [issue #128](https://github.com/aasm/aasm/issues/128)
## 3.1.1

View File

@ -75,8 +75,11 @@ module AASM
end
def may_fire_event?(name, *args)
event = @instance.class.aasm.events[name]
event.may_fire?(@instance, *args)
if event = @instance.class.aasm.events[name]
event.may_fire?(@instance, *args)
else
false # unknown event
end
end
def set_current_state_with_persistence(state)

View File

@ -1,3 +1,3 @@
module AASM
VERSION = "3.1.1"
VERSION = "3.2.0"
end

View File

@ -72,4 +72,13 @@ describe 'when being unsuspended' do
expect(auth.aasm.current_state).to eq(:passive)
end
it "should be able to fire known events" do
expect(auth.aasm.may_fire_event?(:activate)).to be_true
end
it "should not be able to fire unknown events" do
expect(auth.aasm.may_fire_event?(:unknown)).to be_false
end
end