-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(collect): add ability to inject previously collected values
- Loading branch information
Raphaël Benitte
committed
Jun 28, 2017
1 parent
23c490e
commit b72de09
Showing
11 changed files
with
343 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Feature: GitHub API | ||
|
||
Scenario: Using GitHub API | ||
Given I set User-Agent request header to veggies/1.0 | ||
When I GET https://api.github.com/ | ||
Then I should receive a 200 HTTP status code | ||
When I pick response json emojis_url as emojisUrl | ||
And I GET {{emojisUrl}} | ||
Then I should receive a 200 HTTP status code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict' | ||
|
||
const { defineSupportCode } = require('cucumber') | ||
const { state, httpApi } = require('../../src') | ||
|
||
defineSupportCode(({ setWorldConstructor }) => { | ||
setWorldConstructor(function() { | ||
state.extendWorld(this) | ||
httpApi.extendWorld(this) | ||
}) | ||
}) | ||
|
||
state.install(defineSupportCode) | ||
httpApi.install({})(defineSupportCode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
'use strict' | ||
|
||
const Helper = require('../../helper') | ||
const state = require('./state') | ||
|
||
module.exports = world => { | ||
world.state = {} | ||
world.state = state | ||
Helper.registerExtension(world, 'state') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict' | ||
|
||
const _ = require('lodash') | ||
|
||
let state = {} | ||
|
||
exports.set = (key, value) => _.set(state, key, value) | ||
|
||
exports.get = key => _.get(state, key) | ||
|
||
exports.clear = () => { | ||
state = {} | ||
} | ||
|
||
exports.dump = () => state | ||
|
||
exports.populate = value => _.template(value, { interpolate: /{{([\s\S]+?)}}/g })(state) | ||
|
||
exports.populateObject = object => | ||
_.mapValues(object, value => { | ||
if (_.isPlainObject(value)) return exports.populateObject(value) | ||
return exports.populate(value) | ||
}) |
Oops, something went wrong.