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

Support rpm on be_installed` matcher #203

Merged
merged 2 commits into from Jul 5, 2013
Merged

Support rpm on be_installed` matcher #203

merged 2 commits into from Jul 5, 2013

Conversation

@hayato1980
Copy link
Contributor

@hayato1980 hayato1980 commented Jul 4, 2013

This pull request following test.

describe package('httpd') do
  it { should be_installed.by('rpm').with_version('2.2.15-28.el6') }
end

until apply this patch, following result.

 1) Package "httpd" 
     Failure/Error: it { should be_installed.by('rpm').with_version('2.2.15-28.el6') }
     ArgumentError: `be_installed` matcher doesn't support rpm

       `be_installed` matcher doesn't support rpm
@mizzy
Copy link
Owner

@mizzy mizzy commented Jul 5, 2013

Thanks.

You should use alias method rather than defining a new method like this.

def check_installed(package,version=nil)
  cmd = "rpm -q #{escape(package)}"
  if ! version.nil?
    cmd = "#{cmd} | grep -w -- #{escape(version)}"
  end
  cmd
end

alias :check_installed_by_rpm :check_installed
@hayato1980
Copy link
Contributor Author

@hayato1980 hayato1980 commented Jul 5, 2013

Just as you say.

I revert and reimplement by alias.

@mizzy
Copy link
Owner

@mizzy mizzy commented Jul 5, 2013

Thanks!

mizzy added a commit that referenced this pull request Jul 5, 2013
Support rpm on be_installed` matcher
@mizzy mizzy merged commit fef9673 into mizzy:master Jul 5, 2013
1 check passed
1 check passed
default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants