fix initializer to keep existing options (originating from superclass)
This commit is contained in:
parent
383a36d9b7
commit
1acf14fc3c
|
@ -7,13 +7,13 @@ module AASM
|
||||||
|
|
||||||
if options.key?(:whiny_transitions)
|
if options.key?(:whiny_transitions)
|
||||||
sm.config.whiny_transitions = options[: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
|
sm.config.whiny_transitions = true # this is the default, so let's cry
|
||||||
end
|
end
|
||||||
|
|
||||||
if options.key?(:skip_validation_on_save)
|
if options.key?(:skip_validation_on_save)
|
||||||
sm.config.skip_validation_on_save = options[: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
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
class SubClassing < Silencer
|
||||||
|
|
||||||
|
end
|
|
@ -8,12 +8,18 @@ describe 'transitions' do
|
||||||
process.should be_sleeping
|
process.should be_sleeping
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not raise an exception when whiny' do
|
it 'should not raise an exception when not whiny' do
|
||||||
silencer = Silencer.new
|
silencer = Silencer.new
|
||||||
silencer.smile!.should be_false
|
silencer.smile!.should be_false
|
||||||
silencer.should be_silent
|
silencer.should be_silent
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe AASM::SupportingClasses::StateTransition do
|
describe AASM::SupportingClasses::StateTransition do
|
||||||
|
|
Loading…
Reference in New Issue