1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Add --version output to command line options.

This commit is contained in:
Michael Vezzani 2015-07-08 11:11:11 -04:00
parent f8fa623578
commit 18b28d63f2
2 changed files with 12 additions and 1 deletions

View file

@ -62,6 +62,12 @@ OptionParser.new do |o|
puts o
exit
end
o.on("--version", "Show the version") do |ver|
puts "The current version is: #{HTTParty::VERSION}"
exit
end
end.parse!
if ARGV.empty?

View file

@ -9,6 +9,11 @@ Feature: Command Line
When I run `httparty --help`
Then the output should contain "-f, --format [FORMAT]"
Scenario: Show httparty version at command line
When I run `httparty --version`
Then the output should contain "The current version is:"
And the output should not contain "You need to provide a URL"
Scenario: Make a get request
Given a remote deflate service on port '4001'
And the response from the service has a body of 'GET request'
@ -87,4 +92,4 @@ Feature: Command Line
And that service is accessed at the path '/service.csv'
And the response from the service has a Content-Type of 'application/csv'
When I run `httparty http://0.0.0.0:4010/service.csv --format csv`
Then the output should contain '["Last Name", "Name"]'
Then the output should contain '["Last Name", "Name"]'