htty 1.5.4 → 1.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +12 -9
  3. data/.rspec +2 -1
  4. data/.travis.yml +11 -8
  5. data/.yardopts +1 -1
  6. data/Gemfile +22 -10
  7. data/Guardfile +31 -13
  8. data/History.markdown +6 -0
  9. data/README.markdown +29 -13
  10. data/Rakefile +2 -64
  11. data/bin/console +10 -0
  12. data/bin/setup +8 -0
  13. data/exe/htty +5 -0
  14. data/htty.gemspec +27 -29
  15. data/lib/htty.rb +29 -4
  16. data/lib/htty/cli.rb +9 -16
  17. data/lib/htty/cli/body_open_command.rb +2 -7
  18. data/lib/htty/cli/command.rb +10 -18
  19. data/lib/htty/cli/commands.rb +76 -11
  20. data/lib/htty/cli/commands/address.rb +1 -14
  21. data/lib/htty/cli/commands/body_clear.rb +1 -8
  22. data/lib/htty/cli/commands/body_edit.rb +1 -11
  23. data/lib/htty/cli/commands/body_request.rb +1 -12
  24. data/lib/htty/cli/commands/body_request_open.rb +1 -10
  25. data/lib/htty/cli/commands/body_response.rb +1 -12
  26. data/lib/htty/cli/commands/body_response_open.rb +1 -11
  27. data/lib/htty/cli/commands/body_set.rb +1 -10
  28. data/lib/htty/cli/commands/body_unset.rb +1 -9
  29. data/lib/htty/cli/commands/cd.rb +1 -8
  30. data/lib/htty/cli/commands/cookie_add.rb +1 -8
  31. data/lib/htty/cli/commands/cookie_remove.rb +1 -8
  32. data/lib/htty/cli/commands/cookies.rb +1 -15
  33. data/lib/htty/cli/commands/cookies_add.rb +1 -11
  34. data/lib/htty/cli/commands/cookies_clear.rb +1 -8
  35. data/lib/htty/cli/commands/cookies_remove.rb +1 -11
  36. data/lib/htty/cli/commands/cookies_remove_all.rb +1 -11
  37. data/lib/htty/cli/commands/cookies_use.rb +1 -14
  38. data/lib/htty/cli/commands/delete.rb +1 -8
  39. data/lib/htty/cli/commands/exit.rb +1 -8
  40. data/lib/htty/cli/commands/follow.rb +1 -10
  41. data/lib/htty/cli/commands/form.rb +1 -7
  42. data/lib/htty/cli/commands/form_add.rb +1 -7
  43. data/lib/htty/cli/commands/form_clear.rb +1 -8
  44. data/lib/htty/cli/commands/form_remove.rb +1 -7
  45. data/lib/htty/cli/commands/form_remove_all.rb +1 -7
  46. data/lib/htty/cli/commands/fragment_clear.rb +1 -8
  47. data/lib/htty/cli/commands/fragment_set.rb +1 -10
  48. data/lib/htty/cli/commands/fragment_unset.rb +1 -9
  49. data/lib/htty/cli/commands/get.rb +1 -8
  50. data/lib/htty/cli/commands/header_set.rb +1 -8
  51. data/lib/htty/cli/commands/header_unset.rb +1 -8
  52. data/lib/htty/cli/commands/headers_clear.rb +1 -8
  53. data/lib/htty/cli/commands/headers_request.rb +1 -15
  54. data/lib/htty/cli/commands/headers_response.rb +1 -15
  55. data/lib/htty/cli/commands/headers_set.rb +1 -10
  56. data/lib/htty/cli/commands/headers_unset.rb +1 -10
  57. data/lib/htty/cli/commands/headers_unset_all.rb +1 -10
  58. data/lib/htty/cli/commands/help.rb +4 -12
  59. data/lib/htty/cli/commands/history.rb +1 -10
  60. data/lib/htty/cli/commands/history_verbose.rb +1 -12
  61. data/lib/htty/cli/commands/host_set.rb +1 -8
  62. data/lib/htty/cli/commands/http_delete.rb +1 -12
  63. data/lib/htty/cli/commands/http_get.rb +1 -13
  64. data/lib/htty/cli/commands/http_head.rb +1 -9
  65. data/lib/htty/cli/commands/http_options.rb +1 -9
  66. data/lib/htty/cli/commands/http_patch.rb +1 -13
  67. data/lib/htty/cli/commands/http_post.rb +1 -13
  68. data/lib/htty/cli/commands/http_put.rb +1 -12
  69. data/lib/htty/cli/commands/http_trace.rb +1 -9
  70. data/lib/htty/cli/commands/patch.rb +1 -8
  71. data/lib/htty/cli/commands/path_set.rb +11 -11
  72. data/lib/htty/cli/commands/port_set.rb +1 -9
  73. data/lib/htty/cli/commands/post.rb +1 -8
  74. data/lib/htty/cli/commands/put.rb +1 -8
  75. data/lib/htty/cli/commands/query_add.rb +1 -13
  76. data/lib/htty/cli/commands/query_clear.rb +1 -8
  77. data/lib/htty/cli/commands/query_remove.rb +1 -13
  78. data/lib/htty/cli/commands/query_set.rb +1 -13
  79. data/lib/htty/cli/commands/query_unset.rb +1 -13
  80. data/lib/htty/cli/commands/query_unset_all.rb +1 -10
  81. data/lib/htty/cli/commands/quit.rb +1 -7
  82. data/lib/htty/cli/commands/reuse.rb +5 -12
  83. data/lib/htty/cli/commands/scheme_set.rb +1 -9
  84. data/lib/htty/cli/commands/ssl_verification.rb +1 -11
  85. data/lib/htty/cli/commands/ssl_verification_off.rb +1 -10
  86. data/lib/htty/cli/commands/ssl_verification_on.rb +1 -10
  87. data/lib/htty/cli/commands/status.rb +1 -11
  88. data/lib/htty/cli/commands/undo.rb +1 -7
  89. data/lib/htty/cli/commands/userinfo_clear.rb +1 -8
  90. data/lib/htty/cli/commands/userinfo_set.rb +1 -11
  91. data/lib/htty/cli/commands/userinfo_unset.rb +1 -9
  92. data/lib/htty/cli/display.rb +4 -6
  93. data/lib/htty/cli/http_method_command.rb +1 -10
  94. data/lib/htty/cli/input_device.rb +1 -0
  95. data/lib/htty/cli/url_escaping.rb +1 -6
  96. data/lib/htty/cookies_util.rb +3 -3
  97. data/lib/htty/headers.rb +3 -4
  98. data/lib/htty/http_patch.rb +20 -23
  99. data/lib/htty/no_header_error.rb +1 -1
  100. data/lib/htty/no_location_header_error.rb +1 -3
  101. data/lib/htty/no_response_error.rb +1 -1
  102. data/lib/htty/no_set_cookie_header_error.rb +1 -3
  103. data/lib/htty/payload.rb +1 -5
  104. data/lib/htty/platform.rb +1 -1
  105. data/lib/htty/preferences.rb +1 -1
  106. data/lib/htty/request.rb +3 -13
  107. data/lib/htty/requests_util.rb +1 -5
  108. data/lib/htty/response.rb +1 -4
  109. data/lib/htty/session.rb +1 -3
  110. data/lib/htty/tempfile_preserving_extname.rb +1 -2
  111. data/lib/htty/uri.rb +1 -2
  112. data/lib/htty/version.rb +1 -1
  113. data/lib/tasks.rb +3 -0
  114. data/lib/tasks/build_doc.rake +8 -0
  115. data/lib/tasks/lib_each.rake +25 -0
  116. data/lib/tasks/spec.rake +68 -0
  117. data/lib/tasks/spec_each.rake +19 -0
  118. metadata +48 -209
  119. data/bin/htty +0 -5
  120. data/spec/integration/htty/cli/commands/query_add_spec.rb +0 -57
  121. data/spec/integration/htty/cli/commands/query_remove_spec.rb +0 -55
  122. data/spec/integration/htty/cli/commands/query_set_spec.rb +0 -78
  123. data/spec/integration/htty/cli/commands/query_unset_spec.rb +0 -43
  124. data/spec/spec_helper.rb +0 -76
  125. data/spec/unit/htty/cli/commands/address_spec.rb +0 -103
  126. data/spec/unit/htty/cli/commands/body_clear_spec.rb +0 -64
  127. data/spec/unit/htty/cli/commands/body_edit_spec.rb +0 -18
  128. data/spec/unit/htty/cli/commands/body_request_spec.rb +0 -67
  129. data/spec/unit/htty/cli/commands/body_response_spec.rb +0 -72
  130. data/spec/unit/htty/cli/commands/body_set_spec.rb +0 -71
  131. data/spec/unit/htty/cli/commands/body_unset_spec.rb +0 -69
  132. data/spec/unit/htty/cli/commands/cd_spec.rb +0 -57
  133. data/spec/unit/htty/cli/commands/cookie_add_spec.rb +0 -64
  134. data/spec/unit/htty/cli/commands/cookie_remove_spec.rb +0 -64
  135. data/spec/unit/htty/cli/commands/cookies_add_spec.rb +0 -78
  136. data/spec/unit/htty/cli/commands/cookies_clear_spec.rb +0 -64
  137. data/spec/unit/htty/cli/commands/cookies_remove_all_spec.rb +0 -73
  138. data/spec/unit/htty/cli/commands/cookies_remove_spec.rb +0 -69
  139. data/spec/unit/htty/cli/commands/cookies_spec.rb +0 -76
  140. data/spec/unit/htty/cli/commands/cookies_use_spec.rb +0 -75
  141. data/spec/unit/htty/cli/commands/delete_spec.rb +0 -64
  142. data/spec/unit/htty/cli/commands/exit_spec.rb +0 -64
  143. data/spec/unit/htty/cli/commands/follow_spec.rb +0 -70
  144. data/spec/unit/htty/cli/commands/form_add_spec.rb +0 -64
  145. data/spec/unit/htty/cli/commands/form_clear_spec.rb +0 -64
  146. data/spec/unit/htty/cli/commands/form_remove_all_spec.rb +0 -66
  147. data/spec/unit/htty/cli/commands/form_remove_spec.rb +0 -57
  148. data/spec/unit/htty/cli/commands/form_spec.rb +0 -57
  149. data/spec/unit/htty/cli/commands/fragment_clear_spec.rb +0 -64
  150. data/spec/unit/htty/cli/commands/fragment_set_spec.rb +0 -73
  151. data/spec/unit/htty/cli/commands/fragment_unset_spec.rb +0 -72
  152. data/spec/unit/htty/cli/commands/get_spec.rb +0 -64
  153. data/spec/unit/htty/cli/commands/header_set_spec.rb +0 -64
  154. data/spec/unit/htty/cli/commands/header_unset_spec.rb +0 -64
  155. data/spec/unit/htty/cli/commands/headers_clear_spec.rb +0 -64
  156. data/spec/unit/htty/cli/commands/headers_request_spec.rb +0 -81
  157. data/spec/unit/htty/cli/commands/headers_response_spec.rb +0 -77
  158. data/spec/unit/htty/cli/commands/headers_set_spec.rb +0 -74
  159. data/spec/unit/htty/cli/commands/headers_unset_all_spec.rb +0 -71
  160. data/spec/unit/htty/cli/commands/headers_unset_spec.rb +0 -63
  161. data/spec/unit/htty/cli/commands/help_spec.rb +0 -67
  162. data/spec/unit/htty/cli/commands/history_spec.rb +0 -65
  163. data/spec/unit/htty/cli/commands/history_verbose_spec.rb +0 -72
  164. data/spec/unit/htty/cli/commands/host_set_spec.rb +0 -71
  165. data/spec/unit/htty/cli/commands/http_delete_spec.rb +0 -75
  166. data/spec/unit/htty/cli/commands/http_get_spec.rb +0 -77
  167. data/spec/unit/htty/cli/commands/http_head_spec.rb +0 -69
  168. data/spec/unit/htty/cli/commands/http_options_spec.rb +0 -69
  169. data/spec/unit/htty/cli/commands/http_patch_spec.rb +0 -73
  170. data/spec/unit/htty/cli/commands/http_post_spec.rb +0 -73
  171. data/spec/unit/htty/cli/commands/http_put_spec.rb +0 -71
  172. data/spec/unit/htty/cli/commands/http_trace_spec.rb +0 -69
  173. data/spec/unit/htty/cli/commands/patch_spec.rb +0 -64
  174. data/spec/unit/htty/cli/commands/path_set_spec.rb +0 -72
  175. data/spec/unit/htty/cli/commands/port_set_spec.rb +0 -73
  176. data/spec/unit/htty/cli/commands/post_spec.rb +0 -64
  177. data/spec/unit/htty/cli/commands/put_spec.rb +0 -64
  178. data/spec/unit/htty/cli/commands/query_add_spec.rb +0 -82
  179. data/spec/unit/htty/cli/commands/query_clear_spec.rb +0 -64
  180. data/spec/unit/htty/cli/commands/query_remove_spec.rb +0 -82
  181. data/spec/unit/htty/cli/commands/query_set_spec.rb +0 -82
  182. data/spec/unit/htty/cli/commands/query_unset_all_spec.rb +0 -74
  183. data/spec/unit/htty/cli/commands/query_unset_spec.rb +0 -75
  184. data/spec/unit/htty/cli/commands/quit_spec.rb +0 -64
  185. data/spec/unit/htty/cli/commands/reuse_spec.rb +0 -72
  186. data/spec/unit/htty/cli/commands/scheme_set_spec.rb +0 -74
  187. data/spec/unit/htty/cli/commands/shared_examples_for_commands.rb +0 -55
  188. data/spec/unit/htty/cli/commands/ssl_verification_off_spec.rb +0 -67
  189. data/spec/unit/htty/cli/commands/ssl_verification_on_spec.rb +0 -60
  190. data/spec/unit/htty/cli/commands/ssl_verification_spec.rb +0 -65
  191. data/spec/unit/htty/cli/commands/status_spec.rb +0 -73
  192. data/spec/unit/htty/cli/commands/undo_spec.rb +0 -57
  193. data/spec/unit/htty/cli/commands/userinfo_clear_spec.rb +0 -64
  194. data/spec/unit/htty/cli/commands/userinfo_set_spec.rb +0 -97
  195. data/spec/unit/htty/cli/commands/userinfo_unset_spec.rb +0 -72
  196. data/spec/unit/htty/cli/display_spec.rb +0 -84
  197. data/spec/unit/htty/cli_spec.rb +0 -28
  198. data/spec/unit/htty/command.rb +0 -47
  199. data/spec/unit/htty/headers_spec.rb +0 -40
  200. data/spec/unit/htty/payload_spec.rb +0 -60
  201. data/spec/unit/htty/preferences_spec.rb +0 -8
  202. data/spec/unit/htty/request_follow_spec.rb +0 -94
  203. data/spec/unit/htty/request_spec.rb +0 -1232
  204. data/spec/unit/htty/request_userinfo_spec.rb +0 -208
  205. data/spec/unit/htty/response_spec.rb +0 -0
  206. data/spec/unit/htty/session_spec.rb +0 -10
  207. data/spec/unit/htty/shared_examples_for_requests.rb +0 -32
  208. data/spec/unit/htty/url_escaping.rb +0 -70
  209. data/spec/unit/htty/version_spec.rb +0 -8
