cucumber 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +1 -1
- data/LICENSE +1 -1
- data/Rakefile +5 -51
- data/bin/cucumber +7 -1
- data/cucumber.gemspec +463 -679
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +4 -7
- data/examples/i18n/ru/features/division.feature +2 -2
- data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
- data/examples/sinatra/features/support/env.rb +2 -5
- data/examples/v8/features/fibonacci.feature +1 -1
- data/examples/watir/features/step_definitions/search_steps.rb +1 -1
- data/features/background.feature +284 -95
- data/features/custom_formatter.feature +3 -73
- data/features/json_formatter.feature +160 -245
- data/features/step_definitions/cucumber_steps.rb +7 -153
- data/features/support/env.rb +18 -140
- data/fixtures/junit/features/pending.feature +3 -1
- data/fixtures/self_test/features/support/env.rb +8 -0
- data/fixtures/tickets/features.html +1 -1
- data/gem_tasks/examples.rake +1 -1
- data/lib/cucumber.rb +12 -0
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +21 -5
- data/lib/cucumber/ast/examples.rb +12 -4
- data/lib/cucumber/ast/feature.rb +13 -5
- data/lib/cucumber/ast/feature_element.rb +9 -4
- data/lib/cucumber/ast/outline_table.rb +4 -4
- data/lib/cucumber/ast/scenario.rb +7 -5
- data/lib/cucumber/ast/scenario_outline.rb +23 -15
- data/lib/cucumber/ast/step.rb +5 -0
- data/lib/cucumber/ast/step_invocation.rb +21 -15
- data/lib/cucumber/ast/table.rb +14 -8
- data/lib/cucumber/ast/tree_walker.rb +10 -48
- data/lib/cucumber/cli/configuration.rb +33 -8
- data/lib/cucumber/cli/main.rb +20 -35
- data/lib/cucumber/cli/options.rb +8 -7
- data/lib/cucumber/cli/profile_loader.rb +2 -0
- data/lib/cucumber/core_ext/proc.rb +2 -1
- data/lib/cucumber/feature_file.rb +47 -15
- data/lib/cucumber/formatter/ansicolor.rb +3 -5
- data/lib/cucumber/formatter/console.rb +27 -23
- data/lib/cucumber/formatter/cucumber.css +34 -17
- data/lib/cucumber/formatter/cucumber.sass +173 -182
- data/lib/cucumber/formatter/html.rb +46 -11
- 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/junit.rb +28 -22
- data/lib/cucumber/formatter/pdf.rb +6 -6
- data/lib/cucumber/formatter/pretty.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +22 -11
- data/lib/cucumber/formatter/unicode.rb +41 -20
- data/lib/cucumber/js_support/js_dsl.js +4 -4
- data/lib/cucumber/js_support/js_language.rb +9 -5
- data/lib/cucumber/js_support/js_snippets.rb +2 -2
- data/lib/cucumber/language_support.rb +2 -2
- data/lib/cucumber/parser/gherkin_builder.rb +35 -30
- data/lib/cucumber/platform.rb +8 -8
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +80 -31
- data/lib/cucumber/rb_support/rb_dsl.rb +1 -0
- data/lib/cucumber/rb_support/rb_language.rb +10 -8
- data/lib/cucumber/rb_support/rb_step_definition.rb +8 -0
- data/lib/cucumber/rb_support/rb_transform.rb +17 -0
- data/lib/cucumber/rb_support/rb_world.rb +26 -18
- data/lib/cucumber/rspec/doubles.rb +3 -3
- data/lib/cucumber/step_match.rb +6 -2
- data/lib/cucumber/step_mother.rb +6 -427
- data/lib/cucumber/wire_support/configuration.rb +4 -1
- data/lib/cucumber/wire_support/wire_language.rb +3 -10
- data/spec/cucumber/ast/background_spec.rb +68 -6
- data/spec/cucumber/ast/feature_factory.rb +5 -4
- data/spec/cucumber/ast/feature_spec.rb +4 -4
- data/spec/cucumber/ast/outline_table_spec.rb +1 -1
- data/spec/cucumber/ast/scenario_outline_spec.rb +15 -11
- data/spec/cucumber/ast/scenario_spec.rb +4 -4
- data/spec/cucumber/ast/step_spec.rb +3 -3
- data/spec/cucumber/ast/table_spec.rb +38 -2
- data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +32 -6
- data/spec/cucumber/cli/drb_client_spec.rb +2 -3
- data/spec/cucumber/cli/main_spec.rb +43 -43
- data/spec/cucumber/cli/options_spec.rb +28 -1
- data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
- data/spec/cucumber/core_ext/proc_spec.rb +1 -1
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
- data/spec/cucumber/formatter/duration_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +3 -5
- data/spec/cucumber/formatter/junit_spec.rb +16 -2
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +11 -12
- data/spec/cucumber/rb_support/rb_language_spec.rb +241 -28
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +33 -28
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
- data/spec/cucumber/step_match_spec.rb +11 -9
- data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
- data/spec/cucumber/wire_support/connection_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/cucumber/world/pending_spec.rb +2 -2
- data/spec/spec_helper.rb +13 -20
- metadata +11 -222
- data/.gitignore +0 -20
- data/Caliper.yml +0 -4
- data/History.txt +0 -1552
- data/README.rdoc +0 -26
- data/VERSION.yml +0 -5
- data/examples/i18n/ro/features/suma.feature +0 -11
- data/features/announce.feature +0 -164
- data/features/around_hooks.feature +0 -232
- data/features/bug_371.feature +0 -32
- data/features/bug_464.feature +0 -16
- data/features/bug_475.feature +0 -42
- data/features/bug_585_tab_indentation.feature +0 -22
- data/features/bug_600.feature +0 -67
- data/features/call_steps_from_stepdefs.feature +0 -154
- data/features/cucumber_cli.feature +0 -591
- data/features/cucumber_cli_outlines.feature +0 -117
- data/features/default_snippets.feature +0 -42
- data/features/diffing.feature +0 -25
- data/features/drb_server_integration.feature +0 -174
- data/features/exception_in_after_block.feature +0 -127
- data/features/exception_in_after_step_block.feature +0 -104
- data/features/exception_in_before_block.feature +0 -98
- data/features/exclude_files.feature +0 -20
- data/features/expand.feature +0 -60
- data/features/html_formatter.feature +0 -8
- data/features/html_formatter/a.html +0 -582
- data/features/junit_formatter.feature +0 -88
- data/features/language_from_header.feature +0 -30
- data/features/language_help.feature +0 -78
- data/features/listener_debugger_formatter.feature +0 -42
- data/features/multiline_names.feature +0 -44
- data/features/negative_tagged_hooks.feature +0 -60
- data/features/post_configuration_hook.feature +0 -37
- data/features/profiles.feature +0 -126
- data/features/rake_task.feature +0 -152
- data/features/report_called_undefined_steps.feature +0 -34
- data/features/rerun_formatter.feature +0 -45
- data/features/simplest.feature +0 -11
- data/features/snippet.feature +0 -23
- data/features/snippets_when_using_star_keyword.feature +0 -36
- data/features/step_definitions/extra_steps.rb +0 -2
- data/features/step_definitions/simplest_steps.rb +0 -3
- data/features/step_definitions/wire_steps.rb +0 -32
- data/features/support/env.rb.simplest +0 -7
- data/features/support/fake_wire_server.rb +0 -77
- data/features/table_diffing.feature +0 -45
- data/features/table_mapping.feature +0 -34
- data/features/tag_logic.feature +0 -258
- data/features/transform.feature +0 -245
- data/features/unicode_table.feature +0 -35
- data/features/usage_and_stepdefs_formatter.feature +0 -169
- data/features/wire_protocol.feature +0 -332
- data/features/wire_protocol_table_diffing.feature +0 -119
- data/features/wire_protocol_tags.feature +0 -87
- data/features/wire_protocol_timeouts.feature +0 -63
- data/features/work_in_progress.feature +0 -156
- 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/gem_tasks/features.rake +0 -14
- data/gem_tasks/sdoc.rake +0 -12
- data/lib/cucumber/ast/py_string.rb +0 -80
- data/lib/cucumber/formatter/color_io.rb +0 -23
- data/lib/cucumber/formatter/tag_cloud.rb +0 -35
- data/spec/cucumber/ast/py_string_spec.rb +0 -40
- data/spec/cucumber/formatter/color_io_spec.rb +0 -29
- data/spec/cucumber/step_mother_spec.rb +0 -302
|
@@ -1,160 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Given /^I am in (.*)$/ do |example_dir_relative_path|
|
|
5
|
-
@current_dir = fixtures_dir(example_dir_relative_path)
|
|
1
|
+
When /^I run cucumber "(.+)"$/ do |cmd|
|
|
2
|
+
run_simple(unescape("cucumber #{cmd}"), false)
|
|
6
3
|
end
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
FileUtils.rm_rf 'features' if File.directory?('features')
|
|
12
|
-
FileUtils.mkdir_p 'features/support'
|
|
13
|
-
FileUtils.mkdir 'features/step_definitions'
|
|
14
|
-
end
|
|
5
|
+
Then /^it should (pass|fail) with JSON:$/ do |pass_fail, json|
|
|
6
|
+
JSON.parse(all_stdout).should == JSON.parse(json)
|
|
7
|
+
assert_success(pass_fail == 'pass')
|
|
15
8
|
end
|
|
16
9
|
|
|
17
|
-
Given /^
|
|
10
|
+
Given /^a directory without standard Cucumber project directory structure$/ do
|
|
18
11
|
in_current_dir do
|
|
19
|
-
FileUtils.
|
|
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} -r rubygems #{Cucumber::BINARY} --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
|
-
Then /^it should (fail|pass)$/ do |success|
|
|
61
|
-
if success == 'fail'
|
|
62
|
-
last_exit_status.should_not == 0
|
|
63
|
-
else
|
|
64
|
-
if last_exit_status != 0
|
|
65
|
-
raise "Failed with exit status #{last_exit_status}\nSTDOUT:\n#{last_stdout}\nSTDERR:\n#{last_stderr}"
|
|
66
|
-
end
|
|
12
|
+
FileUtils.rm_rf 'features' if File.directory?('features')
|
|
67
13
|
end
|
|
68
14
|
end
|
|
69
|
-
|
|
70
|
-
Then /^it should (fail|pass) with$/ do |success, output|
|
|
71
|
-
combined_output.should =~ Regexp.compile(Regexp.escape(output))
|
|
72
|
-
Then("it should #{success}")
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
Then /^the output should contain$/ do |text|
|
|
76
|
-
last_stdout.should include(text)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
Then /^the output should not contain$/ do |text|
|
|
80
|
-
last_stdout.should_not include(text)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
Then /^the output should be$/ do |text|
|
|
84
|
-
last_stdout.should == text
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
Then /^it should (fail|pass) with JSON$/ do |success, text|
|
|
88
|
-
JSON.parse(last_stdout).should == JSON.parse(text)
|
|
89
|
-
Then("it should #{success}")
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
Then /^"([^"]*)" should contain$/ do |file, text|
|
|
93
|
-
strip_duration(IO.read(file)).should == text
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
Then /^"([^"]*)" with junit duration "([^"]*)" should contain$/ do |actual_file, duration_replacement, text|
|
|
97
|
-
actual = IO.read(actual_file)
|
|
98
|
-
actual = replace_junit_duration(actual, duration_replacement)
|
|
99
|
-
actual = strip_ruby186_extra_trace(actual)
|
|
100
|
-
actual.should == text
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
Then /^"([^"]*)" should match "(.+?)"$/ do |file, text|
|
|
104
|
-
File.open(file, Cucumber.file_mode('r')).read.should =~ Regexp.new(text)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
Then /^"([^"]*)" should have the same contents as "([^"]*)"$/ do |actual_file, expected_file|
|
|
108
|
-
actual = IO.read(actual_file)
|
|
109
|
-
actual = replace_duration(actual, '0m30.005s')
|
|
110
|
-
# Comment out to replace expected file. Use with care!
|
|
111
|
-
# File.open(expected_file, "w") {|io| io.write(actual)}
|
|
112
|
-
actual.should == IO.read(expected_file)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
Then /^STDERR should match$/ do |text|
|
|
116
|
-
last_stderr.should =~ /#{text}/
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
Then /^STDERR should not match$/ do |text|
|
|
120
|
-
last_stderr.should_not =~ /#{text}/
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
Then /^STDERR should be$/ do |text|
|
|
124
|
-
last_stderr.should == text
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
Then /^STDERR should be empty$/ do
|
|
128
|
-
last_stderr.should == ""
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
Then /^"([^"]*)" should exist$/ do |file|
|
|
132
|
-
File.exists?(file).should be_true
|
|
133
|
-
FileUtils.rm(file)
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
Then /^"([^"]*)" should not be required$/ do |file_name|
|
|
137
|
-
last_stdout.should_not include("* #{file_name}")
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
Then /^"([^"]*)" should be required$/ do |file_name|
|
|
141
|
-
last_stdout.should include("* #{file_name}")
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
Then /^exactly these files should be loaded:\s*(.*)$/ do |files|
|
|
145
|
-
last_stdout.scan(/^ \* (.*\.rb)$/).flatten.should == files.split(/,\s+/)
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
Then /^exactly these features should be ran:\s*(.*)$/ do |files|
|
|
149
|
-
last_stdout.scan(/^ \* (.*\.feature)$/).flatten.should == files.split(/,\s+/)
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
Then /^the (.*) profile should be used$/ do |profile|
|
|
153
|
-
last_stdout.should =~ /Using the #{profile} profile/
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
Then /^print output$/ do
|
|
157
|
-
puts last_stdout
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
|
data/features/support/env.rb
CHANGED
|
@@ -1,148 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
require '
|
|
3
|
-
|
|
4
|
-
require 'rspec/expectations'
|
|
5
|
-
rescue LoadError
|
|
6
|
-
require 'spec/expectations'
|
|
7
|
-
end
|
|
8
|
-
require 'fileutils'
|
|
9
|
-
require 'forwardable'
|
|
10
|
-
require 'cucumber/formatter/unicode'
|
|
11
|
-
|
|
12
|
-
class CucumberWorld
|
|
13
|
-
extend Forwardable
|
|
14
|
-
def_delegators CucumberWorld, :fixtures_dir, :self_test_dir, :working_dir, :cucumber_lib_dir
|
|
15
|
-
|
|
16
|
-
def self.fixtures_dir(subdir=nil)
|
|
17
|
-
@fixtures_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../fixtures'))
|
|
18
|
-
subdir ? File.join(@fixtures_dir, subdir) : @fixtures_dir
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def self.self_test_dir
|
|
22
|
-
@self_test_dir ||= fixtures_dir('self_test')
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def self.working_dir
|
|
26
|
-
@working_dir ||= fixtures_dir('self_test/tmp')
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def cucumber_lib_dir
|
|
30
|
-
@cucumber_lib_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../lib'))
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def initialize
|
|
34
|
-
@current_dir = self_test_dir
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
private
|
|
38
|
-
attr_reader :last_exit_status, :last_stderr
|
|
39
|
-
|
|
40
|
-
# The last standard out, with the duration line taken out (unpredictable)
|
|
41
|
-
def last_stdout
|
|
42
|
-
strip_1_9_paths(strip_duration(@last_stdout))
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def combined_output
|
|
46
|
-
last_stdout + "\n" + last_stderr
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def strip_duration(s)
|
|
50
|
-
s.gsub(/^\d+m\d+\.\d+s\n/m, "")
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def strip_1_9_paths(s)
|
|
54
|
-
s.gsub(/#{Dir.pwd}\/fixtures\/self_test\/tmp/m, ".").gsub(/#{Dir.pwd}\/fixtures\/self_test/m, ".")
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def replace_duration(s, replacement)
|
|
58
|
-
s.gsub(/\d+m\d+\.\d+s/m, replacement)
|
|
59
|
-
end
|
|
1
|
+
ENV['FORCE_COLOR'] = 'true'
|
|
2
|
+
require 'aruba/api'
|
|
3
|
+
require 'aruba/cucumber'
|
|
60
4
|
|
|
61
|
-
|
|
62
|
-
|
|
5
|
+
# Monkey patch aruba to filter out some stuff
|
|
6
|
+
module Aruba::Api
|
|
7
|
+
alias __all_stdout all_stdout
|
|
8
|
+
|
|
9
|
+
def all_stdout
|
|
10
|
+
unrandom(__all_stdout)
|
|
63
11
|
end
|
|
64
12
|
|
|
65
|
-
def
|
|
66
|
-
|
|
13
|
+
def unrandom(out)
|
|
14
|
+
out = out.gsub(/#{Dir.pwd}\/tmp\/aruba/, '.') # Remove absolute paths
|
|
15
|
+
out = out.gsub(/^\d+m\d+\.\d+s$/, '0m0.012s') # Make duration predictable
|
|
16
|
+
out = out.gsub(/Coverage report generated for Cucumber Features to #{Dir.pwd}\/coverage.*\n$/, '') # Remove SimpleCov message
|
|
67
17
|
end
|
|
68
|
-
|
|
69
|
-
def create_file(file_name, file_content)
|
|
70
|
-
file_content.gsub!("CUCUMBER_LIB", "'#{cucumber_lib_dir}'") # Some files, such as Rakefiles need to use the lib dir
|
|
71
|
-
in_current_dir do
|
|
72
|
-
FileUtils.mkdir_p(File.dirname(file_name)) unless File.directory?(File.dirname(file_name))
|
|
73
|
-
File.open(file_name, 'w') { |f| f << file_content }
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def set_env_var(variable, value)
|
|
78
|
-
@original_env_vars ||= {}
|
|
79
|
-
@original_env_vars[variable] = ENV[variable]
|
|
80
|
-
ENV[variable] = value
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def background_jobs
|
|
84
|
-
@background_jobs ||= []
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def in_current_dir(&block)
|
|
88
|
-
Dir.chdir(@current_dir, &block)
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def run(command)
|
|
92
|
-
stderr_file = Tempfile.new('cucumber')
|
|
93
|
-
stderr_file.close
|
|
94
|
-
in_current_dir do
|
|
95
|
-
mode = Cucumber::RUBY_1_9 ? {:external_encoding=>"UTF-8"} : 'r'
|
|
96
|
-
IO.popen("#{command} 2> #{stderr_file.path}", mode) do |io|
|
|
97
|
-
@last_stdout = io.read
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
@last_exit_status = $?.exitstatus
|
|
101
|
-
end
|
|
102
|
-
@last_stderr = IO.read(stderr_file.path)
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def run_spork_in_background(port = nil)
|
|
106
|
-
require 'spork'
|
|
107
|
-
|
|
108
|
-
pid = fork
|
|
109
|
-
in_current_dir do
|
|
110
|
-
if pid
|
|
111
|
-
background_jobs << pid
|
|
112
|
-
else
|
|
113
|
-
# STDOUT.close
|
|
114
|
-
# STDERR.close
|
|
115
|
-
port_arg = port ? "-p #{port}" : ''
|
|
116
|
-
cmd = "#{Cucumber::RUBY_BINARY} -I #{Cucumber::LIBDIR} #{Spork::BINARY} cuc #{port_arg}"
|
|
117
|
-
exec cmd
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
sleep 1.0
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def terminate_background_jobs
|
|
124
|
-
background_jobs.each do |pid|
|
|
125
|
-
Process.kill(Signal.list['TERM'], pid)
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def restore_original_env_vars
|
|
130
|
-
@original_env_vars.each { |variable, value| ENV[variable] = value } if @original_env_vars
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
World do
|
|
136
|
-
CucumberWorld.new
|
|
137
18
|
end
|
|
138
19
|
|
|
139
20
|
Before do
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
FileUtils.rm_rf CucumberWorld.working_dir unless ENV['KEEP_FILES']
|
|
146
|
-
terminate_background_jobs
|
|
147
|
-
restore_original_env_vars
|
|
21
|
+
# Make sure bin/cucumber runs with SimpleCov enabled
|
|
22
|
+
# set_env('SIMPLECOV', 'true')
|
|
23
|
+
|
|
24
|
+
# Set a longer timeout for aruba
|
|
25
|
+
@aruba_timeout_seconds = 5
|
|
148
26
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'base64'
|
|
1
2
|
begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end
|
|
2
3
|
$KCODE = 'u' unless Cucumber::RUBY_1_9
|
|
3
4
|
|
|
@@ -16,3 +17,10 @@ end
|
|
|
16
17
|
After('@background_tagged_before_on_outline') do
|
|
17
18
|
@cukes.should == '888'
|
|
18
19
|
end
|
|
20
|
+
|
|
21
|
+
After do
|
|
22
|
+
png = IO.read(File.join(File.dirname(__FILE__), 'bubble_256x256.png'))
|
|
23
|
+
encoded_img = Base64.encode64(png).gsub(/\n/, '')
|
|
24
|
+
embed("data:image/png;base64,#{encoded_img}", 'image/png')
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -135,4 +135,4 @@
|
|
|
135
135
|
./features/step_definitons/tickets_steps.rb:57:in `/^I have a pending step$/'
|
|
136
136
|
features/241.feature:10:in `Given I have a pending step'</pre></li><li class="step skipped" id="features_241_feature_11"><div><span class="keyword">When</span> <span class="step val">I run this feature with the progress format</span></div></li><li class="step skipped" id="features_241_feature_12"><div><span class="keyword">Then</span> <span class="step val">I should get a no method error for 'backtrace_line'</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: https://rspec.lighthouseapp.com/projects/16211/tickets/246-distorted-console-output-for-slightly-complicated-step-regexp-match</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">See "No Record(s) Found" for Zero Existing</span></h3><ol><li class="step passed" id="features_246_feature_4"><div><span class="keyword">Given</span> <span class="step val">no <span class="param">public holiday</span> exists in the system</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: pending method causes failure in Scenario Outlines</span></h2><p class="narrative"></p><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">blah</span></h3><ol><li class="step skipped" id="features_248_feature_4"><div><span class="keyword">Given</span> <span class="step val">this is pending until we fix it</span></div></li><li class="step skipped" id="features_248_feature_5"><div><span class="keyword">Given</span> <span class="step val">context with <Stuff></span></div></li><li class="step skipped" id="features_248_feature_6"><div><span class="keyword">When</span> <span class="step val">action</span></div></li><li class="step skipped" id="features_248_feature_7"><div><span class="keyword">Then</span> <span class="step val">outcome with <Blah></span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_10"><th class="val skipped_param" id="row_10_0">Stuff</th><th class="val skipped_param" id="row_10_1">Blah</th></tr><tr id="row_11"><td class="val skipped" id="row_11_0">Cheese</td><td class="val skipped" id="row_11_1">Pepper Jack</td></tr><tr><td class="failed" colspan="2"><pre>TODO (Cucumber::Pending)
|
|
137
137
|
./features/step_definitons/248_steps.rb:2:in `/^this is pending until we fix it$/'
|
|
138
|
-
features/248.feature:4:in `Given this is pending until we fix it'</pre></td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Background</span></h2><p class="narrative">In for background to work properly<br/>As a user<br/>I want it to run transactionally and only once when I call an individual scenario<br/></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step passed" id="features_270_back_feature_7"><div><span class="keyword">Given</span> <span class="step val">plop</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Barping</span></h3><ol><li class="step passed" id="features_270_back_feature_10"><div><span class="keyword">When</span> <span class="step val">I barp</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Wibbling</span></h3><ol><li class="step passed" id="features_270_back_feature_14"><div><span class="keyword">When</span> <span class="step val">I wibble</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: pystring indentaion testcase</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">example of correct indentation</span></h3><ol><li class="step passed" id="features_279_py_string_indent_feature_4"><div><span class="keyword">Given</span> <span class="step val">multiline string</span></div><pre class="val"> I'm a cucumber and I'm ok
I sleep all night and test all day</pre></li><li class="step passed" id="features_279_py_string_indent_feature_9"><div><span class="keyword">Then</span> <span class="step val">string is</span></div><pre class="val"> I'm a cucumber and I'm ok
I sleep all night and test all day</pre></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">example of wrong indentation</span></h3><ol><li class="step passed" id="features_279_py_string_indent_feature_16"><div><span class="keyword">Given</span> <span class="step val">I am in <span class="param">tickets/features/279</span></span></div></li><li class="step passed" id="features_279_py_string_indent_feature_17"><div><span class="keyword">When</span> <span class="step val">I run cucumber <span class="param">-q wrong.feature_</span></span></div></li><li class="step passed" id="features_279_py_string_indent_feature_18"><div><span class="keyword">Then</span> <span class="step val">it should <span class="param">fail</span> with</span></div><pre class="val"></pre></li><li class="step passed" id="features_279_py_string_indent_feature_22"><div><span class="keyword">And</span> <span class="step val">STDERR should match</span></div><pre class="val">wrong.feature_:8:10: Parse error</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature https://rspec.lighthouseapp.com/projects/16211/tickets/301</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val">A background</span></h3><ol><li class="step passed" id="features_301_filter_background_tagged_hooks_feature_3"><div><span class="keyword">Given</span> <span class="step val">whatever</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">VB is not cool</span></h3><ol><li class="step passed" id="features_301_filter_background_tagged_hooks_feature_6"><div><span class="keyword">Then</span> <span class="step val">VB should not be cool</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: woo yeah</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step undefined" id="features_306_only_background_feature_4"><div><span class="keyword">Given</span> <span class="step val">passing step without a table</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Outlines</span></h2><p class="narrative">In order to re-use scenario table values<br/>As a citizen of Cucumbia<br/>I want to explicitly mark the parameters in a scenario outline<br/></p><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">controlling order</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_7"><div><span class="keyword">Given</span> <span class="step val">there are <start> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_8"><div><span class="keyword">When</span> <span class="step val">I eat <eat> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_9"><div><span class="keyword">Then</span> <span class="step val">I should have <left> cucumbers</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_12"><th class="val skipped_param" id="row_12_0">left</th><th class="val skipped_param" id="row_12_1">start</th><th class="val skipped_param" id="row_12_2">eat</th></tr><tr id="row_13"><td class="val passed" id="row_13_0">7</td><td class="val passed" id="row_13_1">12</td><td class="val passed" id="row_13_2">5</td></tr><tr id="row_14"><td class="val passed" id="row_14_0">15</td><td class="val passed" id="row_14_1">20</td><td class="val passed" id="row_14_2">5</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">reusing place holder</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_17"><div><span class="keyword">Given</span> <span class="step val">there are <start> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_18"><div><span class="keyword">When</span> <span class="step val">I eat <eat> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_19"><div><span class="keyword">Then</span> <span class="step val">I should have <left> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_20"><div><span class="keyword">And</span> <span class="step val">I should have <eat> cucumbers in my belly</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Lots of cukes</span></h4><table><tr id="row_23"><th class="val skipped_param" id="row_23_0">start</th><th class="val skipped_param" id="row_23_1">eat</th><th class="val skipped_param" id="row_23_2">left</th></tr><tr id="row_24"><td class="val passed" id="row_24_0">12</td><td class="val passed" id="row_24_1">5</td><td class="val passed" id="row_24_2">7</td></tr><tr id="row_25"><td class="val passed" id="row_25_0">20</td><td class="val passed" id="row_25_1">5</td><td class="val passed" id="row_25_2">15</td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Ridiculous amounts of cukes</span></h4><table><tr id="row_28"><th class="val skipped_param" id="row_28_0">start</th><th class="val skipped_param" id="row_28_1">eat</th><th class="val skipped_param" id="row_28_2">left</th></tr><tr id="row_29"><td class="val passed" id="row_29_0">120</td><td class="val passed" id="row_29_1">50</td><td class="val passed" id="row_29_2">70</td></tr><tr id="row_30"><td class="val passed" id="row_30_0">200</td><td class="val passed" id="row_30_1">50</td><td class="val passed" id="row_30_2">150</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">no placeholders</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_33"><div><span class="keyword">Given</span> <span class="step val">there are 12 cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_34"><div><span class="keyword">When</span> <span class="step val">I eat 5 cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_35"><div><span class="keyword">Then</span> <span class="step val">I should have 7 cucumbers</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_38"><th class="val skipped_param" id="row_38_0">start</th><th class="val skipped_param" id="row_38_1">eat</th><th class="val skipped_param" id="row_38_2">left</th></tr><tr id="row_39"><td class="val" id="row_39_0">12</td><td class="val" id="row_39_1">5</td><td class="val" id="row_39_2">7</td></tr><tr id="row_40"><td class="val" id="row_40_0">20</td><td class="val" id="row_40_1">5</td><td class="val" id="row_40_2">15</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">using '<' and '>' not as placeholder</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_43"><div><span class="keyword">Given</span> <span class="step val">the belly space is < 12 and > 6</span></div></li><li class="step skipped" id="features_scenario_outline_feature_44"><div><span class="keyword">And</span> <span class="step val">there are <start> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_45"><div><span class="keyword">When</span> <span class="step val">I eat <eat> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_46"><div><span class="keyword">Then</span> <span class="step val">I should have <left> cucumbers</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_49"><th class="val skipped_param" id="row_49_0">start</th><th class="val skipped_param" id="row_49_1">eat</th><th class="val skipped_param" id="row_49_2">left</th></tr><tr id="row_50"><td class="val passed" id="row_50_0">12</td><td class="val passed" id="row_50_1">5</td><td class="val passed" id="row_50_2">7</td></tr><tr id="row_51"><td class="val passed" id="row_51_0">20</td><td class="val passed" id="row_51_1">5</td><td class="val passed" id="row_51_2">15</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">with step tables</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_54"><div><span class="keyword">Given</span> <span class="step val">I have the following fruits in my pantry</span></div><table><tr id="row_55"><td class="val" id="row_55_0">name</td><td class="val" id="row_55_1">quantity</td></tr><tr id="row_56"><td class="val" id="row_56_0">cucumbers</td><td class="val" id="row_56_1">10</td></tr><tr id="row_57"><td class="val" id="row_57_0">strawberrys</td><td class="val" id="row_57_1">5</td></tr><tr id="row_58"><td class="val" id="row_58_0">apricots</td><td class="val" id="row_58_1">7</td></tr></table></li><li class="step skipped" id="features_scenario_outline_feature_60"><div><span class="keyword">When</span> <span class="step val">I eat <number> <fruits> from the pantry</span></div></li><li class="step skipped" id="features_scenario_outline_feature_61"><div><span class="keyword">Then</span> <span class="step val">I should have <left> <fruits> in the pantry</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_64"><th class="val skipped_param" id="row_64_0">number</th><th class="val skipped_param" id="row_64_1">fruits</th><th class="val skipped_param" id="row_64_2">left</th></tr><tr id="row_65"><td class="val passed" id="row_65_0">2</td><td class="val passed" id="row_65_1">cucumbers</td><td class="val passed" id="row_65_2">8</td></tr><tr id="row_66"><td class="val passed" id="row_66_0">4</td><td class="val passed" id="row_66_1">strawberrys</td><td class="val passed" id="row_66_2">1</td></tr><tr id="row_67"><td class="val passed" id="row_67_0">2</td><td class="val passed" id="row_67_1">apricots</td><td class="val passed" id="row_67_2">5</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">placeholder in a multiline string</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_70"><div><span class="keyword">Given</span> <span class="step val">my shopping list</span></div><pre class="val"> Must buy some <fruits></pre></li><li class="step skipped" id="features_scenario_outline_feature_74"><div><span class="keyword">Then</span> <span class="step val">my shopping list should equal</span></div><pre class="val"> Must buy some cucumbers</pre></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_80"><th class="val skipped_param" id="row_80_0">fruits</th></tr><tr id="row_81"><td class="val passed" id="row_81_0">cucumbers</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">placeholder in step table</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_84"><div><span class="keyword">Given</span> <span class="step val">I have the following fruits in my pantry</span></div><table><tr id="row_85"><td class="val" id="row_85_0">name</td><td class="val" id="row_85_1">quantity</td></tr><tr id="row_86"><td class="val" id="row_86_0">cucumbers</td><td class="val" id="row_86_1"><quant_cukes></td></tr><tr id="row_87"><td class="val" id="row_87_0">strawberrys</td><td class="val" id="row_87_1"><quant_straw></td></tr></table></li><li class="step skipped" id="features_scenario_outline_feature_89"><div><span class="keyword">When</span> <span class="step val">I eat <number> <fruits> from the pantry</span></div></li><li class="step skipped" id="features_scenario_outline_feature_90"><div><span class="keyword">Then</span> <span class="step val">I should have <left> <fruits> in the pantry</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_93"><th class="val skipped_param" id="row_93_0">quant_cukes</th><th class="val skipped_param" id="row_93_1">quant_straw</th><th class="val skipped_param" id="row_93_2">number</th><th class="val skipped_param" id="row_93_3">fruits</th><th class="val skipped_param" id="row_93_4">left</th></tr><tr id="row_94"><td class="val passed" id="row_94_0">10</td><td class="val passed" id="row_94_1">5</td><td class="val passed" id="row_94_2">2</td><td class="val passed" id="row_94_3">cucumbers</td><td class="val passed" id="row_94_4">8</td></tr><tr id="row_95"><td class="val passed" id="row_95_0">5</td><td class="val passed" id="row_95_1">5</td><td class="val passed" id="row_95_2">4</td><td class="val passed" id="row_95_3">strawberrys</td><td class="val passed" id="row_95_4">1</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Cucumber</span></h2><p class="narrative">In order to have a happy user base<br/>As a Cucumber user<br/>I don't want no stinkin bugs<br/></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">RSpec be_*</span></h3><ol><li class="step passed" id="features_tickets_feature_7"><div><span class="keyword">Given</span> <span class="step val">be_empty</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call step from step</span></h3><ol><li class="step passed" id="features_tickets_feature_10"><div><span class="keyword">Given</span> <span class="step val">nested step is called</span></div></li><li class="step passed" id="features_tickets_feature_11"><div><span class="keyword">Then</span> <span class="step val">nested step should be executed</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call step from step using text table</span></h3><ol><li class="step passed" id="features_tickets_feature_14"><div><span class="keyword">Given</span> <span class="step val">nested step is called using text table</span></div></li><li class="step passed" id="features_tickets_feature_15"><div><span class="keyword">Then</span> <span class="step val">nested step should be executed</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Reading a table</span></h3><ol><li class="step passed" id="features_tickets_feature_18"><div><span class="keyword">Given</span> <span class="step val">the following table</span></div><table><tr id="row_19"><td class="val" id="row_19_0">born</td><td class="val" id="row_19_1">working</td></tr><tr id="row_20"><td class="val" id="row_20_0">Oslo</td><td class="val" id="row_20_1">London</td></tr></table></li><li class="step passed" id="features_tickets_feature_21"><div><span class="keyword">Then</span> <span class="step val">I should be <span class="param">working</span> in <span class="param">London</span></span></div></li><li class="step passed" id="features_tickets_feature_22"><div><span class="keyword">And</span> <span class="step val">I should be <span class="param">born</span> in <span class="param">Oslo</span></span></div></li><li class="step passed" id="features_tickets_feature_23"><div><span class="keyword">And</span> <span class="step val">I should see a multiline string like</span></div><pre class="val">A string
that spans
several lines</pre></li></ol></div></div><div class="summary">43 scenarios (12 undefined, 2 pending, 29 passed)</div><div class="summary">173 steps (5 skipped, 89 undefined, 2 pending, 77 passed)</div><div class="duration">0m0.701s</div></div></body></html>
|
|
138
|
+
features/248.feature:4:in `Given this is pending until we fix it'</pre></td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Background</span></h2><p class="narrative">In for background to work properly<br/>As a user<br/>I want it to run transactionally and only once when I call an individual scenario<br/></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step passed" id="features_270_back_feature_7"><div><span class="keyword">Given</span> <span class="step val">plop</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Barping</span></h3><ol><li class="step passed" id="features_270_back_feature_10"><div><span class="keyword">When</span> <span class="step val">I barp</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Wibbling</span></h3><ol><li class="step passed" id="features_270_back_feature_14"><div><span class="keyword">When</span> <span class="step val">I wibble</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: pystring indentaion testcase</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">example of correct indentation</span></h3><ol><li class="step passed" id="features_279_doc_string_indent_feature_4"><div><span class="keyword">Given</span> <span class="step val">multiline string</span></div><pre class="val"> I'm a cucumber and I'm ok
I sleep all night and test all day</pre></li><li class="step passed" id="features_279_doc_string_indent_feature_9"><div><span class="keyword">Then</span> <span class="step val">string is</span></div><pre class="val"> I'm a cucumber and I'm ok
I sleep all night and test all day</pre></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">example of wrong indentation</span></h3><ol><li class="step passed" id="features_279_doc_string_indent_feature_16"><div><span class="keyword">Given</span> <span class="step val">I am in <span class="param">tickets/features/279</span></span></div></li><li class="step passed" id="features_279_doc_string_indent_feature_17"><div><span class="keyword">When</span> <span class="step val">I run cucumber <span class="param">-q wrong.feature_</span></span></div></li><li class="step passed" id="features_279_doc_string_indent_feature_18"><div><span class="keyword">Then</span> <span class="step val">it should <span class="param">fail</span> with</span></div><pre class="val"></pre></li><li class="step passed" id="features_279_doc_string_indent_feature_22"><div><span class="keyword">And</span> <span class="step val">STDERR should match</span></div><pre class="val">wrong.feature_:8:10: Parse error</pre></li></ol></div></div><div class="feature"><h2><span class="val">Feature https://rspec.lighthouseapp.com/projects/16211/tickets/301</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val">A background</span></h3><ol><li class="step passed" id="features_301_filter_background_tagged_hooks_feature_3"><div><span class="keyword">Given</span> <span class="step val">whatever</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">VB is not cool</span></h3><ol><li class="step passed" id="features_301_filter_background_tagged_hooks_feature_6"><div><span class="keyword">Then</span> <span class="step val">VB should not be cool</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: woo yeah</span></h2><p class="narrative"></p><div class="background"><h3><span class="keyword">Background:</span> <span class="val"></span></h3><ol><li class="step undefined" id="features_306_only_background_feature_4"><div><span class="keyword">Given</span> <span class="step val">passing step without a table</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: Outlines</span></h2><p class="narrative">In order to re-use scenario table values<br/>As a citizen of Cucumbia<br/>I want to explicitly mark the parameters in a scenario outline<br/></p><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">controlling order</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_7"><div><span class="keyword">Given</span> <span class="step val">there are <start> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_8"><div><span class="keyword">When</span> <span class="step val">I eat <eat> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_9"><div><span class="keyword">Then</span> <span class="step val">I should have <left> cucumbers</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_12"><th class="val skipped_param" id="row_12_0">left</th><th class="val skipped_param" id="row_12_1">start</th><th class="val skipped_param" id="row_12_2">eat</th></tr><tr id="row_13"><td class="val passed" id="row_13_0">7</td><td class="val passed" id="row_13_1">12</td><td class="val passed" id="row_13_2">5</td></tr><tr id="row_14"><td class="val passed" id="row_14_0">15</td><td class="val passed" id="row_14_1">20</td><td class="val passed" id="row_14_2">5</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">reusing place holder</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_17"><div><span class="keyword">Given</span> <span class="step val">there are <start> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_18"><div><span class="keyword">When</span> <span class="step val">I eat <eat> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_19"><div><span class="keyword">Then</span> <span class="step val">I should have <left> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_20"><div><span class="keyword">And</span> <span class="step val">I should have <eat> cucumbers in my belly</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Lots of cukes</span></h4><table><tr id="row_23"><th class="val skipped_param" id="row_23_0">start</th><th class="val skipped_param" id="row_23_1">eat</th><th class="val skipped_param" id="row_23_2">left</th></tr><tr id="row_24"><td class="val passed" id="row_24_0">12</td><td class="val passed" id="row_24_1">5</td><td class="val passed" id="row_24_2">7</td></tr><tr id="row_25"><td class="val passed" id="row_25_0">20</td><td class="val passed" id="row_25_1">5</td><td class="val passed" id="row_25_2">15</td></tr></table></div><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val">Ridiculous amounts of cukes</span></h4><table><tr id="row_28"><th class="val skipped_param" id="row_28_0">start</th><th class="val skipped_param" id="row_28_1">eat</th><th class="val skipped_param" id="row_28_2">left</th></tr><tr id="row_29"><td class="val passed" id="row_29_0">120</td><td class="val passed" id="row_29_1">50</td><td class="val passed" id="row_29_2">70</td></tr><tr id="row_30"><td class="val passed" id="row_30_0">200</td><td class="val passed" id="row_30_1">50</td><td class="val passed" id="row_30_2">150</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">no placeholders</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_33"><div><span class="keyword">Given</span> <span class="step val">there are 12 cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_34"><div><span class="keyword">When</span> <span class="step val">I eat 5 cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_35"><div><span class="keyword">Then</span> <span class="step val">I should have 7 cucumbers</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_38"><th class="val skipped_param" id="row_38_0">start</th><th class="val skipped_param" id="row_38_1">eat</th><th class="val skipped_param" id="row_38_2">left</th></tr><tr id="row_39"><td class="val" id="row_39_0">12</td><td class="val" id="row_39_1">5</td><td class="val" id="row_39_2">7</td></tr><tr id="row_40"><td class="val" id="row_40_0">20</td><td class="val" id="row_40_1">5</td><td class="val" id="row_40_2">15</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">using '<' and '>' not as placeholder</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_43"><div><span class="keyword">Given</span> <span class="step val">the belly space is < 12 and > 6</span></div></li><li class="step skipped" id="features_scenario_outline_feature_44"><div><span class="keyword">And</span> <span class="step val">there are <start> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_45"><div><span class="keyword">When</span> <span class="step val">I eat <eat> cucumbers</span></div></li><li class="step skipped" id="features_scenario_outline_feature_46"><div><span class="keyword">Then</span> <span class="step val">I should have <left> cucumbers</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_49"><th class="val skipped_param" id="row_49_0">start</th><th class="val skipped_param" id="row_49_1">eat</th><th class="val skipped_param" id="row_49_2">left</th></tr><tr id="row_50"><td class="val passed" id="row_50_0">12</td><td class="val passed" id="row_50_1">5</td><td class="val passed" id="row_50_2">7</td></tr><tr id="row_51"><td class="val passed" id="row_51_0">20</td><td class="val passed" id="row_51_1">5</td><td class="val passed" id="row_51_2">15</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">with step tables</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_54"><div><span class="keyword">Given</span> <span class="step val">I have the following fruits in my pantry</span></div><table><tr id="row_55"><td class="val" id="row_55_0">name</td><td class="val" id="row_55_1">quantity</td></tr><tr id="row_56"><td class="val" id="row_56_0">cucumbers</td><td class="val" id="row_56_1">10</td></tr><tr id="row_57"><td class="val" id="row_57_0">strawberrys</td><td class="val" id="row_57_1">5</td></tr><tr id="row_58"><td class="val" id="row_58_0">apricots</td><td class="val" id="row_58_1">7</td></tr></table></li><li class="step skipped" id="features_scenario_outline_feature_60"><div><span class="keyword">When</span> <span class="step val">I eat <number> <fruits> from the pantry</span></div></li><li class="step skipped" id="features_scenario_outline_feature_61"><div><span class="keyword">Then</span> <span class="step val">I should have <left> <fruits> in the pantry</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_64"><th class="val skipped_param" id="row_64_0">number</th><th class="val skipped_param" id="row_64_1">fruits</th><th class="val skipped_param" id="row_64_2">left</th></tr><tr id="row_65"><td class="val passed" id="row_65_0">2</td><td class="val passed" id="row_65_1">cucumbers</td><td class="val passed" id="row_65_2">8</td></tr><tr id="row_66"><td class="val passed" id="row_66_0">4</td><td class="val passed" id="row_66_1">strawberrys</td><td class="val passed" id="row_66_2">1</td></tr><tr id="row_67"><td class="val passed" id="row_67_0">2</td><td class="val passed" id="row_67_1">apricots</td><td class="val passed" id="row_67_2">5</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">placeholder in a multiline string</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_70"><div><span class="keyword">Given</span> <span class="step val">my shopping list</span></div><pre class="val"> Must buy some <fruits></pre></li><li class="step skipped" id="features_scenario_outline_feature_74"><div><span class="keyword">Then</span> <span class="step val">my shopping list should equal</span></div><pre class="val"> Must buy some cucumbers</pre></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_80"><th class="val skipped_param" id="row_80_0">fruits</th></tr><tr id="row_81"><td class="val passed" id="row_81_0">cucumbers</td></tr></table></div></div><div class="scenario outline"><h3><span class="keyword">Scenario Outline:</span> <span class="val">placeholder in step table</span></h3><ol><li class="step skipped" id="features_scenario_outline_feature_84"><div><span class="keyword">Given</span> <span class="step val">I have the following fruits in my pantry</span></div><table><tr id="row_85"><td class="val" id="row_85_0">name</td><td class="val" id="row_85_1">quantity</td></tr><tr id="row_86"><td class="val" id="row_86_0">cucumbers</td><td class="val" id="row_86_1"><quant_cukes></td></tr><tr id="row_87"><td class="val" id="row_87_0">strawberrys</td><td class="val" id="row_87_1"><quant_straw></td></tr></table></li><li class="step skipped" id="features_scenario_outline_feature_89"><div><span class="keyword">When</span> <span class="step val">I eat <number> <fruits> from the pantry</span></div></li><li class="step skipped" id="features_scenario_outline_feature_90"><div><span class="keyword">Then</span> <span class="step val">I should have <left> <fruits> in the pantry</span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_93"><th class="val skipped_param" id="row_93_0">quant_cukes</th><th class="val skipped_param" id="row_93_1">quant_straw</th><th class="val skipped_param" id="row_93_2">number</th><th class="val skipped_param" id="row_93_3">fruits</th><th class="val skipped_param" id="row_93_4">left</th></tr><tr id="row_94"><td class="val passed" id="row_94_0">10</td><td class="val passed" id="row_94_1">5</td><td class="val passed" id="row_94_2">2</td><td class="val passed" id="row_94_3">cucumbers</td><td class="val passed" id="row_94_4">8</td></tr><tr id="row_95"><td class="val passed" id="row_95_0">5</td><td class="val passed" id="row_95_1">5</td><td class="val passed" id="row_95_2">4</td><td class="val passed" id="row_95_3">strawberrys</td><td class="val passed" id="row_95_4">1</td></tr></table></div></div></div><div class="feature"><h2><span class="val">Feature: Cucumber</span></h2><p class="narrative">In order to have a happy user base<br/>As a Cucumber user<br/>I don't want no stinkin bugs<br/></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">RSpec be_*</span></h3><ol><li class="step passed" id="features_tickets_feature_7"><div><span class="keyword">Given</span> <span class="step val">be_empty</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call step from step</span></h3><ol><li class="step passed" id="features_tickets_feature_10"><div><span class="keyword">Given</span> <span class="step val">nested step is called</span></div></li><li class="step passed" id="features_tickets_feature_11"><div><span class="keyword">Then</span> <span class="step val">nested step should be executed</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Call step from step using text table</span></h3><ol><li class="step passed" id="features_tickets_feature_14"><div><span class="keyword">Given</span> <span class="step val">nested step is called using text table</span></div></li><li class="step passed" id="features_tickets_feature_15"><div><span class="keyword">Then</span> <span class="step val">nested step should be executed</span></div></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Reading a table</span></h3><ol><li class="step passed" id="features_tickets_feature_18"><div><span class="keyword">Given</span> <span class="step val">the following table</span></div><table><tr id="row_19"><td class="val" id="row_19_0">born</td><td class="val" id="row_19_1">working</td></tr><tr id="row_20"><td class="val" id="row_20_0">Oslo</td><td class="val" id="row_20_1">London</td></tr></table></li><li class="step passed" id="features_tickets_feature_21"><div><span class="keyword">Then</span> <span class="step val">I should be <span class="param">working</span> in <span class="param">London</span></span></div></li><li class="step passed" id="features_tickets_feature_22"><div><span class="keyword">And</span> <span class="step val">I should be <span class="param">born</span> in <span class="param">Oslo</span></span></div></li><li class="step passed" id="features_tickets_feature_23"><div><span class="keyword">And</span> <span class="step val">I should see a multiline string like</span></div><pre class="val">A string
that spans
several lines</pre></li></ol></div></div><div class="summary">43 scenarios (12 undefined, 2 pending, 29 passed)</div><div class="summary">173 steps (5 skipped, 89 undefined, 2 pending, 77 passed)</div><div class="duration">0m0.701s</div></div></body></html>
|
data/gem_tasks/examples.rake
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
desc 'Run all exmples'
|
|
2
2
|
task :examples do
|
|
3
3
|
Dir['examples/*'].each do |example_dir|
|
|
4
|
-
next if !File.directory?(example_dir) || %w{examples/i18n examples/python examples/ruby2python}.index(example_dir)
|
|
4
|
+
next if !File.directory?(example_dir) || %w{examples/i18n examples/tcl examples/python examples/ruby2python}.index(example_dir)
|
|
5
5
|
puts "Running #{example_dir}"
|
|
6
6
|
Dir.chdir(example_dir) do
|
|
7
7
|
raise "No Rakefile in #{Dir.pwd}" unless File.file?('Rakefile')
|
data/lib/cucumber.rb
CHANGED
|
@@ -7,9 +7,21 @@ require 'cucumber/parser'
|
|
|
7
7
|
require 'cucumber/step_mother'
|
|
8
8
|
require 'cucumber/cli/main'
|
|
9
9
|
require 'cucumber/broadcaster'
|
|
10
|
+
require 'cucumber/step_definitions'
|
|
10
11
|
|
|
11
12
|
module Cucumber
|
|
12
13
|
class << self
|
|
13
14
|
attr_accessor :wants_to_quit
|
|
15
|
+
|
|
16
|
+
def logger
|
|
17
|
+
return @log if @log
|
|
18
|
+
@log = Logger.new(STDOUT)
|
|
19
|
+
@log.level = Logger::INFO
|
|
20
|
+
@log
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def logger=(logger)
|
|
24
|
+
@log = logger
|
|
25
|
+
end
|
|
14
26
|
end
|
|
15
27
|
end
|
data/lib/cucumber/ast.rb
CHANGED
|
@@ -9,7 +9,7 @@ require 'cucumber/ast/step_collection'
|
|
|
9
9
|
require 'cucumber/ast/step'
|
|
10
10
|
require 'cucumber/ast/table'
|
|
11
11
|
require 'cucumber/ast/tags'
|
|
12
|
-
require 'cucumber/ast/
|
|
12
|
+
require 'cucumber/ast/doc_string'
|
|
13
13
|
require 'cucumber/ast/outline_table'
|
|
14
14
|
require 'cucumber/ast/examples'
|
|
15
15
|
require 'cucumber/ast/visitor'
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
require 'cucumber/ast/feature_element'
|
|
2
|
+
require 'cucumber/ast/names'
|
|
2
3
|
|
|
3
4
|
module Cucumber
|
|
4
5
|
module Ast
|
|
5
6
|
class Background #:nodoc:
|
|
6
7
|
include FeatureElement
|
|
8
|
+
include Names
|
|
7
9
|
attr_reader :feature_elements
|
|
8
10
|
|
|
9
|
-
def initialize(comment, line, keyword,
|
|
10
|
-
@comment, @line, @keyword, @
|
|
11
|
+
def initialize(comment, line, keyword, title, description, raw_steps)
|
|
12
|
+
@comment, @line, @keyword, @title, @description, @raw_steps = comment, line, keyword, title, description, raw_steps
|
|
11
13
|
@feature_elements = []
|
|
12
14
|
end
|
|
13
15
|
|
|
@@ -32,16 +34,18 @@ module Cucumber
|
|
|
32
34
|
return if Cucumber.wants_to_quit
|
|
33
35
|
init
|
|
34
36
|
visitor.visit_comment(@comment) unless @comment.empty?
|
|
35
|
-
visitor.visit_background_name(@keyword,
|
|
37
|
+
visitor.visit_background_name(@keyword, name, file_colon_line(@line), source_indent(first_line_length))
|
|
36
38
|
with_visitor(hook_context, visitor) do
|
|
37
39
|
visitor.step_mother.before(hook_context)
|
|
40
|
+
skip_invoke! if failed?
|
|
38
41
|
visitor.visit_steps(@step_invocations)
|
|
39
|
-
@failed = @step_invocations.detect{|step_invocation| step_invocation.exception}
|
|
42
|
+
@failed = @step_invocations.detect{|step_invocation| step_invocation.exception || step_invocation.status != :passed }
|
|
40
43
|
visitor.step_mother.after(hook_context) if @failed || @feature_elements.empty?
|
|
41
44
|
end
|
|
42
45
|
end
|
|
43
46
|
|
|
44
47
|
def with_visitor(scenario, visitor)
|
|
48
|
+
@current_visitor = visitor
|
|
45
49
|
init
|
|
46
50
|
if self != scenario && scenario.respond_to?(:with_visitor)
|
|
47
51
|
scenario.with_visitor(visitor) do
|
|
@@ -62,6 +66,10 @@ module Cucumber
|
|
|
62
66
|
end
|
|
63
67
|
end
|
|
64
68
|
|
|
69
|
+
def skip_invoke!
|
|
70
|
+
@step_invocations.each{|step_invocation| step_invocation.skip_invoke!}
|
|
71
|
+
end
|
|
72
|
+
|
|
65
73
|
def failed?
|
|
66
74
|
@failed
|
|
67
75
|
end
|
|
@@ -73,13 +81,21 @@ module Cucumber
|
|
|
73
81
|
def to_sexp
|
|
74
82
|
init
|
|
75
83
|
sexp = [:background, @line, @keyword]
|
|
76
|
-
sexp += [
|
|
84
|
+
sexp += [name] unless name.empty?
|
|
77
85
|
comment = @comment.to_sexp
|
|
78
86
|
sexp += [comment] if comment
|
|
79
87
|
steps = @steps.to_sexp
|
|
80
88
|
sexp += steps if steps.any?
|
|
81
89
|
sexp
|
|
82
90
|
end
|
|
91
|
+
|
|
92
|
+
def fail!(exception)
|
|
93
|
+
@failed = true
|
|
94
|
+
@exception = exception
|
|
95
|
+
@current_visitor.visit_exception(@exception, :failed)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
|
|
83
99
|
end
|
|
84
100
|
end
|
|
85
101
|
end
|