Commit 2566b021 authored by Steven Danna's avatar Steven Danna Committed by Bryan McLellan
Browse files

[CHEF-3469] Add #add method to Chef::RunList

"Add" is the verb used in the knife command to add items to the
run_list and for consistency it is convient for this same verb to be
available in chef-shell and knife-exec scripts.
parent 2c42e1d6
......@@ -29,7 +29,7 @@ class Chef
include Enumerable
include Chef::Mixin::ParamsValidate
# @run_list_items is an array of RunListItems that describe the items to
# @run_list_items is an array of RunListItems that describe the items to
# execute in order. RunListItems can load from and convert to the string
# forms users set on roles and nodes.
# For example:
......@@ -67,6 +67,7 @@ class Chef
end
alias :push :<<
alias :add :<<
def ==(other)
if other.kind_of?(Chef::RunList)
......@@ -162,4 +163,3 @@ class Chef
end
end
......@@ -77,6 +77,20 @@ describe Chef::RunList do
end
end
describe "add" do
# Testing only the basic functionality here
# since full behavior is tested above.
it "should add a recipe to the run_list" do
@run_list.add 'recipe[needy]'
@run_list.should include('recipe[needy]')
end
it "should add a role to the run_list" do
@run_list.add 'role[needy]'
@run_list.should include('role[needy]')
end
end
describe "==" do
it "should believe two RunLists are equal if they have the same members" do
@run_list << "foo"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment