diff options
author | Chris Roberts <chrisroberts.code@gmail.com> | 2013-01-17 09:00:26 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-06-19 09:10:21 -0700 |
commit | 074f4cc60aefb356336315bb06ce7f9f6562ce14 (patch) | |
tree | e49be40c07f7dbc8db6c1e67dd71c89e58351658 | |
parent | bbc54a11e03a6b49ef91f58725a84a2e7693ada7 (diff) | |
download | chef-074f4cc60aefb356336315bb06ce7f9f6562ce14.tar.gz |
Rename #delay_eval helper to #lazy. Update specs to account for change.
-rw-r--r-- | lib/chef/mixin/params_validate.rb | 2 | ||||
-rw-r--r-- | spec/unit/mixin/params_validate_spec.rb | 10 |
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb index ea0b6e60db..d19758d0f9 100644 --- a/lib/chef/mixin/params_validate.rb +++ b/lib/chef/mixin/params_validate.rb @@ -77,7 +77,7 @@ class Chef opts end - def delay_eval(&block) + def lazy(&block) DelayedEvaluator.new(&block) end diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb index 8fca6a936e..aa37362dc3 100644 --- a/spec/unit/mixin/params_validate_spec.rb +++ b/spec/unit/mixin/params_validate_spec.rb @@ -382,18 +382,14 @@ describe Chef::Mixin::ParamsValidate do end.should raise_error(Chef::Exceptions::ValidationFailed) end - it "should create DelayedEvaluator instance when passed a block" do - @vo.set_or_return(:delayed, nil, {}) do - 'test' - end + it "should create DelayedEvaluator instance when #lazy is used" do + @vo.set_or_return(:delayed, @vo.lazy{ 'test' }, {}) @vo.instance_variable_get(:@delayed).should be_a(Chef::DelayedEvaluator) end it "should execute block on each call when DelayedEvaluator" do value = 'fubar' - @vo.set_or_return(:test, nil, {}) do - value - end + @vo.set_or_return(:test, @vo.lazy{ value }, {}) @vo.set_or_return(:test, nil, {}).should == 'fubar' value = 'foobar' @vo.set_or_return(:test, nil, {}).should == 'foobar' |