Skip to content
This repository
tag: v1.2.1
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 153 lines (127 sloc) 3.817 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
Feature: Rake task
In order to ease the development process
As a developer and CI server administrator
Cucumber features should be executable via Rake

Background:
Given a standard Cucumber project directory structure
And a file named "features/missing_step_definitions.feature" with:
"""
Feature: Sample

Scenario: Wanted
Given I want to run this

Scenario: Unwanted
Given I don't want this ran
"""


Scenario: rake task with a defined profile
Given the following profile is defined:
"""
foo: --quiet --no-color features/missing_step_definitions.feature:3
"""
And a file named "Rakefile" with:
"""
$LOAD_PATH.unshift(CUCUMBER_LIB)
require 'cucumber/rake/task'

Cucumber::Rake::Task.new do |t|
t.profile = "foo"
end
"""
When I run rake cucumber
Then it should pass
And the output should contain
"""
Feature: Sample

Scenario: Wanted
Given I want to run this

1 scenario (1 undefined)
1 step (1 undefined)
"""

Scenario: rake task without a profile
Given a file named "Rakefile" with:
"""
$LOAD_PATH.unshift(CUCUMBER_LIB)
require 'cucumber/rake/task'

Cucumber::Rake::Task.new do |t|
t.cucumber_opts = %w{--quiet --no-color}
end
"""
When I run rake cucumber
Then it should pass
And the output should contain
"""
Feature: Sample

Scenario: Wanted
Given I want to run this

Scenario: Unwanted
Given I don't want this ran

2 scenarios (2 undefined)
2 steps (2 undefined)
"""

Scenario: rake task with a defined profile and cucumber_opts
Given the following profile is defined:
"""
bar: ['features/missing_step_definitions.feature:3']
"""
And a file named "Rakefile" with:
"""
$LOAD_PATH.unshift(CUCUMBER_LIB)
require 'cucumber/rake/task'

Cucumber::Rake::Task.new do |t|
t.profile = "bar"
t.cucumber_opts = %w{--quiet --no-color}
end
"""
When I run rake cucumber
Then it should pass
And the output should contain
"""
Feature: Sample

Scenario: Wanted
Given I want to run this

1 scenario (1 undefined)
1 step (1 undefined)
"""

Scenario: respect requires
Given a file named "features/support/env.rb"
And a file named "features/support/dont_require_me.rb"
And the following profile is defined:
"""
no_bomb: features/missing_step_definitions.feature:3 --require features/support/env.rb --verbose
"""
And a file named "Rakefile" with:
"""
$LOAD_PATH.unshift(CUCUMBER_LIB)
require 'cucumber/rake/task'

Cucumber::Rake::Task.new do |t|
t.profile = "no_bomb"
t.cucumber_opts = %w{--quiet --no-color}
end
"""

When I run rake cucumber
Then it should pass
And the output should not contain
"""
* features/support/dont_require_me.rb
"""

Scenario: feature files with spaces
Given a file named "features/spaces are nasty.feature" with:
"""
Feature: The futures green

Scenario: Orange
Given this is missing
"""
And a file named "Rakefile" with:
"""
$LOAD_PATH.unshift(CUCUMBER_LIB)
require 'cucumber/rake/task'

Cucumber::Rake::Task.new do |t|
t.cucumber_opts = %w{--quiet --no-color}
end
"""
When I run rake cucumber
Then it should pass
And the output should contain
"""
Feature: The futures green

Scenario: Orange
Given this is missing

"""
Something went wrong with that request. Please try again.