Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ChefSpec matchers #42

Merged
merged 1 commit into from
Apr 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions libraries/matchers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# rubocop:disable Style/AccessorMethodName
if defined?(ChefSpec)
ChefSpec.define_matcher :system_timezone

def set_system_timezone(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:system_timezone, :set, resource_name)
end

ChefSpec.define_matcher :system_environment

def configure_system_environment(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:system_environment, :configure, resource_name)
end

ChefSpec.define_matcher :system_hostname

def set_system_hostname(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:system_hostname, :set, resource_name)
end

ChefSpec.define_matcher :system_packages

def install_system_packages(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:system_packages, :install, resource_name)
end

def uninstall_system_packages(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:system_packages, :uninstall, resource_name)
end

ChefSpec.define_matcher :system_profile

def configure_system_profile(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:system_profile, :configure, resource_name)
end
end