1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

fix initializer to keep existing options (originating from superclass)

This commit is contained in:
Pascal Zumkehr 2012-04-02 11:44:53 +02:00
parent 383a36d9b7
commit 1acf14fc3c
3 changed files with 12 additions and 3 deletions

View file

@ -7,13 +7,13 @@ module AASM
if options.key?(:whiny_transitions)
sm.config.whiny_transitions = options[:whiny_transitions]
else
elsif sm.config.whiny_transitions.nil?
sm.config.whiny_transitions = true # this is the default, so let's cry
end
if options.key?(:skip_validation_on_save)
sm.config.skip_validation_on_save = options[:skip_validation_on_save]
else
elsif sm.config.skip_validation_on_save.nil?
sm.config.skip_validation_on_save = false # this is the default, so don't store any new state if the model is invalid
end
end

View file

@ -0,0 +1,3 @@
class SubClassing < Silencer
end

View file

@ -8,12 +8,18 @@ describe 'transitions' do
process.should be_sleeping
end
it 'should not raise an exception when whiny' do
it 'should not raise an exception when not whiny' do
silencer = Silencer.new
silencer.smile!.should be_false
silencer.should be_silent
end
it 'should not raise an exception when superclass not whiny' do
sub = SubClassing.new
sub.smile!.should be_false
sub.should be_silent
end
end
describe AASM::SupportingClasses::StateTransition do