rspec 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/{CHANGES → History.txt} +116 -64
  2. data/Manifest.txt +403 -0
  3. data/{MIT-LICENSE → README.txt} +43 -0
  4. data/Rakefile +39 -212
  5. data/{TODO → TODO.txt} +0 -0
  6. data/bin/autospec +4 -0
  7. data/bin/spec +1 -1
  8. data/examples/pure/yielding_example.rb +33 -0
  9. data/examples/stories/game-of-life/.loadpath +5 -0
  10. data/examples/stories/game-of-life/behaviour/everything.rb +1 -1
  11. data/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story +17 -17
  12. data/init.rb +9 -0
  13. data/lib/autotest/discover.rb +1 -1
  14. data/lib/autotest/rspec.rb +3 -29
  15. data/lib/spec.rb +10 -12
  16. data/lib/spec/adapters.rb +1 -0
  17. data/lib/spec/adapters/ruby_engine.rb +26 -0
  18. data/lib/spec/adapters/ruby_engine/mri.rb +8 -0
  19. data/lib/spec/adapters/ruby_engine/rubinius.rb +8 -0
  20. data/lib/spec/example/errors.rb +6 -0
  21. data/lib/spec/example/example_group_methods.rb +17 -14
  22. data/lib/spec/example/example_matcher.rb +2 -0
  23. data/lib/spec/example/example_methods.rb +4 -9
  24. data/lib/spec/example/module_inclusion_warnings.rb +2 -1
  25. data/lib/spec/expectations/extensions/object.rb +2 -2
  26. data/lib/spec/expectations/handler.rb +8 -16
  27. data/lib/spec/extensions/main.rb +2 -17
  28. data/lib/spec/matchers.rb +8 -2
  29. data/lib/spec/matchers/be.rb +0 -3
  30. data/lib/spec/matchers/change.rb +44 -40
  31. data/lib/spec/matchers/has.rb +1 -1
  32. data/lib/spec/matchers/have.rb +17 -12
  33. data/lib/spec/matchers/operator_matcher.rb +10 -4
  34. data/lib/spec/matchers/simple_matcher.rb +113 -10
  35. data/lib/spec/mocks.rb +1 -1
  36. data/lib/spec/mocks/argument_constraints.rb +185 -0
  37. data/lib/spec/mocks/argument_expectation.rb +35 -173
  38. data/lib/spec/mocks/framework.rb +1 -1
  39. data/lib/spec/mocks/message_expectation.rb +30 -5
  40. data/lib/spec/mocks/methods.rb +14 -2
  41. data/lib/spec/mocks/mock.rb +4 -0
  42. data/lib/spec/mocks/proxy.rb +46 -5
  43. data/lib/spec/mocks/spec_methods.rb +9 -1
  44. data/lib/spec/rake/spectask.rb +14 -22
  45. data/lib/spec/rake/verify_rcov.rb +3 -3
  46. data/lib/spec/runner.rb +18 -6
  47. data/lib/spec/runner/backtrace_tweaker.rb +6 -7
  48. data/lib/spec/runner/command_line.rb +6 -17
  49. data/lib/spec/runner/drb_command_line.rb +1 -1
  50. data/lib/spec/runner/formatter/base_formatter.rb +3 -1
  51. data/lib/spec/runner/formatter/base_text_formatter.rb +5 -9
  52. data/lib/spec/runner/formatter/html_formatter.rb +1 -1
  53. data/lib/spec/runner/formatter/nested_text_formatter.rb +1 -1
  54. data/lib/spec/runner/formatter/progress_bar_formatter.rb +2 -2
  55. data/lib/spec/runner/formatter/specdoc_formatter.rb +1 -1
  56. data/lib/spec/runner/formatter/story/html_formatter.rb +62 -16
  57. data/lib/spec/runner/formatter/story/plain_text_formatter.rb +68 -16
  58. data/lib/spec/runner/formatter/story/progress_bar_formatter.rb +42 -0
  59. data/lib/spec/runner/heckle_runner.rb +2 -2
  60. data/lib/spec/runner/option_parser.rb +2 -1
  61. data/lib/spec/runner/options.rb +18 -9
  62. data/lib/spec/runner/reporter.rb +24 -4
  63. data/lib/spec/runner/spec_parser.rb +1 -1
  64. data/lib/spec/story/runner.rb +1 -2
  65. data/lib/spec/story/runner/story_mediator.rb +14 -0
  66. data/lib/spec/story/runner/story_parser.rb +20 -0
  67. data/lib/spec/story/step.rb +40 -28
  68. data/lib/spec/story/step_mother.rb +2 -1
  69. data/lib/spec/story/world.rb +6 -2
  70. data/lib/spec/version.rb +13 -22
  71. data/rake_tasks/failing_examples_with_html.rake +1 -1
  72. data/rake_tasks/verify_rcov.rake +2 -2
  73. data/rspec.gemspec +33 -0
  74. data/spec/autotest/rspec_spec.rb +90 -141
  75. data/spec/spec/adapters/ruby_engine_spec.rb +16 -0
  76. data/spec/spec/example/base_formatter_spec.rb +112 -0
  77. data/spec/spec/example/example_group_factory_spec.rb +2 -2
  78. data/spec/spec/example/example_group_methods_spec.rb +55 -4
  79. data/spec/spec/example/example_group_spec.rb +4 -3
  80. data/spec/spec/example/example_methods_spec.rb +18 -14
  81. data/spec/spec/example/pending_module_spec.rb +38 -0
  82. data/spec/spec/example/shared_example_group_spec.rb +1 -1
  83. data/spec/spec/expectations/extensions/object_spec.rb +0 -12
  84. data/spec/spec/extensions/main_spec.rb +3 -8
  85. data/spec/spec/matchers/change_spec.rb +16 -6
  86. data/spec/spec/matchers/handler_spec.rb +58 -37
  87. data/spec/spec/matchers/has_spec.rb +10 -0
  88. data/spec/spec/matchers/have_spec.rb +105 -2
  89. data/spec/spec/matchers/operator_matcher_spec.rb +35 -2
  90. data/spec/spec/matchers/simple_matcher_spec.rb +64 -2
  91. data/spec/spec/mocks/any_number_of_times_spec.rb +7 -0
  92. data/spec/spec/mocks/bug_report_496.rb +17 -0
  93. data/spec/spec/mocks/failing_mock_argument_constraints_spec.rb +7 -1
  94. data/spec/spec/mocks/hash_including_matcher_spec.rb +45 -24
  95. data/spec/spec/mocks/mock_spec.rb +55 -10
  96. data/spec/spec/mocks/nil_expectation_warning_spec.rb +54 -0
  97. data/spec/spec/mocks/null_object_mock_spec.rb +14 -0
  98. data/spec/spec/mocks/options_hash_spec.rb +18 -28
  99. data/spec/spec/mocks/partial_mock_spec.rb +2 -0
  100. data/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +20 -6
  101. data/spec/spec/mocks/stub_spec.rb +7 -0
  102. data/spec/spec/runner/command_line_spec.rb +5 -12
  103. data/spec/spec/runner/drb_command_line_spec.rb +13 -6
  104. data/spec/spec/runner/formatter/html_formatter_spec.rb +2 -1
  105. data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +3 -3
  106. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +20 -2
  107. data/spec/spec/runner/formatter/spec_mate_formatter_spec.rb +2 -1
  108. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +3 -3
  109. data/spec/spec/runner/formatter/story/html_formatter_spec.rb +76 -2
  110. data/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +161 -0
  111. data/spec/spec/runner/formatter/story/progress_bar_formatter_spec.rb +82 -0
  112. data/spec/spec/runner/heckle_runner_spec.rb +8 -8
  113. data/spec/spec/runner/option_parser_spec.rb +21 -6
  114. data/spec/spec/runner/output_one_time_fixture_runner.rb +1 -1
  115. data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +6 -0
  116. data/spec/spec/runner/reporter_spec.rb +51 -5
  117. data/spec/spec/runner/spec_parser_spec.rb +4 -4
  118. data/spec/spec/story/runner/plain_text_story_runner_spec.rb +2 -5
  119. data/spec/spec/story/runner/story_mediator_spec.rb +10 -0
  120. data/spec/spec/story/runner/story_parser_spec.rb +23 -6
  121. data/spec/spec/story/scenario_spec.rb +1 -3
  122. data/spec/spec/story/step_mother_spec.rb +12 -0
  123. data/spec/spec/story/step_spec.rb +57 -4
  124. data/spec/spec/story/story_spec.rb +1 -3
  125. data/spec/spec/story/world_spec.rb +1 -1
  126. data/spec/spec_helper.rb +21 -68
  127. data/stories/all.rb +1 -1
  128. data/stories/configuration/before_blocks.story +21 -0
  129. data/stories/configuration/stories.rb +7 -0
  130. data/stories/example_groups/stories.rb +3 -4
  131. data/stories/resources/spec/before_blocks_example.rb +32 -0
  132. data/stories/stories/multiline_steps.story +23 -0
  133. data/stories/stories/steps/multiline_steps.rb +13 -0
  134. data/stories/stories/stories.rb +6 -0
  135. data/story_server/prototype/javascripts/builder.js +136 -0
  136. data/story_server/prototype/javascripts/controls.js +972 -0
  137. data/story_server/prototype/javascripts/dragdrop.js +976 -0
  138. data/story_server/prototype/javascripts/effects.js +1117 -0
  139. data/story_server/prototype/javascripts/prototype.js +4140 -0
  140. data/story_server/prototype/javascripts/rspec.js +149 -0
  141. data/story_server/prototype/javascripts/scriptaculous.js +58 -0
  142. data/story_server/prototype/javascripts/slider.js +276 -0
  143. data/story_server/prototype/javascripts/sound.js +55 -0
  144. data/story_server/prototype/javascripts/unittest.js +568 -0
  145. data/story_server/prototype/lib/server.rb +24 -0
  146. data/story_server/prototype/stories.html +176 -0
  147. data/story_server/prototype/stylesheets/rspec.css +136 -0
  148. data/story_server/prototype/stylesheets/test.css +90 -0
  149. metadata +166 -166
  150. data/README +0 -36
  151. data/UPGRADE +0 -7
  152. data/bin/spec_translator +0 -8
  153. data/lib/spec/mocks/argument_constraint_matchers.rb +0 -31
  154. data/lib/spec/translator.rb +0 -114
  155. data/spec/spec/example/example_spec.rb +0 -53
  156. data/spec/spec/runner/execution_context_spec.rb +0 -37
  157. data/spec/spec/translator_spec.rb +0 -265