@@ -1,78 +0,0 @@
1
- require 'spec_helper'
2
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/session")
3
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_set")
4
-
5
- describe HTTY::CLI::Commands::QuerySet do
6
- let :klass do
7
- subject.class
8
- end
9
-
10
- let :session do
11
- HTTY::Session.new nil
12
- end
13
-
14
- def instance(*arguments)
15
- klass.new :session => session, :arguments => arguments
16
- end
17
-
18
- describe 'without an argument' do
19
- it 'should raise an error' do
20
- expect{instance.perform}.to raise_error(ArgumentError)
21
- end
22
- end
23
-
24
- describe 'with one argument' do
25
- it 'should assign a single key' do
26
- instance('test').perform
27
- session.requests.last.uri.query.should == 'test'
28
- end
29
- end
30
-
31
- describe 'with two arguments' do
32
- it 'should assign a key-value pair' do
33
- instance('test', 'true').perform
34
- session.requests.last.uri.query.should == 'test=true'
35
- end
36
- end
37
-
38
- describe 'with three arguments' do
39
- it 'should assign a key-value pair and a valueless key' do
40
- instance('test', 'true', 'more').perform
41
- session.requests.last.uri.query.should == 'test=true&more'
42
- end
43
- end
44
-
45
- describe 'with four arguments' do
46
- it 'should assign two key-value pairs' do
47
- instance('test', 'true', 'more', 'false').perform
48
- session.requests.last.uri.query.should == 'test=true&more=false'
49
- end
50
- end
51
-
52
- describe 'with duplicate keys' do
53
- it 'should replace existing key' do
54
- session.requests.last.uri.query = 'test=true'
55
- instance('test', 'false').perform
56
- session.requests.last.uri.query.should == 'test=false'
57
- end
58
-
59
- it 'should maintain field location' do
60
- session.requests.last.uri.query = 'test=true&more=true'
61
- instance('test', 'false').perform
62
- session.requests.last.uri.query.should == 'test=false&more=true'
63
- end
64
-
65
- it 'should replace multiple instances with one' do
66
- session.requests.last.uri.query = 'test=true&more=true&test=true'
67
- instance('test', 'false').perform
68
- session.requests.last.uri.query.should == 'test=false&more=true'
69
- end
70
-
71
- it 'should play nice with nested fields' do
72
- instance('test[my][]', '1').perform
73
- instance('test[my][]', '2').perform
74
- instance('test', '3').perform
75
- session.requests.last.uri.query.should == 'test%5Bmy%5D%5B%5D=2&test=3'
76
- end
77
- end
78
- end
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/session")
3
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/address")
4
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_unset")
5
-
6
- describe HTTY::CLI::Commands::QueryUnset do
7
- let :klass do
8
- subject.class
9
- end
10
-
11
- let :session do
12
- HTTY::Session.new nil
13
- end
14
-
15
- def instance(*arguments)
16
- klass.new :session => session, :arguments => arguments
17
- end
18
-
19
- describe 'with existing query string with duplicate keys set' do
20
- before :each do
21
- session.requests.last.uri.query = 'test=true&test=false'
22
- end
23
-
24
- describe 'with only key specified' do
25
- it 'should remove all entries' do
26
- instance('test').perform
27
- session.requests.last.uri.query.should be_nil
28
- end
29
-
30
- it 'should not leave a trailing question mark' do
31
- instance('test').perform
32
- session.requests.last.uri.to_s.should_not end_with('?')
33
- end
34
- end
35
-
36
- describe 'with key and value specified' do
37
- it 'should remove matching entry only' do
38
- instance('test', 'true').perform
39
- session.requests.last.uri.query.should == 'test=false'
40
- end
41
- end
42
- end
43
- end
@@ -1,76 +0,0 @@
1
- begin
2
- require 'codeclimate-test-reporter'
3
- rescue LoadError
4
- else
5
- CodeClimate::TestReporter.start
6
- end
7
-
8
- # This file was generated by the `rspec --init` command. Conventionally, all
9
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
10
- # Require this file using `require "spec_helper"` to ensure that it is only
11
- # loaded once.
12
- #
13
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
14
- RSpec.configure do |config|
15
- config.treat_symbols_as_metadata_keys_with_true_values = true
16
- config.run_all_when_everything_filtered = true
17
- config.filter_run :focus
18
-
19
- # Run specs in random order to surface order dependencies. If you find an
20
- # order dependency and want to debug it, you can fix the order by providing
21
- # the seed, which is printed after each run.
22
- # --seed 1234
23
- config.order = 'random'
24
- end
25
-
26
-
27
- RSpec::Matchers.define :print_on_stdout do |check|
28
-
29
- @captured = nil
30
-
31
- match do |block|
32
- begin
33
- real_stdout = $stdout
34
- $stdout = StringIO.new
35
- block.call
36
- ensure
37
- @captured = $stdout
38
- $stdout = real_stdout
39
- end
40
- case check
41
- when String
42
- @captured.string == check
43
- when Regexp
44
- @captured.string.match(check)
45
- else
46
- false
47
- end
48
- end
49
-
50
- failure_message_for_should do
51
- "expected #{description}"
52
- end
53
-
54
- failure_message_for_should_not do
55
- "expected not #{description}"
56
- end
57
-
58
- description do
59
- "\n#{check}\non STDOUT but got\n#{@captured.string}\n"
60
- end
61
- end
62
-
63
- RSpec::Matchers.define :be_multiline do
64
- match do |actual|
65
- case actual
66
- when String
67
- !actual.empty? && actual.split(/\n/).count > 1
68
- else
69
- false
70
- end
71
- end
72
-
73
- description do
74
- 'be more than one line'
75
- end
76
- end
@@ -1,103 +0,0 @@
1
- require 'spec_helper'
2
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/address")
3
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/fragment_set")
4
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/host_set")
5
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/path_set")
6
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/port_set")
7
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_set")
8
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/scheme_set")
9
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/userinfo_set")
10
-
11
- describe HTTY::CLI::Commands::Address do
12
- describe 'class' do
13
- let :klass do
14
- subject.class
15
- end
16
-
17
- it 'should be an alias_for the expected command' do
18
- klass.alias_for.should == nil
19
- end
20
-
21
- it 'should have the expected aliases' do
22
- klass.aliases.should == []
23
- end
24
-
25
- it 'should belong to the expected category' do
26
- klass.category.should == 'Navigation'
27
- end
28
-
29
- it 'should have the expected command_line' do
30
- klass.command_line.should == 'a[ddress]'
31
- end
32
-
33
- it 'should have the expected command_line_arguments' do
34
- klass.command_line_arguments.should == 'ADDRESS'
35
- end
36
-
37
- it 'should have the expected help' do
38
- klass.help.should == 'Changes the address of the request'
39
- end
40
-
41
- it 'should have the expected help_extended' do
42
- expected = <<-end_help_extended
43
- Changes the address used for the request. Does not communicate with the host.
44
-
45
- The URL you supply can be partial. At a minimum, you must specify a host. The optional and required elements of an address are illustrated below:
46
-
47
- https://steve:woodside@apple.com:6666/store?q=ipad#sold-to-date
48
- \\______/\\_____________/\\_______/\\___/\\____/\\_____/\\___________/
49
- 1. 2. 3. 4. 5. 6. 7.
50
-
51
- 1. A scheme, or protocol identifier (i.e., 'http://' or 'https://' -- optional)
52
- 2. Userinfo (e.g., 'username:password@' -- optional)
53
- 3. A host (i.e., a hostname or IP address -- required)
54
- 4. A TCP port number (i.e., ':0' through ':65535' -- optional)
55
- 5. A path (optional)
56
- 6. A query string (e.g., '?foo=bar&baz=qux' -- optional)
57
- 7. A fragment (e.g., '#fragment-name' -- optional)
58
-
59
- If (1) is omitted, HTTP is used, except if (4) is specified as port 443, in which case HTTPS is used.
60
-
61
- If (3) is omitted, host 0.0.0.0 is used.
62
-
63
- If (4) is omitted, port 80 is used, except if (1) is specified as HTTPS, in which case port 443 is used.
64
-
65
- If (5) is omitted, the root path (i.e., '/') is used.
66
-
67
- The console prompt shows the address for the current request.
68
- end_help_extended
69
- klass.help_extended.should == expected.chomp
70
- end
71
-
72
- it 'should have the expected see_also_commands' do
73
- klass.see_also_commands.should == [HTTY::CLI::Commands::SchemeSet,
74
- HTTY::CLI::Commands::UserinfoSet,
75
- HTTY::CLI::Commands::HostSet,
76
- HTTY::CLI::Commands::PortSet,
77
- HTTY::CLI::Commands::PathSet,
78
- HTTY::CLI::Commands::QuerySet,
79
- HTTY::CLI::Commands::FragmentSet]
80
- end
81
-
82
- describe 'build_for' do
83
- it 'should correctly handle a valid, unabbreviated command line' do
84
- built = klass.build_for('address foo', :session => :the_session)
85
- built.should be_instance_of(klass)
86
- built.arguments.should == ['foo']
87
- built.session.should == :the_session
88
- end
89
-
90
- it 'should correctly handle a valid, abbreviated command line' do
91
- built = klass.build_for('a bar', :session => :a_session)
92
- built.should be_instance_of(klass)
93
- built.arguments.should == ['bar']
94
- built.session.should == :a_session
95
- end
96
-
97
- it 'should correctly handle a command line with a bad command' do
98
- built = klass.build_for('x baz', :session => :another_session)
99
- built.should == nil
100
- end
101
- end
102
- end
103
- end
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_clear")
3
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_unset")
4
-
5
- describe HTTY::CLI::Commands::BodyClear do
6
- describe 'class' do
7
- let :klass do
8
- subject.class
9
- end
10
-
11
- it 'should be an alias_for the expected command' do
12
- klass.alias_for.should == HTTY::CLI::Commands::BodyUnset
13
- end
14
-
15
- it 'should have the expected aliases' do
16
- klass.aliases.should == []
17
- end
18
-
19
- it 'should belong to the expected category' do
20
- klass.category.should == 'Building Requests'
21
- end
22
-
23
- it 'should have the expected command_line' do
24
- klass.command_line.should == 'body-c[lear]'
25
- end
26
-
27
- it 'should have the expected command_line_arguments' do
28
- klass.command_line_arguments.should == nil
29
- end
30
-
31
- it 'should have the expected help' do
32
- klass.help.should == "Alias for \e[1mbody-u[nset]\e[0m"
33
- end
34
-
35
- it 'should have the expected help_extended' do
36
- klass.help_extended.should == "Alias for \e[1mbody-u[nset]\e[0m."
37
- end
38
-
39
- it 'should have the expected see_also_commands' do
40
- klass.see_also_commands.should == [HTTY::CLI::Commands::BodyUnset]
41
- end
42
-
43
- describe 'build_for' do
44
- it 'should correctly handle a valid, unabbreviated command line' do
45
- built = klass.build_for('body-clear', :session => :the_session)
46
- built.should be_instance_of(klass)
47
- built.arguments.should == []
48
- built.session.should == :the_session
49
- end
50
-
51
- it 'should correctly handle a valid, abbreviated command line' do
52
- built = klass.build_for('body-c', :session => :a_session)
53
- built.should be_instance_of(klass)
54
- built.arguments.should == []
55
- built.session.should == :a_session
56
- end
57
-
58
- it 'should correctly handle a command line with a bad command' do
59
- built = klass.build_for('x', :session => :another_session)
60
- built.should == nil
61
- end
62
- end
63
- end
64
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
- require File.expand_path("#{File.dirname __FILE__}/shared_examples_for_commands")
3
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_edit")
4
-
5
- describe HTTY::CLI::Commands::BodyEdit do
6
- it_behaves_like 'a command' do
7
- let(:alias_for) {nil}
8
- let(:aliases) {[]}
9
- let(:arguments) {nil}
10
- let(:category) {'Building Requests'}
11
- let(:command_line) {'body-e[dit]'}
12
- let(:see_also_commands) {[
13
- HTTY::CLI::Commands::BodyRequest,
14
- HTTY::CLI::Commands::BodySet,
15
- HTTY::CLI::Commands::BodyUnset
16
- ]}
17
- end
18
- end
@@ -1,67 +0,0 @@
1
- require 'spec_helper'
2
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_request")
3
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_request_open")
4
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_response")
5
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_set")
6
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_unset")
7
- require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/headers_request")
8
-
9
- describe HTTY::CLI::Commands::BodyRequest do
10
- describe 'class' do
11
- let :klass do
12
- subject.class
13
- end
14
-
15
- it 'should be an alias_for the expected command' do
16
- klass.alias_for.should == nil
17
- end
18
-
19
- it 'should have the expected aliases' do
20
- klass.aliases.should == []
21
- end
22
-
23
- it 'should belong to the expected category' do
24
- klass.category.should == 'Building Requests'
25
- end
26
-
27
- it 'should have the expected command_line' do
28
- klass.command_line.should == 'body-request'
29
- end
30
-
31
- it 'should have the expected command_line_arguments' do
32
- klass.command_line_arguments.should == nil
33
- end
34
-
35
- it 'should have the expected help' do
36
- klass.help.should == 'Displays the body of the request'
37
- end
38
-
39
- it 'should have the expected help_extended' do
40
- klass.help_extended.should == 'Displays the body content used for the ' +
41
- 'request. Does not communicate with the ' +
42
- 'host.'
43
- end
44
-
45
- it 'should have the expected see_also_commands' do
46
- klass.see_also_commands.should == [HTTY::CLI::Commands::BodyRequestOpen,
47
- HTTY::CLI::Commands::BodySet,
48
- HTTY::CLI::Commands::BodyUnset,
49
- HTTY::CLI::Commands::HeadersRequest,
50
- HTTY::CLI::Commands::BodyResponse]
51
- end
52
-
53
- describe 'build_for' do
54
- it 'should correctly handle a valid, unabbreviated command line' do
55
- built = klass.build_for('body-request', :session => :the_session)
56
- built.should be_instance_of(klass)
57
- built.arguments.should == []
58
- built.session.should == :the_session
59
- end
60
-
61
- it 'should correctly handle a command line with a bad command' do
62
- built = klass.build_for('x', :session => :another_session)
63
- built.should == nil
64
- end
65
- end
66
- end
67
- end