diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2018-05-08 15:18:58 -0700 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2018-05-08 15:18:58 -0700 |
commit | 35977771fa4da04178590dc0e02e0c39c0e81fb0 (patch) | |
tree | 4db78895fdde6f83aaf832fb4c2e01eb70f56807 /spec | |
parent | dbee7f652952beb8e1056f6e6731223672788838 (diff) | |
download | chef-35977771fa4da04178590dc0e02e0c39c0e81fb0.tar.gz |
Switch Node#role? to use the attributes expansion instead of the run list.
This means it understands nested roles, avoiding a common footgun.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/node_spec.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index c9f3d7d1d2..3a43a155d5 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1160,16 +1160,16 @@ describe Chef::Node do describe "roles" do it "should allow you to query whether or not it has a recipe applied with role?" do - node.run_list << "role[sunrise]" + node.automatic["roles"] = %w{sunrise} expect(node.role?("sunrise")).to eql(true) expect(node.role?("not at home")).to eql(false) end it "should allow you to set roles with arguments" do - node.run_list << "role[one]" - node.run_list << "role[two]" + node.automatic["roles"] = %w{one two} expect(node.role?("one")).to eql(true) expect(node.role?("two")).to eql(true) + expect(node.role?("three")).to eql(false) end end |