@@ -9,9 +9,22 @@ module Spec
9
9
  super
10
10
  @successful_scenario_count = 0
11
11
  @pending_scenario_count = 0
12
+
13
+ @pre_story_pending_count = 0
14
+ @pre_story_successful_count = 0
15
+
12
16
  @failed_scenarios = []
13
17
  @pending_steps = []
14
- @previous_type = nil
18
+ @previous_type = nil
19
+
20
+ @scenario_body_text = ""
21
+ @story_body_text = ""
22
+
23
+ @scenario_head_text = ""
24
+ @story_head_text = ""
25
+
26
+ @scenario_failed = false
27
+ @story_failed = false
15
28
  end
16
29
 
17
30
  def run_started(count)
@@ -20,15 +33,30 @@ module Spec
20
33
  end
21
34
 
22
35
  def story_started(title, narrative)
36
+ @pre_story_pending_count = @pending_scenario_count
37
+ @pre_story_successful_count = @successful_scenario_count
38
+
23
39
  @current_story_title = title
24
- @output.puts "Story: #{title}\n\n"
40
+ @story_failed = false
41
+ @story_body_text = ""
42
+ @story_head_text = "Story: #{title}\n\n"
43
+
25
44
  narrative.each_line do |line|
26
- @output.print " "
27
- @output.print line
45
+ @story_head_text += " "
46
+ @story_head_text += line
28
47
  end
