htty 1.1.6 → 1.2.0

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 (84) hide show
  1. data/History.markdown +46 -0
  2. data/README.markdown +12 -12
  3. data/VERSION +1 -1
  4. data/lib/htty/cli.rb +10 -0
  5. data/lib/htty/cli/command.rb +50 -41
  6. data/lib/htty/cli/commands/http_put.rb +3 -0
  7. data/lib/htty/cli/commands/query_unset.rb +4 -2
  8. data/lib/htty/cli/http_method_command.rb +5 -3
  9. data/spec/integration/htty/cli/commands/query_add_spec.rb +51 -0
  10. data/spec/integration/htty/cli/commands/query_remove_spec.rb +37 -0
  11. data/spec/integration/htty/cli/commands/query_set_spec.rb +72 -0
  12. data/spec/integration/htty/cli/commands/query_unset_spec.rb +37 -0
  13. data/spec/unit/htty/cli/commands/address_spec.rb +103 -0
  14. data/spec/unit/htty/cli/commands/body_clear_spec.rb +64 -0
  15. data/spec/unit/htty/cli/commands/body_request_spec.rb +72 -0
  16. data/spec/unit/htty/cli/commands/body_response_spec.rb +70 -0
  17. data/spec/unit/htty/cli/commands/body_set_spec.rb +71 -0
  18. data/spec/unit/htty/cli/commands/body_unset_spec.rb +69 -0
  19. data/spec/unit/htty/cli/commands/cd_spec.rb +57 -0
  20. data/spec/unit/htty/cli/commands/cookie_add_spec.rb +64 -0
  21. data/spec/unit/htty/cli/commands/cookie_remove_spec.rb +64 -0
  22. data/spec/unit/htty/cli/commands/cookies_add_spec.rb +78 -0
  23. data/spec/unit/htty/cli/commands/cookies_clear_spec.rb +64 -0
  24. data/spec/unit/htty/cli/commands/cookies_remove_all_spec.rb +73 -0
  25. data/spec/unit/htty/cli/commands/cookies_remove_spec.rb +69 -0
  26. data/spec/unit/htty/cli/commands/cookies_spec.rb +76 -0
  27. data/spec/unit/htty/cli/commands/cookies_use_spec.rb +75 -0
  28. data/spec/unit/htty/cli/commands/delete_spec.rb +64 -0
  29. data/spec/unit/htty/cli/commands/exit_spec.rb +64 -0
  30. data/spec/unit/htty/cli/commands/follow_spec.rb +70 -0
  31. data/spec/unit/htty/cli/commands/form_add_spec.rb +64 -0
  32. data/spec/unit/htty/cli/commands/form_clear_spec.rb +64 -0
  33. data/spec/unit/htty/cli/commands/form_remove_all_spec.rb +66 -0
  34. data/spec/unit/htty/cli/commands/form_remove_spec.rb +57 -0
  35. data/spec/unit/htty/cli/commands/form_spec.rb +57 -0
  36. data/spec/unit/htty/cli/commands/fragment_clear_spec.rb +64 -0
  37. data/spec/unit/htty/cli/commands/fragment_set_spec.rb +73 -0
  38. data/spec/unit/htty/cli/commands/fragment_unset_spec.rb +72 -0
  39. data/spec/unit/htty/cli/commands/get_spec.rb +64 -0
  40. data/spec/unit/htty/cli/commands/header_set_spec.rb +64 -0
  41. data/spec/unit/htty/cli/commands/header_unset_spec.rb +64 -0
  42. data/spec/unit/htty/cli/commands/headers_clear_spec.rb +64 -0
  43. data/spec/unit/htty/cli/commands/headers_request_spec.rb +81 -0
  44. data/spec/unit/htty/cli/commands/headers_response_spec.rb +77 -0
  45. data/spec/unit/htty/cli/commands/headers_set_spec.rb +74 -0
  46. data/spec/unit/htty/cli/commands/headers_unset_all_spec.rb +71 -0
  47. data/spec/unit/htty/cli/commands/headers_unset_spec.rb +63 -0
  48. data/spec/unit/htty/cli/commands/help_spec.rb +67 -0
  49. data/spec/unit/htty/cli/commands/history_spec.rb +65 -0
  50. data/spec/unit/htty/cli/commands/history_verbose_spec.rb +72 -0
  51. data/spec/unit/htty/cli/commands/host_set_spec.rb +71 -0
  52. data/spec/unit/htty/cli/commands/http_delete_spec.rb +73 -0
  53. data/spec/unit/htty/cli/commands/http_get_spec.rb +75 -0
  54. data/spec/unit/htty/cli/commands/http_head_spec.rb +69 -0
  55. data/spec/unit/htty/cli/commands/http_options_spec.rb +69 -0
  56. data/spec/unit/htty/cli/commands/http_post_spec.rb +71 -0
  57. data/spec/unit/htty/cli/commands/http_put_spec.rb +69 -0
  58. data/spec/unit/htty/cli/commands/http_trace_spec.rb +69 -0
  59. data/spec/unit/htty/cli/commands/path_set_spec.rb +72 -0
  60. data/spec/unit/htty/cli/commands/port_set_spec.rb +73 -0
  61. data/spec/unit/htty/cli/commands/post_spec.rb +64 -0
  62. data/spec/unit/htty/cli/commands/put_spec.rb +64 -0
  63. data/spec/unit/htty/cli/commands/query_add_spec.rb +67 -36
  64. data/spec/unit/htty/cli/commands/query_clear_spec.rb +64 -0
  65. data/spec/unit/htty/cli/commands/query_remove_spec.rb +69 -24
  66. data/spec/unit/htty/cli/commands/query_set_spec.rb +59 -49
  67. data/spec/unit/htty/cli/commands/query_unset_all_spec.rb +73 -0
  68. data/spec/unit/htty/cli/commands/query_unset_spec.rb +75 -0
  69. data/spec/unit/htty/cli/commands/quit_spec.rb +64 -0
  70. data/spec/unit/htty/cli/commands/reuse_spec.rb +72 -0
  71. data/spec/unit/htty/cli/commands/scheme_set_spec.rb +74 -0
  72. data/spec/unit/htty/cli/commands/ssl_verification_off_spec.rb +67 -0
  73. data/spec/unit/htty/cli/commands/ssl_verification_on_spec.rb +60 -0
  74. data/spec/unit/htty/cli/commands/ssl_verification_spec.rb +65 -0
  75. data/spec/unit/htty/cli/commands/status_spec.rb +73 -0
  76. data/spec/unit/htty/cli/commands/undo_spec.rb +57 -0
  77. data/spec/unit/htty/cli/commands/userinfo_clear_spec.rb +64 -0
  78. data/spec/unit/htty/cli/commands/userinfo_set_spec.rb +75 -0
  79. data/spec/unit/htty/cli/commands/userinfo_unset_spec.rb +72 -0
  80. data/spec/unit/htty/cli_spec.rb +8 -2
  81. data/spec/unit/htty/ordered_hash_spec.rb +14 -24
  82. data/spec/unit/htty/preferences_spec.rb +1 -1
  83. data/spec/unit/htty/request_spec.rb +454 -463
  84. metadata +80 -20
