Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit 2dce1dc

Browse files
author
Adam Kliment
committed
Merge pull request #141 from apiaryio/kubula/update_hipchat_notification
Fix cli-test by freezing devDependency clone@0.x
2 parents 631ae67 + 8233039 commit 2dce1dc

File tree

3 files changed

+29
-68
lines changed

3 files changed

+29
-68
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
language: node_js
22
node_js:
33
- 0.10
4+
sudo: false
45
before_install:
5-
- npm install -g npm@~1.4.6
6+
- npm install -g npm@1.4.28
67
notifications:
78
email:
89
recipients:
@@ -13,7 +14,7 @@ notifications:
1314
on_failure: always
1415
hipchat:
1516
rooms:
16-
secure: "pKDBboEmYne/Hs9qUSCQCgWZ9insdvgvB0DyMYYpO8RHgNOAhpcY1Kz/wTmFtm1k2HjGNGx1OVgVhOYXwIiJQZbmiUT4gVDEUtmpSgiW3/uQATgaPFUAsaIFqemTPgI6Q8RfsJZQk1kRMioZhk0ldQY5A+AUIKYKg1BFiOsrO1s="
17+
secure: "QGWyFDPoKcj97epznHoyriuS/eJIbgZtTAVVM6M3IpgwgTX2LuiGVJbUvZy1BDlp31sYTLslrZ4zHeBwbOoy8zrM0KW8pr+pvgzO+EAsNchd9Ox9SqA0E/4gnaRg0myZIb67YM0hB9NEXT5sAOv9EoEae2SXw2KeoX1Myg+wsI4="
1718
template:
1819
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message} (<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
1920
format: html

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"devDependencies": {
3636
"body-parser": "^1.10.2",
3737
"chai": "^1.10.0",
38-
"clone": "",
38+
"clone": "^0.x",
3939
"codo": "2.0.9",
4040
"coffee-coverage": "~0.4.4",
4141
"coffee-errors": "~0.8.6",

test/integration/cli-test.coffee

Lines changed: 25 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ describe "Command line interface", () ->
122122
assert.equal exitStatus, 1
123123

124124
describe "when called with arguments", () ->
125-
126125
describe "when using reporter -r apiary", () ->
127-
126+
server = null
127+
server2 = null
128128
receivedRequest = null
129129

130130
before (done) ->
@@ -133,11 +133,11 @@ describe "Command line interface", () ->
133133
apiary = express()
134134
app = express()
135135

136-
apiary.use bodyParser.json(size:'1mb')
136+
apiary.use bodyParser.json(size:'5mb')
137137

138138
apiary.post '/apis/*', (req, res) ->
139-
if req.url.indexOf('/public/tests/steps') > -1
140-
receivedRequest ?= req.body
139+
if req.body and req.url.indexOf('/tests/steps') > -1
140+
receivedRequest ?= clone(req.body, false)
141141
res.type('json')
142142
res.status(201).send
143143
_id: '1234_id'
@@ -146,7 +146,7 @@ describe "Command line interface", () ->
146146

147147
apiary.all '*', (req, res) ->
148148
res.type 'json'
149-
res.status(200).send {}
149+
res.send {}
150150

151151
app.get '/machines', (req, res) ->
152152
res.setHeader 'Content-Type', 'application/json'
@@ -158,8 +158,8 @@ describe "Command line interface", () ->
158158

159159
server = app.listen PORT, () ->
160160
server2 = apiary.listen (PORT+1), ->
161-
env = clone process.env
162-
env['APIARY_API_URL'] = "http://localhost:#{PORT+1}"
161+
env = clone process.env, false
162+
env['APIARY_API_URL'] = "http://127.0.0.1:#{PORT+1}"
163163
execCommand cmd, {env}, () ->
164164
server2.close ->
165165
server.close ->
@@ -180,16 +180,12 @@ describe "Command line interface", () ->
180180

181181

182182
describe "when using additional reporters with -r", () ->
183-
184-
recievedRequest = {}
185-
186183
before (done) ->
187184
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -r nyan"
188185

189186
app = express()
190187

191188
app.get '/machines', (req, res) ->
192-
recievedRequest = req
193189
res.setHeader 'Content-Type', 'application/json'
194190
machine =
195191
type: 'bulldozer'
@@ -209,16 +205,12 @@ describe "Command line interface", () ->
209205

210206

211207
describe 'when using an output path with -o', () ->
212-
213-
recievedRequest = {}
214-
215208
before (done) ->
216209
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -r junit -o test_file_output.xml"
217210

218211
app = express()
219212

220213
app.get '/machines', (req, res) ->
221-
recievedRequest = req
222214
res.setHeader 'Content-Type', 'application/json'
223215
machine =
224216
type: 'bulldozer'
@@ -241,15 +233,15 @@ describe "Command line interface", () ->
241233

242234
describe "when adding additional headers with -h", () ->
243235

244-
recievedRequest = {}
236+
receivedRequest = {}
245237

246238
before (done) ->
247239
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -h Accept:application/json"
248240

249241
app = express()
250242

251243
app.get '/machines', (req, res) ->
252-
recievedRequest = req
244+
receivedRequest = req
253245
res.setHeader 'Content-Type', 'application/json'
254246
machine =
255247
type: 'bulldozer'
@@ -264,20 +256,20 @@ describe "Command line interface", () ->
264256
server.on 'close', done
265257

266258
it 'should have an additional header in the request', () ->
267-
assert.ok recievedRequest.headers.accept is 'application/json'
259+
assert.deepPropertyVal receivedRequest, 'headers.accept', 'application/json'
268260

269261

270262
describe "when adding basic auth credentials with -u", () ->
271263

272-
recievedRequest = {}
264+
receivedRequest = {}
273265

274266
before (done) ->
275267
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -u username:password"
276268

277269
app = express()
278270

279271
app.get '/machines', (req, res) ->
280-
recievedRequest = req
272+
receivedRequest = req
281273
res.setHeader 'Content-Type', 'application/json'
282274
machine =
283275
type: 'bulldozer'
@@ -292,23 +284,19 @@ describe "Command line interface", () ->
292284
server.on 'close', done
293285

294286
it 'should have an authorization header in the request', () ->
295-
assert.ok recievedRequest.headers.authorization
287+
assert.ok receivedRequest.headers.authorization
296288

297289
it 'should contain a base64 encoded string of the username and password', () ->
298-
assert.ok recievedRequest.headers.authorization is 'Basic ' + new Buffer('username:password').toString('base64')
290+
assert.ok receivedRequest.headers.authorization is 'Basic ' + new Buffer('username:password').toString('base64')
299291

300292

301293
describe "when sorting requests with -s", () ->
302-
303-
recievedRequest = {}
304-
305294
before (done) ->
306295
cmd = "./bin/dredd ./test/fixtures/apiary.apib http://localhost:#{PORT} -s"
307296

308297
app = express()
309298

310299
app.get '/machines', (req, res) ->
311-
recievedRequest = req
312300
res.setHeader 'Content-Type', 'application/json'
313301
machine =
314302
type: 'bulldozer'
@@ -353,16 +341,12 @@ describe "Command line interface", () ->
353341
assert.equal count, 2
354342

355343
describe 'when showing details for all requests with -d', () ->
356-
357-
recievedRequest = {}
358-
359344
before (done) ->
360345
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -d"
361346

362347
app = express()
363348

364349
app.get '/machines', (req, res) ->
365-
recievedRequest = req
366350
res.setHeader 'Content-Type', 'application/json'
367351
machine =
368352
type: 'bulldozer'
@@ -384,15 +368,15 @@ describe "Command line interface", () ->
384368

385369
describe 'when blocking a request', () ->
386370

387-
recievedRequest = {}
371+
receivedRequest = {}
388372

389373
before (done) ->
390374
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -m POST"
391375

392376
app = express()
393377

394378
app.get '/machines', (req, res) ->
395-
recievedRequest = req
379+
receivedRequest = req
396380
res.setHeader 'Content-Type', 'application/json'
397381
machine =
398382
type: 'bulldozer'
@@ -407,19 +391,19 @@ describe "Command line interface", () ->
407391
server.on 'close', done
408392

409393
it 'should not send the request request', () ->
410-
assert.deepEqual recievedRequest, {}
394+
assert.deepEqual receivedRequest, {}
411395

412396
describe 'when not blocking a request', () ->
413397

414-
recievedRequest = {}
398+
receivedRequest = {}
415399

416400
before (done) ->
417401
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -m GET"
418402

419403
app = express()
420404

421405
app.get '/machines', (req, res) ->
422-
recievedRequest = req
406+
receivedRequest = req
423407
res.setHeader 'Content-Type', 'application/json'
424408
machine =
425409
type: 'bulldozer'
@@ -434,7 +418,7 @@ describe "Command line interface", () ->
434418
server.on 'close', done
435419

436420
it 'should allow the request to go through', () ->
437-
assert.ok recievedRequest.headers
421+
assert.ok receivedRequest.headers
438422

439423
describe "when filtering transaction to particular name with -x or --only", () ->
440424

@@ -478,16 +462,12 @@ describe "Command line interface", () ->
478462
assert.equal exitStatus, 0
479463

480464
describe 'when suppressing color with --no-color', () ->
481-
482-
recievedRequest = {}
483-
484465
before (done) ->
485466
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} --no-color"
486467

487468
app = express()
488469

489470
app.get '/machines', (req, res) ->
490-
recievedRequest = req
491471
res.setHeader 'Content-Type', 'application/json'
492472
machine =
493473
type: 'bulldozer'
@@ -507,16 +487,12 @@ describe "Command line interface", () ->
507487
assert.include stdout, 'pass:'
508488

509489
describe 'when suppressing color with --color false', () ->
510-
511-
recievedRequest = {}
512-
513490
before (done) ->
514491
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} --color false"
515492

516493
app = express()
517494

518495
app.get '/machines', (req, res) ->
519-
recievedRequest = req
520496
res.setHeader 'Content-Type', 'application/json'
521497
machine =
522498
type: 'bulldozer'
@@ -536,16 +512,12 @@ describe "Command line interface", () ->
536512
assert.include stdout, 'pass:'
537513

538514
describe 'when setting the log output level with -l', () ->
539-
540-
recievedRequest = {}
541-
542515
before (done) ->
543516
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -l=error"
544517

545518
app = express()
546519

547520
app.get '/machines', (req, res) ->
548-
recievedRequest = req
549521
res.setHeader 'Content-Type', 'application/json'
550522
machine =
551523
type: 'bulldozer'
@@ -564,16 +536,12 @@ describe "Command line interface", () ->
564536
assert.ok stdout.indexOf 'complete' is -1
565537

566538
describe 'when showing timestamps with -t', () ->
567-
568-
recievedRequest = {}
569-
570539
before (done) ->
571540
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} -t"
572541

573542
app = express()
574543

575544
app.get '/machines', (req, res) ->
576-
recievedRequest = req
577545
res.setHeader 'Content-Type', 'application/json'
578546
machine =
579547
type: 'bulldozer'
@@ -593,15 +561,15 @@ describe "Command line interface", () ->
593561

