cucumber 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -6
  3. data/CONTRIBUTING.md +3 -1
  4. data/Gemfile +1 -1
  5. data/History.md +17 -0
  6. data/README.md +3 -3
  7. data/bin/cucumber +1 -2
  8. data/cucumber.gemspec +2 -2
  9. data/examples/i18n/ht/features/adisyon.feature +7 -7
  10. data/features/docs/api/listen_for_events.feature +58 -0
  11. data/features/docs/cli/fail_fast.feature +46 -0
  12. data/features/docs/defining_steps/nested_steps_with_second_arg.feature +3 -22
  13. data/features/docs/extending_cucumber/custom_formatter.feature +40 -4
  14. data/features/docs/gherkin/doc_strings.feature +5 -5
  15. data/features/docs/gherkin/language_help.feature +15 -15
  16. data/features/docs/gherkin/using_descriptions.feature +0 -5
  17. data/lib/cucumber/cli/configuration.rb +10 -92
  18. data/lib/cucumber/cli/main.rb +1 -7
  19. data/lib/cucumber/cli/options.rb +47 -12
  20. data/lib/cucumber/configuration.rb +195 -7
  21. data/lib/cucumber/events.rb +20 -0
  22. data/lib/cucumber/events/after_test_case.rb +25 -0
  23. data/lib/cucumber/events/after_test_step.rb +30 -0
  24. data/lib/cucumber/events/before_test_case.rb +18 -0
  25. data/lib/cucumber/events/before_test_step.rb +23 -0
  26. data/lib/cucumber/events/bus.rb +86 -0
  27. data/lib/cucumber/events/step_match.rb +23 -0
  28. data/lib/cucumber/filters/prepare_world.rb +2 -2
  29. data/lib/cucumber/formatter/backtrace_filter.rb +9 -8
  30. data/lib/cucumber/formatter/console.rb +1 -1
  31. data/lib/cucumber/formatter/event_bus_report.rb +37 -0
  32. data/lib/cucumber/formatter/fail_fast.rb +18 -0
  33. data/lib/cucumber/formatter/html.rb +1 -1
  34. data/lib/cucumber/formatter/io.rb +3 -1
  35. data/lib/cucumber/formatter/json.rb +19 -1
  36. data/lib/cucumber/formatter/legacy_api/adapter.rb +5 -13
  37. data/lib/cucumber/formatter/legacy_api/ast.rb +2 -2
  38. data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +3 -1
  39. data/lib/cucumber/formatter/pretty.rb +5 -7
  40. data/lib/cucumber/formatter/progress.rb +1 -1
  41. data/lib/cucumber/formatter/rerun.rb +1 -1
  42. data/lib/cucumber/formatter/steps.rb +1 -1
  43. data/lib/cucumber/formatter/usage.rb +12 -8
  44. data/lib/cucumber/gherkin/data_table_parser.rb +23 -0
  45. data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +99 -0
  46. data/lib/cucumber/gherkin/formatter/argument.rb +17 -0
  47. data/lib/cucumber/gherkin/formatter/escaping.rb +17 -0
  48. data/lib/cucumber/gherkin/formatter/hashable.rb +27 -0
  49. data/lib/cucumber/gherkin/i18n.rb +15 -0
  50. data/lib/cucumber/gherkin/steps_parser.rb +41 -0
  51. data/lib/cucumber/language_support/language_methods.rb +6 -5
  52. data/lib/cucumber/multiline_argument.rb +0 -3
  53. data/lib/cucumber/multiline_argument/data_table.rb +6 -5
  54. data/lib/cucumber/multiline_argument/doc_string.rb +1 -2
  55. data/lib/cucumber/platform.rb +1 -1
  56. data/lib/cucumber/rake/task.rb +2 -2
  57. data/lib/cucumber/rb_support/rb_hook.rb +1 -6
  58. data/lib/cucumber/rb_support/rb_language.rb +15 -5
  59. data/lib/cucumber/rb_support/rb_step_definition.rb +11 -17
  60. data/lib/cucumber/rb_support/rb_world.rb +6 -4
  61. data/lib/cucumber/rb_support/regexp_argument_matcher.rb +2 -2
  62. data/lib/cucumber/runtime.rb +36 -16
  63. data/lib/cucumber/runtime/support_code.rb +19 -15
  64. data/lib/cucumber/step_definition_light.rb +5 -5
  65. data/lib/cucumber/step_definitions.rb +2 -2
  66. data/lib/cucumber/step_match.rb +11 -2
  67. data/lib/cucumber/wire_support/wire_protocol/requests.rb +2 -2
  68. data/lib/cucumber/wire_support/wire_step_definition.rb +4 -2
  69. data/{spec → lib}/simplecov_setup.rb +0 -0
  70. data/spec/cucumber/cli/configuration_spec.rb +2 -104
  71. data/spec/cucumber/cli/main_spec.rb +0 -22
  72. data/spec/cucumber/cli/options_spec.rb +3 -1
  73. data/spec/cucumber/configuration_spec.rb +123 -0
  74. data/spec/cucumber/events/bus_spec.rb +94 -0
  75. data/spec/cucumber/formatter/event_bus_report_spec.rb +79 -0
  76. data/spec/cucumber/formatter/fail_fast_spec.rb +88 -0
  77. data/spec/cucumber/formatter/json_spec.rb +43 -1
  78. data/spec/cucumber/formatter/rerun_spec.rb +4 -20
  79. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +29 -0
  80. data/spec/cucumber/runtime_spec.rb +2 -28
  81. data/spec/spec_helper.rb +1 -1
  82. data/spec/support/standard_step_actions.rb +18 -0
  83. metadata +37 -13
  84. data/lib/cucumber/core_ext/proc.rb +0 -36
  85. 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