summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorAdam Leff <adam@leff.co>2016-12-02 14:51:56 -0500
committerThom May <thom@chef.io>2017-01-18 11:22:10 +0000
commit5ece8327c9d67fa13ca00cce5749a960c643b247 (patch)
tree3f1949e491b0689cead2e17a00e6f0529842445d /spec/unit
parenta70905ea932e1a5678c910c8495a344b3b0930e0 (diff)
downloadchef-5ece8327c9d67fa13ca00cce5749a960c643b247.tar.gz
Deprecate creating properties whose names are already methodsadamleff/warn-on-dangerous-property-names
When creating a resource, a user can create a property that is the same name as an already-existing Ruby method, such as `#hash`. In the case of the `#hash` method, this can cause issues when attempting to adding resources to other data structures, such as Arrays or Hashes. In other examples, this could cause unexpected behavior that is incredibly difficult to troubleshoot. This change adds a deprecation warning in the case where a user adds a property to a resource that the resource instance already responds to. If y'all are OK with this approach, I'll be happy to write up the deprecation doc for this for docs.chef.io. Signed-off-by: Adam Leff <adam@leff.co>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/provider/launchd_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/unit/provider/launchd_spec.rb b/spec/unit/provider/launchd_spec.rb
index 3e45433c62..693801f99b 100644
--- a/spec/unit/provider/launchd_spec.rb
+++ b/spec/unit/provider/launchd_spec.rb
@@ -185,8 +185,8 @@ XML
end
describe "hash is passed" do
- it "should produce the test_plist from the hash" do
- new_resource.hash test_hash
+ it "should produce the test_plist content from the plist_hash property" do
+ new_resource.plist_hash test_hash
expect(provider.content?).to be_truthy
expect(provider.content).to eql(test_plist)
end