blitz 0.1.20 → 0.1.21
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/Gemfile +7 -2
- data/Gemfile.lock +8 -1
- data/README.md +26 -0
- data/Rakefile +5 -5
- data/blitz.gemspec +21 -10
- data/lib/blitz.rb +2 -1
- data/lib/blitz/command.rb +2 -32
- data/lib/blitz/command/curl.rb +13 -195
- data/lib/blitz/curl.rb +226 -0
- data/lib/blitz/curl/error.rb +1 -1
- data/lib/blitz/curl/rush.rb +12 -19
- data/lib/blitz/curl/sprint.rb +13 -17
- data/lib/blitz/utils.rb +38 -0
- data/spec/blitz/client_spec.rb +57 -0
- data/spec/blitz/command/api_spec.rb +42 -0
- data/spec/blitz/command/curl_spec.rb +4 -0
- data/spec/blitz/curl/rush_spec.rb +89 -0
- data/spec/blitz/curl/sprint_spec.rb +86 -0
- data/spec/blitz/curl_spec.rb +242 -0
- data/spec/spec_helper.rb +13 -0
- metadata +29 -26
- data/spec/command/curl_spec.rb +0 -244
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Blitz::Command::API do
|
4
|
+
before :each do
|
5
|
+
@resource = mock RestClient::Resource
|
6
|
+
RestClient::Resource.stub!(:new).and_return @resource
|
7
|
+
@api = Blitz::Command::API.instance
|
8
|
+
@api.credentials= nil
|
9
|
+
File.stub!(:exists?).and_return true
|
10
|
+
File.stub!(:read).and_return "test@example.com\nabc123"
|
11
|
+
end
|
12
|
+
|
13
|
+
context "#get_credentials" do
|
14
|
+
it "should return given array" do
|
15
|
+
@api.credentials= ['abc@example.com', '123456']
|
16
|
+
result = @api.get_credentials
|
17
|
+
result.should be_nil
|
18
|
+
@api.user.should == 'abc@example.com'
|
19
|
+
@api.password.should == '123456'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return credentials from the file" do
|
23
|
+
result = @api.get_credentials
|
24
|
+
result.should_not be_nil
|
25
|
+
@api.user.should == 'test@example.com'
|
26
|
+
@api.password.should == 'abc123'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "#client" do
|
31
|
+
it "should login using credentials from the file" do
|
32
|
+
Blitz::Client.should_receive(:new).
|
33
|
+
with('test@example.com', 'abc123', anything)
|
34
|
+
result = @api.client
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should reutn a Blitz::Client instance" do
|
38
|
+
result = @api.client
|
39
|
+
result.class.should == Blitz::Client
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Blitz::Curl::Rush do
|
4
|
+
before :each do
|
5
|
+
@resource = mock RestClient::Resource
|
6
|
+
RestClient::Resource.stub!(:new).and_return @resource
|
7
|
+
File.stub!(:exists?).and_return true
|
8
|
+
File.stub!(:read).and_return "test@example.com\nabc123"
|
9
|
+
args = {
|
10
|
+
:region => 'california',
|
11
|
+
:steps => [ { :url => "http://www.example.com"}],
|
12
|
+
:pattern => {
|
13
|
+
:intervals => [{ :start => 1, :end => 10000, :duration => 60 }]
|
14
|
+
}
|
15
|
+
}
|
16
|
+
@rush = Blitz::Curl::Rush.new args
|
17
|
+
end
|
18
|
+
|
19
|
+
context "#queue" do
|
20
|
+
before :each do
|
21
|
+
@queue = mock RestClient::Resource
|
22
|
+
json = "{\"ok\":true, \"job_id\":\"j123\", \"status\":\"queued\", \"region\":\"california\"}"
|
23
|
+
@resource.should_receive(:[]).with('/api/1/curl/execute').and_return @queue
|
24
|
+
@queue.should_receive(:post).and_return json
|
25
|
+
@status = mock RestClient::Resource
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should set the region" do
|
29
|
+
@rush.region.should be_nil
|
30
|
+
@rush.queue
|
31
|
+
@rush.region.should == 'california'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should set the job_id" do
|
35
|
+
@rush.job_id.should be_nil
|
36
|
+
@rush.queue
|
37
|
+
@rush.job_id.should == 'j123'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "#result" do
|
42
|
+
before :each do
|
43
|
+
@queue = mock RestClient::Resource
|
44
|
+
json = "{\"ok\":true, \"job_id\":\"j123\", \"status\":\"queued\", \"region\":\"california\"}"
|
45
|
+
@resource.should_receive(:[]).with('/api/1/curl/execute').and_return @queue
|
46
|
+
@queue.should_receive(:post).and_return json
|
47
|
+
@status = mock RestClient::Resource
|
48
|
+
json2 = "{\"ok\":true, \"status\":\"completed\", \"result\":{\"region\":\"california\", \"timeline\":[]}}"
|
49
|
+
@resource.should_receive(:[]).with("/api/1/jobs/j123/status").and_return @status
|
50
|
+
@status.should_receive(:get).and_return json2
|
51
|
+
@rush.queue
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should return a new Blitz::Curl::Rush::Result instance" do
|
55
|
+
result = @rush.result
|
56
|
+
result.should_not be_nil
|
57
|
+
result.class.should == Blitz::Curl::Rush::Result
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should return result with region california" do
|
61
|
+
result = @rush.result
|
62
|
+
result.region.should == 'california'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "#execute" do
|
67
|
+
before :each do
|
68
|
+
@queue = mock RestClient::Resource
|
69
|
+
json = "{\"ok\":true, \"job_id\":\"j123\", \"status\":\"queued\", \"region\":\"california\"}"
|
70
|
+
@resource.should_receive(:[]).with('/api/1/curl/execute').and_return @queue
|
71
|
+
@queue.should_receive(:post).and_return json
|
72
|
+
@status = mock RestClient::Resource
|
73
|
+
json2 = "{\"ok\":true, \"status\":\"completed\", \"result\":{\"region\":\"california\", \"timeline\":[]}}"
|
74
|
+
@resource.should_receive(:[]).with("/api/1/jobs/j123/status").and_return @status
|
75
|
+
@status.should_receive(:get).and_return json2
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should return a new Blitz::Curl::Rush::Result instance" do
|
79
|
+
result = @rush.execute
|
80
|
+
result.should_not be_nil
|
81
|
+
result.class.should == Blitz::Curl::Rush::Result
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should return result with region california" do
|
85
|
+
result = @rush.execute
|
86
|
+
result.region.should == 'california'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Blitz::Curl::Sprint do
|
4
|
+
before :each do
|
5
|
+
@resource = mock RestClient::Resource
|
6
|
+
RestClient::Resource.stub!(:new).and_return @resource
|
7
|
+
File.stub!(:exists?).and_return true
|
8
|
+
File.stub!(:read).and_return "test@example.com\nabc123"
|
9
|
+
args = {
|
10
|
+
:region => 'california',
|
11
|
+
:steps => [ { :url => "http://www.example.com"}]
|
12
|
+
}
|
13
|
+
@sprint = Blitz::Curl::Sprint.new args
|
14
|
+
end
|
15
|
+
|
16
|
+
context "#queue" do
|
17
|
+
before :each do
|
18
|
+
@queue = mock RestClient::Resource
|
19
|
+
json = "{\"ok\":true, \"job_id\":\"j123\", \"status\":\"queued\", \"region\":\"california\"}"
|
20
|
+
@resource.should_receive(:[]).with('/api/1/curl/execute').and_return @queue
|
21
|
+
@queue.should_receive(:post).and_return json
|
22
|
+
@status = mock RestClient::Resource
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should set the region" do
|
26
|
+
@sprint.region.should be_nil
|
27
|
+
@sprint.queue
|
28
|
+
@sprint.region.should == 'california'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should set the job_id" do
|
32
|
+
@sprint.job_id.should be_nil
|
33
|
+
@sprint.queue
|
34
|
+
@sprint.job_id.should == 'j123'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "#result" do
|
39
|
+
before :each do
|
40
|
+
@queue = mock RestClient::Resource
|
41
|
+
json = "{\"ok\":true, \"job_id\":\"j123\", \"status\":\"queued\", \"region\":\"california\"}"
|
42
|
+
@resource.should_receive(:[]).with('/api/1/curl/execute').and_return @queue
|
43
|
+
@queue.should_receive(:post).and_return json
|
44
|
+
@status = mock RestClient::Resource
|
45
|
+
json2 = "{\"ok\":true, \"status\":\"completed\", \"result\":{\"region\":\"california\", \"steps\":[]}}"
|
46
|
+
@resource.should_receive(:[]).with("/api/1/jobs/j123/status").and_return @status
|
47
|
+
@status.should_receive(:get).and_return json2
|
48
|
+
@sprint.queue
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should return a new Blitz::Curl::Sprint::Result instance" do
|
52
|
+
result = @sprint.result
|
53
|
+
result.should_not be_nil
|
54
|
+
result.class.should == Blitz::Curl::Sprint::Result
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return result with region california" do
|
58
|
+
result = @sprint.result
|
59
|
+
result.region.should == 'california'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "#execute" do
|
64
|
+
before :each do
|
65
|
+
@queue = mock RestClient::Resource
|
66
|
+
json = "{\"ok\":true, \"job_id\":\"j123\", \"status\":\"queued\", \"region\":\"california\"}"
|
67
|
+
@resource.should_receive(:[]).with('/api/1/curl/execute').and_return @queue
|
68
|
+
@queue.should_receive(:post).and_return json
|
69
|
+
@status = mock RestClient::Resource
|
70
|
+
json2 = "{\"ok\":true, \"status\":\"completed\", \"result\":{\"region\":\"california\", \"steps\":[]}}"
|
71
|
+
@resource.should_receive(:[]).with("/api/1/jobs/j123/status").and_return @status
|
72
|
+
@status.should_receive(:get).and_return json2
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should return a new Blitz::Curl::Sprint::Result instance" do
|
76
|
+
result = @sprint.execute
|
77
|
+
result.should_not be_nil
|
78
|
+
result.class.should == Blitz::Curl::Sprint::Result
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should return result with region california" do
|
82
|
+
result = @sprint.execute
|
83
|
+
result.region.should == 'california'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,242 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Blitz::Curl do
|
4
|
+
describe "parse_cli" do
|
5
|
+
context "url" do
|
6
|
+
it "should check that the args are not empty" do
|
7
|
+
lambda {
|
8
|
+
Blitz::Curl.parse_cli %w[]
|
9
|
+
}.should raise_error(ArgumentError, /no URL specified!/)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should not check for URL when --help is specified" do
|
13
|
+
%w[-h --help].each do |h|
|
14
|
+
hash = Blitz::Curl.parse_cli [h]
|
15
|
+
hash.should include 'help'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should succeed when a URL is given" do
|
20
|
+
hash = Blitz::Curl.parse_cli %w[blitz.io]
|
21
|
+
hash.should include 'steps'
|
22
|
+
hash['steps'].should be_a(Array)
|
23
|
+
hash['steps'].size.should == 1
|
24
|
+
hash['steps'].first.should include 'url'
|
25
|
+
hash['steps'].first['url'].should == 'blitz.io'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should succeed when multiple URLs are given" do
|
29
|
+
hash = Blitz::Curl.parse_cli %w[blitz.io docs.blitz.io]
|
30
|
+
hash.should include 'steps'
|
31
|
+
hash['steps'].should be_a(Array)
|
32
|
+
hash['steps'].size.should == 2
|
33
|
+
hash['steps'][0].should include 'url'
|
34
|
+
hash['steps'][0]['url'].should == 'blitz.io'
|
35
|
+
hash['steps'][1].should include 'url'
|
36
|
+
hash['steps'][1]['url'].should == 'docs.blitz.io'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "user-agent" do
|
41
|
+
it "should check that a user-agent is given" do
|
42
|
+
lambda {
|
43
|
+
Blitz::Curl.parse_cli %w[--user-agent]
|
44
|
+
}.should raise_error(MiniTest::Assertion, /missing value/)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should support one user-agent for each step" do
|
48
|
+
hash = Blitz::Curl.parse_cli %w[-A foo blitz.io -A bar /faq]
|
49
|
+
hash.should include 'steps'
|
50
|
+
hash['steps'].size.should == 2
|
51
|
+
hash['steps'][0]['user-agent'] == 'foo'
|
52
|
+
hash['steps'][1]['user-agent'] == 'bar'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "cookie" do
|
57
|
+
it "should check that a cookie is given" do
|
58
|
+
lambda { Blitz::Curl.parse_cli %w[--cookie] }.should raise_error(MiniTest::Assertion, /missing value/)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should be an array of cookies" do
|
62
|
+
hash = Blitz::Curl.parse_cli %w[--cookie foo=bar --cookie hello=world blitz.io]
|
63
|
+
hash['steps'].size.should == 1
|
64
|
+
step = hash['steps'].first
|
65
|
+
step['cookies'].should be_a(Array)
|
66
|
+
step['cookies'].should == [ 'foo=bar', 'hello=world' ]
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should support one cookie for each step" do
|
70
|
+
hash = Blitz::Curl.parse_cli %w[-b foo=bar blitz.io -b hello=world /faq]
|
71
|
+
hash.should include 'steps'
|
72
|
+
hash['steps'].size.should == 2
|
73
|
+
hash['steps'][0]['cookies'] == [ 'foo=bar' ]
|
74
|
+
hash['steps'][1]['cookies'] == [ 'hello=world' ]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "data" do
|
79
|
+
it "should check that a data is given" do
|
80
|
+
lambda { Blitz::Curl.parse_cli %w[--data] }.should raise_error(MiniTest::Assertion, /missing value/)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should be an array of data" do
|
84
|
+
hash = Blitz::Curl.parse_cli %w[--data foo=bar --data hello=world blitz.io]
|
85
|
+
hash['steps'].size.should == 1
|
86
|
+
step = hash['steps'].first
|
87
|
+
step['content'].should be_a(Hash)
|
88
|
+
step['content']['data'].should be_a(Array)
|
89
|
+
step['content']['data'].should == [ 'foo=bar', 'hello=world' ]
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should support one data for each step" do
|
93
|
+
hash = Blitz::Curl.parse_cli %w[-d foo=bar blitz.io -d hello=world /faq]
|
94
|
+
hash.should include 'steps'
|
95
|
+
hash['steps'].size.should == 2
|
96
|
+
hash['steps'][0]['content']['data'] == [ 'foo=bar' ]
|
97
|
+
hash['steps'][1]['content']['data'] == [ 'hello=world' ]
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context "referer" do
|
102
|
+
it "should check that a referer is given" do
|
103
|
+
lambda { Blitz::Curl.parse_cli %w[--referer] }.should raise_error(MiniTest::Assertion, /missing value/)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should support one referer for each step" do
|
107
|
+
hash = Blitz::Curl.parse_cli %w[-e foo blitz.io -e bar /faq]
|
108
|
+
hash.should include 'steps'
|
109
|
+
hash['steps'].size.should == 2
|
110
|
+
hash['steps'][0]['referer'] == 'foo'
|
111
|
+
hash['steps'][1]['referer'] == 'bar'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "headers" do
|
116
|
+
it "should check that a header is given" do
|
117
|
+
lambda { Blitz::Curl.parse_cli %w[--header] }.should raise_error(MiniTest::Assertion, /missing value/)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should be an array of headers" do
|
121
|
+
hash = Blitz::Curl.parse_cli %w[-H foo=bar -H hello=world blitz.io]
|
122
|
+
hash['steps'].size.should == 1
|
123
|
+
step = hash['steps'].first
|
124
|
+
step['headers'].should be_a(Array)
|
125
|
+
step['headers'].should == [ 'foo=bar', 'hello=world' ]
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should support one header for each step" do
|
129
|
+
hash = Blitz::Curl.parse_cli %w[-H foo=bar blitz.io -H hello=world /faq]
|
130
|
+
hash.should include 'steps'
|
131
|
+
hash['steps'].size.should == 2
|
132
|
+
hash['steps'][0]['headers'] == [ 'foo=bar' ]
|
133
|
+
hash['steps'][1]['headers'] == [ 'hello=world' ]
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context "pattern" do
|
138
|
+
it "should check that a pattern is given" do
|
139
|
+
lambda { Blitz::Curl.parse_cli %w[--pattern] }.should raise_error(MiniTest::Assertion, /missing value/)
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should add the pattern to the hash" do
|
143
|
+
hash = Blitz::Curl.parse_cli %w[-p 1-250:60 blitz.io]
|
144
|
+
hash['pattern'].should be_a(Hash)
|
145
|
+
hash['pattern']['iterations'].should == 1
|
146
|
+
hash['pattern']['intervals'].should be_an(Array)
|
147
|
+
hash['pattern']['intervals'].size.should == 1
|
148
|
+
hash['pattern']['intervals'].first['iterations'].should == 1
|
149
|
+
hash['pattern']['intervals'].first['start'].should == 1
|
150
|
+
hash['pattern']['intervals'].first['end'].should == 250
|
151
|
+
hash['pattern']['intervals'].first['duration'].should == 60
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should parse multiple intervals in the pattern" do
|
155
|
+
hash = Blitz::Curl.parse_cli %w[-p 1-250:60,500-500:10 blitz.io]
|
156
|
+
hash['pattern'].should be_a(Hash)
|
157
|
+
hash['pattern']['iterations'].should == 1
|
158
|
+
hash['pattern']['intervals'].should be_an(Array)
|
159
|
+
hash['pattern']['intervals'].size.should == 2
|
160
|
+
hash['pattern']['intervals'].first['iterations'].should == 1
|
161
|
+
hash['pattern']['intervals'].first['start'].should == 1
|
162
|
+
hash['pattern']['intervals'].first['end'].should == 250
|
163
|
+
hash['pattern']['intervals'].first['duration'].should == 60
|
164
|
+
hash['pattern']['intervals'].last['iterations'].should == 1
|
165
|
+
hash['pattern']['intervals'].last['start'].should == 500
|
166
|
+
hash['pattern']['intervals'].last['end'].should == 500
|
167
|
+
hash['pattern']['intervals'].last['duration'].should == 10
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
context "region" do
|
172
|
+
it "should check that a region is given" do
|
173
|
+
lambda { Blitz::Curl.parse_cli %w[--region] }.should raise_error(MiniTest::Assertion, /missing value/)
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should verify that it's a valid region" do
|
177
|
+
[ 'california', 'oregon', 'virginia', 'ireland', 'singapore', 'japan', 'saopaulo' ].each do |r|
|
178
|
+
lambda { Blitz::Curl.parse_cli ['-r', r, 'blitz.io' ] }.should_not raise_error
|
179
|
+
end
|
180
|
+
|
181
|
+
lambda { Blitz::Curl.parse_cli %w[-r -a ] }.should raise_error(MiniTest::Assertion, /missing value/)
|
182
|
+
lambda { Blitz::Curl.parse_cli %w[-r --data ] }.should raise_error(MiniTest::Assertion, /missing value/)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
context "status" do
|
187
|
+
it "should check that a status is given" do
|
188
|
+
lambda { Blitz::Curl.parse_cli %w[--status] }.should raise_error(MiniTest::Assertion, /missing value/)
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should support one status for each step" do
|
192
|
+
hash = Blitz::Curl.parse_cli %w[-s 302 blitz.io -s 200 /faq]
|
193
|
+
hash.should include 'steps'
|
194
|
+
hash['steps'].size.should == 2
|
195
|
+
hash['steps'][0]['status'] == 302
|
196
|
+
hash['steps'][1]['status'] == 200
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
context "timeout" do
|
201
|
+
it "should check that a timeout is given" do
|
202
|
+
lambda { Blitz::Curl.parse_cli %w[--timeout] }.should raise_error(MiniTest::Assertion, /missing value/)
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should support one timeout for each step" do
|
206
|
+
hash = Blitz::Curl.parse_cli %w[-T 100 blitz.io -T 200 /faq]
|
207
|
+
hash.should include 'steps'
|
208
|
+
hash['steps'].size.should == 2
|
209
|
+
hash['steps'][0]['timeout'] == 100
|
210
|
+
hash['steps'][1]['timeout'] == 200
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
context "user" do
|
215
|
+
it "should check that a user is given" do
|
216
|
+
lambda { Blitz::Curl.parse_cli %w[--user] }.should raise_error(MiniTest::Assertion, /missing value/)
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should support one user for each step" do
|
220
|
+
hash = Blitz::Curl.parse_cli %w[-u foo:bar blitz.io -u hello:world /faq]
|
221
|
+
hash.should include 'steps'
|
222
|
+
hash['steps'].size.should == 2
|
223
|
+
hash['steps'][0]['user'] == 'foo:bar'
|
224
|
+
hash['steps'][1]['user'] == 'hello:world'
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
context "request" do
|
229
|
+
it "should check that a request is given" do
|
230
|
+
lambda { Blitz::Curl.parse_cli %w[--request] }.should raise_error(MiniTest::Assertion, /missing value/)
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should support one request for each step" do
|
234
|
+
hash = Blitz::Curl.parse_cli %w[-X GET blitz.io -X POST /faq]
|
235
|
+
hash.should include 'steps'
|
236
|
+
hash['steps'].size.should == 2
|
237
|
+
hash['steps'][0]['request'] == 'GET'
|
238
|
+
hash['steps'][1]['request'] == 'POST'
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|