summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2017-05-25 22:03:28 -0700
committerNoah Kantrowitz <noah@coderanger.net>2017-05-25 22:03:28 -0700
commitca526db0a1a353abb966df136c49de017b95782e (patch)
treee17780855ad14fa6eaf09517edcb3c02b4d77821 /spec
parent2a830427c0610fb158a9ead63b2c29b259b6ab06 (diff)
parent2d71e99f69fc13bb007a2473811784a98cd15734 (diff)
downloadchef-ca526db0a1a353abb966df136c49de017b95782e.tar.gz
Merge branch 'master' into version-check
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'spec')
-rw-r--r--spec/functional/resource/chocolatey_package_spec.rb2
-rw-r--r--spec/functional/resource/windows_task_spec.rb2
-rw-r--r--spec/unit/provider/breakpoint_spec.rb53
-rw-r--r--spec/unit/provider_resolver_spec.rb2
-rw-r--r--spec/unit/resource/breakpoint_spec.rb39
5 files changed, 31 insertions, 67 deletions
diff --git a/spec/functional/resource/chocolatey_package_spec.rb b/spec/functional/resource/chocolatey_package_spec.rb
index ce71c06229..e8dae581b9 100644
--- a/spec/functional/resource/chocolatey_package_spec.rb
+++ b/spec/functional/resource/chocolatey_package_spec.rb
@@ -18,7 +18,7 @@
require "spec_helper"
require "chef/mixin/powershell_out"
-describe Chef::Resource::ChocolateyPackage, :windows_only, :win2012r2_only do
+describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
include Chef::Mixin::PowershellOut
let(:package_name) { "test-A" }
diff --git a/spec/functional/resource/windows_task_spec.rb b/spec/functional/resource/windows_task_spec.rb
index a04cbb5a83..14c78bd6be 100644
--- a/spec/functional/resource/windows_task_spec.rb
+++ b/spec/functional/resource/windows_task_spec.rb
@@ -396,7 +396,7 @@ describe Chef::Resource::WindowsTask, :windows_only do
end
end
- describe "action :end" do
+ describe "action :end", :volatile do
after { delete_task }
subject do
diff --git a/spec/unit/provider/breakpoint_spec.rb b/spec/unit/provider/breakpoint_spec.rb
deleted file mode 100644
index ffe8c8261f..0000000000
--- a/spec/unit/provider/breakpoint_spec.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Author:: Daniel DeLeo (<dan@kallistec.com>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "spec_helper"
-describe Chef::Provider::Breakpoint do
-
- before do
- @resource = Chef::Resource::Breakpoint.new
- @node = Chef::Node.new
- @events = Chef::EventDispatch::Dispatcher.new
- @run_context = Chef::RunContext.new(@node, {}, @events)
- @collection = double("resource collection")
- allow(@run_context).to receive(:resource_collection).and_return(@collection)
- @provider = Chef::Provider::Breakpoint.new(@resource, @run_context)
- end
-
- it "responds to load_current_resource" do
- expect(@provider).to respond_to(:load_current_resource)
- end
-
- it "gets the iterator from @collection and pauses it" do
- allow(Shell).to receive(:running?).and_return(true)
- @iterator = double("stepable_iterator")
- allow(@collection).to receive(:iterator).and_return(@iterator)
- expect(@iterator).to receive(:pause)
- @provider.action_break
- expect(@resource).to be_updated
- end
-
- it "doesn't pause the iterator if chef-shell isn't running" do
- allow(Shell).to receive(:running?).and_return(false)
- @iterator = double("stepable_iterator")
- allow(@collection).to receive(:iterator).and_return(@iterator)
- expect(@iterator).not_to receive(:pause)
- @provider.action_break
- end
-
-end
diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb
index 0a504fa5fe..1902fb5375 100644
--- a/spec/unit/provider_resolver_spec.rb
+++ b/spec/unit/provider_resolver_spec.rb
@@ -554,7 +554,7 @@ describe Chef::ProviderResolver do
PROVIDERS =
{
bash: [ Chef::Resource::Bash, Chef::Provider::Script ],
- breakpoint: [ Chef::Resource::Breakpoint, Chef::Provider::Breakpoint ],
+ breakpoint: [ Chef::Resource::Breakpoint, Chef::Resource::Breakpoint.action_class ],
chef_gem: [ Chef::Resource::ChefGem, Chef::Provider::Package::Rubygems ],
cookbook_file: [ Chef::Resource::CookbookFile, Chef::Provider::CookbookFile ],
csh: [ Chef::Resource::Csh, Chef::Provider::Script ],
diff --git a/spec/unit/resource/breakpoint_spec.rb b/spec/unit/resource/breakpoint_spec.rb
index a5b27bae16..ce0df676dd 100644
--- a/spec/unit/resource/breakpoint_spec.rb
+++ b/spec/unit/resource/breakpoint_spec.rb
@@ -17,31 +17,48 @@
#
require "spec_helper"
-require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::Breakpoint do
- static_provider_resolution(
- resource: Chef::Resource::Breakpoint,
- provider: Chef::Provider::Breakpoint,
- name: :breakpoint,
- action: :break
- )
+ let(:node) { Chef::Node.new }
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
+ let(:collection) { double("resource collection") }
+ let(:resource) { Chef::Resource::Breakpoint.new("name", run_context) }
+ let(:provider) { resource.provider_for_action(:break) }
before do
- @breakpoint = Chef::Resource::Breakpoint.new
+ allow(run_context).to receive(:resource_collection).and_return(collection)
+ end
+
+ it "gets the iterator from @collection and pauses it" do
+ allow(Shell).to receive(:running?).and_return(true)
+ iterator = double("stepable_iterator")
+ allow(collection).to receive(:iterator).and_return(iterator)
+ expect(iterator).to receive(:pause)
+ provider.action_break
+ expect(resource).to be_updated
+ end
+
+ it "doesn't pause the iterator if chef-shell isn't running" do
+ allow(Shell).to receive(:running?).and_return(false)
+ iterator = double("stepable_iterator")
+ allow(collection).to receive(:iterator).and_return(iterator)
+ expect(iterator).not_to receive(:pause)
+ provider.action_break
end
it "allows the action :break" do
- expect(@breakpoint.allowed_actions).to include(:break)
+ expect(resource.allowed_actions).to include(:break)
end
it "defaults to the break action" do
- expect(@breakpoint.action).to eq([:break])
+ expect(resource.action).to eq([:break])
end
it "names itself after the line number of the file where it's created" do
- expect(@breakpoint.name).to match(/breakpoint_spec\.rb\:[\d]{2}\:in \`new\'$/)
+ resource = Chef::Resource::Breakpoint.new
+ expect(resource.name).to match(/breakpoint_spec\.rb\:[\d]{2}\:in \`new\'$/)
end
end