htty 1.1.6 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +46 -0
- data/README.markdown +12 -12
- data/VERSION +1 -1
- data/lib/htty/cli.rb +10 -0
- data/lib/htty/cli/command.rb +50 -41
- data/lib/htty/cli/commands/http_put.rb +3 -0
- data/lib/htty/cli/commands/query_unset.rb +4 -2
- data/lib/htty/cli/http_method_command.rb +5 -3
- data/spec/integration/htty/cli/commands/query_add_spec.rb +51 -0
- data/spec/integration/htty/cli/commands/query_remove_spec.rb +37 -0
- data/spec/integration/htty/cli/commands/query_set_spec.rb +72 -0
- data/spec/integration/htty/cli/commands/query_unset_spec.rb +37 -0
- data/spec/unit/htty/cli/commands/address_spec.rb +103 -0
- data/spec/unit/htty/cli/commands/body_clear_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/body_request_spec.rb +72 -0
- data/spec/unit/htty/cli/commands/body_response_spec.rb +70 -0
- data/spec/unit/htty/cli/commands/body_set_spec.rb +71 -0
- data/spec/unit/htty/cli/commands/body_unset_spec.rb +69 -0
- data/spec/unit/htty/cli/commands/cd_spec.rb +57 -0
- data/spec/unit/htty/cli/commands/cookie_add_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/cookie_remove_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/cookies_add_spec.rb +78 -0
- data/spec/unit/htty/cli/commands/cookies_clear_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/cookies_remove_all_spec.rb +73 -0
- data/spec/unit/htty/cli/commands/cookies_remove_spec.rb +69 -0
- data/spec/unit/htty/cli/commands/cookies_spec.rb +76 -0
- data/spec/unit/htty/cli/commands/cookies_use_spec.rb +75 -0
- data/spec/unit/htty/cli/commands/delete_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/exit_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/follow_spec.rb +70 -0
- data/spec/unit/htty/cli/commands/form_add_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/form_clear_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/form_remove_all_spec.rb +66 -0
- data/spec/unit/htty/cli/commands/form_remove_spec.rb +57 -0
- data/spec/unit/htty/cli/commands/form_spec.rb +57 -0
- data/spec/unit/htty/cli/commands/fragment_clear_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/fragment_set_spec.rb +73 -0
- data/spec/unit/htty/cli/commands/fragment_unset_spec.rb +72 -0
- data/spec/unit/htty/cli/commands/get_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/header_set_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/header_unset_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/headers_clear_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/headers_request_spec.rb +81 -0
- data/spec/unit/htty/cli/commands/headers_response_spec.rb +77 -0
- data/spec/unit/htty/cli/commands/headers_set_spec.rb +74 -0
- data/spec/unit/htty/cli/commands/headers_unset_all_spec.rb +71 -0
- data/spec/unit/htty/cli/commands/headers_unset_spec.rb +63 -0
- data/spec/unit/htty/cli/commands/help_spec.rb +67 -0
- data/spec/unit/htty/cli/commands/history_spec.rb +65 -0
- data/spec/unit/htty/cli/commands/history_verbose_spec.rb +72 -0
- data/spec/unit/htty/cli/commands/host_set_spec.rb +71 -0
- data/spec/unit/htty/cli/commands/http_delete_spec.rb +73 -0
- data/spec/unit/htty/cli/commands/http_get_spec.rb +75 -0
- data/spec/unit/htty/cli/commands/http_head_spec.rb +69 -0
- data/spec/unit/htty/cli/commands/http_options_spec.rb +69 -0
- data/spec/unit/htty/cli/commands/http_post_spec.rb +71 -0
- data/spec/unit/htty/cli/commands/http_put_spec.rb +69 -0
- data/spec/unit/htty/cli/commands/http_trace_spec.rb +69 -0
- data/spec/unit/htty/cli/commands/path_set_spec.rb +72 -0
- data/spec/unit/htty/cli/commands/port_set_spec.rb +73 -0
- data/spec/unit/htty/cli/commands/post_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/put_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/query_add_spec.rb +67 -36
- data/spec/unit/htty/cli/commands/query_clear_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/query_remove_spec.rb +69 -24
- data/spec/unit/htty/cli/commands/query_set_spec.rb +59 -49
- data/spec/unit/htty/cli/commands/query_unset_all_spec.rb +73 -0
- data/spec/unit/htty/cli/commands/query_unset_spec.rb +75 -0
- data/spec/unit/htty/cli/commands/quit_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/reuse_spec.rb +72 -0
- data/spec/unit/htty/cli/commands/scheme_set_spec.rb +74 -0
- data/spec/unit/htty/cli/commands/ssl_verification_off_spec.rb +67 -0
- data/spec/unit/htty/cli/commands/ssl_verification_on_spec.rb +60 -0
- data/spec/unit/htty/cli/commands/ssl_verification_spec.rb +65 -0
- data/spec/unit/htty/cli/commands/status_spec.rb +73 -0
- data/spec/unit/htty/cli/commands/undo_spec.rb +57 -0
- data/spec/unit/htty/cli/commands/userinfo_clear_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/userinfo_set_spec.rb +75 -0
- data/spec/unit/htty/cli/commands/userinfo_unset_spec.rb +72 -0
- data/spec/unit/htty/cli_spec.rb +8 -2
- data/spec/unit/htty/ordered_hash_spec.rb +14 -24
- data/spec/unit/htty/preferences_spec.rb +1 -1
- data/spec/unit/htty/request_spec.rb +454 -463
- metadata +80 -20
@@ -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/query_set")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_unset")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_unset_all")
|
6
|
+
|
7
|
+
describe HTTY::CLI::Commands::QueryUnsetAll 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::QueryClear]
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should belong to the expected category' do
|
22
|
+
klass.category.should == 'Navigation'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should have the expected command_line' do
|
26
|
+
klass.command_line.should == 'query-unset-[all]'
|
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 == "Clears the query string of the request's address"
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should have the expected help_extended' do
|
38
|
+
expected = <<-end_help_extended
|
39
|
+
Clears the query string used for the request. Does not communicate with the host.
|
40
|
+
|
41
|
+
The console prompt shows the address for the current request.
|
42
|
+
end_help_extended
|
43
|
+
klass.help_extended.should == expected.chomp
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should have the expected see_also_commands' do
|
47
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::QueryUnset,
|
48
|
+
HTTY::CLI::Commands::QuerySet,
|
49
|
+
HTTY::CLI::Commands::Address]
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'build_for' do
|
53
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
54
|
+
built = klass.build_for('query-unset-all', :session => :the_session)
|
55
|
+
built.should be_instance_of(klass)
|
56
|
+
built.arguments.should == []
|
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('query-unset-', :session => :a_session)
|
62
|
+
built.should be_instance_of(klass)
|
63
|
+
built.arguments.should == []
|
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', :session => :another_session)
|
69
|
+
built.should == nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,75 @@
|
|
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/query_add")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_remove")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_set")
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_unset")
|
7
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_unset_all")
|
8
|
+
|
9
|
+
describe HTTY::CLI::Commands::QueryUnset 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 == 'Navigation'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should have the expected command_line' do
|
28
|
+
klass.command_line.should == 'query-unset'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should have the expected command_line_arguments' do
|
32
|
+
klass.command_line_arguments.should == 'NAME [VALUE]'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have the expected help' do
|
36
|
+
klass.help.should == 'Removes query-string parameters from the ' +
|
37
|
+
"request's address"
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should have the expected help_extended' do
|
41
|
+
expected = <<-end_help_extended
|
42
|
+
Removes one or more a query-string parameters used for the request. Does not communicate with the host.
|
43
|
+
|
44
|
+
The difference between this command and \e[1mquery-r[emove]\e[0m is that this command removes all matching parameters instead of removing matches one at a time from the end of the address.
|
45
|
+
|
46
|
+
The name of the query-string parameter will be URL-encoded if necessary.
|
47
|
+
|
48
|
+
The console prompt shows the address for the current request.
|
49
|
+
end_help_extended
|
50
|
+
klass.help_extended.should == expected.chomp
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should have the expected see_also_commands' do
|
54
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::QuerySet,
|
55
|
+
HTTY::CLI::Commands::QueryUnsetAll,
|
56
|
+
HTTY::CLI::Commands::QueryAdd,
|
57
|
+
HTTY::CLI::Commands::QueryRemove,
|
58
|
+
HTTY::CLI::Commands::Address]
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'build_for' do
|
62
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
63
|
+
built = klass.build_for('query-unset foo bar', :session => :the_session)
|
64
|
+
built.should be_instance_of(klass)
|
65
|
+
built.arguments.should == %w(foo bar)
|
66
|
+
built.session.should == :the_session
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should correctly handle a command line with a bad command' do
|
70
|
+
built = klass.build_for('x baz qux', :session => :another_session)
|
71
|
+
built.should == nil
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/exit")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/quit")
|
4
|
+
|
5
|
+
describe HTTY::CLI::Commands::Quit 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 == [HTTY::CLI::Commands::Exit]
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should belong to the expected category' do
|
20
|
+
klass.category.should == nil
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have the expected command_line' do
|
24
|
+
klass.command_line.should == 'qui[t]'
|
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 == 'Quits htty'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have the expected help_extended' do
|
36
|
+
klass.help_extended.should == 'Quits htty.'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have the expected see_also_commands' do
|
40
|
+
klass.see_also_commands.should == []
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'build_for' do
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
45
|
+
built = klass.build_for('quit', :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('qui', :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
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/history")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/history_verbose")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/reuse")
|
5
|
+
|
6
|
+
describe HTTY::CLI::Commands::Reuse 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 == 'r[euse]'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have the expected command_line_arguments' do
|
29
|
+
klass.command_line_arguments.should == 'INDEX'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should have the expected help' do
|
33
|
+
klass.help.should == 'Copies a previous request by the index number ' +
|
34
|
+
'shown in history'
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should have the expected help_extended' do
|
38
|
+
expected = <<-end_help_extended
|
39
|
+
Copies the properties of a previous request to be used for the request, using the request index number shown in history. Does not communicate with the host.
|
40
|
+
|
41
|
+
The argument is an index number that appears when you type \e[1mhistory\e[0m.
|
42
|
+
end_help_extended
|
43
|
+
klass.help_extended.should == expected.chomp
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should have the expected see_also_commands' do
|
47
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::History,
|
48
|
+
HTTY::CLI::Commands::HistoryVerbose]
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'build_for' do
|
52
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
53
|
+
built = klass.build_for('reuse 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('r 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,74 @@
|
|
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::SchemeSet 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 == 'sc[heme-set]'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have the expected command_line_arguments' do
|
29
|
+
klass.command_line_arguments.should == 'SCHEME'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should have the expected help' do
|
33
|
+
klass.help.should == 'Changes the scheme (protocol identifier) of the ' +
|
34
|
+
"request's address"
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should have the expected help_extended' do
|
38
|
+
expected = <<-end_help_extended
|
39
|
+
Changes the scheme, or protocol identifier, used for the request. Does not communicate with the host.
|
40
|
+
|
41
|
+
The scheme you supply must be either 'http' or 'https'. Changing the scheme has no effect on the port, and vice versa.
|
42
|
+
|
43
|
+
The console prompt shows the address for the current request.
|
44
|
+
end_help_extended
|
45
|
+
klass.help_extended.should == expected.chomp
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should have the expected see_also_commands' do
|
49
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::Address,
|
50
|
+
HTTY::CLI::Commands::PortSet]
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'build_for' do
|
54
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
55
|
+
built = klass.build_for('scheme-set foo', :session => :the_session)
|
56
|
+
built.should be_instance_of(klass)
|
57
|
+
built.arguments.should == ['foo']
|
58
|
+
built.session.should == :the_session
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should correctly handle a valid, abbreviated command line' do
|
62
|
+
built = klass.build_for('sc bar', :session => :a_session)
|
63
|
+
built.should be_instance_of(klass)
|
64
|
+
built.arguments.should == ['bar']
|
65
|
+
built.session.should == :a_session
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should correctly handle a command line with a bad command' do
|
69
|
+
built = klass.build_for('x baz', :session => :another_session)
|
70
|
+
built.should == nil
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/ssl_verification")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/ssl_verification_off")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/ssl_verification_on")
|
5
|
+
|
6
|
+
describe HTTY::CLI::Commands::SslVerificationOff 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 == 'Preferences'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should have the expected command_line' do
|
25
|
+
klass.command_line.should == 'ssl-verification-of[f]'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have the expected command_line_arguments' do
|
29
|
+
klass.command_line_arguments.should == nil
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should have the expected help' do
|
33
|
+
klass.help.should == 'Disables SSL certificate verification'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should have the expected help_extended' do
|
37
|
+
klass.help_extended.should == 'Disables SSL certificate verification. ' +
|
38
|
+
'Does not communicate with the host.'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should have the expected see_also_commands' do
|
42
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::SslVerificationOn,
|
43
|
+
HTTY::CLI::Commands::SslVerification]
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'build_for' do
|
47
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
48
|
+
built = klass.build_for('ssl-verification-off', :session => :the_session)
|
49
|
+
built.should be_instance_of(klass)
|
50
|
+
built.arguments.should == []
|
51
|
+
built.session.should == :the_session
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should correctly handle a valid, abbreviated command line' do
|
55
|
+
built = klass.build_for('ssl-verification-of', :session => :a_session)
|
56
|
+
built.should be_instance_of(klass)
|
57
|
+
built.arguments.should == []
|
58
|
+
built.session.should == :a_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
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/ssl_verification")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/ssl_verification_off")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/ssl_verification_on")
|
5
|
+
|
6
|
+
describe HTTY::CLI::Commands::SslVerificationOn 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 == 'Preferences'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should have the expected command_line' do
|
25
|
+
klass.command_line.should == 'ssl-verification-on'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have the expected command_line_arguments' do
|
29
|
+
klass.command_line_arguments.should == nil
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should have the expected help' do
|
33
|
+
klass.help.should == 'Reenables SSL certificate verification'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should have the expected help_extended' do
|
37
|
+
klass.help_extended.should == 'Reenables SSL certificate verification. ' +
|
38
|
+
'Does not communicate with the host.'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should have the expected see_also_commands' do
|
42
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::SslVerificationOff,
|
43
|
+
HTTY::CLI::Commands::SslVerification]
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'build_for' do
|
47
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
48
|
+
built = klass.build_for('ssl-verification-on', :session => :the_session)
|
49
|
+
built.should be_instance_of(klass)
|
50
|
+
built.arguments.should == []
|
51
|
+
built.session.should == :the_session
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should correctly handle a command line with a bad command' do
|
55
|
+
built = klass.build_for('x', :session => :another_session)
|
56
|
+
built.should == nil
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|