diff --git a/lib/configatron/proc.rb b/lib/configatron/proc.rb index 3ea7a07..97234dd 100644 --- a/lib/configatron/proc.rb +++ b/lib/configatron/proc.rb @@ -18,7 +18,7 @@ def call @val = val end end - return val || @val + return val.nil? ? @val : val end def finalize? diff --git a/test/unit/configatron/proc.rb b/test/unit/configatron/proc.rb index 303d455..24d55c9 100644 --- a/test/unit/configatron/proc.rb +++ b/test/unit/configatron/proc.rb @@ -20,5 +20,11 @@ class Critic::Unit::ProcTest < Critic::Unit::Test @proc.stubs(:finalize?).returns(false) refute_equal(@proc.call, @proc.call) end + + it 'sets and returns false in Dynamic' do + stubs(:rand).returns(false) + @proc.stubs(:finalize?).returns(false) + assert_equal(false, @proc.call) + end end end