Merge pull request #46 from codez/master

Keep options in subclasses
This commit is contained in:
Thorsten Böttger 2012-04-02 03:06:41 -07:00
commit 0015e945e0
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