Permalink
Browse files

Fix install_package_at_version matcher to work with single symbol act…

…ions.
  • Loading branch information...
1 parent c76c90e commit dabff2ace8737d3d0c8e76b0ac0df229aa2506d3 Chris Griego and Morgan Nelson committed with Development Nov 7, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −1 lib/chefspec/matchers/package.rb
  2. +3 −3 spec/chefspec/matchers/package_spec.rb
@@ -8,7 +8,7 @@ module Matchers
RSpec::Matchers.define :install_package_at_version do |package_name, version|
match do |chef_run|
chef_run.resources.any? do |resource|
- resource_type(resource) == 'package' and resource.package_name == package_name and resource.action.include? :install and resource.version == version
+ resource_type(resource) == 'package' and resource.package_name == package_name and resource.action.to_s.include? 'install' and resource.version == version
end
end
end
@@ -13,13 +13,13 @@ module Matchers
:source => 'config.conf.erb'}]}).should be false
end
it "should not match if is a different package and an unspecified version" do
- matcher.matches?({:resources => [{:resource_name => 'package', :package_name => 'bar', :version => nil, :action => [:install]}]}).should be false
+ matcher.matches?({:resources => [{:resource_name => 'package', :package_name => 'bar', :version => nil, :action => :install}]}).should be false
end
it "should not match if it is the same package and version but a different action" do
- matcher.matches?({:resources => [{:resource_name => 'package', :package_name => 'foo', :version => '1.2.3', :action => [:upgrade]}]}).should be false
+ matcher.matches?({:resources => [{:resource_name => 'package', :package_name => 'foo', :version => '1.2.3', :action => :upgrade}]}).should be false
end
it "should match if is the same package, the correct version and the install action" do
- matcher.matches?({:resources => [{:resource_name => 'package', :package_name => 'foo', :version => '1.2.3', :action => [:install]}]}).should be true
+ matcher.matches?({:resources => [{:resource_name => 'package', :package_name => 'foo', :version => '1.2.3', :action => :install}]}).should be true
end
end
end

0 comments on commit dabff2a

Please sign in to comment.