summaryrefslogtreecommitdiff
path: root/spec/unit/resource/apt_package_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-12-15 17:01:55 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-12-15 17:06:48 -0800
commit7ff224e939b214df2fa92ef9ae1487c5f8e93327 (patch)
tree8dd14c5378735baded4139bc69414990d6cae1c4 /spec/unit/resource/apt_package_spec.rb
parent06806bafd2ce28b54360e382af6fd18c936e8277 (diff)
downloadchef-7ff224e939b214df2fa92ef9ae1487c5f8e93327.tar.gz
fix apt default_release attribute broken in 12.0
the apt provider attempts to check if it has a provider that responds to :default_release (i.e. a real apt_package resource) via if the provider attribute is explicitly set or not, which is relying on a side-effect which broke in 12.0. the correct behavior is just to duck-type the new_resource object and see if it respond_to?(:default_release) and then use it if it does. Also the unit tests were not testing the apt_provider against both the package and apt_package resources. Added some hacky spec code (which needs a cleanup) to at least exercise the use cases.
Diffstat (limited to 'spec/unit/resource/apt_package_spec.rb')
-rw-r--r--spec/unit/resource/apt_package_spec.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/spec/unit/resource/apt_package_spec.rb b/spec/unit/resource/apt_package_spec.rb
index be8eb9c324..3c31f63dd7 100644
--- a/spec/unit/resource/apt_package_spec.rb
+++ b/spec/unit/resource/apt_package_spec.rb
@@ -29,12 +29,10 @@ describe Chef::Resource::AptPackage, "initialize" do
os: "linux",
)
- before(:each) do
- @resource = Chef::Resource::AptPackage.new("foo")
- end
+ let(:resource) { Chef::Resource::AptPackage.new("foo") }
it "should support default_release" do
- @resource.default_release("lenny-backports")
- expect(@resource.default_release).to eql("lenny-backports")
+ resource.default_release("lenny-backports")
+ expect(resource.default_release).to eql("lenny-backports")
end
end