cucumber 2.0.2 → 2.1.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +0 -6
- data/CONTRIBUTING.md +3 -1
- data/Gemfile +1 -1
- data/History.md +17 -0
- data/README.md +3 -3
- data/bin/cucumber +1 -2
- data/cucumber.gemspec +2 -2
- data/examples/i18n/ht/features/adisyon.feature +7 -7
- data/features/docs/api/listen_for_events.feature +58 -0
- data/features/docs/cli/fail_fast.feature +46 -0
- data/features/docs/defining_steps/nested_steps_with_second_arg.feature +3 -22
- data/features/docs/extending_cucumber/custom_formatter.feature +40 -4
- data/features/docs/gherkin/doc_strings.feature +5 -5
- data/features/docs/gherkin/language_help.feature +15 -15
- data/features/docs/gherkin/using_descriptions.feature +0 -5
- data/lib/cucumber/cli/configuration.rb +10 -92
- data/lib/cucumber/cli/main.rb +1 -7
- data/lib/cucumber/cli/options.rb +47 -12
- data/lib/cucumber/configuration.rb +195 -7
- data/lib/cucumber/events.rb +20 -0
- data/lib/cucumber/events/after_test_case.rb +25 -0
- data/lib/cucumber/events/after_test_step.rb +30 -0
- data/lib/cucumber/events/before_test_case.rb +18 -0
- data/lib/cucumber/events/before_test_step.rb +23 -0
- data/lib/cucumber/events/bus.rb +86 -0
- data/lib/cucumber/events/step_match.rb +23 -0
- data/lib/cucumber/filters/prepare_world.rb +2 -2
- data/lib/cucumber/formatter/backtrace_filter.rb +9 -8
- data/lib/cucumber/formatter/console.rb +1 -1
- data/lib/cucumber/formatter/event_bus_report.rb +37 -0
- data/lib/cucumber/formatter/fail_fast.rb +18 -0
- data/lib/cucumber/formatter/html.rb +1 -1
- data/lib/cucumber/formatter/io.rb +3 -1
- data/lib/cucumber/formatter/json.rb +19 -1
- data/lib/cucumber/formatter/legacy_api/adapter.rb +5 -13
- data/lib/cucumber/formatter/legacy_api/ast.rb +2 -2
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +3 -1
- data/lib/cucumber/formatter/pretty.rb +5 -7
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/rerun.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +1 -1
- data/lib/cucumber/formatter/usage.rb +12 -8
- data/lib/cucumber/gherkin/data_table_parser.rb +23 -0
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +99 -0
- data/lib/cucumber/gherkin/formatter/argument.rb +17 -0
- data/lib/cucumber/gherkin/formatter/escaping.rb +17 -0
- data/lib/cucumber/gherkin/formatter/hashable.rb +27 -0
- data/lib/cucumber/gherkin/i18n.rb +15 -0
- data/lib/cucumber/gherkin/steps_parser.rb +41 -0
- data/lib/cucumber/language_support/language_methods.rb +6 -5
- data/lib/cucumber/multiline_argument.rb +0 -3
- data/lib/cucumber/multiline_argument/data_table.rb +6 -5
- data/lib/cucumber/multiline_argument/doc_string.rb +1 -2
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/rake/task.rb +2 -2
- data/lib/cucumber/rb_support/rb_hook.rb +1 -6
- data/lib/cucumber/rb_support/rb_language.rb +15 -5
- data/lib/cucumber/rb_support/rb_step_definition.rb +11 -17
- data/lib/cucumber/rb_support/rb_world.rb +6 -4
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +2 -2
- data/lib/cucumber/runtime.rb +36 -16
- data/lib/cucumber/runtime/support_code.rb +19 -15
- data/lib/cucumber/step_definition_light.rb +5 -5
- data/lib/cucumber/step_definitions.rb +2 -2
- data/lib/cucumber/step_match.rb +11 -2
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +2 -2
- data/lib/cucumber/wire_support/wire_step_definition.rb +4 -2
- data/{spec → lib}/simplecov_setup.rb +0 -0
- data/spec/cucumber/cli/configuration_spec.rb +2 -104
- data/spec/cucumber/cli/main_spec.rb +0 -22
- data/spec/cucumber/cli/options_spec.rb +3 -1
- data/spec/cucumber/configuration_spec.rb +123 -0
- data/spec/cucumber/events/bus_spec.rb +94 -0
- data/spec/cucumber/formatter/event_bus_report_spec.rb +79 -0
- data/spec/cucumber/formatter/fail_fast_spec.rb +88 -0
- data/spec/cucumber/formatter/json_spec.rb +43 -1
- data/spec/cucumber/formatter/rerun_spec.rb +4 -20
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +29 -0
- data/spec/cucumber/runtime_spec.rb +2 -28
- data/spec/spec_helper.rb +1 -1
- data/spec/support/standard_step_actions.rb +18 -0
- metadata +37 -13
- data/lib/cucumber/core_ext/proc.rb +0 -36
- data/spec/cucumber/core_ext/proc_spec.rb +0 -69
@@ -1,36 +0,0 @@
|
|
1
|
-
# Proc extension to get more location info out of a proc
|
2
|
-
require 'cucumber/platform'
|
3
|
-
class Proc #:nodoc:
|
4
|
-
PROC_PATTERN = /[\d\w]+@(.+):(\d+).*>/
|
5
|
-
PWD = Dir.pwd
|
6
|
-
|
7
|
-
def to_comment_line
|
8
|
-
"# #{file_colon_line}"
|
9
|
-
end
|
10
|
-
|
11
|
-
def backtrace_line(name)
|
12
|
-
"#{file_colon_line}:in `#{name}'"
|
13
|
-
end
|
14
|
-
|
15
|
-
if Proc.new{}.to_s =~ PROC_PATTERN
|
16
|
-
def file_colon_line
|
17
|
-
path, line = *to_s.match(PROC_PATTERN)[1..2]
|
18
|
-
path = File.expand_path(path)
|
19
|
-
pwd = File.expand_path(PWD)
|
20
|
-
pwd.force_encoding(path.encoding)
|
21
|
-
if path.index(pwd)
|
22
|
-
path = path[pwd.length+1..-1]
|
23
|
-
elsif path =~ /.*\/gems\/(.*\.rb)$/
|
24
|
-
path = $1
|
25
|
-
end
|
26
|
-
"#{path}:#{line}"
|
27
|
-
end
|
28
|
-
else
|
29
|
-
# This Ruby implementation doesn't implement Proc#to_s correctly
|
30
|
-
STDERR.puts "*** THIS RUBY IMPLEMENTATION DOESN'T REPORT FILE AND LINE FOR PROCS ***"
|
31
|
-
|
32
|
-
def file_colon_line
|
33
|
-
"UNKNOWN:-1"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'cucumber/core_ext/proc'
|
4
|
-
|
5
|
-
describe Proc do
|
6
|
-
it "removes extraneous path info for file" do
|
7
|
-
proc = lambda {|a,b|}
|
8
|
-
|
9
|
-
expect(proc.file_colon_line).to match /^spec\/cucumber\/core_ext\/proc_spec\.rb:7/
|
10
|
-
end
|
11
|
-
|
12
|
-
it "works with non-English path" do
|
13
|
-
proc = lambda {|a,b|}
|
14
|
-
def proc.to_s
|
15
|
-
"#<Proc:0x00000003c04740@#{Dir.pwd}/å/spec/cucumber/core_ext/proc_spec.rb:12 (lambda)>".force_encoding('ASCII-8BIT')
|
16
|
-
end
|
17
|
-
|
18
|
-
expect(proc.file_colon_line.force_encoding('UTF-8')).to match /^å\/spec\/cucumber\/core_ext\/proc_spec\.rb:12/
|
19
|
-
end
|
20
|
-
|
21
|
-
it "raises ArityMismatchError for too many args (expecting 0)" do
|
22
|
-
expect(-> {
|
23
|
-
Object.new.cucumber_instance_exec(true, 'foo', 1) do
|
24
|
-
end
|
25
|
-
}).to raise_error(Cucumber::ArityMismatchError, "Your block takes 0 arguments, but the Regexp matched 1 argument.")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "raises ArityMismatchError for too many args (expecting 1)" do
|
29
|
-
expect(-> {
|
30
|
-
Object.new.cucumber_instance_exec(true, 'foo', 1,2) do |a|
|
31
|
-
end
|
32
|
-
}).to raise_error(Cucumber::ArityMismatchError, "Your block takes 1 argument, but the Regexp matched 2 arguments.")
|
33
|
-
end
|
34
|
-
|
35
|
-
it "raises ArityMismatchError for too few args (expecting 1)" do
|
36
|
-
expect(-> {
|
37
|
-
Object.new.cucumber_instance_exec(true, 'foo') do |a|
|
38
|
-
end
|
39
|
-
}).to raise_error(Cucumber::ArityMismatchError, "Your block takes 1 argument, but the Regexp matched 0 arguments.")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "raises ArityMismatchError for too few args (expecting 2)" do
|
43
|
-
expect(-> {
|
44
|
-
Object.new.cucumber_instance_exec(true, 'foo', 1) do |a,b|
|
45
|
-
end
|
46
|
-
}).to raise_error(Cucumber::ArityMismatchError, "Your block takes 2 arguments, but the Regexp matched 1 argument.")
|
47
|
-
end
|
48
|
-
|
49
|
-
it "allows varargs (expecting 0+)" do
|
50
|
-
expect(-> {
|
51
|
-
Object.new.cucumber_instance_exec(true, 'foo', 1) do |*args|
|
52
|
-
end
|
53
|
-
}).not_to raise_error
|
54
|
-
end
|
55
|
-
|
56
|
-
it "allows varargs (expecting 1+)" do
|
57
|
-
expect(-> {
|
58
|
-
Object.new.cucumber_instance_exec(true, 'foo', 1) do |arg,*args|
|
59
|
-
end
|
60
|
-
}).not_to raise_error
|
61
|
-
end
|
62
|
-
|
63
|
-
it "raises ArityMismatchError for too few required args when using varargs (expecting 1+)" do
|
64
|
-
expect(-> {
|
65
|
-
Object.new.cucumber_instance_exec(true, nil) do |arg,*args|
|
66
|
-
end
|
67
|
-
}).to raise_error(Cucumber::ArityMismatchError, "Your block takes 1+ arguments, but the Regexp matched 0 arguments.")
|
68
|
-
end
|
69
|
-
end
|