summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2014-09-09 14:10:32 -0700
committerPhil Dibowitz <phil@ipom.com>2014-09-09 21:54:08 -0700
commit15f1a6c5550b7907cb8ab667d28b22f2d711974e (patch)
tree59eac79cc2d48eb54ddcf521cd939311948b9048 /spec/functional
parent3d933ab9fa547f58de846b4db588da47dbe11a8c (diff)
downloadchef-15f1a6c5550b7907cb8ab667d28b22f2d711974e.tar.gz
[master/12] Fix whyrun_safe_ruby_block regression
`whyrun_safe_ruby_block` broke in the 11 changes. Forward port of #2021
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/provider/whyrun_safe_ruby_block_spec.rb51
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/functional/provider/whyrun_safe_ruby_block_spec.rb b/spec/functional/provider/whyrun_safe_ruby_block_spec.rb
new file mode 100644
index 0000000000..150d46d384
--- /dev/null
+++ b/spec/functional/provider/whyrun_safe_ruby_block_spec.rb
@@ -0,0 +1,51 @@
+#
+# Author:: Serdar Sutay (<serdar@opscode.com>)
+# Copyright:: Copyright (c) 2014 Opscode, 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::Resource::WhyrunSafeRubyBlock do
+ let(:node) { Chef::Node.new }
+
+ let(:run_context) {
+ events = Chef::EventDispatch::Dispatcher.new
+ Chef::RunContext.new(node, {}, events)
+ }
+
+ before do
+ $evil_global_evil_laugh = :wahwah
+ Chef::Config[:why_run] = true
+ end
+
+ after do
+ Chef::Config[:why_run] = false
+ end
+
+ describe "when testing the resource" do
+ let(:new_resource) do
+ r = Chef::Resource::WhyrunSafeRubyBlock.new("reload all", run_context)
+ r.block { $evil_global_evil_laugh = :mwahahaha }
+ r
+ end
+
+ it "updates the evil laugh, even in why-run mode" do
+ new_resource.run_action(new_resource.action)
+ $evil_global_evil_laugh.should == :mwahahaha
+ new_resource.should be_updated
+ end
+ end
+end