dredd-rack 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/doc/runner.md +9 -0
- data/lib/dredd/rack/runner.rb +33 -1
- data/lib/dredd/rack/version.rb +1 -1
- data/spec/lib/dredd/rack/runner_spec.rb +56 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18df818e221d674ff9790acfbccc8cb2324fcab3
|
4
|
+
data.tar.gz: 6631de46a43a5dc77506c7b42de90d7ad383142e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc4009ccc1e08a1ae033edb244ec1a8db6e50dff78686ea96d249859a9a70ae3fd7225dfb460cbc757add66c77f0a6f7f15dd6eeb8a1a4f666edde24e3a70422
|
7
|
+
data.tar.gz: 6c940aef0d478e172e73455516944bff12b6de3a5001b674a12ac2238c782bff9df04d02bf9f1415036aca34f2de4816c7de4327f8466f2ed95c4b0328b0de0d
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [0.8.2] - 2016-06-08
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
- Fix inaccurate counting of command arguments for local API
|
11
|
+
- Minor fix missing documentation for Dredd v1.0.8 options
|
12
|
+
|
6
13
|
## [0.8.1] - 2016-05-07
|
7
14
|
|
8
15
|
### Added
|
@@ -65,6 +72,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
65
72
|
The original implementation of the Rake task was shared in this [gist][gist].
|
66
73
|
|
67
74
|
[gist]: https://gist.github.com/gonzalo-bulnes/eec3f73cc7d6605add21
|
75
|
+
[0.8.2]: https://github.com/gonzalo-bulnes/dredd-rack/compare/v0.8.1...v0.8.2
|
68
76
|
[0.8.1]: https://github.com/gonzalo-bulnes/dredd-rack/compare/v0.7.1...v0.8.1
|
69
77
|
[0.8.0]: https://github.com/gonzalo-bulnes/dredd-rack/compare/v0.7.1...v0.8.0
|
70
78
|
[0.7.1]: https://github.com/gonzalo-bulnes/dredd-rack/compare/v0.7.0...v0.7.1
|
data/README.md
CHANGED
data/doc/runner.md
CHANGED
@@ -82,6 +82,15 @@ dredd = Dredd::Rack::Runner.new do |options|
|
|
82
82
|
|
83
83
|
options.method('POST').method('PUT')
|
84
84
|
|
85
|
+
options.hooks_worker_timeout 5000
|
86
|
+
options.hooks_worker_connect_timeout 1500
|
87
|
+
options.hooks_worker_connect_retry 500
|
88
|
+
options.hooks_worker_after_connect_wait 100
|
89
|
+
options.hooks_worker_term_timeout 5000
|
90
|
+
options.hooks_worker_term_retry 500
|
91
|
+
options.hooks_worker_handler_host 'localhost'
|
92
|
+
options.hooks_worker_handler_port 61321
|
93
|
+
|
85
94
|
options.dry_run! # no_dry_run!
|
86
95
|
options.sandbox! # no_sandbox!
|
87
96
|
options.names! # no_names!
|
data/lib/dredd/rack/runner.rb
CHANGED
@@ -117,7 +117,11 @@ module Dredd
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def command_valid?
|
120
|
-
|
120
|
+
if api_remote?
|
121
|
+
command.has_at_least_two_arguments?
|
122
|
+
else
|
123
|
+
command.has_at_least_one_argument?
|
124
|
+
end
|
121
125
|
end
|
122
126
|
|
123
127
|
def start_server!
|
@@ -151,6 +155,34 @@ end
|
|
151
155
|
|
152
156
|
class String
|
153
157
|
|
158
|
+
# Verify that a command has at least one argument (excluding options)
|
159
|
+
#
|
160
|
+
# Examples:
|
161
|
+
#
|
162
|
+
# "dredd doc/*.apib".valid? # => true
|
163
|
+
# "dredd doc/*.apib doc/*apib.md".valid? # => true
|
164
|
+
# "dredd doc/*.apib --level verbose".valid? # => true
|
165
|
+
# "dredd".valid? # => false
|
166
|
+
# "dredd --dry-run".valid? # => false
|
167
|
+
# "dredd --dry-run --level verbose".valid? # => false
|
168
|
+
#
|
169
|
+
# Known limitations:
|
170
|
+
#
|
171
|
+
# Does not support short flags. (e.g. using `-l` instead of `--level`).
|
172
|
+
# Requires options to be specified after the last argument.
|
173
|
+
#
|
174
|
+
# Note:
|
175
|
+
#
|
176
|
+
# The known limitations imply that there may be false negatives: this method
|
177
|
+
# can return false for commands that do have two arguments or more. But there
|
178
|
+
# should not be false positives: if the method returns true, then the command
|
179
|
+
# does have at least two arguments.
|
180
|
+
#
|
181
|
+
# Returns true if the command String has at least one arguments, false otherwise.
|
182
|
+
def has_at_least_one_argument?
|
183
|
+
split('--').first.split(' ').length >= 2
|
184
|
+
end
|
185
|
+
|
154
186
|
# Verify that a command has at least two arguments (excluding options)
|
155
187
|
#
|
156
188
|
# Examples:
|
data/lib/dredd/rack/version.rb
CHANGED
@@ -74,13 +74,33 @@ describe Dredd::Rack::Runner do
|
|
74
74
|
|
75
75
|
describe '#command_valid?', private: true do
|
76
76
|
|
77
|
-
|
77
|
+
|
78
|
+
context 'when the command has less than one argument' do
|
78
79
|
|
79
80
|
it 'returns false' do
|
81
|
+
allow(subject).to receive_message_chain(:command, :has_at_least_one_argument?).and_return(false)
|
80
82
|
allow(subject).to receive_message_chain(:command, :has_at_least_two_arguments?).and_return(false)
|
83
|
+
|
81
84
|
expect(subject.send(:command_valid?)).not_to be_truthy
|
82
85
|
end
|
83
86
|
end
|
87
|
+
|
88
|
+
context 'when the API to test is remote' do
|
89
|
+
|
90
|
+
before(:each) do
|
91
|
+
allow(subject).to receive(:api_remote?).and_return(true)
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'when the command has less than two arguments' do
|
95
|
+
|
96
|
+
it 'returns false' do
|
97
|
+
allow(subject).to receive_message_chain(:command, :has_at_least_one_argument?).and_return(true)
|
98
|
+
allow(subject).to receive_message_chain(:command, :has_at_least_two_arguments?).and_return(false)
|
99
|
+
|
100
|
+
expect(subject.send(:command_valid?)).not_to be_truthy
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
84
104
|
end
|
85
105
|
|
86
106
|
describe '#configure', public: true do
|
@@ -252,6 +272,10 @@ end
|
|
252
272
|
|
253
273
|
describe String, public: true do
|
254
274
|
|
275
|
+
it 'responds to :has_at_least_one_argument?' do
|
276
|
+
expect(subject).to respond_to :has_at_least_one_argument?
|
277
|
+
end
|
278
|
+
|
255
279
|
it 'responds to :has_at_least_two_arguments?' do
|
256
280
|
expect(subject).to respond_to :has_at_least_two_arguments?
|
257
281
|
end
|
@@ -260,6 +284,37 @@ describe String, public: true do
|
|
260
284
|
expect(subject).to respond_to :quote!
|
261
285
|
end
|
262
286
|
|
287
|
+
describe '#has_at_least_one_argument?' do
|
288
|
+
|
289
|
+
context 'when the String can be interpreted as a command with at least one argument' do
|
290
|
+
context 'returns true (reliable)' do
|
291
|
+
|
292
|
+
['dredd doc/*.apib',
|
293
|
+
'dredd doc/*.apib doc/*apib.md',
|
294
|
+
'dredd doc/*.apib --level verbose'].each do |subject|
|
295
|
+
|
296
|
+
it "e.g. '#{subject}'" do
|
297
|
+
expect(subject.has_at_least_one_argument?).to be_truthy
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
context 'when the String can be interpreted as a command with no arguments' do
|
304
|
+
context 'returns false (unreliable)' do
|
305
|
+
|
306
|
+
['dredd',
|
307
|
+
'dredd --dry-run',
|
308
|
+
'dredd --dry-run --level verbose'].each do |subject|
|
309
|
+
|
310
|
+
it "e.g. '#{subject}'" do
|
311
|
+
expect(subject.has_at_least_one_argument?).to be_falsey
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
263
318
|
describe '#has_at_least_two_arguments?' do
|
264
319
|
|
265
320
|
context 'when the String can be interpreted as a command with at least two arguments' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dredd-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gonzalo Bulnes Guilpain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.6.1
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Convenient API blueprint testing with Apiary Dredd for Rack applications.
|