Skip to content

Commit

Permalink
be more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss committed Feb 3, 2020
1 parent 36a354a commit 05583e0
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions features/tagged_hooks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,49 @@ Feature: Tagged Hooks
Scenario: ability to specify tags for hooks
Given a file named "features/a.feature" with:
"""
@bar
@foo
Feature:
Scenario:
Then the value is 1
Then foo is true
And bar is false
@foo
@bar
Scenario:
Then the value is 2
Then foo is true
And bar is true
"""
And a file named "features/step_definitions/world.js" with:
"""
const {setWorldConstructor} = require('cucumber')
setWorldConstructor(function() {
this.value = 0
this.foo = false
this.bar = false
})
"""
And a file named "features/step_definitions/my_steps.js" with:
"""
const assert = require('assert')
const {Then} = require('cucumber')
Then(/^the value is (\d*)$/, function(number) {
assert.equal(number, this.value)
Then('{word} is true', function(prop) {
assert.equal(true, this[prop])
})
Then('{word} is false', function(prop) {
assert.equal(false, this[prop])
})
"""
And a file named "features/step_definitions/my_tagged_hooks.js" with:
"""
const {Before} = require('cucumber')
Before({tags: '@foo'}, function() {
this.value += 1
this.foo = true
})
Before({tags: '@bar'}, function() {
this.value += 1
this.bar = true
})
"""
When I run cucumber-js
Expand Down

0 comments on commit 05583e0

Please sign in to comment.