@@ -0,0 +1,69 @@
1
+ require 'rspec'
2
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
3
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_head")
4
+
5
+ describe HTTY::CLI::Commands::HttpHead 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 == nil
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 == 'Issuing Requests'
21
+ end
22
+
23
+ it 'should have the expected command_line' do
24
+ klass.command_line.should == 'http-h[ead]'
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 == 'Issues an HTTP HEAD using the current request'
33
+ end
34
+
35
+ it 'should have the expected help_extended' do
36
+ expected = <<-end_help_extended
37
+ Issues an HTTP HEAD using the current request.
38
+
39
+ Any request body you may set is ignored (i.e., it is not sent as part of the request).
40
+ end_help_extended
41
+ klass.help_extended.should == expected.chomp
42
+ end
43
+
44
+ it 'should have the expected see_also_commands' do
45
+ klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet]
46
+ end
47
+
48
+ describe 'build_for' do
49
+ it 'should correctly handle a valid, unabbreviated command line' do
50
+ built = klass.build_for('http-head', :session => :the_session)
51
+ built.should be_instance_of(klass)
52
+ built.arguments.should == []
53
+ built.session.should == :the_session
54
+ end
55
+
56
+ it 'should correctly handle a valid, abbreviated command line' do
57
+ built = klass.build_for('http-h', :session => :a_session)
58
+ built.should be_instance_of(klass)
59
+ built.arguments.should == []
60
+ built.session.should == :a_session
61
+ end
62
+
63
+ it 'should correctly handle a command line with a bad command' do
64
+ built = klass.build_for('x', :session => :another_session)
65
+ built.should == nil
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,69 @@
1
+ require 'rspec'
2
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
3
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_options")
4
+
5
+ describe HTTY::CLI::Commands::HttpOptions 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 == nil
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 == 'Issuing Requests'
21
+ end
22
+
23
+ it 'should have the expected command_line' do
24
+ klass.command_line.should == 'http-o[ptions]'
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 == 'Issues an HTTP OPTIONS using the current request'
33
+ end
34
+
35
+ it 'should have the expected help_extended' do
36
+ expected = <<-end_help_extended
37
+ Issues an HTTP OPTIONS using the current request.
38
+
39
+ Any request body you may set is ignored (i.e., it is not sent as part of the request).
40
+ end_help_extended
41
+ klass.help_extended.should == expected.chomp
42
+ end
43
+
44
+ it 'should have the expected see_also_commands' do
45
+ klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet]
46
+ end
47
+
48
+ describe 'build_for' do
49
+ it 'should correctly handle a valid, unabbreviated command line' do
50
+ built = klass.build_for('http-options', :session => :the_session)
51
+ built.should be_instance_of(klass)
52
+ built.arguments.should == []
53
+ built.session.should == :the_session
54
+ end
55
+
56
+ it 'should correctly handle a valid, abbreviated command line' do
57
+ built = klass.build_for('http-o', :session => :a_session)
58
+ built.should be_instance_of(klass)
59
+ built.arguments.should == []
60
+ built.session.should == :a_session
61
+ end
62
+
63
+ it 'should correctly handle a command line with a bad command' do
64
+ built = klass.build_for('x', :session => :another_session)
65
+ built.should == nil
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,71 @@
1
+ require 'rspec'
2
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/follow")
3
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_delete")
4
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
5
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_post")
6
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_put")
7
+
8
+ describe HTTY::CLI::Commands::HttpPost do
9
+ describe 'class' do
10
+ let :klass do
11
+ subject.class
12
+ end
13
+
14
+ it 'should be an alias_for the expected command' do
15
+ klass.alias_for.should == nil
16
+ end
17
+
18
+ it 'should have the expected aliases' do
19
+ klass.aliases.should == [HTTY::CLI::Commands::Post]
20
+ end
21
+
22
+ it 'should belong to the expected category' do
23
+ klass.category.should == 'Issuing Requests'
24
+ end
25
+
26
+ it 'should have the expected command_line' do
27
+ klass.command_line.should == 'http-po[st]'
28
+ end
29
+
30
+ it 'should have the expected command_line_arguments' do
31
+ klass.command_line_arguments.should == nil
32
+ end
33
+
34
+ it 'should have the expected help' do
35
+ klass.help.should == 'Issues an HTTP POST using the current request'
36
+ end
37
+
38
+ it 'should have the expected help_extended' do
39
+ klass.help_extended.should == 'Issues an HTTP POST using the current ' +
40
+ 'request.'
41
+ end
42
+
43
+ it 'should have the expected see_also_commands' do
44
+ klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet,
45
+ HTTY::CLI::Commands::Follow,
46
+ HTTY::CLI::Commands::HttpPut,
47
+ HTTY::CLI::Commands::HttpDelete]
48
+ end
49
+
50
+ describe 'build_for' do
51
+ it 'should correctly handle a valid, unabbreviated command line' do
52
+ built = klass.build_for('http-post', :session => :the_session)
53
+ built.should be_instance_of(klass)
54
+ built.arguments.should == []
55
+ built.session.should == :the_session
56
+ end
57
+
58
+ it 'should correctly handle a valid, abbreviated command line' do
59
+ built = klass.build_for('http-po', :session => :a_session)
60
+ built.should be_instance_of(klass)
61
+ built.arguments.should == []
62
+ built.session.should == :a_session
63
+ end
64
+
65
+ it 'should correctly handle a command line with a bad command' do
66
+ built = klass.build_for('x', :session => :another_session)
67
+ built.should == nil
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,69 @@
1
+ require 'rspec'
2
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_delete")
3
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
4
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_post")
5
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_put")
6
+
7
+ describe HTTY::CLI::Commands::HttpPut do
8
+ describe 'class' do
9
+ let :klass do
10
+ subject.class
11
+ end
12
+
13
+ it 'should be an alias_for the expected command' do
14
+ klass.alias_for.should == nil
15
+ end
16
+
17
+ it 'should have the expected aliases' do
18
+ klass.aliases.should == [HTTY::CLI::Commands::Put]
19
+ end
20
+
21
+ it 'should belong to the expected category' do
22
+ klass.category.should == 'Issuing Requests'
23
+ end
24
+
25
+ it 'should have the expected command_line' do
26
+ klass.command_line.should == 'http-pu[t]'
27
+ end
28
+
29
+ it 'should have the expected command_line_arguments' do
30
+ klass.command_line_arguments.should == nil
31
+ end
32
+
33
+ it 'should have the expected help' do
34
+ klass.help.should == 'Issues an HTTP PUT using the current request'
35
+ end
36
+
37
+ it 'should have the expected help_extended' do
38
+ klass.help_extended.should == 'Issues an HTTP PUT using the current ' +
39
+ 'request.'
40
+ end
41
+
42
+ it 'should have the expected see_also_commands' do
43
+ klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet,
44
+ HTTY::CLI::Commands::HttpPost,
45
+ HTTY::CLI::Commands::HttpDelete]
46
+ end
47
+
48
+ describe 'build_for' do
49
+ it 'should correctly handle a valid, unabbreviated command line' do
50
+ built = klass.build_for('http-put', :session => :the_session)
51
+ built.should be_instance_of(klass)
52
+ built.arguments.should == []
53
+ built.session.should == :the_session
54
+ end
55
+
56
+ it 'should correctly handle a valid, abbreviated command line' do
57
+ built = klass.build_for('http-pu', :session => :a_session)
58
+ built.should be_instance_of(klass)
59
+ built.arguments.should == []
60
+ built.session.should == :a_session
61
+ end
62
+
63
+ it 'should correctly handle a command line with a bad command' do
64
+ built = klass.build_for('x', :session => :another_session)
65
+ built.should == nil
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,69 @@
1
+ require 'rspec'
2
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
3
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_trace")
4
+
5
+ describe HTTY::CLI::Commands::HttpTrace 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 == nil
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 == 'Issuing Requests'
21
+ end
22
+
23
+ it 'should have the expected command_line' do
24
+ klass.command_line.should == 'http-t[race]'
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 == 'Issues an HTTP TRACE using the current request'
33
+ end
34
+
35
+ it 'should have the expected help_extended' do
36
+ expected = <<-end_help_extended
37
+ Issues an HTTP TRACE using the current request.
38
+
39
+ Any request body you may set is ignored (i.e., it is not sent as part of the request).
40
+ end_help_extended
41
+ klass.help_extended.should == expected.chomp
42
+ end
43
+
44
+ it 'should have the expected see_also_commands' do
45
+ klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet]
46
+ end
47
+
48
+ describe 'build_for' do
49
+ it 'should correctly handle a valid, unabbreviated command line' do
50
+ built = klass.build_for('http-trace', :session => :the_session)
51
+ built.should be_instance_of(klass)
52
+ built.arguments.should == []
53
+ built.session.should == :the_session
54
+ end
55
+
56
+ it 'should correctly handle a valid, abbreviated command line' do
57
+ built = klass.build_for('http-t', :session => :a_session)
58
+ built.should be_instance_of(klass)
59
+ built.arguments.should == []
60
+ built.session.should == :a_session
61
+ end
62
+
63
+ it 'should correctly handle a command line with a bad command' do
64
+ built = klass.build_for('x', :session => :another_session)
65
+ built.should == nil
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,72 @@
1
+ require 'rspec'
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/cd")
4
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/path_set")
5
+
6
+ describe HTTY::CLI::Commands::PathSet do
7
+ describe 'class' do
8
+ let :klass do
9
+ subject.class
10
+ end
11
+
12
+ it 'should be an alias_for the expected command' do
13
+ klass.alias_for.should == nil
14
+ end
15
+
16
+ it 'should have the expected aliases' do
17
+ klass.aliases.should == [HTTY::CLI::Commands::Cd]
18
+ end
19
+
20
+ it 'should belong to the expected category' do
21
+ klass.category.should == 'Navigation'
22
+ end
23
+
24
+ it 'should have the expected command_line' do
25
+ klass.command_line.should == 'pa[th-set]'
26
+ end
27
+
28
+ it 'should have the expected command_line_arguments' do
29
+ klass.command_line_arguments.should == 'PATH'
30
+ end
31
+
32
+ it 'should have the expected help' do
33
+ klass.help.should == "Changes the path of the request's address"
34
+ end
35
+
36
+ it 'should have the expected help_extended' do
37
+ expected = <<-end_help_extended
38
+ Changes the path used for the request. Does not communicate with the host.
39
+
40
+ The path will be URL-encoded if necessary.
41
+
42
+ The console prompt shows the address for the current request.
43
+ end_help_extended
44
+ klass.help_extended.should == expected.chomp
45
+ end
46
+
47
+ it 'should have the expected see_also_commands' do
48
+ klass.see_also_commands.should == [HTTY::CLI::Commands::Address]
49
+ end
50
+
51
+ describe 'build_for' do
52
+ it 'should correctly handle a valid, unabbreviated command line' do
53
+ built = klass.build_for('path-set foo', :session => :the_session)
54
+ built.should be_instance_of(klass)
55
+ built.arguments.should == ['foo']
56
+ built.session.should == :the_session
57
+ end
58
+
59
+ it 'should correctly handle a valid, abbreviated command line' do
60
+ built = klass.build_for('pa bar', :session => :a_session)
61
+ built.should be_instance_of(klass)
62
+ built.arguments.should == ['bar']
63
+ built.session.should == :a_session
64
+ end
65
+
66
+ it 'should correctly handle a command line with a bad command' do
67
+ built = klass.build_for('x baz', :session => :another_session)
68
+ built.should == nil
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,73 @@
1
+ require 'rspec'
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/port_set")
4
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/scheme_set")
5
+
6
+ describe HTTY::CLI::Commands::PortSet do
7
+ describe 'class' do
8
+ let :klass do
9
+ subject.class
10
+ end
11
+
12
+ it 'should be an alias_for the expected command' do
13
+ klass.alias_for.should == nil
14
+ end
15
+
16
+ it 'should have the expected aliases' do
17
+ klass.aliases.should == []
18
+ end
19
+
20
+ it 'should belong to the expected category' do
21
+ klass.category.should == 'Navigation'
22
+ end
23
+
24
+ it 'should have the expected command_line' do
25
+ klass.command_line.should == 'por[t-set]'
26
+ end
27
+
28
+ it 'should have the expected command_line_arguments' do
29
+ klass.command_line_arguments.should == 'PORT'
30
+ end
31
+
32
+ it 'should have the expected help' do
33
+ klass.help.should == "Changes the TCP port of the request's address"
34
+ end
35
+
36
+ it 'should have the expected help_extended' do
37
+ expected = <<-end_help_extended
38
+ Changes the TCP port used for the request. Does not communicate with the host.
39
+
40
+ The port you supply must be an integer between 0 and 65,535. Changing the port has no effect on the scheme, and vice versa.
41
+
42
+ The console prompt shows the address for the current request.
43
+ end_help_extended
44
+ klass.help_extended.should == expected.chomp
45
+ end
46
+
47
+ it 'should have the expected see_also_commands' do
48
+ klass.see_also_commands.should == [HTTY::CLI::Commands::Address,
49
+ HTTY::CLI::Commands::SchemeSet]
50
+ end
51
+
52
+ describe 'build_for' do
53
+ it 'should correctly handle a valid, unabbreviated command line' do
54
+ built = klass.build_for('port-set foo', :session => :the_session)
55
+ built.should be_instance_of(klass)
56
+ built.arguments.should == ['foo']
57
+ built.session.should == :the_session
58
+ end
59
+
60
+ it 'should correctly handle a valid, abbreviated command line' do
61
+ built = klass.build_for('por bar', :session => :a_session)
62
+ built.should be_instance_of(klass)
63
+ built.arguments.should == ['bar']
64
+ built.session.should == :a_session
65
+ end
66
+
67
+ it 'should correctly handle a command line with a bad command' do
68
+ built = klass.build_for('x baz', :session => :another_session)
69
+ built.should == nil
70
+ end
71
+ end
72
+ end
73
+ end