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,76 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_add")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove_all")
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_use")
|
7
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/headers_request")
|
8
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/headers_response")
|
9
|
+
|
10
|
+
describe HTTY::CLI::Commands::Cookies do
|
11
|
+
describe 'class' do
|
12
|
+
let :klass do
|
13
|
+
subject.class
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should be an alias_for the expected command' do
|
17
|
+
klass.alias_for.should == nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have the expected aliases' do
|
21
|
+
klass.aliases.should == []
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should belong to the expected category' do
|
25
|
+
klass.category.should == 'Building Requests'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have the expected command_line' do
|
29
|
+
klass.command_line.should == 'cookies'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should have the expected command_line_arguments' do
|
33
|
+
klass.command_line_arguments.should == nil
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should have the expected help' do
|
37
|
+
klass.help.should == 'Displays the cookies of the request'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should have the expected help_extended' do
|
41
|
+
expected = <<-end_help_extended
|
42
|
+
Displays the cookies used for the request. Does not communicate with the host.
|
43
|
+
|
44
|
+
This command displays cookies extracted from the request's 'Cookie' header, which is nevertheless shown when you type \e[1mheaders-req[uest]\e[0m.
|
45
|
+
|
46
|
+
Cookies are not required to have unique names. You can add multiple cookies with the same name, and they will be removed in last-in-first-out order.
|
47
|
+
|
48
|
+
Cookies are cleared automatically when you change hosts.
|
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::CookiesAdd,
|
55
|
+
HTTY::CLI::Commands::CookiesRemove,
|
56
|
+
HTTY::CLI::Commands::CookiesRemoveAll,
|
57
|
+
HTTY::CLI::Commands::CookiesUse,
|
58
|
+
HTTY::CLI::Commands::HeadersRequest,
|
59
|
+
HTTY::CLI::Commands::HeadersResponse]
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'build_for' do
|
63
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
64
|
+
built = klass.build_for('cookies', :session => :the_session)
|
65
|
+
built.should be_instance_of(klass)
|
66
|
+
built.arguments.should == []
|
67
|
+
built.session.should == :the_session
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should correctly handle a command line with a bad command' do
|
71
|
+
built = klass.build_for('x', :session => :another_session)
|
72
|
+
built.should == nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_add")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove_all")
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_use")
|
7
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/headers_response")
|
8
|
+
|
9
|
+
describe HTTY::CLI::Commands::CookiesUse 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 == 'cookies-u[se]'
|
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 == 'Uses cookies offered in the response'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have the expected help_extended' do
|
40
|
+
klass.help_extended.should == 'Sets the cookies of the request to the ' +
|
41
|
+
'cookies offered in the response (the ' +
|
42
|
+
"'Set-Cookie' header). Does not " +
|
43
|
+
'communicate with the host.'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should have the expected see_also_commands' do
|
47
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::Cookies,
|
48
|
+
HTTY::CLI::Commands::CookiesAdd,
|
49
|
+
HTTY::CLI::Commands::CookiesRemove,
|
50
|
+
HTTY::CLI::Commands::CookiesRemoveAll,
|
51
|
+
HTTY::CLI::Commands::HeadersResponse]
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'build_for' do
|
55
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
56
|
+
built = klass.build_for('cookies-use', :session => :the_session)
|
57
|
+
built.should be_instance_of(klass)
|
58
|
+
built.arguments.should == []
|
59
|
+
built.session.should == :the_session
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should correctly handle a valid, abbreviated command line' do
|
63
|
+
built = klass.build_for('cookies-u', :session => :a_session)
|
64
|
+
built.should be_instance_of(klass)
|
65
|
+
built.arguments.should == []
|
66
|
+
built.session.should == :a_session
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should correctly handle a command line with a bad command' do
|
70
|
+
built = klass.build_for('x', :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/delete")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_delete")
|
4
|
+
|
5
|
+
describe HTTY::CLI::Commands::Delete 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::HttpDelete
|
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 == 'd[elete]'
|
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[1mhttp-d[elete]\e[0m"
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have the expected help_extended' do
|
36
|
+
klass.help_extended.should == "Alias for \e[1mhttp-d[elete]\e[0m."
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have the expected see_also_commands' do
|
40
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::HttpDelete]
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'build_for' do
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
45
|
+
built = klass.build_for('delete', :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('d', :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,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::Exit 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::Quit
|
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 == nil
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have the expected command_line' do
|
24
|
+
klass.command_line.should == 'e[xit]'
|
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[1mqui[t]\e[0m"
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have the expected help_extended' do
|
36
|
+
klass.help_extended.should == "Alias for \e[1mqui[t]\e[0m."
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have the expected see_also_commands' do
|
40
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::Quit]
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'build_for' do
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
45
|
+
built = klass.build_for('exit', :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('e', :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,70 @@
|
|
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/follow")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
|
5
|
+
|
6
|
+
describe HTTY::CLI::Commands::Follow 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 == 'fol[low]'
|
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 == 'Changes the address of the request to the value ' +
|
34
|
+
"of the response's 'Location' header"
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should have the expected help_extended' do
|
38
|
+
klass.help_extended.should == 'Changes the address of the request to ' +
|
39
|
+
"the value of the response's 'Location' " +
|
40
|
+
'header. Does not communicate with the ' +
|
41
|
+
'host.'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should have the expected see_also_commands' do
|
45
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::Address,
|
46
|
+
HTTY::CLI::Commands::HttpGet]
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'build_for' do
|
50
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
51
|
+
built = klass.build_for('follow', :session => :the_session)
|
52
|
+
built.should be_instance_of(klass)
|
53
|
+
built.arguments.should == []
|
54
|
+
built.session.should == :the_session
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should correctly handle a valid, abbreviated command line' do
|
58
|
+
built = klass.build_for('fol', :session => :a_session)
|
59
|
+
built.should be_instance_of(klass)
|
60
|
+
built.arguments.should == []
|
61
|
+
built.session.should == :a_session
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should correctly handle a command line with a bad command' do
|
65
|
+
built = klass.build_for('x', :session => :another_session)
|
66
|
+
built.should == nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/form_add")
|
3
|
+
|
4
|
+
describe HTTY::CLI::Commands::FormAdd do
|
5
|
+
describe 'class' do
|
6
|
+
let :klass do
|
7
|
+
subject.class
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should be an alias_for the expected command' do
|
11
|
+
klass.alias_for.should == nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should have the expected aliases' do
|
15
|
+
klass.aliases.should == []
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should belong to the expected category' do
|
19
|
+
klass.category.should == 'Building Requests'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should have the expected command_line' do
|
23
|
+
klass.command_line.should == 'form-a[dd]'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should have the expected command_line_arguments' do
|
27
|
+
klass.command_line_arguments.should == nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should have the expected help' do
|
31
|
+
klass.help.should == "(Help for \e[1mform-a[dd]\e[0m is not available)"
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should have the expected help_extended' do
|
35
|
+
klass.help_extended.should == "(Help for \e[1mform-a[dd]\e[0m is not " +
|
36
|
+
'available).'
|
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('form-add', :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('form-a', :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,64 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/form_clear")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/form_remove_all")
|
4
|
+
|
5
|
+
describe HTTY::CLI::Commands::FormClear 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::FormRemoveAll
|
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 == 'form-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[1mform-remove-[all]\e[0m"
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have the expected help_extended' do
|
36
|
+
klass.help_extended.should == "Alias for \e[1mform-remove-[all]\e[0m."
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have the expected see_also_commands' do
|
40
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::FormRemoveAll]
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'build_for' do
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
45
|
+
built = klass.build_for('form-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('form-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
|