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:
parent
383a36d9b7
commit
1acf14fc3c
3 changed files with 12 additions and 3 deletions
|
@ -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
|
||||
|
|
3
spec/models/sub_classing.rb
Normal file
3
spec/models/sub_classing.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class SubClassing < Silencer
|
||||
|
||||
end
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue