cucumber 0.9.4 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/History.txt +16 -0
- data/bin/cucumber +7 -1
- data/cucumber.gemspec +5 -4
- data/cucumber.yml +1 -1
- data/examples/sinatra/features/support/env.rb +1 -4
- data/features/background.feature +284 -95
- data/features/custom_formatter.feature +3 -73
- data/features/execute_with_tag_filter.feature +63 -0
- data/features/{negative_tagged_hooks.feature → hooks.feature} +5 -6
- data/features/json_formatter.feature +161 -245
- data/features/stats_formatters.feature +70 -0
- data/features/step_definitions/cucumber_steps.rb +5 -163
- data/features/support/env.rb +23 -149
- data/features/{tag_logic.feature → tagged_hooks.feature} +11 -52
- data/gem_tasks/{features.rake → cucumber.rake} +6 -1
- data/{features → legacy_features}/announce.feature +0 -0
- data/{features → legacy_features}/api/list_step_defs_as_json.feature +0 -0
- data/{features → legacy_features}/api/run_cli_main_with_existing_runtime.feature +0 -0
- data/{features → legacy_features}/around_hooks.feature +0 -0
- data/{features → legacy_features}/bug_371.feature +0 -0
- data/{features → legacy_features}/bug_464.feature +0 -0
- data/{features → legacy_features}/bug_475.feature +0 -0
- data/{features → legacy_features}/bug_585_tab_indentation.feature +0 -0
- data/{features → legacy_features}/bug_600.feature +0 -0
- data/{features → legacy_features}/call_steps_from_stepdefs.feature +0 -0
- data/{features → legacy_features}/cucumber_cli.feature +9 -9
- data/{features → legacy_features}/cucumber_cli_outlines.feature +0 -0
- data/{features → legacy_features}/default_snippets.feature +0 -0
- data/{features → legacy_features}/diffing.feature +0 -0
- data/{features → legacy_features}/drb_server_integration.feature +0 -0
- data/{features → legacy_features}/exception_in_after_block.feature +0 -0
- data/{features → legacy_features}/exception_in_after_step_block.feature +0 -0
- data/{features → legacy_features}/exception_in_before_block.feature +0 -0
- data/{features → legacy_features}/exclude_files.feature +0 -0
- data/{features → legacy_features}/expand.feature +0 -0
- data/{features → legacy_features}/html_formatter.feature +0 -0
- data/{features → legacy_features}/html_formatter/a.html +0 -0
- data/{features → legacy_features}/junit_formatter.feature +0 -0
- data/{features → legacy_features}/language_from_header.feature +0 -0
- data/{features → legacy_features}/language_help.feature +0 -0
- data/{features → legacy_features}/listener_debugger_formatter.feature +0 -0
- data/legacy_features/multiline_names.feature +44 -0
- data/{features → legacy_features}/post_configuration_hook.feature +0 -0
- data/{features → legacy_features}/profiles.feature +0 -0
- data/{features → legacy_features}/rake_task.feature +0 -0
- data/{features → legacy_features}/report_called_undefined_steps.feature +0 -0
- data/{features → legacy_features}/rerun_formatter.feature +0 -0
- data/{features → legacy_features}/simplest.feature +0 -0
- data/{features → legacy_features}/snippet.feature +0 -0
- data/{features → legacy_features}/snippets_when_using_star_keyword.feature +0 -0
- data/legacy_features/step_definitions/cucumber_steps.rb +168 -0
- data/{features → legacy_features}/step_definitions/extra_steps.rb +0 -0
- data/{features → legacy_features}/step_definitions/simplest_steps.rb +0 -0
- data/{features → legacy_features}/step_definitions/wire_steps.rb +1 -0
- data/legacy_features/support/env.rb +157 -0
- data/{features → legacy_features}/support/env.rb.simplest +0 -0
- data/{features → legacy_features}/support/fake_wire_server.rb +0 -0
- data/{features → legacy_features}/table_diffing.feature +0 -0
- data/{features → legacy_features}/table_mapping.feature +0 -0
- data/{features → legacy_features}/transform.feature +0 -0
- data/{features → legacy_features}/unicode_table.feature +0 -0
- data/{features → legacy_features}/wire_protocol.feature +1 -1
- data/{features → legacy_features}/wire_protocol_table_diffing.feature +0 -0
- data/{features → legacy_features}/wire_protocol_tags.feature +0 -0
- data/{features → legacy_features}/wire_protocol_timeouts.feature +0 -0
- data/{features → legacy_features}/work_in_progress.feature +0 -0
- data/lib/cucumber/ast/examples.rb +5 -0
- data/lib/cucumber/ast/feature.rb +5 -0
- data/lib/cucumber/ast/feature_element.rb +5 -0
- data/lib/cucumber/ast/scenario_outline.rb +9 -4
- data/lib/cucumber/ast/step.rb +5 -0
- data/lib/cucumber/ast/step_invocation.rb +4 -0
- data/lib/cucumber/ast/table.rb +3 -3
- data/lib/cucumber/ast/tree_walker.rb +1 -39
- data/lib/cucumber/cli/main.rb +1 -6
- data/lib/cucumber/cli/options.rb +1 -2
- data/lib/cucumber/formatter/ansicolor.rb +2 -4
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +84 -0
- data/lib/cucumber/formatter/gpretty.rb +24 -0
- data/lib/cucumber/formatter/html.rb +1 -1
- data/lib/cucumber/formatter/io.rb +2 -4
- data/lib/cucumber/formatter/json.rb +15 -152
- data/lib/cucumber/formatter/json_pretty.rb +5 -6
- data/lib/cucumber/formatter/unicode.rb +41 -20
- data/lib/cucumber/parser/gherkin_builder.rb +7 -1
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/step_match.rb +5 -1
- data/spec/cucumber/ast/scenario_outline_spec.rb +11 -8
- data/spec/cucumber/ast/table_spec.rb +6 -1
- data/spec/cucumber/cli/main_spec.rb +4 -1
- metadata +105 -132
- data/features/multiline_names.feature +0 -44
- data/features/usage_and_stepdefs_formatter.feature +0 -169
- data/fixtures/json/features/pystring.feature +0 -8
- data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +0 -12
- data/fixtures/self_test/features/background/background_with_name.feature +0 -7
- data/fixtures/self_test/features/background/failing_background.feature +0 -12
- data/fixtures/self_test/features/background/failing_background_after_success.feature +0 -11
- data/fixtures/self_test/features/background/multiline_args_background.feature +0 -32
- data/fixtures/self_test/features/background/passing_background.feature +0 -10
- data/fixtures/self_test/features/background/pending_background.feature +0 -10
- data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +0 -16
- data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +0 -16
- data/lib/cucumber/formatter/color_io.rb +0 -23
- data/lib/cucumber/formatter/tag_cloud.rb +0 -35
- data/spec/cucumber/formatter/color_io_spec.rb +0 -29
@@ -0,0 +1,70 @@
|
|
1
|
+
Feature: Usage formatter
|
2
|
+
In order to see where step definitions are used
|
3
|
+
Developers should be able to see a list of step definitions and their use
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given a file named "features/f.feature" with:
|
7
|
+
"""
|
8
|
+
Feature: F
|
9
|
+
Background: A
|
10
|
+
Given A
|
11
|
+
Scenario: B
|
12
|
+
Given B
|
13
|
+
Scenario Outline: C
|
14
|
+
Given <x>
|
15
|
+
Examples:
|
16
|
+
|x|
|
17
|
+
|C|
|
18
|
+
Scenario: AC
|
19
|
+
Given A
|
20
|
+
Given C
|
21
|
+
"""
|
22
|
+
And a file named "features/step_definitions/steps.rb" with:
|
23
|
+
"""
|
24
|
+
Given /A/ do;end
|
25
|
+
Given /B/ do;end
|
26
|
+
Given /C/ do;end
|
27
|
+
Given /D/ do;end
|
28
|
+
"""
|
29
|
+
|
30
|
+
Scenario: Run with --format usage
|
31
|
+
When I run "cucumber -f usage --dry-run"
|
32
|
+
Then it should pass with exactly:
|
33
|
+
"""
|
34
|
+
--------
|
35
|
+
|
36
|
+
/A/ # features/step_definitions/steps.rb:1
|
37
|
+
Given A # features/f.feature:3
|
38
|
+
Given A # features/f.feature:3
|
39
|
+
Given A # features/f.feature:3
|
40
|
+
Given A # features/f.feature:12
|
41
|
+
/B/ # features/step_definitions/steps.rb:2
|
42
|
+
Given B # features/f.feature:5
|
43
|
+
/C/ # features/step_definitions/steps.rb:3
|
44
|
+
Given C # features/f.feature:13
|
45
|
+
/D/ # features/step_definitions/steps.rb:4
|
46
|
+
NOT MATCHED BY ANY STEPS
|
47
|
+
|
48
|
+
3 scenarios (3 skipped)
|
49
|
+
7 steps (7 skipped)
|
50
|
+
0m0.012s
|
51
|
+
|
52
|
+
"""
|
53
|
+
|
54
|
+
Scenario: Run with --format stepdefs
|
55
|
+
When I run "cucumber -f stepdefs --dry-run"
|
56
|
+
Then it should pass with exactly:
|
57
|
+
"""
|
58
|
+
--------
|
59
|
+
|
60
|
+
/A/ # features/step_definitions/steps.rb:1
|
61
|
+
/B/ # features/step_definitions/steps.rb:2
|
62
|
+
/C/ # features/step_definitions/steps.rb:3
|
63
|
+
/D/ # features/step_definitions/steps.rb:4
|
64
|
+
NOT MATCHED BY ANY STEPS
|
65
|
+
|
66
|
+
3 scenarios (3 skipped)
|
67
|
+
7 steps (7 skipped)
|
68
|
+
0m0.012s
|
69
|
+
|
70
|
+
"""
|
@@ -1,166 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Given /^I am in (.*)$/ do |example_dir_relative_path|
|
5
|
-
@current_dir = fixtures_dir(example_dir_relative_path)
|
6
|
-
end
|
7
|
-
|
8
|
-
Given /^a standard Cucumber project directory structure$/ do
|
9
|
-
@current_dir = working_dir
|
10
|
-
in_current_dir do
|
11
|
-
FileUtils.rm_rf 'features' if File.directory?('features')
|
12
|
-
FileUtils.mkdir_p 'features/support'
|
13
|
-
FileUtils.mkdir 'features/step_definitions'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Given /^the (.*) directory is empty$/ do |directory|
|
18
|
-
in_current_dir do
|
19
|
-
FileUtils.remove_dir(directory) rescue nil
|
20
|
-
FileUtils.mkdir 'tmp'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
Given /^a file named "([^"]*)"$/ do |file_name|
|
25
|
-
create_file(file_name, '')
|
26
|
-
end
|
27
|
-
|
28
|
-
Given /^a file named "([^"]*)" with:$/ do |file_name, file_content|
|
29
|
-
create_file(file_name, file_content)
|
30
|
-
end
|
31
|
-
|
32
|
-
Given /^the following profiles? (?:are|is) defined:$/ do |profiles|
|
33
|
-
create_file('cucumber.yml', profiles)
|
34
|
-
end
|
35
|
-
|
36
|
-
Given /^I am running spork in the background$/ do
|
37
|
-
run_spork_in_background
|
38
|
-
end
|
39
|
-
|
40
|
-
Given /^I am running spork in the background on port (\d+)$/ do |port|
|
41
|
-
run_spork_in_background(port.to_i)
|
42
|
-
end
|
43
|
-
|
44
|
-
Given /^I am not running (?:.*) in the background$/ do
|
45
|
-
# no-op
|
46
|
-
end
|
47
|
-
|
48
|
-
Given /^I have environment variable (\w+) set to "([^"]*)"$/ do |variable, value|
|
49
|
-
set_env_var(variable, value)
|
50
|
-
end
|
51
|
-
|
52
|
-
When /^I run cucumber (.*)$/ do |cucumber_opts|
|
53
|
-
run "#{Cucumber::RUBY_BINARY} -I rubygems #{cucumber_bin} --no-color #{cucumber_opts} CUCUMBER_OUTPUT_ENCODING=UTF-8"
|
54
|
-
end
|
55
|
-
|
56
|
-
When /^I run rake (.*)$/ do |rake_opts|
|
57
|
-
run "rake #{rake_opts} --trace"
|
58
|
-
end
|
59
|
-
|
60
|
-
When /^I run the following Ruby code:$/ do |code|
|
61
|
-
run %{#{Cucumber::RUBY_BINARY} -r rubygems -I #{cucumber_lib_dir} -e "#{code}"}
|
62
|
-
end
|
63
|
-
|
64
|
-
Then /^it should (fail|pass)$/ do |success|
|
65
|
-
if success == 'fail'
|
66
|
-
last_exit_status.should_not == 0
|
67
|
-
else
|
68
|
-
if last_exit_status != 0
|
69
|
-
raise "Failed with exit status #{last_exit_status}\nSTDOUT:\n#{last_stdout}\nSTDERR:\n#{last_stderr}"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
Then /^it should (fail|pass) with$/ do |success, output|
|
75
|
-
combined_output.should =~ Regexp.compile(Regexp.escape(output))
|
76
|
-
Then("it should #{success}")
|
77
|
-
end
|
78
|
-
|
79
|
-
Then /^the output should contain:?$/ do |text|
|
80
|
-
last_stdout.should include(text)
|
81
|
-
end
|
82
|
-
|
83
|
-
Then /^the output should not contain$/ do |text|
|
84
|
-
last_stdout.should_not include(text)
|
85
|
-
end
|
86
|
-
|
87
|
-
Then /^the output should be$/ do |text|
|
88
|
-
last_stdout.should == text
|
89
|
-
end
|
90
|
-
|
91
|
-
Then /^it should (fail|pass) with JSON$/ do |success, text|
|
92
|
-
JSON.parse(last_stdout).should == JSON.parse(text)
|
93
|
-
Then("it should #{success}")
|
94
|
-
end
|
95
|
-
|
96
|
-
Then /^"([^"]*)" should contain$/ do |file, text|
|
97
|
-
strip_duration(IO.read(file)).should == text
|
98
|
-
end
|
99
|
-
|
100
|
-
Then /^"([^"]*)" with junit duration "([^"]*)" should contain$/ do |actual_file, duration_replacement, text|
|
101
|
-
actual = IO.read(actual_file)
|
102
|
-
actual = replace_junit_duration(actual, duration_replacement)
|
103
|
-
actual = strip_ruby186_extra_trace(actual)
|
104
|
-
actual.should == text
|
105
|
-
end
|
106
|
-
|
107
|
-
Then /^"([^"]*)" should match "(.+?)"$/ do |file, text|
|
108
|
-
File.open(file, Cucumber.file_mode('r')).read.should =~ Regexp.new(text)
|
109
|
-
end
|
110
|
-
|
111
|
-
Then /^"([^"]*)" should have the same contents as "([^"]*)"$/ do |actual_file, expected_file|
|
112
|
-
actual = IO.read(actual_file)
|
113
|
-
actual = replace_duration(actual, '0m30.005s')
|
114
|
-
# Comment out to replace expected file. Use with care!
|
115
|
-
# File.open(expected_file, "w") {|io| io.write(actual)}
|
116
|
-
actual.should == IO.read(expected_file)
|
117
|
-
end
|
118
|
-
|
119
|
-
Then /^STDERR should match$/ do |text|
|
120
|
-
last_stderr.should =~ /#{text}/
|
121
|
-
end
|
122
|
-
|
123
|
-
Then /^STDERR should not match$/ do |text|
|
124
|
-
last_stderr.should_not =~ /#{text}/
|
125
|
-
end
|
126
|
-
|
127
|
-
Then /^STDERR should be$/ do |text|
|
128
|
-
last_stderr.should == text
|
129
|
-
end
|
130
|
-
|
131
|
-
Then /^STDERR should be empty$/ do
|
132
|
-
last_stderr.should == ""
|
133
|
-
end
|
134
|
-
|
135
|
-
Then /^"([^"]*)" should exist$/ do |file|
|
136
|
-
File.exists?(file).should be_true
|
137
|
-
FileUtils.rm(file)
|
138
|
-
end
|
139
|
-
|
140
|
-
Then /^"([^"]*)" should not be required$/ do |file_name|
|
141
|
-
last_stdout.should_not include("* #{file_name}")
|
142
|
-
end
|
143
|
-
|
144
|
-
Then /^"([^"]*)" should be required$/ do |file_name|
|
145
|
-
last_stdout.should include("* #{file_name}")
|
146
|
-
end
|
147
|
-
|
148
|
-
Then /^exactly these files should be loaded:\s*(.*)$/ do |files|
|
149
|
-
last_stdout.scan(/^ \* (.*\.rb)$/).flatten.should == files.split(/,\s+/)
|
150
|
-
end
|
151
|
-
|
152
|
-
Then /^exactly these features should be ran:\s*(.*)$/ do |files|
|
153
|
-
last_stdout.scan(/^ \* (.*\.feature)$/).flatten.should == files.split(/,\s+/)
|
154
|
-
end
|
155
|
-
|
156
|
-
Then /^the (.*) profile should be used$/ do |profile|
|
157
|
-
last_stdout.should =~ /Using the #{profile} profile/
|
158
|
-
end
|
159
|
-
|
160
|
-
Then /^print output$/ do
|
161
|
-
puts last_stdout
|
1
|
+
When /^I run cucumber "([^"]*)"$/ do |cmd|
|
2
|
+
run_simple(unescape("cucumber #{cmd}"), false)
|
162
3
|
end
|
163
4
|
|
164
|
-
Then /^
|
165
|
-
JSON.parse(
|
5
|
+
Then /^it should (pass|fail) with JSON:$/ do |pass_fail, json|
|
6
|
+
JSON.pretty_generate(JSON.parse(all_stdout)).should == JSON.pretty_generate(JSON.parse(json))
|
7
|
+
assert_exiting_with(pass_fail == 'pass')
|
166
8
|
end
|
data/features/support/env.rb
CHANGED
@@ -1,157 +1,31 @@
|
|
1
|
-
require '
|
1
|
+
require 'aruba/api'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require 'forwardable'
|
7
|
-
require 'cucumber/formatter/unicode'
|
8
|
-
# This is to force miniunit to be loaded on 1.9.2, and verify that we can still run with --profile. See:
|
9
|
-
# * disable_mini_test_autorun.rb and
|
10
|
-
# * http://groups.google.com/group/cukes/browse_thread/thread/5682d41436e235d7
|
11
|
-
# * https://rspec.lighthouseapp.com/projects/16211/tickets/677-cucumber-093-prevents-testunit-from-running
|
12
|
-
require 'test/unit'
|
13
|
-
|
14
|
-
class CucumberWorld
|
15
|
-
extend Forwardable
|
16
|
-
def_delegators CucumberWorld, :fixtures_dir, :self_test_dir, :working_dir, :cucumber_lib_dir
|
17
|
-
|
18
|
-
def self.fixtures_dir(subdir=nil)
|
19
|
-
@fixtures_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../fixtures'))
|
20
|
-
subdir ? File.join(@fixtures_dir, subdir) : @fixtures_dir
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.self_test_dir
|
24
|
-
@self_test_dir ||= fixtures_dir('self_test')
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.working_dir
|
28
|
-
@working_dir ||= fixtures_dir('self_test/tmp')
|
29
|
-
end
|
30
|
-
|
31
|
-
def cucumber_lib_dir
|
32
|
-
@cucumber_lib_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../lib'))
|
33
|
-
end
|
3
|
+
# Monkey patch aruba to filter out some stuff
|
4
|
+
module Aruba::Api
|
5
|
+
alias _all_stdout all_stdout
|
34
6
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
private
|
47
|
-
attr_reader :last_exit_status, :last_stderr
|
48
|
-
|
49
|
-
# The last standard out, with the duration line taken out (unpredictable)
|
50
|
-
def last_stdout
|
51
|
-
strip_1_9_paths(strip_duration(@last_stdout))
|
52
|
-
end
|
53
|
-
|
54
|
-
def combined_output
|
55
|
-
last_stdout + "\n" + last_stderr
|
56
|
-
end
|
57
|
-
|
58
|
-
def strip_duration(s)
|
59
|
-
s.gsub(/^\d+m\d+\.\d+s\n/m, "")
|
60
|
-
end
|
61
|
-
|
62
|
-
def strip_1_9_paths(s)
|
63
|
-
s.gsub(/#{Dir.pwd}\/fixtures\/self_test\/tmp/m, ".").gsub(/#{Dir.pwd}\/fixtures\/self_test/m, ".")
|
64
|
-
end
|
65
|
-
|
66
|
-
def replace_duration(s, replacement)
|
67
|
-
s.gsub(/\d+m\d+\.\d+s/m, replacement)
|
68
|
-
end
|
69
|
-
|
70
|
-
def replace_junit_duration(s, replacement)
|
71
|
-
s.gsub(/\d+\.\d\d+/m, replacement)
|
7
|
+
def all_stdout
|
8
|
+
out = _all_stdout
|
9
|
+
|
10
|
+
# Remove absolute paths
|
11
|
+
out.gsub!(/#{Dir.pwd}\/tmp\/aruba/, '.')
|
12
|
+
# Make duration predictable
|
13
|
+
out.gsub!(/^\d+m\d+\.\d+s$/, '0m0.012s')
|
14
|
+
# Remove SimpleCov message
|
15
|
+
out.gsub!(/Coverage report generated for Cucumber Features to #{Dir.pwd}\/coverage\n$/, '')
|
16
|
+
|
17
|
+
out
|
72
18
|
end
|
73
|
-
|
74
|
-
def strip_ruby186_extra_trace(s)
|
75
|
-
s.gsub(/^.*\.\/features\/step_definitions(.*)\n/, "")
|
76
|
-
end
|
77
|
-
|
78
|
-
def create_file(file_name, file_content)
|
79
|
-
file_content.gsub!("CUCUMBER_LIB", "'#{cucumber_lib_dir}'") # Some files, such as Rakefiles need to use the lib dir
|
80
|
-
in_current_dir do
|
81
|
-
FileUtils.mkdir_p(File.dirname(file_name)) unless File.directory?(File.dirname(file_name))
|
82
|
-
File.open(file_name, 'w') { |f| f << file_content }
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def set_env_var(variable, value)
|
87
|
-
@original_env_vars ||= {}
|
88
|
-
@original_env_vars[variable] = ENV[variable]
|
89
|
-
ENV[variable] = value
|
90
|
-
end
|
91
|
-
|
92
|
-
def background_jobs
|
93
|
-
@background_jobs ||= []
|
94
|
-
end
|
95
|
-
|
96
|
-
def in_current_dir(&block)
|
97
|
-
Dir.chdir(@current_dir, &block)
|
98
|
-
end
|
99
|
-
|
100
|
-
def run(command)
|
101
|
-
stderr_file = Tempfile.new('cucumber')
|
102
|
-
stderr_file.close
|
103
|
-
in_current_dir do
|
104
|
-
mode = Cucumber::RUBY_1_9 ? {:external_encoding=>"UTF-8"} : 'r'
|
105
|
-
IO.popen("#{command} 2> #{stderr_file.path}", mode) do |io|
|
106
|
-
@last_stdout = io.read
|
107
|
-
end
|
108
|
-
|
109
|
-
@last_exit_status = $?.exitstatus
|
110
|
-
end
|
111
|
-
@last_stderr = IO.read(stderr_file.path)
|
112
|
-
end
|
113
|
-
|
114
|
-
def run_spork_in_background(port = nil)
|
115
|
-
require 'spork'
|
116
|
-
|
117
|
-
pid = fork
|
118
|
-
in_current_dir do
|
119
|
-
if pid
|
120
|
-
background_jobs << pid
|
121
|
-
else
|
122
|
-
# STDOUT.close
|
123
|
-
# STDERR.close
|
124
|
-
port_arg = port ? "-p #{port}" : ''
|
125
|
-
cmd = "#{Cucumber::RUBY_BINARY} -I #{Cucumber::LIBDIR} #{Spork::BINARY} cuc #{port_arg}"
|
126
|
-
exec cmd
|
127
|
-
end
|
128
|
-
end
|
129
|
-
sleep 1.0
|
130
|
-
end
|
131
|
-
|
132
|
-
def terminate_background_jobs
|
133
|
-
background_jobs.each do |pid|
|
134
|
-
Process.kill(Signal.list['TERM'], pid)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
def restore_original_env_vars
|
139
|
-
@original_env_vars.each { |variable, value| ENV[variable] = value } if @original_env_vars
|
140
|
-
end
|
141
|
-
|
142
19
|
end
|
143
20
|
|
144
|
-
|
145
|
-
CucumberWorld.new
|
146
|
-
end
|
21
|
+
require 'aruba/cucumber'
|
147
22
|
|
148
|
-
Before do
|
149
|
-
|
150
|
-
FileUtils.mkdir CucumberWorld.working_dir
|
151
|
-
end
|
23
|
+
Before do |scenario|
|
24
|
+
@scenario = scenario
|
152
25
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
26
|
+
# Make sure bin/cucumber runs with SimpleCov enabled
|
27
|
+
set_env('SIMPLECOV', 'true')
|
28
|
+
|
29
|
+
# Set a longer timeout for aruba
|
30
|
+
@aruba_timeout_seconds = 5
|
157
31
|
end
|
@@ -4,8 +4,7 @@ Feature: Tag logic
|
|
4
4
|
I want to select features using logical AND/OR of tags
|
5
5
|
|
6
6
|
Background:
|
7
|
-
Given a
|
8
|
-
And a file named "features/tagulicious.feature" with:
|
7
|
+
Given a file named "features/tagulicious.feature" with:
|
9
8
|
"""
|
10
9
|
Feature: Sample
|
11
10
|
|
@@ -25,46 +24,6 @@ Feature: Tag logic
|
|
25
24
|
Scenario: And yet another Example
|
26
25
|
"""
|
27
26
|
|
28
|
-
Scenario: ANDing tags
|
29
|
-
When I run cucumber -q -t @one -t @three features/tagulicious.feature
|
30
|
-
Then it should pass
|
31
|
-
And the output should contain
|
32
|
-
"""
|
33
|
-
Feature: Sample
|
34
|
-
|
35
|
-
@one @three
|
36
|
-
Scenario: Example
|
37
|
-
Given passing
|
38
|
-
|
39
|
-
1 scenario (1 undefined)
|
40
|
-
1 step (1 undefined)
|
41
|
-
|
42
|
-
"""
|
43
|
-
|
44
|
-
Scenario: ORing tags
|
45
|
-
When I run cucumber -q -t @one,@three features/tagulicious.feature
|
46
|
-
Then it should pass
|
47
|
-
And the output should contain
|
48
|
-
"""
|
49
|
-
Feature: Sample
|
50
|
-
|
51
|
-
@one @three
|
52
|
-
Scenario: Example
|
53
|
-
Given passing
|
54
|
-
|
55
|
-
@one
|
56
|
-
Scenario: Another Example
|
57
|
-
Given passing
|
58
|
-
|
59
|
-
@three
|
60
|
-
Scenario: Yet another Example
|
61
|
-
Given passing
|
62
|
-
|
63
|
-
3 scenarios (3 undefined)
|
64
|
-
3 steps (3 undefined)
|
65
|
-
|
66
|
-
"""
|
67
|
-
|
68
27
|
Scenario: Before hooks ORing
|
69
28
|
Given a file named "features/support/hooks.rb" with:
|
70
29
|
"""
|
@@ -72,8 +31,8 @@ Feature: Tag logic
|
|
72
31
|
raise 'boom'
|
73
32
|
end
|
74
33
|
"""
|
75
|
-
When I run cucumber -q features/tagulicious.feature
|
76
|
-
Then it should fail with
|
34
|
+
When I run "cucumber -q features/tagulicious.feature"
|
35
|
+
Then it should fail with:
|
77
36
|
"""
|
78
37
|
Feature: Sample
|
79
38
|
|
@@ -115,8 +74,8 @@ Feature: Tag logic
|
|
115
74
|
raise 'boom'
|
116
75
|
end
|
117
76
|
"""
|
118
|
-
When I run cucumber -q features/tagulicious.feature
|
119
|
-
Then it should fail with
|
77
|
+
When I run "cucumber -q features/tagulicious.feature"
|
78
|
+
Then it should fail with:
|
120
79
|
"""
|
121
80
|
Feature: Sample
|
122
81
|
|
@@ -152,8 +111,8 @@ Feature: Tag logic
|
|
152
111
|
raise 'boom'
|
153
112
|
end
|
154
113
|
"""
|
155
|
-
When I run cucumber -q features/tagulicious.feature
|
156
|
-
Then it should pass with
|
114
|
+
When I run "cucumber -q features/tagulicious.feature"
|
115
|
+
Then it should pass with:
|
157
116
|
"""
|
158
117
|
Feature: Sample
|
159
118
|
|
@@ -184,8 +143,8 @@ Feature: Tag logic
|
|
184
143
|
raise 'boom'
|
185
144
|
end
|
186
145
|
"""
|
187
|
-
When I run cucumber -q features/tagulicious.feature
|
188
|
-
Then it should fail with
|
146
|
+
When I run "cucumber -q features/tagulicious.feature"
|
147
|
+
Then it should fail with:
|
189
148
|
"""
|
190
149
|
Feature: Sample
|
191
150
|
|
@@ -227,8 +186,8 @@ Feature: Tag logic
|
|
227
186
|
raise 'boom'
|
228
187
|
end
|
229
188
|
"""
|
230
|
-
When I run cucumber -q features/tagulicious.feature
|
231
|
-
Then it should fail with
|
189
|
+
When I run "cucumber -q features/tagulicious.feature"
|
190
|
+
Then it should fail with:
|
232
191
|
"""
|
233
192
|
Feature: Sample
|
234
193
|
|