29
48
  end
30
49
 
31
50
  def story_ended(title, narrative)
51
+ if @story_failed
52
+ @output.print red(@story_head_text)
53
+ elsif @pre_story_successful_count == @successful_scenario_count &&
54
+ @pending_scenario_count >= @pre_story_pending_count
55
+ @output.print yellow(@story_head_text)
56
+ else
57
+ @output.print green(@story_head_text)
58
+ end
59
+ @output.print @story_body_text
32
60
  @output.puts
33
61
  @output.puts
34
62
  end
@@ -36,29 +64,54 @@ module Spec
36
64
  def scenario_started(story_title, scenario_name)
37
65
  @current_scenario_name = scenario_name
38
66
  @scenario_already_failed = false
39
- @output.print "\n\n Scenario: #{scenario_name}"
67
+ @scenario_head_text = "\n\n Scenario: #{scenario_name}"
68
+ @scenario_body_text = ""
40
69
  @scenario_ok = true
41
70
  @scenario_pending = false
71
+ @scenario_failed = false
42
72
  end
43
73
 
44
74
  def scenario_succeeded(story_title, scenario_name)
45
75
  @successful_scenario_count += 1
76
+ scenario_ended
46
77
  end
47
78
 
48
79
  def scenario_failed(story_title, scenario_name, err)
