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 version method to package type for testing package version #311

Merged
merged 2 commits into from Dec 16, 2013

Conversation

mizzy
Copy link
Owner

@mizzy mizzy commented Dec 16, 2013

You can write a test for checking package version like this.

describe package('httpd') do
  its(:version) { should >= '2.2.14' }
end

@vincentbernat
Copy link
Contributor

That would be very useful! However, I think there is a trap with the use of >=. For example, '2.2.5' >= '2.2.14'. But this is unrelated to the functionality (we can use this functionality with a regular expression instead or do splitting before comparison).

I would also prefer to return nil if the package is not installed.

@mizzy
Copy link
Owner Author

mizzy commented Dec 16, 2013

I think there is a trap with the use of >=. For example, '2.2.5' >= '2.2.14'.

Yes, I know :-) It is an example to show that you can use any matchers or operators.

I would also prefer to return nil if the package is not installed.

Sure.I will fix it soon.

@mizzy
Copy link
Owner Author

mizzy commented Dec 16, 2013

I've fixed to return nil if the package is not installed.

Please check it.

@vincentbernat
Copy link
Contributor

It suits my need! Thanks!

@mizzy
Copy link
Owner Author

mizzy commented Dec 16, 2013

Thanks for your checking!

mizzy added a commit that referenced this pull request Dec 16, 2013
Add version method to package type for testing package version
@mizzy mizzy merged commit 149d0f4 into master Dec 16, 2013
@mizzy mizzy deleted the check-package-version branch December 16, 2013 15:18
@mizzy
Copy link
Owner Author

mizzy commented Dec 16, 2013

I've released specinfra v0.0.14 and serverspec v0.13.4.

@mizzy
Copy link
Owner Author

mizzy commented Mar 27, 2014

Released as v1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants