kosmas58-cucumber 0.1.99.23 → 0.1.100.5

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.
Files changed (100) hide show
  1. data/History.txt +8 -23
  2. data/Manifest.txt +14 -2
  3. data/examples/i18n/en-lol/Rakefile +6 -0
  4. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +16 -0
  5. data/examples/i18n/en-lol/features/stuffing.feature +8 -0
  6. data/examples/i18n/en-lol/features/support/env.rb +8 -0
  7. data/examples/i18n/en-lol/lib/basket.rb +12 -0
  8. data/examples/i18n/en-lol/lib/belly.rb +11 -0
  9. data/examples/i18n/et/features/jagamine.feature +9 -0
  10. data/examples/jbehave/README.textile +4 -1
  11. data/examples/jbehave/features/trading.feature +4 -0
  12. data/examples/jbehave/pom.xml +5 -0
  13. data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +6 -1
  14. data/examples/selenium/features/step_definitons/search_steps.rb +13 -0
  15. data/examples/selenium/features/support/env.rb +19 -0
  16. data/examples/selenium_webrat/Rakefile +6 -0
  17. data/examples/selenium_webrat/features/search.feature +9 -0
  18. data/examples/selenium_webrat/features/step_definitons/search_steps.rb +13 -0
  19. data/examples/selenium_webrat/features/support/env.rb +41 -0
  20. data/examples/self_test/Rakefile +1 -1
  21. data/examples/self_test/features/background/failing_background.feature +1 -0
  22. data/examples/self_test/features/step_definitions/sample_steps.rb +1 -1
  23. data/examples/self_test/features/support/tag_count_formatter.rb +1 -1
  24. data/examples/tickets/Rakefile +13 -8
  25. data/examples/tickets/cucumber.yml +2 -1
  26. data/examples/tickets/features/236.feature +13 -0
  27. data/examples/tickets/features/241.feature +13 -0
  28. data/examples/tickets/features/step_definitons/tickets_steps.rb +17 -4
  29. data/examples/tickets/features/tickets.feature +1 -1
  30. data/features/background.feature +9 -11
  31. data/features/cucumber_cli.feature +24 -1
  32. data/features/cucumber_cli_outlines.feature +10 -19
  33. data/features/report_called_undefined_steps.feature +2 -0
  34. data/gem_tasks/rspec.rake +3 -2
  35. data/lib/cucumber.rb +7 -15
  36. data/lib/cucumber/ast.rb +3 -3
  37. data/lib/cucumber/ast/background.rb +28 -66
  38. data/lib/cucumber/ast/examples.rb +15 -3
  39. data/lib/cucumber/ast/feature.rb +20 -24
  40. data/lib/cucumber/ast/feature_element.rb +46 -0
  41. data/lib/cucumber/ast/features.rb +2 -21
  42. data/lib/cucumber/ast/outline_table.rb +46 -14
  43. data/lib/cucumber/ast/py_string.rb +9 -3
  44. data/lib/cucumber/ast/scenario.rb +34 -73
  45. data/lib/cucumber/ast/scenario_outline.rb +40 -42
  46. data/lib/cucumber/ast/step.rb +51 -90
  47. data/lib/cucumber/ast/step_collection.rb +66 -0
  48. data/lib/cucumber/ast/step_invocation.rb +110 -0
  49. data/lib/cucumber/ast/table.rb +41 -21
  50. data/lib/cucumber/ast/tags.rb +4 -11
  51. data/lib/cucumber/ast/visitor.rb +35 -19
  52. data/lib/cucumber/broadcaster.rb +1 -3
  53. data/lib/cucumber/cli/configuration.rb +25 -17
  54. data/lib/cucumber/cli/language_help_formatter.rb +4 -4
  55. data/lib/cucumber/cli/main.rb +6 -4
  56. data/lib/cucumber/core_ext/proc.rb +2 -2
  57. data/lib/cucumber/formatter/ansicolor.rb +0 -1
  58. data/lib/cucumber/formatter/console.rb +24 -34
  59. data/lib/cucumber/formatter/html.rb +18 -11
  60. data/lib/cucumber/formatter/pretty.rb +48 -36
  61. data/lib/cucumber/formatter/profile.rb +6 -6
  62. data/lib/cucumber/formatter/progress.rb +14 -22
  63. data/lib/cucumber/formatter/rerun.rb +6 -6
  64. data/lib/cucumber/jbehave.rb +21 -26
  65. data/lib/cucumber/languages.yml +17 -2
  66. data/lib/cucumber/parser/feature.rb +26 -29
  67. data/lib/cucumber/parser/feature.tt +17 -12
  68. data/lib/cucumber/parser/treetop_ext.rb +13 -13
  69. data/lib/cucumber/platform.rb +0 -1
  70. data/lib/cucumber/rails/world.rb +2 -2
  71. data/lib/cucumber/rake/task.rb +1 -2
  72. data/lib/cucumber/step_definition.rb +21 -12
  73. data/lib/cucumber/step_match.rb +49 -0
  74. data/lib/cucumber/step_mother.rb +100 -80
  75. data/lib/cucumber/version.rb +2 -2
  76. data/lib/cucumber/world.rb +53 -0
  77. data/rails_generators/cucumber/templates/paths.rb +1 -1
  78. data/rails_generators/cucumber/templates/webrat_steps.rb +17 -17
  79. data/rails_generators/feature/feature_generator.rb +5 -1
  80. data/rails_generators/feature/templates/steps.erb +0 -4
  81. data/spec/cucumber/ast/background_spec.rb +32 -41
  82. data/spec/cucumber/ast/feature_factory.rb +10 -1
  83. data/spec/cucumber/ast/feature_spec.rb +7 -30
  84. data/spec/cucumber/ast/py_string_spec.rb +7 -0
  85. data/spec/cucumber/ast/scenario_outline_spec.rb +3 -0
  86. data/spec/cucumber/ast/scenario_spec.rb +8 -25
  87. data/spec/cucumber/ast/step_collection_spec.rb +8 -0
  88. data/spec/cucumber/ast/step_spec.rb +49 -28
  89. data/spec/cucumber/ast/table_spec.rb +13 -3
  90. data/spec/cucumber/ast/tags_spec.rb +2 -18
  91. data/spec/cucumber/broadcaster_spec.rb +6 -5
  92. data/spec/cucumber/cli/configuration_spec.rb +7 -0
  93. data/spec/cucumber/cli/main_spec.rb +1 -1
  94. data/spec/cucumber/parser/feature_parser_spec.rb +6 -5
  95. data/spec/cucumber/step_definition_spec.rb +16 -5
  96. data/spec/cucumber/step_mother_spec.rb +6 -6
  97. data/spec/cucumber/world/pending_spec.rb +1 -1
  98. metadata +24 -5
  99. data/lib/cucumber/ast/filter.rb +0 -22
  100. data/lib/cucumber/ast/steps.rb +0 -13
@@ -17,15 +17,18 @@ module Cucumber
17
17
  tags
18
18
  white
19
19
  header:(!(scenario_outline / scenario / background) .)*
20
- background:(background)?
20
+ bg:background?
21
21
  feature_elements
22
22
  comment? {
23
23
  def build
24
- if background.respond_to?(:build)
25
- Ast::Feature.new(comment.build, tags.build, header.text_value, feature_elements.build, background.build)
26
- else
27
- Ast::Feature.new(comment.build, tags.build, header.text_value, feature_elements.build)
28
- end
24
+ background = bg.respond_to?(:build) ? bg.build : nil
25
+ Ast::Feature.new(
26
+ background,
27
+ comment.build,
28
+ tags.build,
29
+ header.text_value,
30
+ feature_elements.build(background)
31
+ )
29
32
  end
30
33
  }
31
34
  end
@@ -40,7 +43,7 @@ module Cucumber
40
43
  end
41
44
 
42
45
  rule tag
43
- '@' tag_name:([^@\n\t ])+
46
+ '@' tag_name:([^@\r\n\t ])+
44
47
  end
45
48
 
46
49
  rule comment
@@ -70,16 +73,17 @@ module Cucumber
70
73
 
71
74
  rule feature_elements
72
75
  (scenario / scenario_outline)* {
73
- def build
74
- elements.map{|s| s.build}
76
+ def build(background)
77
+ elements.map{|s| s.build(background)}
75
78
  end
76
79
  }
77
80
  end
78
81
 
79
82
  rule scenario
80
- comment tags white scenario_keyword space* name:line_to_eol (white / eof) steps white {
81
- def build
83
+ comment tags white scenario_keyword space* name:line_to_eol white steps white {
84
+ def build(background)
82
85
  Ast::Scenario.new(
86
+ background,
83
87
  comment.build,
84
88
  tags.build,
85
89
  scenario_keyword.line,
@@ -93,8 +97,9 @@ module Cucumber
93
97
 
94
98
  rule scenario_outline
95
99
  comment tags white scenario_outline_keyword space* name:line_to_eol white steps examples_sections white {
96
- def build
100
+ def build(background)
97
101
  Ast::ScenarioOutline.new(
102
+ background,
98
103
  comment.build,
99
104
  tags.build,
100
105
  scenario_outline_keyword.line,
@@ -13,11 +13,11 @@ end
13
13
  module Cucumber
14
14
  module Parser
15
15
  module TreetopExt
16
- FILE_LINE_PATTERN = /^([\w\W]*?):([\d:]+)$/
16
+ FILE_COLON_LINE_PATTERN = /^([\w\W]*?):([\d:]+)$/
17
17
 
18
18
  # Parses a file and returns a Cucumber::Ast
19
19
  def parse_file(file)
20
- _, path, lines = *FILE_LINE_PATTERN.match(file)
20
+ _, path, lines = *FILE_COLON_LINE_PATTERN.match(file)
21
21
  if path
22
22
  lines = lines.split(':').map { |line| line.to_i }
23
23
  else
@@ -35,6 +35,17 @@ module Cucumber
35
35
  feature.lines = lines
36
36
  feature
37
37
  end
38
+
39
+ def parse_or_fail(s, file=nil, line_offset=0)
40
+ parse_tree = parse(s)
41
+ if parse_tree.nil?
42
+ raise Cucumber::Parser::SyntaxError.new(self, file, line_offset)
43
+ else
44
+ ast = parse_tree.build
45
+ ast.file = file
46
+ ast
47
+ end
48
+ end
38
49
  end
39
50
 
40
51
  class SyntaxError < StandardError
@@ -59,17 +70,6 @@ module Treetop
59
70
 
60
71
  class CompiledParser
61
72
  include Cucumber::Parser::TreetopExt
62
-
63
- def parse_or_fail(s, file=nil, line=0)
64
- parse_tree = parse(s)
65
- if parse_tree.nil?
66
- raise Cucumber::Parser::SyntaxError.new(self, file, line)
67
- else
68
- ast = parse_tree.build
69
- ast.file = file
70
- ast
71
- end
72
- end
73
73
  end
74
74
  end
75
75
  end
@@ -14,5 +14,4 @@ module Cucumber
14
14
  RAILS = defined?(Rails)
15
15
  RUBY_BINARY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
16
16
  RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
17
- EXCEPTION_STATUS = Hash.new(:failed)
18
17
  end
@@ -11,8 +11,8 @@ require 'test/unit/testresult'
11
11
 
12
12
  # These allow exceptions to come through as opposed to being caught and having non-helpful responses returned.
13
13
  ActionController::Base.class_eval do
14
- def perform_action_with_rescue
15
- perform_action_without_rescue
14
+ def rescue_action(exception)
15
+ raise exception
16
16
  end
17
17
  end
18
18
  ActionController::Dispatcher.class_eval do
@@ -14,7 +14,6 @@ module Cucumber
14
14
  # To further configure the task, you can pass a block:
15
15
  #
16
16
  # Cucumber::Rake::Task.new do |t|
17
- # t.libs << 'lib'
18
17
  # t.cucumber_opts = "--format progress"
19
18
  # end
20
19
  #
@@ -54,7 +53,7 @@ module Cucumber
54
53
  # Define a Rake
55
54
  def initialize(task_name = "features", desc = "Run Features with Cucumber")
56
55
  @task_name, @desc = task_name, desc
57
- @libs = []
56
+ @libs = ['lib']
58
57
  @rcov_opts = %w{--rails --exclude osx\/objc,gems\/}
59
58
 
60
59
  yield self if block_given?
@@ -1,3 +1,4 @@
1
+ require 'cucumber/step_match'
1
2
  require 'cucumber/core_ext/string'
2
3
  require 'cucumber/core_ext/proc'
3
4
 
@@ -27,12 +28,30 @@ module Cucumber
27
28
  def initialize(pattern, &proc)
28
29
  raise MissingProc if proc.nil?
29
30
  if String === pattern
30
- p = pattern.gsub(/\$\w+/, '(.*)')
31
+ p = pattern.gsub(/\$\w+/, '(.*)') # Replace $var with (.*)
31
32
  pattern = Regexp.new("^#{p}$")
32
33
  end
33
34
  @regexp, @proc = pattern, proc
34
35
  end
35
36
 
37
+ def step_match(name_to_match, name_to_report)
38
+ if(match = name_to_match.match(@regexp))
39
+ StepMatch.new(self, name_to_match, name_to_report, match.captures)
40
+ else
41
+ nil
42
+ end
43
+ end
44
+
45
+ def invoke(world, args, step_name)
46
+ args = args.map{|arg| Ast::PyString === arg ? arg.to_s : arg}
47
+ begin
48
+ world.cucumber_instance_exec(true, @regexp.inspect, *args, &@proc)
49
+ rescue Cucumber::ArityMismatchError => e
50
+ e.backtrace.unshift(self.backtrace_line)
51
+ raise e
52
+ end
53
+ end
54
+
36
55
  #:stopdoc:
37
56
 
38
57
  def match(step_name)
@@ -65,17 +84,7 @@ module Cucumber
65
84
  step_name.match(@regexp).captures
66
85
  end
67
86
 
68
- def execute(step_name, world, *args)
69
- args = args.map{|arg| Ast::PyString === arg ? arg.to_s : arg}
70
- begin
71
- world.cucumber_instance_exec(true, @regexp.inspect, *args, &@proc)
72
- rescue Cucumber::ArityMismatchError => e
73
- e.backtrace.unshift(self.to_backtrace_line)
74
- raise e
75
- end
76
- end
77
-
78
- def to_backtrace_line
87
+ def backtrace_line
79
88
  "#{file_colon_line}:in `#{@regexp.inspect}'"
80
89
  end
81
90
 
@@ -0,0 +1,49 @@
1
+ module Cucumber
2
+ class StepMatch
3
+ attr_reader :step_definition
4
+ attr_reader :args
5
+
6
+ def initialize(step_definition, step_name, formatted_step_name, args)
7
+ @step_definition, @step_name, @formatted_step_name, @args = step_definition, step_name, formatted_step_name, args
8
+ end
9
+
10
+ def invoke(world, multiline_arg)
11
+ all_args = @args.dup
12
+ all_args << multiline_arg if multiline_arg
13
+ @step_definition.invoke(world, all_args, @step_name)
14
+ end
15
+
16
+ def format_args(format)
17
+ @formatted_step_name || @step_definition.format_args(@step_name, format)
18
+ end
19
+
20
+ def file_colon_line
21
+ @step_definition.file_colon_line
22
+ end
23
+
24
+ def backtrace_line
25
+ @step_definition.backtrace_line
26
+ end
27
+ end
28
+
29
+ class NoStepMatch
30
+ attr_reader :step_definition
31
+
32
+ def initialize(step)
33
+ @step = step
34
+ end
35
+
36
+ def format_args(format)
37
+ @step.name
38
+ end
39
+
40
+ def file_colon_line
41
+ raise "No file:line for #{@step}" unless @step.file_colon_line
42
+ @step.file_colon_line
43
+ end
44
+
45
+ def backtrace_line
46
+ @step.backtrace_line
47
+ end
48
+ end
49
+ end
@@ -1,4 +1,5 @@
1
1
  require 'cucumber/step_definition'
2
+ require 'cucumber/world'
2
3
  require 'cucumber/core_ext/instance_exec'
3
4
 
4
5
  module Cucumber
@@ -9,18 +10,25 @@ module Cucumber
9
10
  super %{Undefined step: "#{step_name}"}
10
11
  @step_name = step_name
11
12
  end
12
- Cucumber::EXCEPTION_STATUS[self] = :undefined
13
+
14
+ def nested!
15
+ @nested = true
16
+ end
17
+
18
+ def nested?
19
+ @nested
20
+ end
13
21
  end
14
22
 
23
+ # Raised when a StepDefinition's block invokes World#pending
15
24
  class Pending < StandardError
16
- Cucumber::EXCEPTION_STATUS[self] = :pending
17
25
  end
18
26
 
19
27
  # Raised when a step matches 2 or more StepDefinition
20
28
  class Ambiguous < StandardError
21
29
  def initialize(step_name, step_definitions)
22
30
  message = "Ambiguous match of \"#{step_name}\":\n\n"
23
- message << step_definitions.map{|sd| sd.to_backtrace_line}.join("\n")
31
+ message << step_definitions.map{|sd| sd.backtrace_line}.join("\n")
24
32
  message << "\n\n"
25
33
  super(message)
26
34
  end
@@ -30,8 +38,8 @@ module Cucumber
30
38
  class Redundant < StandardError
31
39
  def initialize(step_def_1, step_def_2)
32
40
  message = "Multiple step definitions have the same Regexp:\n\n"
33
- message << step_def_1.to_backtrace_line << "\n"
34
- message << step_def_2.to_backtrace_line << "\n\n"
41
+ message << step_def_1.backtrace_line << "\n"
42
+ message << step_def_2.backtrace_line << "\n\n"
35
43
  super(message)
36
44
  end
37
45
  end
@@ -41,9 +49,32 @@ module Cucumber
41
49
  # so #register_step_definition (and more interestingly - its aliases) are
42
50
  # available from the top-level.
43
51
  module StepMother
44
- attr_writer :snippet_generator
45
- attr_writer :options
52
+ class << self
53
+ def alias_adverb(adverb)
54
+ adverb = adverb.gsub(/\s/, '')
55
+ alias_method adverb, :register_step_definition
56
+ end
57
+ end
58
+
59
+ attr_writer :snippet_generator, :options, :visitor
60
+
61
+ def step_visited(step)
62
+ steps << step unless steps.index(step)
63
+ end
46
64
 
65
+ def steps(status = nil)
66
+ @steps ||= []
67
+ if(status)
68
+ @steps.select{|step| step.status == status}
69
+ else
70
+ @steps
71
+ end
72
+ end
73
+
74
+ def scenarios
75
+ @scenarios ||= []
76
+ end
77
+
47
78
  # Registers a new StepDefinition. This method is aliased
48
79
  # to <tt>Given</tt>, <tt>When</tt> and <tt>Then</tt>.
49
80
  #
@@ -63,20 +94,6 @@ module Cucumber
63
94
  step_definition
64
95
  end
65
96
 
66
- def world(scenario, prior_world = nil, &proc)
67
- world = prior_world || new_world
68
- begin
69
- (@before_procs ||= []).each do |proc|
70
- world.cucumber_instance_exec(false, 'Before', scenario, &proc)
71
- end
72
- yield world
73
- ensure
74
- (@after_procs ||= []).each do |proc|
75
- world.cucumber_instance_exec(false, 'After', scenario, &proc)
76
- end
77
- end
78
- end
79
-
80
97
  # Registers a Before proc. You can call this method as many times as you
81
98
  # want (typically from ruby scripts under <tt>support</tt>).
82
99
  def Before(&proc)
@@ -93,37 +110,25 @@ module Cucumber
93
110
  (@world_procs ||= []) << proc
94
111
  end
95
112
 
96
- # Creates a new world instance
97
- def new_world #:nodoc:
98
- world = Object.new
99
- (@world_procs ||= []).each do |proc|
100
- world = proc.call(world)
101
- end
102
-
103
- world.extend(WorldMethods)
104
- world.__cucumber_step_mother = self
113
+ def current_world
114
+ @current_world
115
+ end
105
116
 
106
- world.extend(::Spec::Matchers) if defined?(::Spec::Matchers)
107
- world
117
+ def step_match(step_name, formatted_step_name=nil)
118
+ matches = step_definitions.map { |d| d.step_match(step_name, formatted_step_name) }.compact
119
+ raise Undefined.new(step_name) if matches.empty?
120
+ matches = best_matches(step_name, matches) if matches.size > 1 && options[:guess]
121
+ raise Ambiguous.new(step_name, matches) if matches.size > 1
122
+ matches[0]
108
123
  end
109
124
 
110
- # Looks up the StepDefinition that matches +step_name+
111
- def step_definition(step_name) #:nodoc:
112
- found = step_definitions.select do |step_definition|
113
- step_definition.match(step_name)
114
- end
115
- raise Undefined.new(step_name) if found.empty?
116
- found = best_matches(step_name, found) if found.size > 1 && options[:guess]
117
- raise Ambiguous.new(step_name, found) if found.size > 1
118
- found[0]
119
- end
120
-
121
- def best_matches(step_name, step_definitions)
122
- top_group_score = step_definitions.map {|s| s.match(step_name).captures.length }.sort.last
123
- top_groups = step_definitions.select {|s| s.match(step_name).captures.length == top_group_score }
124
- if top_groups.size > 1
125
- shortest_capture_length = top_groups.map {|s| s.match(step_name).captures.inject(0) {|sum, c| sum + c.length } }.sort.first
126
- top_groups.select {|s| s.match(step_name).captures.inject(0) {|sum, c| sum + c.length } == shortest_capture_length }
125
+ def best_matches(step_name, step_matches)
126
+ max_arg_length = step_matches.map {|step_match| step_match.args.length }.max
127
+ top_groups = step_matches.select {|step_match| step_match.args.length == max_arg_length }
128
+
129
+ if top_groups.length > 1
130
+ shortest_capture_length = top_groups.map {|step_match| step_match.args.inject(0) {|sum, c| sum + c.length } }.min
131
+ top_groups.select {|step_match| step_match.args.inject(0) {|sum, c| sum + c.length } == shortest_capture_length }
127
132
  else
128
133
  top_groups
129
134
  end
@@ -144,6 +149,19 @@ module Cucumber
144
149
  end
145
150
  end
146
151
 
152
+ def before_and_after(scenario, skip=false)
153
+ unless current_world || skip
154
+ new_world!
155
+ execute_before(scenario)
156
+ end
157
+ if block_given?
158
+ yield
159
+ execute_after(scenario) unless skip
160
+ nil_world!
161
+ scenario_visited(scenario)
162
+ end
163
+ end
164
+
147
165
  private
148
166
 
149
167
  def max_step_definition_length
@@ -154,41 +172,43 @@ module Cucumber
154
172
  @options || {}
155
173
  end
156
174
 
157
- module WorldMethods #:nodoc:
158
- attr_writer :__cucumber_step_mother, :__cucumber_current_step
159
-
160
- # Call a step from within a step definition
161
- def __cucumber_invoke(name, *multiline_arguments)
162
- begin
163
- # TODO: Very similar to code in Step. Refactor. Get back StepInvocation?
164
- # Make more similar to JBehave?
165
- step_definition = @__cucumber_step_mother.step_definition(name)
166
- matched_args = step_definition.matched_args(name)
167
- args = (matched_args + multiline_arguments)
168
- step_definition.execute(name, self, *args)
169
- rescue Exception => e
170
- @__cucumber_current_step.exception = e
171
- raise e
172
- end
175
+ # Creates a new world instance
176
+ def new_world!
177
+ @current_world = Object.new
178
+ (@world_procs ||= []).each do |proc|
179
+ @current_world = proc.call(@current_world)
173
180
  end
174
-
175
- def table(text, file=nil, line=0)
176
- @table_parser ||= Parser::TableParser.new
177
- @table_parser.parse_or_fail(text.strip, file, line)
181
+
182
+ @current_world.extend(World)
183
+ @current_world.__cucumber_step_mother = self
184
+ @current_world.__cucumber_visitor = @visitor
185
+
186
+ @current_world.extend(::Spec::Matchers) if defined?(::Spec::Matchers)
187
+ @current_world
188
+ end
189
+
190
+ def nil_world!
191
+ @current_world = nil
192
+ end
193
+
194
+ def execute_before(scenario)
195
+ (@before_procs ||= []).each do |proc|
196
+ @current_world.cucumber_instance_exec(false, 'Before', scenario, &proc)
178
197
  end
198
+ end
179
199
 
180
- def pending(message = "TODO")
181
- if block_given?
182
- begin
183
- yield
184
- rescue Exception => e
185
- raise Pending.new(message)
186
- end
187
- raise Pending.new("Expected pending '#{message}' to fail. No Error was raised. No longer pending?")
188
- else
189
- raise Pending.new(message)
190
- end
200
+ def execute_after(scenario)
201
+ (@after_procs ||= []).each do |proc|
202
+ @current_world.cucumber_instance_exec(false, 'After', scenario, &proc)
191
203
  end
192
204
  end
205
+
206
+ def scenario_visited(scenario)
207
+ scenarios << scenario unless scenarios.index(scenario)
208
+ end
209
+
210
+ def options
211
+ @options || {}
212
+ end
193
213
  end
194
214
  end