49
80
  @options.backtrace_tweaker.tweak_backtrace(err)
50
81
  @failed_scenarios << [story_title, scenario_name, err] unless @scenario_already_failed
51
82
  @scenario_already_failed = true
83
+ @story_failed = true
84
+ @scenario_failed = true
85
+ scenario_ended
52
86
  end
53
87
 
54
88
  def scenario_pending(story_title, scenario_name, msg)
55
89
  @pending_scenario_count += 1 unless @scenario_already_failed
56
90
  @scenario_pending = true
57
91
  @scenario_already_failed = true
92
+ scenario_ended
58
93
  end
59
94
 
95
+ def scenario_ended
96
+ if @scenario_failed
97
+ @story_body_text += red(@scenario_head_text)
98
+ elsif @scenario_pending
99
+ @story_body_text += yellow(@scenario_head_text)
100
+ else
101
+ @story_body_text += green(@scenario_head_text)
102
+ end
103
+ @story_body_text += @scenario_body_text
104
+ end
105
+
60
106
  def run_ended
61
- @output.puts "#@count scenarios: #@successful_scenario_count succeeded, #{@failed_scenarios.size} failed, #@pending_scenario_count pending"
107
+ summary_text = "#@count scenarios: #@successful_scenario_count succeeded, #{@failed_scenarios.size} failed, #@pending_scenario_count pending"
108
+ if !@failed_scenarios.empty?
109
+ @output.puts red(summary_text)
110
+ elsif !@pending_steps.empty?
111
+ @output.puts yellow(summary_text)
112
+ else
113
+ @output.puts green(summary_text)
114
+ end
62
115
  unless @pending_steps.empty?
63
116
  @output.puts "\nPending Steps:"
64
117
  @pending_steps.each_with_index do |pending, i|
@@ -70,11 +123,10 @@ module Spec
70
123
  @output.print "\nFAILURES:"
71
124
  @failed_scenarios.each_with_index do |failure, i|
72
125
  title, scenario_name, err = failure
73
- @output.print %[
74
- #{i+1}) #{title} (#{scenario_name}) FAILED
75
- #{err.class}: #{err.message}
76
- #{err.backtrace.join("\n")}
77
- ]
126
+ @output.print "\n #{i+1}) "
127
+ @output.print red("#{title} (#{scenario_name}) FAILED")
128
+ @output.print red("\n #{err.class}: #{err.message}")
129
+ @output.print "\n #{err.backtrace.join("\n")}\n"
78
130
  end
79
131
  end
80
132
  end
@@ -89,7 +141,7 @@ module Spec
89
141
  def step_pending(type, description, *args)
90
142
  found_step(type, description, false, true, *args)
91
143
  @pending_steps << [@current_story_title, @current_scenario_name, description]
92
- @output.print yellow(" (PENDING)")
144
+ @scenario_body_text += yellow(" (PENDING)")
93
145
  @scenario_pending = true
94
146
  @scenario_ok = false
95
147
  end
