Permalink
Browse files

fix issue with defaults not getting set on initialization

  • Loading branch information...
1 parent 3c39934 commit 5f49ca1a09db64e09bfc65b1f2d24713f60527e1 hmcgowan committed Aug 9, 2012
Showing with 11 additions and 1 deletion.
  1. +1 −1 lib/watirmark/models/base.rb
  2. +10 −0 spec/model_spec.rb
@@ -137,9 +137,9 @@ def generate_uuid model_name=nil
def reload_settings
- update @params
create_default_methods
create_model_methods
+ update @params
end
View
@@ -91,8 +91,18 @@
m.middle_name.should == 'foo middle_name'
end
+ specify "should be able to override default settings on initialization" do
+ ModelWithDefaults = Watirmark::Model::Base.new(:foo, :bar) do
+ default.foo {"hello from proc"}
+ end
+
+ m = ModelWithDefaults.new :foo => 'hello init'
+ m.foo.should == 'hello init'
+ end
+
specify "update a default setting" do
m = @model.new
+ m.first_name.should == 'my_first_name'
m.first_name = 'fred'
m.first_name.should == 'fred'
end

0 comments on commit 5f49ca1

Please sign in to comment.