594562
describe 'when loading hooks with --hookfiles', () ->
595563

596-
recievedRequest = {}
564+
receivedRequest = {}
597565

598566
before (done) ->
599567
cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} --hookfiles=./test/fixtures/*_hooks.*"
600568

601569
app = express()
602570

603571
app.get '/machines', (req, res) ->
604-
recievedRequest = req
572+
receivedRequest = req
605573
res.setHeader 'Content-Type', 'application/json'
606574
machine =
607575
type: 'bulldozer'
@@ -616,13 +584,10 @@ describe "Command line interface", () ->
616584
server.on 'close', done
617585

618586
it 'should modify the transaction with hooks', () ->
619-
assert.equal recievedRequest.headers['header'], '123232323'
587+
assert.equal receivedRequest.headers['header'], '123232323'
620588

621589
describe 'when describing events in hookfiles', () ->
622-
623-
recievedRequest = {}
624590
output = {}
625-
626591
containsLine = (str, expected) ->
627592
lines = str.split('\n')
628593
for line in lines
@@ -636,7 +601,6 @@ describe "Command line interface", () ->
636601
app = express()
637602

638603
app.get '/machines', (req, res) ->
639-
recievedRequest = req
640604
res.setHeader 'Content-Type', 'application/json'
641605
machine =
642606
type: 'bulldozer'
@@ -657,10 +621,7 @@ describe "Command line interface", () ->
657621
assert.ok containsLine(output.stdout, 'afterAll')
658622

659623
describe 'when describing both hooks and events in hookfiles', () ->
660-
661-
recievedRequest = {}
662624
output = {}
663-
664625
getResults = (str) ->
665626
ret = []
666627
lines = str.split('\n')
@@ -675,7 +636,6 @@ describe "Command line interface", () ->
675636
app = express()
676637

677638
app.get '/machines', (req, res) ->
678-
recievedRequest = req
679639
res.setHeader 'Content-Type', 'application/json'
680640
machine =
681641
type: 'bulldozer'
@@ -800,7 +760,7 @@ describe "Command line interface", () ->
800760
assert.equal exitStatus, 0
801761

802762
it 'server should receive 3 requests', () ->
803-
assert.equal receivedRequests.length, 3
763+
assert.lengthOf receivedRequests, 3
804764

805765

806766
describe "when called with additional --path argument which is a glob", () ->

0 commit comments

Comments
 (0)