@@ -97,9 +149,9 @@ module Spec
97
149
  def step_failed(type, description, *args)
98
150
  found_step(type, description, true, @scenario_pending, *args)
99
151
  if @scenario_pending
100
- @output.print yellow(" (SKIPPED)")
152
+ @scenario_body_text += yellow(" (SKIPPED)")
101
153
  else
102
- @output.print red(@scenario_ok ? " (FAILED)" : " (SKIPPED)")
154
+ @scenario_body_text += red(@scenario_ok ? " (FAILED)" : " (SKIPPED)")
103
155
  end
104
156
  @scenario_ok = false
105
157
  end
@@ -124,9 +176,9 @@ module Spec
124
176
  i = -1
125
177
  text << desc_string.gsub(arg_regexp) { |param| args[i+=1] }
126
178
  if pending
127
- @output.print yellow(text)
179
+ @scenario_body_text += yellow(text)
128
180
  else
129
- @output.print(failed ? red(text) : green(text))
181
+ @scenario_body_text += (failed ? red(text) : green(text))
130
182
  end
131
183
 
132
184
  if type == :'given scenario'
@@ -0,0 +1,42 @@
1
+ require 'spec/runner/formatter/story/plain_text_formatter'
2
+
3
+ module Spec
4
+ module Runner
5
+ module Formatter
6
+ module Story
7
+ class ProgressBarFormatter < PlainTextFormatter
8
+
9
+ def story_started(title, narrative) end
10
+ def story_ended(title, narrative) end
11
+
12
+ def run_started(count)
13
+ @start_time = Time.now
14
+ super
15
+ end
16
+
17
+ def run_ended
18
+ @output.puts
19
+ @output.puts
20
+ @output.puts "Finished in %f seconds" % (Time.now - @start_time)
21
+ @output.puts
22
+ super
23
+ end
24
+
25
+ def scenario_ended
26
+ if @scenario_failed
27
+ @output.print red('F')
28
+ @output.flush
29
+ elsif @scenario_pending
30
+ @output.print yellow('P')
31
+ @output.flush
32
+ else
33
+ @output.print green('.')
34
+ @output.flush
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -25,7 +25,7 @@ module Spec
25
25
 
26
26
  def heckle_method(class_name, method_name)
27
27
  verify_constant(class_name)
28
- heckle = @heckle_class.new(class_name, method_name, rspec_options)
28
+ heckle = @heckle_class.new(class_name, method_name, Spec::Runner.options)
29
29
  heckle.validate
30
30
  end
31
31
 
@@ -39,7 +39,7 @@ module Spec
39
39
 
40
40
  classes.each do |klass|
41
41
  klass.instance_methods(false).each do |method_name|
42
- heckle = @heckle_class.new(klass.name, method_name, rspec_options)
42
+ heckle = @heckle_class.new(klass.name, method_name, Spec::Runner.options)
43
43
  heckle.validate
44
44
  end
45
45
  end
@@ -54,6 +54,7 @@ module Spec
54
54
  "Builtin formats for stories: ",
55
55
  "plain|p : Plain Text",
56
56
  "html|h : A nice HTML report",
57
+ "progress|r : Text progress",
57
58
  " ",
58
59
  "FORMAT can also be the name of a custom formatter class",
59
60
  "(in which case you should also specify --require to load it)"],
@@ -186,7 +187,7 @@ module Spec
186
187
  end
187
188
 
188
189
  def parse_version
189
- @out_stream.puts ::Spec::VERSION::DESCRIPTION
190
+ @out_stream.puts ::Spec::VERSION::SUMMARY
190
191
  exit if stdout?
191
192
  end
192
193
 
@@ -24,10 +24,13 @@ module Spec
24
24
  }
25
25
 
