Make "property :foo, :default => false" work
Before a default value of false was treated like a default of nil, which is not the same. Signed-off-by: Matt Aimonetti <mattaimonetti@gmail.com>
This commit is contained in:
parent
75a5018b12
commit
f7bbee8243
3 changed files with 9 additions and 3 deletions
|
@ -10,6 +10,7 @@ describe "ExtendedDocument" do
|
|||
property :preset, :default => {:right => 10, :top_align => false}
|
||||
property :set_by_proc, :default => Proc.new{Time.now}, :cast_as => 'Time'
|
||||
property :tags, :default => []
|
||||
property :false_default, :default => false
|
||||
property :name
|
||||
timestamps!
|
||||
end
|
||||
|
@ -157,6 +158,11 @@ describe "ExtendedDocument" do
|
|||
obj = WithDefaultValues.new(:tags => ['spec'])
|
||||
obj.tags.should == ['spec']
|
||||
end
|
||||
|
||||
it "should work with a default value of false" do
|
||||
obj = WithDefaultValues.new
|
||||
obj.false_default.should == false
|
||||
end
|
||||
end
|
||||
|
||||
describe "a doc with template values (CR::Model spec)" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue