rspec 1.1.12 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. data/.autotest +2 -1
  2. data/.document +7 -0
  3. data/History.txt +58 -0
  4. data/License.txt +1 -1
  5. data/Manifest.txt +45 -82
  6. data/README.txt +3 -6
  7. data/Rakefile +33 -13
  8. data/Ruby1.9.markdown +32 -0
  9. data/TODO.txt +10 -4
  10. data/Upgrade.markdown +63 -0
  11. data/bin/spec +1 -1
  12. data/cucumber.yml +3 -0
  13. data/examples/failing/{failing_autogenerated_docstrings_example.rb → failing_implicit_docstrings_example.rb} +0 -0
  14. data/examples/failing/pending_example.rb +9 -0
  15. data/examples/failing/spec_helper.rb +1 -1
  16. data/examples/passing/{custom_expectation_matchers.rb → custom_matchers.rb} +0 -0
  17. data/examples/passing/filtered_formatter.rb +18 -0
  18. data/examples/passing/filtered_formatter_example.rb +31 -0
  19. data/examples/passing/implicit_docstrings_example.rb +18 -0
  20. data/examples/passing/spec_helper.rb +1 -1
  21. data/examples/ruby1.9.compatibility/access_to_constants_spec.rb +17 -18
  22. data/features/before_and_after_blocks/before_and_after_blocks.feature +4 -4
  23. data/features/example_groups/example_group_with_should_methods.feature +1 -1
  24. data/features/example_groups/{autogenerated_docstrings.feature → implicit_docstrings.feature} +7 -9
  25. data/features/example_groups/nested_groups.feature +1 -1
  26. data/features/heckle/heckle.feature +56 -0
  27. data/features/interop/examples_and_tests_together.feature +1 -1
  28. data/features/interop/test_but_not_test_unit.feature +1 -1
  29. data/features/interop/test_case_with_should_methods.feature +1 -1
  30. data/features/matchers/create_matcher.feature +115 -0
  31. data/features/mock_framework_integration/use_flexmock.feature +22 -4
  32. data/features/mock_framework_integration/use_mocha.feature +27 -0
  33. data/features/mock_framework_integration/use_rr.feature +27 -0
  34. data/features/mocks/mix_stubs_and_mocks.feature +22 -0
  35. data/features/pending/pending_examples.feature +81 -0
  36. data/features/step_definitions/running_rspec.rb +5 -3
  37. data/features/support/env.rb +1 -1
  38. data/features/support/matchers/smart_match.rb +2 -2
  39. data/lib/autotest/rspec.rb +1 -1
  40. data/lib/spec.rb +1 -1
  41. data/lib/{adapters → spec/adapters}/mock_frameworks/flexmock.rb +0 -0
  42. data/lib/{adapters → spec/adapters}/mock_frameworks/mocha.rb +0 -0
  43. data/lib/{adapters → spec/adapters}/mock_frameworks/rr.rb +0 -0
  44. data/lib/{adapters → spec/adapters}/mock_frameworks/rspec.rb +0 -1
  45. data/lib/spec/autorun.rb +3 -0
  46. data/lib/spec/dsl.rb +3 -1
  47. data/lib/spec/dsl/matchers.rb +13 -0
  48. data/lib/spec/example.rb +4 -0
  49. data/lib/spec/example/before_and_after_hooks.rb +5 -20
  50. data/lib/spec/example/errors.rb +3 -3
  51. data/lib/spec/example/example_description.rb +15 -0
  52. data/lib/spec/example/example_group.rb +0 -15
  53. data/lib/spec/example/example_group_factory.rb +34 -46
  54. data/lib/spec/example/example_group_hierarchy.rb +53 -0
  55. data/lib/spec/example/example_group_methods.rb +101 -211
  56. data/lib/spec/example/example_methods.rb +61 -81
  57. data/lib/spec/example/module_reopening_fix.rb +23 -1
  58. data/lib/spec/example/pending.rb +3 -2
  59. data/lib/spec/example/predicate_matchers.rb +47 -0
  60. data/lib/spec/example/subject.rb +91 -0
  61. data/lib/spec/expectations.rb +1 -1
  62. data/lib/spec/expectations/differs/default.rb +0 -1
  63. data/lib/spec/expectations/extensions.rb +0 -1
  64. data/lib/spec/expectations/handler.rb +13 -6
  65. data/lib/spec/interop/test.rb +5 -0
  66. data/lib/spec/interop/test/unit/testcase.rb +5 -22
  67. data/lib/spec/matchers.rb +22 -8
  68. data/lib/spec/matchers/be.rb +4 -9
  69. data/lib/spec/matchers/be_close.rb +20 -5
  70. data/lib/spec/matchers/be_instance_of.rb +45 -0
  71. data/lib/spec/matchers/be_kind_of.rb +45 -0
  72. data/lib/spec/matchers/change.rb +8 -6
  73. data/lib/spec/matchers/compatibility.rb +14 -0
  74. data/lib/spec/matchers/eql.rb +24 -6
  75. data/lib/spec/matchers/equal.rb +24 -6
  76. data/lib/spec/matchers/exist.rb +21 -5
  77. data/lib/spec/matchers/extensions/instance_exec.rb +25 -0
  78. data/lib/spec/matchers/generated_descriptions.rb +2 -2
  79. data/lib/spec/matchers/has.rb +28 -11
  80. data/lib/spec/matchers/have.rb +2 -2
  81. data/lib/spec/matchers/include.rb +2 -2
  82. data/lib/spec/matchers/match.rb +25 -7
  83. data/lib/spec/matchers/match_array.rb +3 -3
  84. data/lib/spec/matchers/matcher.rb +51 -0
  85. data/lib/spec/matchers/method_missing.rb +2 -2
  86. data/lib/spec/matchers/operator_matcher.rb +12 -5
  87. data/lib/spec/matchers/raise_error.rb +3 -3
  88. data/lib/spec/matchers/respond_to.rb +3 -3
  89. data/lib/spec/matchers/satisfy.rb +7 -7
  90. data/lib/spec/matchers/throw_symbol.rb +3 -5
  91. data/lib/spec/mocks.rb +3 -3
  92. data/lib/spec/mocks/argument_expectation.rb +15 -15
  93. data/lib/spec/mocks/{argument_constraints.rb → argument_matchers.rb} +19 -23
  94. data/lib/spec/mocks/error_generator.rb +5 -8
  95. data/lib/spec/mocks/framework.rb +1 -1
  96. data/lib/spec/mocks/message_expectation.rb +5 -13
  97. data/lib/spec/mocks/mock.rb +4 -5
  98. data/lib/spec/mocks/proxy.rb +9 -5
  99. data/lib/spec/mocks/spec_methods.rb +10 -1
  100. data/lib/spec/rake/spectask.rb +0 -1
  101. data/lib/spec/runner.rb +6 -28
  102. data/lib/spec/runner/configuration.rb +3 -3
  103. data/lib/spec/runner/drb_command_line.rb +2 -1
  104. data/lib/spec/runner/example_group_runner.rb +3 -2
  105. data/lib/spec/runner/formatter/base_text_formatter.rb +34 -19
  106. data/lib/spec/runner/formatter/failing_example_groups_formatter.rb +3 -5
  107. data/lib/spec/runner/formatter/html_formatter.rb +2 -3
  108. data/lib/spec/runner/formatter/nested_text_formatter.rb +7 -25
  109. data/lib/spec/runner/formatter/progress_bar_formatter.rb +1 -1
  110. data/lib/spec/runner/formatter/snippet_extractor.rb +1 -1
  111. data/lib/spec/runner/formatter/specdoc_formatter.rb +1 -7
  112. data/lib/spec/runner/heckle_runner.rb +3 -6
  113. data/lib/spec/runner/heckle_runner_unsupported.rb +1 -1
  114. data/lib/spec/runner/option_parser.rb +19 -21
  115. data/lib/spec/runner/options.rb +32 -27
  116. data/lib/spec/runner/reporter.rb +8 -9
  117. data/lib/spec/test/unit.rb +10 -0
  118. data/lib/spec/version.rb +2 -2
  119. data/{features/support → resources}/helpers/cmdline.rb +2 -2
  120. data/resources/rake/verify_rcov.rake +1 -1
  121. data/resources/spec/example_group_with_should_methods.rb +1 -1
  122. data/resources/spec/simple_spec.rb +1 -1
  123. data/resources/test/spec_and_test_together.rb +2 -3
  124. data/resources/test/spec_including_test_but_not_unit.rb +1 -1
  125. data/resources/test/test_case_with_should_methods.rb +2 -3
  126. data/spec/autotest/autotest_helper.rb +0 -1
  127. data/spec/autotest/rspec_spec.rb +95 -98
  128. data/spec/spec/dsl/main_spec.rb +3 -3
  129. data/spec/spec/dsl/matchers_spec.rb +25 -0
  130. data/spec/spec/example/example_group_class_definition_spec.rb +14 -15
  131. data/spec/spec/example/example_group_factory_spec.rb +31 -44
  132. data/spec/spec/example/example_group_methods_spec.rb +86 -52
  133. data/spec/spec/example/example_group_spec.rb +32 -79
  134. data/spec/spec/example/example_matcher_spec.rb +10 -10
  135. data/spec/spec/example/example_methods_spec.rb +108 -242
  136. data/spec/spec/example/nested_example_group_spec.rb +2 -2
  137. data/spec/spec/example/pending_module_spec.rb +66 -41
  138. data/spec/spec/example/shared_example_group_spec.rb +4 -4
  139. data/spec/spec/{matchers → expectations}/handler_spec.rb +52 -4
  140. data/spec/spec/interop/test/unit/resources/spec_that_fails.rb +2 -2
  141. data/spec/spec/interop/test/unit/resources/spec_that_passes.rb +2 -2
  142. data/spec/spec/interop/test/unit/resources/spec_with_errors.rb +2 -2
  143. data/spec/spec/interop/test/unit/resources/spec_with_options_hash.rb +2 -2
  144. data/spec/spec/interop/test/unit/resources/test_case_that_fails.rb +2 -2
  145. data/spec/spec/interop/test/unit/resources/test_case_that_passes.rb +2 -2
  146. data/spec/spec/interop/test/unit/resources/test_case_with_errors.rb +2 -2
  147. data/spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb +2 -2
  148. data/spec/spec/interop/test/unit/testcase_spec.rb +0 -4
  149. data/spec/spec/matchers/be_close_spec.rb +1 -1
  150. data/spec/spec/matchers/be_instance_of_spec.rb +29 -0
  151. data/spec/spec/matchers/be_kind_of_spec.rb +29 -0
  152. data/spec/spec/matchers/change_spec.rb +20 -0
  153. data/spec/spec/matchers/compatibility_spec.rb +34 -0
  154. data/spec/spec/matchers/description_generation_spec.rb +0 -12
  155. data/spec/spec/matchers/eql_spec.rb +2 -2
  156. data/spec/spec/matchers/equal_spec.rb +2 -2
  157. data/spec/spec/matchers/exist_spec.rb +8 -4
  158. data/spec/spec/matchers/have_spec.rb +4 -4
  159. data/spec/spec/matchers/match_spec.rb +2 -2
  160. data/spec/spec/matchers/matcher_methods_spec.rb +1 -1
  161. data/spec/spec/matchers/matcher_spec.rb +97 -0
  162. data/spec/spec/matchers/throw_symbol_spec.rb +8 -8
  163. data/spec/spec/mocks/{bug_report_496.rb → bug_report_496_spec.rb} +0 -0
  164. data/spec/spec/mocks/{failing_mock_argument_constraints_spec.rb → failing_argument_matchers_spec.rb} +2 -2
  165. data/spec/spec/mocks/hash_including_matcher_spec.rb +4 -4
  166. data/spec/spec/mocks/hash_not_including_matcher_spec.rb +3 -3
  167. data/spec/spec/mocks/mock_spec.rb +27 -2
  168. data/spec/spec/mocks/nil_expectation_warning_spec.rb +1 -1
  169. data/spec/spec/mocks/partial_mock_spec.rb +18 -3
  170. data/spec/spec/mocks/{passing_mock_argument_constraints_spec.rb → passing_argument_matchers_spec.rb} +6 -6
  171. data/spec/spec/mocks/stubbed_message_expectations_spec.rb +13 -1
  172. data/spec/spec/package/bin_spec_spec.rb +2 -2
  173. data/spec/spec/runner/configuration_spec.rb +12 -12
  174. data/spec/spec/runner/drb_command_line_spec.rb +71 -73
  175. data/spec/spec/runner/formatter/base_text_formatter_spec.rb +82 -1
  176. data/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +8 -8
  177. data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +4 -4
  178. data/spec/spec/runner/formatter/html_formatted-1.8.6.html +8 -8
  179. data/spec/spec/runner/formatter/html_formatted-1.8.7.html +38 -26
  180. data/spec/spec/runner/formatter/html_formatted-1.9.1.html +61 -53
  181. data/spec/spec/runner/formatter/html_formatter_spec.rb +100 -48
  182. data/spec/spec/runner/formatter/nested_text_formatter_spec.rb +20 -34
  183. data/spec/spec/runner/formatter/profile_formatter_spec.rb +2 -1
  184. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +9 -6
  185. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +6 -6
  186. data/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +20 -20
  187. data/spec/spec/runner/formatter/text_mate_formatted-1.8.7.html +38 -26
  188. data/spec/spec/runner/formatter/text_mate_formatted-1.9.1.html +55 -47
  189. data/spec/spec/runner/formatter/{spec_mate_formatter_spec.rb → text_mate_formatter_spec.rb} +11 -9
  190. data/spec/spec/runner/heckle_runner_spec.rb +1 -1
  191. data/spec/spec/runner/heckler_spec.rb +1 -1
  192. data/spec/spec/runner/option_parser_spec.rb +28 -11
  193. data/spec/spec/runner/options_spec.rb +34 -0
  194. data/spec/spec/runner/reporter_spec.rb +66 -62
  195. data/spec/spec/runner/resources/utf8_encoded.rb +1 -0
  196. data/spec/spec/runner/spec_drb.opts +1 -0
  197. data/spec/spec/runner_spec.rb +7 -5
  198. data/spec/spec_helper.rb +24 -2
  199. metadata +49 -90
  200. data/examples/passing/autogenerated_docstrings_example.rb +0 -25
  201. data/examples/passing/before_and_after_example.rb +0 -40
  202. data/examples/passing/behave_as_example.rb +0 -45
  203. data/examples/passing/legacy_spec.rb +0 -11
  204. data/examples/passing/priority.txt +0 -1
  205. data/features/support/helpers/story_helper.rb +0 -16
  206. data/lib/spec/expectations/extensions/string_and_symbol.rb +0 -17
  207. data/lib/spec/runner/formatter/story/html_formatter.rb +0 -174
  208. data/lib/spec/runner/formatter/story/plain_text_formatter.rb +0 -194
  209. data/lib/spec/runner/formatter/story/progress_bar_formatter.rb +0 -42
  210. data/lib/spec/story.rb +0 -10
  211. data/lib/spec/story/extensions.rb +0 -3
  212. data/lib/spec/story/extensions/main.rb +0 -86
  213. data/lib/spec/story/extensions/regexp.rb +0 -9
  214. data/lib/spec/story/extensions/string.rb +0 -9
  215. data/lib/spec/story/given_scenario.rb +0 -14
  216. data/lib/spec/story/runner.rb +0 -57
  217. data/lib/spec/story/runner/plain_text_story_runner.rb +0 -48
  218. data/lib/spec/story/runner/scenario_collector.rb +0 -18
  219. data/lib/spec/story/runner/scenario_runner.rb +0 -54
  220. data/lib/spec/story/runner/story_mediator.rb +0 -137
  221. data/lib/spec/story/runner/story_parser.rb +0 -247
  222. data/lib/spec/story/runner/story_runner.rb +0 -74
  223. data/lib/spec/story/scenario.rb +0 -14
  224. data/lib/spec/story/step.rb +0 -70
  225. data/lib/spec/story/step_group.rb +0 -89
  226. data/lib/spec/story/step_mother.rb +0 -38
  227. data/lib/spec/story/story.rb +0 -39
  228. data/lib/spec/story/world.rb +0 -124
  229. data/resources/spec/spec_with_flexmock.rb +0 -19
  230. data/rspec.gemspec +0 -32
  231. data/spec/spec/matchers/mock_constraint_matchers_spec.rb +0 -24
  232. data/spec/spec/runner/formatter/story/html_formatter_spec.rb +0 -135
  233. data/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +0 -600
  234. data/spec/spec/runner/formatter/story/progress_bar_formatter_spec.rb +0 -82
  235. data/spec/spec/spec_spec.rb +0 -21
  236. data/spec/spec/story/builders.rb +0 -46
  237. data/spec/spec/story/extensions/main_spec.rb +0 -161
  238. data/spec/spec/story/extensions_spec.rb +0 -14
  239. data/spec/spec/story/given_scenario_spec.rb +0 -27
  240. data/spec/spec/story/runner/plain_text_story_runner_spec.rb +0 -90
  241. data/spec/spec/story/runner/scenario_collector_spec.rb +0 -27
  242. data/spec/spec/story/runner/scenario_runner_spec.rb +0 -214
  243. data/spec/spec/story/runner/story_mediator_spec.rb +0 -143
  244. data/spec/spec/story/runner/story_parser_spec.rb +0 -401
  245. data/spec/spec/story/runner/story_runner_spec.rb +0 -294
  246. data/spec/spec/story/runner_spec.rb +0 -93
  247. data/spec/spec/story/scenario_spec.rb +0 -18
  248. data/spec/spec/story/step_group_spec.rb +0 -157
  249. data/spec/spec/story/step_mother_spec.rb +0 -84
  250. data/spec/spec/story/step_spec.rb +0 -272
  251. data/spec/spec/story/story_helper.rb +0 -2
  252. data/spec/spec/story/story_spec.rb +0 -84
  253. data/spec/spec/story/world_spec.rb +0 -423
  254. data/story_server/prototype/javascripts/builder.js +0 -136
  255. data/story_server/prototype/javascripts/controls.js +0 -972
  256. data/story_server/prototype/javascripts/dragdrop.js +0 -976
  257. data/story_server/prototype/javascripts/effects.js +0 -1117
  258. data/story_server/prototype/javascripts/prototype.js +0 -4140
  259. data/story_server/prototype/javascripts/rspec.js +0 -149
  260. data/story_server/prototype/javascripts/scriptaculous.js +0 -58
  261. data/story_server/prototype/javascripts/slider.js +0 -276
  262. data/story_server/prototype/javascripts/sound.js +0 -55
  263. data/story_server/prototype/javascripts/unittest.js +0 -568
  264. data/story_server/prototype/lib/server.rb +0 -24
  265. data/story_server/prototype/stories.html +0 -176
  266. data/story_server/prototype/stylesheets/rspec.css +0 -136
  267. data/story_server/prototype/stylesheets/test.css +0 -90
@@ -43,7 +43,7 @@ function makeYellow(element_id) {
43
43
  </script>
44
44
  <style type="text/css">
45
45
  #rspec-header {
46
- background: #65C400; color: #fff; height: 42px;
46
+ background: #65C400; color: #fff; height: 4em;
47
47
  }
48
48
 
49
49
  .rspec-report h1 {
@@ -51,7 +51,7 @@ function makeYellow(element_id) {
51
51
  padding: 10px;
52
52
  font-family: "Lucida Grande", Helvetica, sans-serif;
53
53
  font-size: 1.8em;
54
- float: left;
54
+ position: absolute;
55
55
  }
56
56
 
57
57
  #summary {
@@ -192,14 +192,15 @@ a {
192
192
  <div class="failure" id="failure_1">
193
193
  <div class="message"><pre>Mock 'poke me' expected :poke with (any args) once, but received it 0 times</pre></div>
194
194
  <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb&line=13">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb:13</a> :in `block (2 levels) in <top (required)>'
195
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=51">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:51</a> :in `block (4 levels) in <module:Formatter>'
196
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `chdir'
197
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
198
- <pre class="ruby"><code><span class="linenum">11</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">should fail when expected message not received</span><span class="punct">&quot;</span> <span class="keyword">do</span>
199
- <span class="linenum">12</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">(&quot;</span><span class="string">poke me</span><span class="punct">&quot;)</span>
200
- <span class="offending"><span class="linenum">13</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(</span><span class="symbol">:poke</span><span class="punct">)</span></span>
201
- <span class="linenum">14</span> <span class="keyword">end</span>
202
- <span class="linenum">15</span> </code></pre>
195
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
196
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
197
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
198
+ <pre class="ruby"><code><span class="linenum">11</span> it "should fail when expected message not received" do
199
+ <span class="linenum">12</span> mock = mock("poke me")
200
+ <span class="offending"><span class="linenum">13</span> mock.should_receive(:poke)</span>
201
+ <span class="linenum">14</span> end
202
+ <span class="linenum">15</span>
203
+ <span class="linenum">16</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
203
204
  </div>
204
205
  </dd>
205
206
  <script type="text/javascript">moveProgressBar('17.6');</script>
@@ -208,14 +209,15 @@ a {
208
209
  <div class="failure" id="failure_2">
209
210
  <div class="message"><pre>Mock 'one two three' received :three out of order</pre></div>
210
211
  <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb&line=22">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb:22</a> :in `block (2 levels) in <top (required)>'
211
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=51">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:51</a> :in `block (4 levels) in <module:Formatter>'
212
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `chdir'
213
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
214
- <pre class="ruby"><code><span class="linenum">20</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(</span><span class="symbol">:three</span><span class="punct">).</span><span class="ident">ordered</span>
215
- <span class="linenum">21</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">one</span>
216
- <span class="offending"><span class="linenum">22</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">three</span></span>
217
- <span class="linenum">23</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">two</span>
218
- <span class="linenum">24</span> <span class="keyword">end</span></code></pre>
212
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
213
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
214
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
215
+ <pre class="ruby"><code><span class="linenum">20</span> mock.should_receive(:three).ordered
216
+ <span class="linenum">21</span> mock.one
217
+ <span class="offending"><span class="linenum">22</span> mock.three</span>
218
+ <span class="linenum">23</span> mock.two
219
+ <span class="linenum">24</span> end
220
+ <span class="linenum">25</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
219
221
  </div>
220
222
  </dd>
221
223
  <script type="text/javascript">moveProgressBar('23.5');</script>
@@ -224,13 +226,15 @@ a {
224
226
  <div class="failure" id="failure_3">
225
227
  <div class="message"><pre>Mock 'don't talk to me' expected :any_message_at_all with (no args) 0 times, but received it once</pre></div>
226
228
  <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb&line=29">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb:29</a> :in `block (2 levels) in <top (required)>'
227
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=51">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:51</a> :in `block (4 levels) in <module:Formatter>'
228
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `chdir'
229
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
230
- <pre class="ruby"><code><span class="linenum">27</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">(&quot;</span><span class="string">don't talk to me</span><span class="punct">&quot;)</span>
231
- <span class="linenum">28</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">should_not_receive</span><span class="punct">(</span><span class="symbol">:any_message_at_all</span><span class="punct">)</span>
232
- <span class="offending"><span class="linenum">29</span> <span class="ident">mock</span><span class="punct">.</span><span class="ident">any_message_at_all</span></span>
233
- <span class="linenum">30</span> <span class="keyword">end</span></code></pre>
229
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
230
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
231
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
232
+ <pre class="ruby"><code><span class="linenum">27</span> mock = mock("don't talk to me")
233
+ <span class="linenum">28</span> mock.should_not_receive(:any_message_at_all)
234
+ <span class="offending"><span class="linenum">29</span> mock.any_message_at_all</span>
235
+ <span class="linenum">30</span> end
236
+ <span class="linenum">31</span>
237
+ <span class="linenum">32</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
234
238
  </div>
235
239
  </dd>
236
240
  <script type="text/javascript">moveProgressBar('29.4');</script>
@@ -239,14 +243,15 @@ a {
239
243
  <div class="failure" id="failure_4">
240
244
  <div class="message"><pre>Expected pending 'here is the bug' to fail. No Error was raised.</pre></div>
241
245
  <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb&line=33">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/mocking_example.rb:33</a> :in `block (2 levels) in <top (required)>'
242
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=51">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:51</a> :in `block (4 levels) in <module:Formatter>'
243
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `chdir'
244
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
246
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
247
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
248
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
245
249
  <pre class="ruby"><code><span class="linenum">31</span>
246
- <span class="linenum">32</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">has a bug we need to fix</span><span class="punct">&quot;</span> <span class="keyword">do</span>
247
- <span class="offending"><span class="linenum">33</span> <span class="ident">pending</span> <span class="punct">&quot;</span><span class="string">here is the bug</span><span class="punct">&quot;</span> <span class="keyword">do</span></span>
248
- <span class="linenum">34</span> <span class="comment"># Actually, no. It's fixed. This will fail because it passes :-)</span>
249
- <span class="linenum">35</span> <span class="ident">mock</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">(&quot;</span><span class="string">Bug</span><span class="punct">&quot;)</span></code></pre>
250
+ <span class="linenum">32</span> it "has a bug we need to fix" do
251
+ <span class="offending"><span class="linenum">33</span> pending "here is the bug" do</span>
252
+ <span class="linenum">34</span> # Actually, no. It's fixed. This will fail because it passes :-)
253
+ <span class="linenum">35</span> mock = mock("Bug")
254
+ <span class="linenum">36</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
250
255
  </div>
251
256
  </dd>
252
257
  </dl>
@@ -269,13 +274,15 @@ Diff:
269
274
  framework for Ruby
270
275
  </pre></div>
271
276
  <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/diffing_spec.rb&line=13">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/diffing_spec.rb:13</a> :in `block (2 levels) in <top (required)>'
272
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=51">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:51</a> :in `block (4 levels) in <module:Formatter>'
273
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `chdir'
274
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
275
- <pre class="ruby"><code><span class="linenum">11</span><span class="ident">framework</span> <span class="keyword">for</span> <span class="constant">Ruby</span>
276
- <span class="linenum">12</span><span class="constant">EOF</span>
277
- <span class="offending"><span class="linenum">13</span> <span class="ident">usa</span><span class="punct">.</span><span class="ident">should</span> <span class="punct">==</span> <span class="ident">uk</span></span>
278
- <span class="linenum">14</span> <span class="keyword">end</span></code></pre>
277
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
278
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
279
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
280
+ <pre class="ruby"><code><span class="linenum">11</span>framework for Ruby
281
+ <span class="linenum">12</span>EOF
282
+ <span class="offending"><span class="linenum">13</span> usa.should == uk</span>
283
+ <span class="linenum">14</span> end
284
+ <span class="linenum">15</span>
285
+ <span class="linenum">16</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
279
286
  </div>
280
287
  </dd>
281
288
  <script type="text/javascript">moveProgressBar('41.1');</script>
@@ -300,14 +307,15 @@ Diff:
300
307
  &gt;
301
308
  </pre></div>
302
309
  <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/diffing_spec.rb&line=34">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/examples/failing/diffing_spec.rb:34</a> :in `block (2 levels) in <top (required)>'
303
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=51">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:51</a> :in `block (4 levels) in <module:Formatter>'
304
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `chdir'
305
- <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb&line=47">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb:47</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
306
- <pre class="ruby"><code><span class="linenum">32</span> <span class="ident">expected</span> <span class="punct">=</span> <span class="constant">Animal</span><span class="punct">.</span><span class="ident">new</span> <span class="punct">&quot;</span><span class="string">bob</span><span class="punct">&quot;,</span> <span class="punct">&quot;</span><span class="string">giraffe</span><span class="punct">&quot;</span>
307
- <span class="linenum">33</span> <span class="ident">actual</span> <span class="punct">=</span> <span class="constant">Animal</span><span class="punct">.</span><span class="ident">new</span> <span class="punct">&quot;</span><span class="string">bob</span><span class="punct">&quot;,</span> <span class="punct">&quot;</span><span class="string">tortoise</span><span class="punct">&quot;</span>
308
- <span class="offending"><span class="linenum">34</span> <span class="ident">expected</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eql</span><span class="punct">(</span><span class="ident">actual</span><span class="punct">)</span></span>
309
- <span class="linenum">35</span> <span class="keyword">end</span>
310
- <span class="linenum">36</span><span class="keyword">end</span></code></pre>
310
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=49">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:49</a> :in `block (4 levels) in <module:Formatter>'
311
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `chdir'
312
+ <a href="txmt://open?url=file:///Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb&line=45">/Users/david/projects/ruby/rspec-dev/example_rails_app/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatter_spec.rb:45</a> :in `block (3 levels) in <module:Formatter>'</pre></div>
313
+ <pre class="ruby"><code><span class="linenum">32</span> expected = Animal.new "bob", "giraffe"
314
+ <span class="linenum">33</span> actual = Animal.new "bob", "tortoise"
315
+ <span class="offending"><span class="linenum">34</span> expected.should eql(actual)</span>
316
+ <span class="linenum">35</span> end
317
+ <span class="linenum">36</span>end
318
+ <span class="linenum">37</span><span class="comment"># gem install syntax to get syntax highlighting</span></code></pre>
311
319
  </div>
312
320
  </dd>
313
321
  </dl>
@@ -1,10 +1,8 @@
1
1
  require File.dirname(__FILE__) + '/../../../spec_helper'
2
- begin
3
- require 'nokogiri' # Needed to compare generated with wanted HTML
4
- rescue LoadError
5
- warn "nokogiri not loaded -- skipping TextMateFormatter specs"
6
- return
7
- end
2
+
3
+ begin # See rescue all the way at the bottom
4
+
5
+ require 'nokogiri' # Needed to compare generated with wanted HTML
8
6
  require 'spec/runner/formatter/text_mate_formatter'
9
7
 
10
8
  module Spec
@@ -51,10 +49,10 @@ module Spec
51
49
  # Spec::Runner::CommandLine.run(
52
50
  # ::Spec::Runner::OptionParser.parse(args, err, out)
53
51
  # )
54
- #
52
+ #
55
53
  # seconds = /\d+\.\d+ seconds/
56
54
  # html = out.string.gsub seconds, 'x seconds'
57
- #
55
+ #
58
56
  # File.open(expected_file, 'w') {|io| io.write(html)}
59
57
  # end
60
58
  # end
@@ -64,7 +62,7 @@ module Spec
64
62
  it "should produce HTML identical to the one we designed manually with --diff" do
65
63
  produces_html_identical_to_manually_designed_document("--diff") do |html|
66
64
  suffix = jruby? ? '-jruby' : ''
67
- expected_file = File.dirname(__FILE__) + "/text_mate_formatted-#{::VERSION}#{suffix}.html"
65
+ expected_file = File.dirname(__FILE__) + "/text_mate_formatted-#{::RUBY_VERSION}#{suffix}.html"
68
66
  unless File.file?(expected_file)
69
67
  raise "There is no HTML file with expected content for this platform: #{expected_file}"
70
68
  end
@@ -102,3 +100,7 @@ module Spec
102
100
  end
103
101
  end
104
102
  end
103
+
104
+ rescue LoadError
105
+ warn "nokogiri not loaded -- skipping TextMateFormatter specs"
106
+ end
@@ -1,5 +1,5 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
- unless [/mswin/, /java/].detect{|p| p =~ RUBY_PLATFORM}
2
+ unless [/mswin/, /java/].detect{|p| p =~ RUBY_PLATFORM} || Spec::Ruby.version.to_f == 1.9
3
3
  require 'spec/runner/heckle_runner'
4
4
 
5
5
  module Foo
@@ -1,4 +1,4 @@
1
- unless Spec::Ruby.version.to_f == 1.9
1
+ if Spec::Ruby.version.to_f < 1.9
2
2
  require File.dirname(__FILE__) + '/../../spec_helper.rb'
3
3
  unless [/mswin/, /java/].detect{|p| p =~ RUBY_PLATFORM}
4
4
  require 'spec/runner/heckle_runner'
@@ -144,19 +144,19 @@ describe "OptionParser" do
144
144
  options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
145
145
  end
146
146
 
147
- it "should use html story formatter when format is h" do
148
- options = parse(["--format", "h"])
149
- options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter)
150
- end
151
-
152
147
  it "should use html formatter when format is html" do
153
148
  options = parse(["--format", "html"])
154
149
  options.formatters[0].class.should equal(Spec::Runner::Formatter::HtmlFormatter)
155
150
  end
156
151
 
157
- it "should use html story formatter when format is html" do
158
- options = parse(["--format", "html"])
159
- options.story_formatters[0].class.should equal(Spec::Runner::Formatter::Story::HtmlFormatter)
152
+ it "should use base formatter when format is s" do
153
+ options = parse(["--format", "l"])
154
+ options.formatters[0].class.should equal(Spec::Runner::Formatter::BaseFormatter)
155
+ end
156
+
157
+ it "should use base formatter when format is silent" do
158
+ options = parse(["--format", "silent"])
159
+ options.formatters[0].class.should equal(Spec::Runner::Formatter::BaseFormatter)
160
160
  end
161
161
 
162
162
  it "should use html formatter with explicit output when format is html:test.html" do
@@ -299,7 +299,13 @@ describe "OptionParser" do
299
299
  it "should barf when --heckle is specified (and platform is windows)" do
300
300
  lambda do
301
301
  options = parse(["--heckle", "Spec"])
302
- end.should raise_error(StandardError, "Heckle not supported on Windows")
302
+ end.should raise_error(StandardError, /Heckle is not supported/)
303
+ end
304
+ elsif Spec::Ruby.version.to_f == 1.9
305
+ it "should barf when --heckle is specified (and platform is Ruby 1.9)" do
306
+ lambda do
307
+ options = parse(["--heckle", "Spec"])
308
+ end.should raise_error(StandardError, /Heckle is not supported/)
303
309
  end
304
310
  else
305
311
  it "should heckle when --heckle is specified (and platform is not windows)" do
@@ -320,11 +326,17 @@ describe "OptionParser" do
320
326
  end
321
327
 
322
328
  it "should run parse drb after parsing options" do
323
- @parser.stub!(:parse_drb)
324
- @parser.should_receive(:parse_drb).with(["--drb"]).and_return(true)
329
+ @parser.should_receive(:parse_drb).with(no_args).and_return(true)
325
330
  options = parse(["--options", File.dirname(__FILE__) + "/spec_drb.opts"])
326
331
  end
327
332
 
333
+ it "should send all the arguments others than --drb back to the parser after parsing options" do
334
+ Spec::Runner::DrbCommandLine.should_receive(:run).and_return do |options|
335
+ options.argv.should == ["example_file.rb", "--colour"]
336
+ end
337
+ options = parse(["example_file.rb", "--options", File.dirname(__FILE__) + "/spec_drb.opts"])
338
+ end
339
+
328
340
  it "should read spaced and multi-line options from file when --options is specified" do
329
341
  options = parse(["--options", File.dirname(__FILE__) + "/spec_spaced.opts"])
330
342
  options.diff_format.should_not be_nil
@@ -403,4 +415,9 @@ describe "OptionParser" do
403
415
  options = parse(["--runner", "Custom::ExampleGroupRunner:something"])
404
416
  options.run_examples
405
417
  end
418
+
419
+ it "sets options.autospec to true with --autospec" do
420
+ options = parse(["--autospec"])
421
+ options.autospec.should be(true)
422
+ end
406
423
  end
@@ -312,6 +312,40 @@ module Spec
312
312
  end
313
313
 
314
314
  describe "#run_examples" do
315
+ describe "with global predicate matchers" do
316
+ it "defines global predicate matcher methods on ExampleMethods" do
317
+ Spec::Runner.configuration.stub!(:predicate_matchers).and_return({:this => :that?})
318
+ group = Class.new(::Spec::Example::ExampleGroupDouble).describe("Some Examples")
319
+ example = group.new("")
320
+
321
+ @options.run_examples
322
+ example.this
323
+ end
324
+
325
+ after(:each) do
326
+ Spec::Example::ExampleMethods.class_eval "undef :this"
327
+ end
328
+ end
329
+
330
+ describe "with a mock framework defined as a Symbol" do
331
+ it "includes Spec::Adapters::MockFramework" do
332
+ Spec::Runner.configuration.stub!(:mock_framework).and_return('spec/adapters/mock_frameworks/rspec')
333
+
334
+ Spec::Example::ExampleMethods.should_receive(:include).with(Spec::Adapters::MockFramework)
335
+
336
+ @options.run_examples
337
+ end
338
+ end
339
+
340
+ describe "with a mock framework defined as a Module" do
341
+ it "includes the module in ExampleMethods" do
342
+ mod = Module.new
343
+ Spec::Runner.configuration.stub!(:mock_framework).and_return(mod)
344
+ Spec::Example::ExampleMethods.should_receive(:include).with(mod)
345
+ @options.run_examples
346
+ end
347
+ end
348
+
315
349
  describe "when not given a custom runner" do
316
350
  it "should use the standard" do
317
351
  runner = ::Spec::Runner::ExampleGroupRunner.new(@options)
@@ -13,15 +13,15 @@ module Spec
13
13
  options.formatters << formatter
14
14
  @reporter = Reporter.new(options)
15
15
  @example_group = create_example_group("example_group")
16
- reporter.add_example_group example_group
16
+ example_group.notify(reporter)
17
17
  end
18
18
 
19
19
  def failure
20
- Mocks::ArgumentConstraints::DuckTypeConstraint.new(:header, :exception)
20
+ Mocks::ArgumentMatchers::DuckTypeMatcher.new(:header, :exception)
21
21
  end
22
22
 
23
- def create_example_group(description_text)
24
- example_group = Spec::Example::ExampleGroup.describe(description_text) do
23
+ def create_example_group(text)
24
+ example_group = Spec::Example::ExampleGroup.describe(text) do
25
25
  it "should do something" do
26
26
  end
27
27
  end
@@ -31,12 +31,12 @@ module Spec
31
31
  it "should assign itself as the reporter to options" do
32
32
  options.reporter.should equal(@reporter)
33
33
  end
34
-
34
+
35
35
  it "should tell formatter when example_group is added" do
36
36
  formatter.should_receive(:add_example_group).with(example_group)
37
- reporter.add_example_group(example_group)
37
+ example_group.notify(reporter)
38
38
  end
39
-
39
+
40
40
  it "should handle multiple example_groups with same name" do
41
41
  formatter.should_receive(:add_example_group).exactly(3).times
42
42
  formatter.should_receive(:example_started).exactly(3).times
@@ -45,27 +45,31 @@ module Spec
45
45
  formatter.should_receive(:dump_pending)
46
46
  formatter.should_receive(:close).with(no_args)
47
47
  formatter.should_receive(:dump_summary).with(anything(), 3, 0, 0)
48
- reporter.add_example_group(create_example_group("example_group"))
49
- reporter.example_started("spec 1")
50
- reporter.example_finished("spec 1")
51
- reporter.add_example_group(create_example_group("example_group"))
52
- reporter.example_started("spec 2")
53
- reporter.example_finished("spec 2")
54
- reporter.add_example_group(create_example_group("example_group"))
55
- reporter.example_started("spec 3")
56
- reporter.example_finished("spec 3")
48
+ create_example_group("example_group").notify(reporter)
49
+ reporter.example_started(description_of("spec 1"))
50
+ reporter.example_finished(description_of("spec 1"))
51
+ create_example_group("example_group").notify(reporter)
52
+ reporter.example_started(description_of("spec 2"))
53
+ reporter.example_finished(description_of("spec 2"))
54
+ create_example_group("example_group").notify(reporter)
55
+ reporter.example_started(description_of("spec 3"))
56
+ reporter.example_finished(description_of("spec 3"))
57
57
  reporter.dump
58
58
  end
59
+
60
+ def description_of(example)
61
+ ::Spec::Example::ExampleDescription.new(String === example ? example : example.description)
62
+ end
59
63
 
60
64
  it "should handle multiple examples with the same name" do
61
65
  error=RuntimeError.new
62
- passing = ExampleGroup.new("example")
63
- failing = ExampleGroup.new("example")
66
+ passing = ::Spec::Example::ExampleGroupDouble.new("an example")
67
+ failing = ::Spec::Example::ExampleGroupDouble.new("an example")
64
68
 
65
69
  formatter.should_receive(:add_example_group).exactly(2).times
66
- formatter.should_receive(:example_passed).with(passing).exactly(2).times
67
- formatter.should_receive(:example_failed).with(failing, 1, failure)
68
- formatter.should_receive(:example_failed).with(failing, 2, failure)
70
+ formatter.should_receive(:example_passed).with(description_of(passing)).exactly(2).times
71
+ formatter.should_receive(:example_failed).with(description_of(failing), 1, failure)
72
+ formatter.should_receive(:example_failed).with(description_of(failing), 2, failure)
69
73
  formatter.should_receive(:dump_failure).exactly(2).times
70
74
  formatter.should_receive(:start_dump)
71
75
  formatter.should_receive(:dump_pending)
@@ -73,13 +77,13 @@ module Spec
73
77
  formatter.should_receive(:dump_summary).with(anything(), 4, 2, 0)
74
78
  backtrace_tweaker.should_receive(:tweak_backtrace).twice
75
79
 
76
- reporter.add_example_group(create_example_group("example_group"))
77
- reporter.example_finished(passing)
78
- reporter.example_finished(failing, error)
80
+ create_example_group("example_group").notify(reporter)
81
+ reporter.example_finished(description_of(passing))
82
+ reporter.example_finished(description_of(failing), error)
79
83
 
80
- reporter.add_example_group(create_example_group("example_group"))
81
- reporter.example_finished(passing)
82
- reporter.example_finished(failing, error)
84
+ create_example_group("example_group").notify(reporter)
85
+ reporter.example_finished(description_of(passing))
86
+ reporter.example_finished(description_of(failing), error)
83
87
  reporter.dump
84
88
  end
85
89
 
@@ -90,7 +94,7 @@ module Spec
90
94
  formatter.should_receive(:close).with(no_args)
91
95
  reporter.dump
92
96
  end
93
-
97
+
94
98
  it "should push time to formatter" do
95
99
  formatter.should_receive(:start).with(5)
96
100
  formatter.should_receive(:start_dump)
@@ -103,57 +107,57 @@ module Spec
103
107
  reporter.end
104
108
  reporter.dump
105
109
  end
106
-
110
+
107
111
  describe "reporting one passing example" do
108
112
  it "should tell formatter example passed" do
109
113
  formatter.should_receive(:example_passed)
110
- reporter.example_finished("example")
114
+ reporter.example_finished(description_of("example"))
111
115
  end
112
-
116
+
113
117
  it "should not delegate to backtrace tweaker" do
114
118
  formatter.should_receive(:example_passed)
115
119
  backtrace_tweaker.should_not_receive(:tweak_backtrace)
116
- reporter.example_finished("example")
120
+ reporter.example_finished(description_of("example"))
117
121
  end
118
-
122
+
119
123
  it "should account for passing example in stats" do
120
124
  formatter.should_receive(:example_passed)
121
125
  formatter.should_receive(:start_dump)
122
126
  formatter.should_receive(:dump_pending)
123
127
  formatter.should_receive(:dump_summary).with(anything(), 1, 0, 0)
124
128
  formatter.should_receive(:close).with(no_args)
125
- reporter.example_finished("example")
129
+ reporter.example_finished(description_of("example"))
126
130
  reporter.dump
127
131
  end
128
132
  end
129
-
133
+
130
134
  describe "reporting one failing example" do
131
135
  it "should tell formatter that example failed" do
132
136
  example = example_group.it("should do something") {}
133
137
  formatter.should_receive(:example_failed)
134
- reporter.example_finished(example, RuntimeError.new)
138
+ reporter.example_finished(description_of(example), RuntimeError.new)
135
139
  end
136
-
140
+
137
141
  it "should delegate to backtrace tweaker" do
138
142
  formatter.should_receive(:example_failed)
139
143
  backtrace_tweaker.should_receive(:tweak_backtrace)
140
- reporter.example_finished(ExampleGroup.new("example"), RuntimeError.new)
144
+ reporter.example_finished(description_of(ExampleGroup.new("example")), RuntimeError.new)
141
145
  end
142
-
146
+
143
147
  it "should account for failing example in stats" do
144
- example = ExampleGroup.new("example")
145
- formatter.should_receive(:example_failed).with(example, 1, failure)
148
+ example = ::Spec::Example::ExampleGroupDouble.new("example")
149
+ formatter.should_receive(:example_failed).with(description_of(example), 1, failure)
146
150
  formatter.should_receive(:start_dump)
147
151
  formatter.should_receive(:dump_pending)
148
152
  formatter.should_receive(:dump_failure).with(1, anything())
149
153
  formatter.should_receive(:dump_summary).with(anything(), 1, 1, 0)
150
154
  formatter.should_receive(:close).with(no_args)
151
- reporter.example_finished(example, RuntimeError.new)
155
+ reporter.example_finished(description_of(example), RuntimeError.new)
152
156
  reporter.dump
153
157
  end
154
-
158
+
155
159
  end
156
-
160
+
157
161
  describe "reporting one pending example (ExamplePendingError)" do
158
162
  before :each do
159
163
  @pending_error = Spec::Example::ExamplePendingError.new("reason")
@@ -162,22 +166,22 @@ module Spec
162
166
 
163
167
  it "should tell formatter example is pending" do
164
168
  example = ExampleGroup.new("example")
165
- formatter.should_receive(:example_pending).with(example, "reason", @pending_caller)
169
+ formatter.should_receive(:example_pending).with(description_of(example), "reason", @pending_caller)
166
170
  formatter.should_receive(:add_example_group).with(example_group)
167
- reporter.add_example_group(example_group)
168
- reporter.example_finished(example, @pending_error)
171
+ example_group.notify(reporter)
172
+ reporter.example_finished(description_of(example), @pending_error)
169
173
  end
170
-
174
+
171
175
  it "should account for pending example in stats" do
172
176
  example = ExampleGroup.new("example")
173
- formatter.should_receive(:example_pending).with(example, "reason", @pending_caller)
177
+ formatter.should_receive(:example_pending).with(description_of(example), "reason", @pending_caller)
174
178
  formatter.should_receive(:start_dump)
175
179
  formatter.should_receive(:dump_pending)
176
180
  formatter.should_receive(:dump_summary).with(anything(), 1, 0, 1)
177
181
  formatter.should_receive(:close).with(no_args)
178
182
  formatter.should_receive(:add_example_group).with(example_group)
179
- reporter.add_example_group(example_group)
180
- reporter.example_finished(example, @pending_error)
183
+ example_group.notify(reporter)
184
+ reporter.example_finished(description_of(example), @pending_error)
181
185
  reporter.dump
182
186
  end
183
187
 
@@ -187,7 +191,7 @@ module Spec
187
191
 
188
192
  @deprecated_formatter = Class.new(@formatter.class) do
189
193
  attr_reader :example_passed_to_method, :message_passed_to_method
190
-
194
+
191
195
  def example_pending(example_passed_to_method, message_passed_to_method)
192
196
  @example_passed_to_method = example_passed_to_method
193
197
  @message_passed_to_method = message_passed_to_method
@@ -199,16 +203,16 @@ module Spec
199
203
 
200
204
  it "should pass the correct example to the formatter" do
201
205
  example = ExampleGroup.new("example")
202
- reporter.add_example_group(example_group)
203
- reporter.example_finished(example, @pending_error)
206
+ example_group.notify(reporter)
207
+ reporter.example_finished(description_of(example), @pending_error)
204
208
 
205
- (@deprecated_formatter.example_passed_to_method == example).should be_true
209
+ @deprecated_formatter.example_passed_to_method.should == description_of(example)
206
210
  end
207
211
 
208
212
  it "should pass the correct pending error message to the formatter" do
209
213
  example = ExampleGroup.new("example")
210
- reporter.add_example_group(example_group)
211
- reporter.example_finished(example, @pending_error)
214
+ example_group.notify(reporter)
215
+ reporter.example_finished(description_of(example), @pending_error)
212
216
 
213
217
  @deprecated_formatter.message_passed_to_method.should == @pending_error.message
214
218
  end
@@ -217,20 +221,20 @@ module Spec
217
221
  Kernel.should_receive(:warn).with(Spec::Runner::Reporter::EXAMPLE_PENDING_DEPRECATION_WARNING)
218
222
 
219
223
  example = ExampleGroup.new("example")
220
- reporter.add_example_group(example_group)
221
- reporter.example_finished(example, @pending_error)
224
+ example_group.notify(reporter)
225
+ reporter.example_finished(description_of(example), @pending_error)
222
226
  end
223
227
  end
224
228
  end
225
-
229
+
226
230
  describe "reporting one pending example (PendingExampleFixedError)" do
227
231
  it "should tell formatter pending example is fixed" do
228
232
  formatter.should_receive(:example_failed) do |name, counter, failure|
229
233
  failure.header.should == "'example_group should do something' FIXED"
230
234
  end
231
235
  formatter.should_receive(:add_example_group).with(example_group)
232
- reporter.add_example_group(example_group)
233
- reporter.example_finished(example_group.examples.first, Spec::Example::PendingExampleFixedError.new("reason"))
236
+ example_group.notify(reporter)
237
+ reporter.example_finished(description_of(example_group.examples.first), Spec::Example::PendingExampleFixedError.new("reason"))
234
238
  end
235
239
  end
236
240
  end