summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJulian C. Dunn <jdunn@getchef.com>2013-12-19 17:36:23 -0500
committerBryan McLellan <btm@getchef.com>2014-03-19 17:09:55 -0700
commitc799a671f42931d5235fa8b90f04d642811fdd0d (patch)
treeb197a8170e7126c94885aa87ca98fa4157e80f47 /spec
parentb57226b4a8c80b865cd3e256923ba07e5ac09749 (diff)
downloadchef-c799a671f42931d5235fa8b90f04d642811fdd0d.tar.gz
[CHEF-3812] Support a --before option in "knife node run_list add"
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/knife/node_run_list_add_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/knife/node_run_list_add_spec.rb b/spec/unit/knife/node_run_list_add_spec.rb
index 61f2e6af4c..3113ee9e0b 100644
--- a/spec/unit/knife/node_run_list_add_spec.rb
+++ b/spec/unit/knife/node_run_list_add_spec.rb
@@ -65,6 +65,28 @@ describe Chef::Knife::NodeRunListAdd do
end
end
+ describe "with -b or --before specified" do
+ it "should add to the run list before the specified entry" do
+ @node.run_list << "role[acorns]"
+ @node.run_list << "role[barn]"
+ @knife.config[:before] = "role[acorns]"
+ @knife.run
+ @node.run_list[0].should == "role[monkey]"
+ @node.run_list[1].should == "role[acorns]"
+ @node.run_list[2].should == "role[barn]"
+ end
+ end
+
+ describe "with both --after and --before specified" do
+ it "should raise ArgumentError" do
+ @node.run_list << "role[acorns]"
+ @node.run_list << "role[barn]"
+ @knife.config[:before] = "role[acorns]"
+ @knife.config[:after] = "role[acorns]"
+ lambda { @knife.run }.should raise_error ArgumentError
+ end
+ end
+
describe "with more than one role or recipe" do
it "should add to the run list all the entries" do
@knife.name_args = [ "adam", "role[monkey],role[duck]" ]