Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 159 lines (142 sloc) 4.122 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
Feature: Options
In order to make it easier for Cucumber plugins to run seamlessly
As a Cuke developer
I want to configure Cucumber from within a cucumber execution

Background:
Given a standard Cucumber project directory structure

Scenario: Tags
Given a file named "features/philosophers.feature" with:
"""
Feature: Drunken Philosophers
Scenario: I drink therefore I am
Given Immanuel Kant was a real pissant
@wip
Scenario: Failing drunk
Given fail
"""
And a file named "features/step_definitions/steps.rb" with:
"""
Given /^Immanuel Kant was a real pissant$/ do
end
Given /^fail$/ do
fail
end
"""
And a file named "features/support/env.rb" with:
"""
Cucumber.configure do |c|
c.tags = ['~@wip']
end
"""
When I run cucumber features --format progress
Then it should pass with
"""
.
1 scenario (1 passed)
1 step (1 passed)

"""

Scenario: HTML formatter
Given a file named "features/support/env.rb" with:
"""
Cucumber.configure do |config|
config.formats << ['html', config.out_stream]
end
"""
When I run cucumber features
Then STDERR should be empty
And the output should contain
"""
html
"""

Scenario: feature directories read from configuration
Given a file named "features/support/env.rb" with:
"""
Cucumber.configure do |config|
config.out_stream << "Read feature directories: #{config.feature_dirs.join(', ')}"
end
"""
When I run cucumber features
Then STDERR should be empty
And the output should contain
"""
Read feature directories: features
"""

Scenario: Pick up .cucumber, but not anything under features
And a file named ".cucumber.rb" with:
"""
Cucumber.configure do |config|
config.out_stream << "IM IN URZ CONFIGZ"
end
"""
And a file named "features/support/env.rb" with:
"""
This isn't even ruby, but that's
ok since it is never loaded
"""
When I run cucumber features
Then STDERR should be empty
And the output should contain
"""
IM IN URZ CONFIGZ
"""

Scenario: configuring outside of support
Given a file named "features/step_definitions/cheat_steps.rb" with:
"""
Cucumber.configure do |config|
config.formats << ['html', config.out_stream]
end
"""
When I run cucumber features
Then it should pass with
"""
html
"""

Scenario: configuring during Cucumber execution
Given a file named "features/philosophers.feature" with:
"""
Feature: Drunken Philosophers
Scenario: I drink therefore I am
Given Immanuel Kant was a real pissant
"""
And a file named "features/step_definitions/steps.rb" with:
"""
Given /^Immanuel Kant was a real pissant$/ do
Cucumber.configure do |config|
config.tags = ['@wip']
end
end
"""
When I run cucumber features
Then it should fail with
"""
You cannot modify configuration once Cucumber has started executing features.
"""

Scenario: strict and wip
Given a file named "features/support/env.rb" with:
"""
Cucumber.configure do |config|
config.wip = true
config.strict = true
end

"""
When I run cucumber features
Then it should fail with
"""
You can't use both --strict and --wip
"""

@wip
Scenario: Profiles
Given a file named "features/support/env.rb" with:
"""
Cucumber.configure('html_it') do |config|
config.formats << ['html', config.out_stream]
end
Cucumber.configure('progress') do |config|
config.formats << ['pretty', config.out_stream]
end

"""
When I run cucumber features --profile html_it
Then it should pass with
"""
html
"""
Something went wrong with that request. Please try again.