summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-03-13 12:56:44 -0700
committerPete Higgins <pete@peterhiggins.org>2020-03-23 13:55:01 -0700
commit7d5642cc9e3b0ab3bbfcf6e1fc0fe234ac59fbfc (patch)
tree518ee7f576bd31c763f8103f15318025988450de /spec
parent1bc1c904749997ca8696c575f880d0f50a8c05a6 (diff)
downloadchef-7d5642cc9e3b0ab3bbfcf6e1fc0fe234ac59fbfc.tar.gz
Move clear_sources? helper from resource to provider.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb45
-rw-r--r--spec/unit/resource/gem_package_spec.rb38
2 files changed, 45 insertions, 38 deletions
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index 1ef76c05c3..295e5f9bf9 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -992,3 +992,48 @@ describe Chef::Provider::Package::Rubygems do
end
end
end
+
+describe Chef::Provider::Package::Rubygems, "clear_sources?" do
+ let(:new_resource) do
+ Chef::Resource::GemPackage.new("foo")
+ end
+
+ let(:provider) do
+ run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)
+ Chef::Provider::Package::Rubygems.new(new_resource, run_context)
+ end
+
+ it "is false when clear_sources is unset" do
+ expect(provider.clear_sources?).to be false
+ end
+
+ it "is false when clear_sources is set false" do
+ new_resource.clear_sources(false)
+ expect(provider.clear_sources?).to be false
+ end
+
+ it "is true when clear_sources is set true" do
+ new_resource.clear_sources(true)
+ expect(provider.clear_sources?).to be true
+ end
+
+ context "when a source is set" do
+ before do
+ new_resource.source("http://mirror.ops.rhcloud.com/mirror/ruby")
+ end
+
+ it "is true when clear_sources is unset" do
+ expect(provider.clear_sources?).to be true
+ end
+
+ it "is false when clear_sources is set false" do
+ new_resource.clear_sources(false)
+ expect(provider.clear_sources?).to be false
+ end
+
+ it "is true when clear_sources is set true" do
+ new_resource.clear_sources(true)
+ expect(provider.clear_sources?).to be true
+ end
+ end
+end
diff --git a/spec/unit/resource/gem_package_spec.rb b/spec/unit/resource/gem_package_spec.rb
index 5ecc2f46ca..b572fd0d40 100644
--- a/spec/unit/resource/gem_package_spec.rb
+++ b/spec/unit/resource/gem_package_spec.rb
@@ -65,41 +65,3 @@ describe Chef::Resource::GemPackage, "clear_sources" do
expect(resource.clear_sources).to be true
end
end
-
-describe Chef::Resource::GemPackage, "clear_sources?" do
- let(:resource) { Chef::Resource::GemPackage.new("foo") }
-
- it "is false when clear_sources is unset" do
- expect(resource.clear_sources?).to be false
- end
-
- it "is false when clear_sources is set false" do
- resource.clear_sources(false)
- expect(resource.clear_sources?).to be false
- end
-
- it "is true when clear_sources is set true" do
- resource.clear_sources(true)
- expect(resource.clear_sources?).to be true
- end
-
- context "when a source is set" do
- before do
- resource.source("http://mirror.ops.rhcloud.com/mirror/ruby")
- end
-
- it "is true when clear_sources is unset" do
- expect(resource.clear_sources?).to be true
- end
-
- it "is false when clear_sources is set false" do
- resource.clear_sources(false)
- expect(resource.clear_sources?).to be false
- end
-
- it "is true when clear_sources is set true" do
- resource.clear_sources(true)
- expect(resource.clear_sources?).to be true
- end
- end
-end