From 07f504ff554534e41099019fc911b3ea1dd8382c Mon Sep 17 00:00:00 2001 From: Curt Wilhelm Date: Thu, 2 Mar 2017 18:18:58 -0700 Subject: [PATCH] adding matcher for cookbook tests (#37) --- CHANGELOG.md | 4 ++++ libraries/matcher.rb | 28 ++++++++++++++++++++++++++++ metadata.rb | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 libraries/matcher.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 4529690..b80d1a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ machine_tag Cookbook CHANGELOG This file is used to list changes made in each version of the machine_tag cookbook. +v2.0.3 +------ +- adding a matcher for cookbook test + v2.0.2 ------ - adding in support for chef 12.18 diff --git a/libraries/matcher.rb b/libraries/matcher.rb new file mode 100644 index 0000000..d60c240 --- /dev/null +++ b/libraries/matcher.rb @@ -0,0 +1,28 @@ +# +# Cookbook Name:: machine_tag +# Library:: matchers +# +# Copyright (C) 2017 RightScale, Inc. +# +# 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. +# + +if defined?(ChefSpec) + def create_machine_tag(resource_name) + ChefSpec::Matchers::ResourceMatcher.new('machine_tag', :create, resource_name) + end + + def delete_machine_tag(resource_name) + ChefSpec::Matchers::ResourceMatcher.new('machine_tag', :delete, resource_name) + end +end diff --git a/metadata.rb b/metadata.rb index a240503..b6430ff 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures machine_tag' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.2' +version '2.0.3' issues_url 'https://github.com/rightscale-cookbooks/machine_tag/issues' if respond_to?(:issues_url) source_url 'https://github.com/rightscale-cookbooks/machine_tag' if respond_to?(:source_url) chef_version '>= 12.0' if respond_to?(:chef_version)