summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-02-24 16:12:51 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-02-28 11:19:48 -0800
commit0ca58ffd12e5399792e0f8a3b54c6f3ba7bddab2 (patch)
tree4c6ffee87fac90600b0ba386c6a329a8a27c2abb /spec
parentd8a2bc810381f58eeb4ecd4db7ff104038f8f97c (diff)
downloadchef-0ca58ffd12e5399792e0f8a3b54c6f3ba7bddab2.tar.gz
Chef-13 break: script and all its subclasses now errors on 'command' property
This was always a coding bug. The `command` property is only used internally but is exposed for users to twiddle because script subclasses execute. Thus this still violates Liskov Substitution and this is not an is-a relationship where inheritance might be appropriate, because the script resource should /use/ the execute resource and not /be an/ execute resource. The more you know... Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/support/shared/unit/script_resource.rb10
-rw-r--r--spec/unit/resource/script_spec.rb2
2 files changed, 2 insertions, 10 deletions
diff --git a/spec/support/shared/unit/script_resource.rb b/spec/support/shared/unit/script_resource.rb
index 27864e1625..a04da4b63e 100644
--- a/spec/support/shared/unit/script_resource.rb
+++ b/spec/support/shared/unit/script_resource.rb
@@ -1,7 +1,7 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Tyler Cloke (<tyler@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,10 +34,6 @@ shared_examples_for "a script resource" do
expect(script_resource.command).to be nil
end
- it "should set command to the name on the resource", chef: "< 13" do
- expect(script_resource.command).to eql script_resource.name
- end
-
it "should accept a string for the code" do
script_resource.code "hey jude"
expect(script_resource.code).to eql("hey jude")
@@ -52,10 +48,6 @@ shared_examples_for "a script resource" do
expect { script_resource.command("foo") }.to raise_error(Chef::Exceptions::Script)
end
- it "should not raise an exception if users set command on the resource", chef: "< 13" do
- expect { script_resource.command("foo") }.not_to raise_error
- end
-
describe "when executing guards" do
let(:resource) do
resource = script_resource
diff --git a/spec/unit/resource/script_spec.rb b/spec/unit/resource/script_spec.rb
index fca9fb0d7b..16f7650712 100644
--- a/spec/unit/resource/script_spec.rb
+++ b/spec/unit/resource/script_spec.rb
@@ -1,7 +1,7 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Tyler Cloke (<tyler@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");