26
26
  STORY_FORMATTERS = {
27
- 'plain' => ['spec/runner/formatter/story/plain_text_formatter', 'Formatter::Story::PlainTextFormatter'],
28
- 'p' => ['spec/runner/formatter/story/plain_text_formatter', 'Formatter::Story::PlainTextFormatter'],
29
- 'html' => ['spec/runner/formatter/story/html_formatter', 'Formatter::Story::HtmlFormatter'],
30
- 'h' => ['spec/runner/formatter/story/html_formatter', 'Formatter::Story::HtmlFormatter']
27
+ 'plain' => ['spec/runner/formatter/story/plain_text_formatter', 'Formatter::Story::PlainTextFormatter'],
28
+ 'p' => ['spec/runner/formatter/story/plain_text_formatter', 'Formatter::Story::PlainTextFormatter'],
29
+ 'html' => ['spec/runner/formatter/story/html_formatter', 'Formatter::Story::HtmlFormatter'],
30
+ 'h' => ['spec/runner/formatter/story/html_formatter', 'Formatter::Story::HtmlFormatter'],
31
+ 'progress' => ['spec/runner/formatter/story/progress_bar_formatter', 'Formatter::Story::ProgressBarFormatter'],
32
+ 'r' => ['spec/runner/formatter/story/progress_bar_formatter', 'Formatter::Story::ProgressBarFormatter']
33
+
31
34
  }
32
35
 
33
36
  attr_accessor(
@@ -54,7 +57,7 @@ module Spec
54
57
  :argv
55
58
  )
56
59
  attr_reader :colour, :differ_class, :files, :example_groups
57
-
60
+
58
61
  def initialize(error_stream, output_stream)
59
62
  @error_stream = error_stream
60
63
  @output_stream = output_stream
@@ -89,9 +92,6 @@ module Spec
89
92
  return true unless examples_should_be_run?
90
93
  success = true
91
94
  begin
92
- before_suite_parts.each do |part|
93
- part.call
94
- end
95
95
  runner = custom_runner || ExampleGroupRunner.new(self)
96
96
 
97
97
  unless @files_loaded
@@ -99,6 +99,15 @@ module Spec
99
99
  @files_loaded = true
100
100
  end
101
101
 
102
+ # TODO - this has to happen after the files get loaded,
103
+ # otherwise the before_suite_parts are not populated
104
+ # from the configuration. There is no spec for this
105
+ # directly, but stories/configuration/before_blocks.story
106
+ # will fail if this happens before the files are loaded.
107
+ before_suite_parts.each do |part|
108
+ part.call
109
+ end
110
+
102
111
  if example_groups.empty?
103
112
  true
104
113
  else
@@ -125,7 +134,7 @@ module Spec
125
134
 
126
135
  def colour=(colour)
127
136
  @colour = colour
128
- if @colour && RUBY_PLATFORM =~ /win32/ ;\
137
+ if @colour && RUBY_PLATFORM =~ /mswin|mingw/ ;\
129
138
  begin ;\
130
139
  require 'rubygems' ;\
131
140
  require 'Win32/Console/ANSI' ;\
@@ -26,7 +26,7 @@ module Spec
26
26
  if error.nil?
27
27
  example_passed(example)
28
28
  elsif Spec::Example::ExamplePendingError === error
29
- example_pending(example, error.message)
29
+ example_pending(example, error.pending_caller, error.message)
30
30
  else
31
31
  example_failed(example, error)
32
32
  end
@@ -103,14 +103,34 @@ module Spec
103
103
  def example_passed(example)
104
104
  formatters.each{|f| f.example_passed(example)}
105
105
  end
106
+
107
+ EXAMPLE_PENDING_DEPRECATION_WARNING = <<-WARNING
108
+ DEPRECATION NOTICE: RSpec's formatters have changed example_pending
109
+ to accept three arguments instead of just two. Please see the rdoc
110
+ for Spec::Runner::Formatter::BaseFormatter#example_pending
111
+ for more information.
112
+
113
+ Please update any custom formatters to accept the third argument
114
+ to example_pending. Support for example_pending with two arguments
115
+ and this warning message will be removed after the RSpec 1.1.5 release.
116
+ WARNING
106
117
 
107
- def example_pending(example, message="Not Yet Implemented")
118
+ def example_pending(example, pending_caller, message="Not Yet Implemented")
108
119
  @pending_count += 1
