|
| 1 | +Feature: Tagged Hooks |
| 2 | + |
| 3 | + Background: |
| 4 | + Given a file named "features/step_definitions/world.js" with: |
| 5 | + """ |
| 6 | + module.exports = function() { |
| 7 | + this.World = function() { |
| 8 | + this.value = 0 |
| 9 | + }; |
| 10 | + }; |
| 11 | + """ |
| 12 | + Given a file named "features/step_definitions/my_steps.js" with: |
| 13 | + """ |
| 14 | + var assert = require('assert'); |
| 15 | +
|
| 16 | + module.exports = function() { |
| 17 | + this.Then(/^the value is (\d*)$/, function(number) { |
| 18 | + assert.equal(parseInt(number), this.value); |
| 19 | + }); |
| 20 | + }; |
| 21 | + """ |
| 22 | + |
| 23 | + Scenario: no tags |
| 24 | + Given a file named "features/a.feature" with: |
| 25 | + """ |
| 26 | + Feature: |
| 27 | + Scenario: |
| 28 | + Then the value is 0 |
| 29 | + """ |
| 30 | + When I run cucumber.js with `--strict` |
| 31 | + And the exit status should be 0 |
| 32 | + |
| 33 | + Scenario: simple tag match |
| 34 | + Given a file named "features/step_definitions/my_tagged_hooks.js" with: |
| 35 | + """ |
| 36 | + module.exports = function() { |
| 37 | + this.Before({tags: ['@foo']}, function() { |
| 38 | + this.value += 1; |
| 39 | + }); |
| 40 | + }; |
| 41 | + """ |
| 42 | + Given a file named "features/a.feature" with: |
| 43 | + """ |
| 44 | + Feature: |
| 45 | + Scenario: |
| 46 | + Then the value is 0 |
| 47 | +
|
| 48 | + @foo |
| 49 | + Scenario: |
| 50 | + Then the value is 1 |
| 51 | + """ |
| 52 | + When I run cucumber.js with `--strict` |
| 53 | + And the exit status should be 0 |
| 54 | + |
| 55 | + Scenario: or tag match |
| 56 | + Given a file named "features/step_definitions/my_tagged_hooks.js" with: |
| 57 | + """ |
| 58 | + module.exports = function() { |
| 59 | + this.Before({tags: ['@foo,@bar']}, function() { |
| 60 | + this.value += 1; |
| 61 | + }); |
| 62 | + }; |
| 63 | + """ |
| 64 | + Given a file named "features/a.feature" with: |
| 65 | + """ |
| 66 | + Feature: |
| 67 | + Scenario: |
| 68 | + Then the value is 0 |
| 69 | +
|
| 70 | + @foo |
| 71 | + Scenario: |
| 72 | + Then the value is 1 |
| 73 | +
|
| 74 | + @bar |
| 75 | + Scenario: |
| 76 | + Then the value is 1 |
| 77 | +
|
| 78 | + @foo @bar |
| 79 | + Scenario: |
| 80 | + Then the value is 1 |
| 81 | + """ |
| 82 | + When I run cucumber.js with `--strict` |
| 83 | + And the exit status should be 0 |
| 84 | + |
| 85 | + Scenario: and tag match |
| 86 | + Given a file named "features/step_definitions/my_tagged_hooks.js" with: |
| 87 | + """ |
| 88 | + module.exports = function() { |
| 89 | + this.Before({tags: ['@foo', '@bar']}, function() { |
| 90 | + this.value += 1; |
| 91 | + }); |
| 92 | + }; |
| 93 | + """ |
| 94 | + Given a file named "features/a.feature" with: |
| 95 | + """ |
| 96 | + Feature: |
| 97 | + Scenario: |
| 98 | + Then the value is 0 |
| 99 | +
|
| 100 | + @foo |
| 101 | + Scenario: |
| 102 | + Then the value is 0 |
| 103 | +
|
| 104 | + @bar |
| 105 | + Scenario: |
| 106 | + Then the value is 0 |
| 107 | +
|
| 108 | + @foo @bar |
| 109 | + Scenario: |
| 110 | + Then the value is 1 |
| 111 | + """ |
| 112 | + When I run cucumber.js with `--strict` |
| 113 | + And the exit status should be 0 |
0 commit comments