summaryrefslogtreecommitdiff
path: root/spec/unit/node_spec.rb
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-05-14 16:02:06 -0700
committerClaire McQuin <claire@getchef.com>2014-05-15 14:04:59 -0700
commit1323ffb1de47b31b9e1515c8123c1b8545385a22 (patch)
treee17343bd84cb455380dc945d87bd782c4b9c8cfd /spec/unit/node_spec.rb
parent4c48ed4a014480cbb34091df3c79600bd3b7378d (diff)
downloadchef-1323ffb1de47b31b9e1515c8123c1b8545385a22.tar.gz
Change attribute whitelist filter syntax to match Ohai
Diffstat (limited to 'spec/unit/node_spec.rb')
-rw-r--r--spec/unit/node_spec.rb46
1 files changed, 23 insertions, 23 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 7c8dba0b12..21a978a9c9 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -852,41 +852,40 @@ describe Chef::Node do
end
context "with whitelisted attributes configured" do
- before do
- @defaults = {}
- ["automatic", "default", "normal", "override"].each do |level|
- option_key = "#{level}_attribute_whitelist".to_sym
- @defaults[level] = Chef::Config[option_key]
- end
- end
-
- after do
- @defaults.each do |level, setting|
- option_key = "#{level}_attribute_whitelist".to_sym
- Chef::Config[option_key] = setting
- end
- end
-
it "should only save whitelisted attributes (and subattributes)" do
- Chef::Config[:automatic_attribute_whitelist] = {
- "filesystem" => { "/dev/disk0s2" => true }
- }
+ Chef::Config[:automatic_attribute_whitelist] = [
+ ["filesystem", "/dev/disk0s2"],
+ "network/interfaces/eth0"
+ ]
data = {
"automatic" => {
"filesystem" => {
"/dev/disk0s2" => { "size" => "10mb" },
"map - autohome" => { "size" => "10mb" }
+ },
+ "network" => {
+ "interfaces" => {
+ "eth0" => {},
+ "eth1" => {}
+ }
}
- }
+ },
+ "default" => {}, "normal" => {}, "override" => {}
}
selected_data = {
"automatic" => {
"filesystem" => {
"/dev/disk0s2" => { "size" => "10mb" }
+ },
+ "network" => {
+ "interfaces" => {
+ "eth0" => {}
+ }
}
- }
+ },
+ "default" => {}, "normal" => {}, "override" => {}
}
node.name("picky-monkey")
@@ -896,7 +895,7 @@ describe Chef::Node do
end
it "should not save any attributes if the whitelist is empty" do
- Chef::Config[:automatic_attribute_whitelist] = {}
+ Chef::Config[:automatic_attribute_whitelist] = []
data = {
"automatic" => {
@@ -904,11 +903,12 @@ describe Chef::Node do
"/dev/disk0s2" => { "size" => "10mb" },
"map - autohome" => { "size" => "10mb" }
}
- }
+ },
+ "default" => {}, "normal" => {}, "override" => {}
}
selected_data = {
- "automatic" => {}
+ "automatic" => {}, "default" => {}, "normal" => {}, "override" => {}
}
node.name("picky-monkey")