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

Conversation

Projects
None yet
2 participants
@hayato1980
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@mizzy

mizzy Jul 5, 2013

Owner

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
Owner

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

This comment has been minimized.

Show comment
Hide comment
@hayato1980

hayato1980 Jul 5, 2013

Contributor

Just as you say.

I revert and reimplement by alias.

Contributor

hayato1980 commented Jul 5, 2013

Just as you say.

I revert and reimplement by alias.

@mizzy

This comment has been minimized.

Show comment
Hide comment
@mizzy

mizzy Jul 5, 2013

Owner

Thanks!

Owner

mizzy commented Jul 5, 2013

Thanks!

mizzy added a commit that referenced this pull request Jul 5, 2013

Merge pull request #203 from hayato1980/master
Support rpm on be_installed` matcher

@mizzy mizzy merged commit fef9673 into mizzy:master Jul 5, 2013

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