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.
- 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,57 @@
|
|
|
1
|
+
require 'rspec'
|
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cd")
|
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/path_set")
|
|
4
|
+
|
|
5
|
+
describe HTTY::CLI::Commands::Cd 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::PathSet
|
|
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 == 'Navigation'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'should have the expected command_line' do
|
|
24
|
+
klass.command_line.should == 'cd'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should have the expected command_line_arguments' do
|
|
28
|
+
klass.command_line_arguments.should == 'PATH'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should have the expected help' do
|
|
32
|
+
klass.help.should == "Alias for \e[1mpa[th-set]\e[0m"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should have the expected help_extended' do
|
|
36
|
+
klass.help_extended.should == "Alias for \e[1mpa[th-set]\e[0m."
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should have the expected see_also_commands' do
|
|
40
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::PathSet]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'build_for' do
|
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
|
45
|
+
built = klass.build_for('cd foo', :session => :the_session)
|
|
46
|
+
built.should be_instance_of(klass)
|
|
47
|
+
built.arguments.should == ['foo']
|
|
48
|
+
built.session.should == :the_session
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'should correctly handle a command line with a bad command' do
|
|
52
|
+
built = klass.build_for('x bar', :session => :another_session)
|
|
53
|
+
built.should == nil
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'rspec'
|
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookie_add")
|
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_add")
|
|
4
|
+
|
|
5
|
+
describe HTTY::CLI::Commands::CookieAdd 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::CookiesAdd
|
|
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 == 'cookie-a[dd]'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should have the expected command_line_arguments' do
|
|
28
|
+
klass.command_line_arguments.should == 'NAME [VALUE]'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should have the expected help' do
|
|
32
|
+
klass.help.should == "Alias for \e[1mcookies-a[dd]\e[0m"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should have the expected help_extended' do
|
|
36
|
+
klass.help_extended.should == "Alias for \e[1mcookies-a[dd]\e[0m."
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should have the expected see_also_commands' do
|
|
40
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::CookiesAdd]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'build_for' do
|
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
|
45
|
+
built = klass.build_for('cookie-add foo bar', :session => :the_session)
|
|
46
|
+
built.should be_instance_of(klass)
|
|
47
|
+
built.arguments.should == %w(foo bar)
|
|
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('cookie-a baz', :session => :a_session)
|
|
53
|
+
built.should be_instance_of(klass)
|
|
54
|
+
built.arguments.should == ['baz']
|
|
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 qux', :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/cookie_remove")
|
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove")
|
|
4
|
+
|
|
5
|
+
describe HTTY::CLI::Commands::CookieRemove 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::CookiesRemove
|
|
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 == 'cookie-r[emove]'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should have the expected command_line_arguments' do
|
|
28
|
+
klass.command_line_arguments.should == 'NAME'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should have the expected help' do
|
|
32
|
+
klass.help.should == "Alias for \e[1mcookies-remove\e[0m"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should have the expected help_extended' do
|
|
36
|
+
klass.help_extended.should == "Alias for \e[1mcookies-remove\e[0m."
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should have the expected see_also_commands' do
|
|
40
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::CookiesRemove]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'build_for' do
|
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
|
45
|
+
built = klass.build_for('cookie-remove foo', :session => :the_session)
|
|
46
|
+
built.should be_instance_of(klass)
|
|
47
|
+
built.arguments.should == ['foo']
|
|
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('cookie-r bar', :session => :a_session)
|
|
53
|
+
built.should be_instance_of(klass)
|
|
54
|
+
built.arguments.should == ['bar']
|
|
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 baz', :session => :another_session)
|
|
60
|
+
built.should == nil
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require 'rspec'
|
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookie_add")
|
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies")
|
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_add")
|
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove")
|
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove_all")
|
|
7
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_use")
|
|
8
|
+
|
|
9
|
+
describe HTTY::CLI::Commands::CookiesAdd 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 == [HTTY::CLI::Commands::CookieAdd]
|
|
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-a[dd]'
|
|
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 == 'Adds a cookie to the request'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should have the expected help_extended' do
|
|
40
|
+
expected = <<-end_help_extended
|
|
41
|
+
Adds a cookie used for the request. Does not communicate with the host.
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
Cookies are not required to have values, either.
|
|
46
|
+
end_help_extended
|
|
47
|
+
klass.help_extended.should == expected.chomp
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'should have the expected see_also_commands' do
|
|
51
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::Cookies,
|
|
52
|
+
HTTY::CLI::Commands::CookiesRemove,
|
|
53
|
+
HTTY::CLI::Commands::CookiesRemoveAll,
|
|
54
|
+
HTTY::CLI::Commands::CookiesUse]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe 'build_for' do
|
|
58
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
|
59
|
+
built = klass.build_for('cookies-add foo bar', :session => :the_session)
|
|
60
|
+
built.should be_instance_of(klass)
|
|
61
|
+
built.arguments.should == %w(foo bar)
|
|
62
|
+
built.session.should == :the_session
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'should correctly handle a valid, abbreviated command line' do
|
|
66
|
+
built = klass.build_for('cookies-a baz', :session => :a_session)
|
|
67
|
+
built.should be_instance_of(klass)
|
|
68
|
+
built.arguments.should == ['baz']
|
|
69
|
+
built.session.should == :a_session
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'should correctly handle a command line with a bad command' do
|
|
73
|
+
built = klass.build_for('x qux', :session => :another_session)
|
|
74
|
+
built.should == nil
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'rspec'
|
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_clear")
|
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove_all")
|
|
4
|
+
|
|
5
|
+
describe HTTY::CLI::Commands::CookiesClear 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::CookiesRemoveAll
|
|
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 == 'cookies-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[1mcookies-remove-[all]\e[0m"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should have the expected help_extended' do
|
|
36
|
+
klass.help_extended.should == "Alias for \e[1mcookies-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::CookiesRemoveAll]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'build_for' do
|
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
|
45
|
+
built = klass.build_for('cookies-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('cookies-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
|
|
@@ -0,0 +1,73 @@
|
|
|
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_clear")
|
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove")
|
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove_all")
|
|
7
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_use")
|
|
8
|
+
|
|
9
|
+
describe HTTY::CLI::Commands::CookiesRemoveAll 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 == [HTTY::CLI::Commands::CookiesClear]
|
|
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-remove-[all]'
|
|
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 == 'Removes all cookies from the request'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should have the expected help_extended' do
|
|
40
|
+
klass.help_extended.should == 'Removes all cookies 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::Cookies,
|
|
47
|
+
HTTY::CLI::Commands::CookiesRemove,
|
|
48
|
+
HTTY::CLI::Commands::CookiesAdd,
|
|
49
|
+
HTTY::CLI::Commands::CookiesUse]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe 'build_for' do
|
|
53
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
|
54
|
+
built = klass.build_for('cookies-remove-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('cookies-remove-', :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,69 @@
|
|
|
1
|
+
require 'rspec'
|
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookie_remove")
|
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies")
|
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_add")
|
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove")
|
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_remove_all")
|
|
7
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/cookies_use")
|
|
8
|
+
|
|
9
|
+
describe HTTY::CLI::Commands::CookiesRemove 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 == [HTTY::CLI::Commands::CookieRemove]
|
|
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-remove'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should have the expected command_line_arguments' do
|
|
32
|
+
klass.command_line_arguments.should == 'NAME'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should have the expected help' do
|
|
36
|
+
klass.help.should == 'Removes from the request the last cookie having a particular name'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should have the expected help_extended' do
|
|
40
|
+
expected = <<-end_help_extended
|
|
41
|
+
Removes a cookie used for the request. Does not communicate with the host.
|
|
42
|
+
|
|
43
|
+
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.
|
|
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::Cookies,
|
|
50
|
+
HTTY::CLI::Commands::CookiesAdd,
|
|
51
|
+
HTTY::CLI::Commands::CookiesRemoveAll,
|
|
52
|
+
HTTY::CLI::Commands::CookiesUse]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe 'build_for' do
|
|
56
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
|
57
|
+
built = klass.build_for('cookies-remove foo', :session => :the_session)
|
|
58
|
+
built.should be_instance_of(klass)
|
|
59
|
+
built.arguments.should == ['foo']
|
|
60
|
+
built.session.should == :the_session
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'should correctly handle a command line with a bad command' do
|
|
64
|
+
built = klass.build_for('x bar', :session => :another_session)
|
|
65
|
+
built.should == nil
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|