109
- formatters.each do |f|
110
- f.example_pending(example, message)
120
+ formatters.each do |formatter|
121
+ if formatter_uses_deprecated_example_pending_method?(formatter)
122
+ Kernel.warn EXAMPLE_PENDING_DEPRECATION_WARNING
123
+ formatter.example_pending(example, message)
124
+ else
125
+ formatter.example_pending(example, message, pending_caller)
126
+ end
111
127
  end
112
128
  end
113
129
 
130
+ def formatter_uses_deprecated_example_pending_method?(formatter)
131
+ formatter.method(:example_pending).arity == 2
132
+ end
133
+
114
134
  class Failure
115
135
  attr_reader :example, :exception
116
136
 
@@ -11,7 +11,7 @@ module Spec
11
11
  def spec_name_for(file, line_number)
12
12
  best_match.clear
13
13
  file = File.expand_path(file)
14
- rspec_options.example_groups.each do |example_group|
14
+ Spec::Runner.options.example_groups.each do |example_group|
15
15
  consider_example_groups_for_best_match example_group, file, line_number
16
16
 
17
17
  example_group.examples.each do |example|
@@ -10,8 +10,7 @@ module Spec
10
10
  module Runner
11
11
  class << self
12
12
  def run_options # :nodoc:
13
- rspec_options
14
- # @run_options ||= ::Spec::Runner::OptionParser.parse(ARGV, $stderr, $stdout)
13
+ Spec::Runner.options
15
14
  end
16
15
 
17
16
  def story_runner # :nodoc:
@@ -38,6 +38,14 @@
38
38
  current_scenario.add_step Step.new('Then', name)
39
39
  end
40
40
 
41
+ def last_step
42
+ current_scenario.last_step
43
+ end
44
+
45
+ def add_to_last(name)
46
+ last_step.name << name
47
+ end
48
+
41
49
  def run_stories
42
50
  stories.each { |story| @runner.instance_eval(&story) }
43
51
  end
@@ -100,9 +108,15 @@
100
108
  def add_step(step)
101
109
  @steps << step
102
110
  end
111
+
112
+ def last_step
113
+ @steps.last
114
+ end
103
115
  end
104
116
 
105
117
  class Step
118
+ attr_reader :name
119
+
106
120
  def initialize(type, name)
107
121
  @type = type
108
122
  @name = name
@@ -26,6 +26,7 @@ module Spec
26
26
  def process_line(line)
27
27
  line.strip!
28
28
  case line
29
+ when /^#/ then @state.comment(line)
29
30
  when /^Story: / then @state.story(line)
30
31
  when /^Scenario: / then @state.scenario(line)
31
32
  when /^Given:? / then @state.given(line)
@@ -72,6 +73,10 @@ module Spec
72
73
  def create_then(name)
73
74
  @story_mediator.create_then(name)
74
75
  end
76
+
77
+ def add_to_last(line)
78
+ @story_mediator.add_to_last("\n#{line}")
79
+ end
75
80
 
76
81
  def transition_to(key)
77
82
  @state = states[key]
@@ -136,6 +141,9 @@ module Spec
136
141
  def other(line)
137
142
  # no-op - supports header text before the first story in a file
138
143
  end
144
+
145
+ def comment(line)
146
+ end
139
147
  end
140
148
 
141
149
  class StartingState < State
@@ -199,6 +207,10 @@ module Spec
199
207
  def given(line)
200
208
  @parser.create_given(remove_tag_from(:given, line))
201
209
  end
210
+
211
+ def other(line)
212
+ @parser.add_to_last(line)
213
+ end
202
214
  end
203
215
 
204
216
  class WhenState < State
@@ -209,6 +221,10 @@ module Spec
209
221
  def event(line)
210
222
  @parser.create_when(remove_tag_from(:when ,line))
211
223
  end
224
+
225
+ def other(line)
226
+ @parser.add_to_last(line)
227
+ end
212
228
  end
213
229
 
214
230
  class ThenState < State
@@ -219,6 +235,10 @@ module Spec
219
235
  def outcome(line)
220
236
  @parser.create_then(remove_tag_from(:then ,line))
221
237
  end
238
+
239
+ def other(line)
240
+ @parser.add_to_last(line)
241
+ end
222
242
  end
223
243
 
224
244
  end