summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-11-14 12:45:53 -0800
committertyler-ball <tyleraball@gmail.com>2014-11-17 10:26:49 -0800
commitf1a188f6e3855d4ba0a31b64d447324661037d26 (patch)
treeae234045d611f5ecc0cae309e9f08fc9b8c4a0ff
parent6c810d8acea82e19dddac4fb09d7e798d2e136b8 (diff)
downloadchef-f1a188f6e3855d4ba0a31b64d447324661037d26.tar.gz
Adding test for duplicated DSL
-rw-r--r--spec/integration/solo/solo_spec.rb2
-rw-r--r--spec/unit/audit/duplication.rb50
2 files changed, 51 insertions, 1 deletions
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index 9500e7a1ca..cc9ba1abb2 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -92,7 +92,7 @@ EOM
# We have a timeout protection here so that if due to some bug
# run_lock gets stuck we can discover it.
expect {
- Timeout.timeout(1200) do
+ Timeout.timeout(120) do
chef_dir = File.join(File.dirname(__FILE__), "..", "..", "..")
# Instantiate the first chef-solo run
diff --git a/spec/unit/audit/duplication.rb b/spec/unit/audit/duplication.rb
new file mode 100644
index 0000000000..0d66a2e06c
--- /dev/null
+++ b/spec/unit/audit/duplication.rb
@@ -0,0 +1,50 @@
+#
+# Author:: Tyler Ball (<tball@getchef.com>)
+# Copyright:: Copyright (c) 2014 Chef, 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'
+require 'chef/dsl/audit'
+require 'chef/dsl/recipe'
+# This includes the Serverspec DSL
+require 'chef/audit'
+
+describe "Duplicated `package` DSL in Chef and Serverspec" do
+ # This includes the Chef DSL
+ include Chef::DSL::Recipe
+ # TODO why do I need this? Should I wrap below in calls to Recipe.instance_eval?
+ include Chef::DSL::Audit
+
+ # TODO disable rspec global DSL
+ # TODO disable serverspec global DSL
+
+ it "Should call the Chef Recipe DSL in a Chef Recipe" do
+ expect(Chef::Resource).to receive(:resource_for_node).with(:package) { Chef::Resource::Package }
+ expect(Chef::Resource::Package).to receive(:new).with("foo").and_call_original
+
+ package "foo"
+ end
+
+ it "Should call the Serverspec DSL in a `controls` Recipe" do
+ #expect(Chef::Resource).to receive(:resource_for_node).with(:package) { Chef::Resource::Package }
+ #expect(Chef::Resource::Package).to receive(:new).with("foo").and_call_original
+
+ controls "some controls" do
+ package "foo"
+ end
+ end
+
+end