rspec 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. data/CHANGES +125 -9
  2. data/EXAMPLES.rd +50 -27
  3. data/README +14 -1
  4. data/Rakefile +95 -42
  5. data/UPGRADE +31 -0
  6. data/bin/spec +0 -1
  7. data/bin/spec_translator +6 -0
  8. data/examples/auto_spec_description_example.rb +19 -0
  9. data/examples/{setup_teardown_example.rb → before_and_after_example.rb} +6 -6
  10. data/examples/behave_as_example.rb +45 -0
  11. data/examples/custom_expectation_matchers.rb +13 -12
  12. data/examples/dynamic_spec.rb +2 -2
  13. data/examples/file_accessor_spec.rb +2 -2
  14. data/examples/greeter_spec.rb +3 -3
  15. data/examples/helper_method_example.rb +2 -2
  16. data/examples/io_processor_spec.rb +4 -4
  17. data/examples/legacy_spec.rb +10 -0
  18. data/examples/mocking_example.rb +5 -5
  19. data/examples/multi_threaded_behaviour_runner.rb +25 -0
  20. data/examples/partial_mock_example.rb +4 -4
  21. data/examples/predicate_example.rb +4 -4
  22. data/examples/priority.txt +1 -0
  23. data/examples/shared_behaviours_example.rb +31 -0
  24. data/examples/stack_spec.rb +52 -69
  25. data/examples/stubbing_example.rb +10 -10
  26. data/examples/test_case_adapter_example.rb +26 -0
  27. data/examples/test_case_spec.rb +6 -6
  28. data/lib/spec.rb +9 -4
  29. data/lib/spec/dsl.rb +10 -0
  30. data/lib/spec/dsl/behaviour.rb +189 -0
  31. data/lib/spec/dsl/behaviour_callbacks.rb +43 -0
  32. data/lib/spec/dsl/behaviour_eval.rb +170 -0
  33. data/lib/spec/dsl/behaviour_factory.rb +32 -0
  34. data/lib/spec/dsl/composite_proc_builder.rb +28 -0
  35. data/lib/spec/dsl/configuration.rb +38 -0
  36. data/lib/spec/dsl/description.rb +34 -0
  37. data/lib/spec/dsl/example.rb +114 -0
  38. data/lib/spec/dsl/example_matcher.rb +28 -0
  39. data/lib/spec/{runner/spec_should_raise_handler.rb → dsl/example_should_raise_handler.rb} +4 -4
  40. data/lib/spec/expectations.rb +0 -3
  41. data/lib/spec/expectations/differs/default.rb +0 -1
  42. data/lib/spec/expectations/extensions.rb +0 -1
  43. data/lib/spec/expectations/extensions/object.rb +10 -53
  44. data/lib/spec/expectations/handler.rb +14 -18
  45. data/lib/spec/extensions.rb +1 -0
  46. data/lib/spec/extensions/object.rb +6 -0
  47. data/lib/spec/matchers.rb +19 -21
  48. data/lib/spec/matchers/be.rb +40 -11
  49. data/lib/spec/matchers/be_close.rb +2 -2
  50. data/lib/spec/matchers/operator_matcher.rb +52 -0
  51. data/lib/spec/matchers/respond_to.rb +21 -11
  52. data/lib/spec/mocks.rb +5 -28
  53. data/lib/spec/mocks/argument_constraint_matchers.rb +12 -0
  54. data/lib/spec/mocks/argument_expectation.rb +7 -4
  55. data/lib/spec/mocks/methods.rb +11 -16
  56. data/lib/spec/mocks/mock.rb +6 -3
  57. data/lib/spec/mocks/{mock_handler.rb → proxy.rb} +4 -7
  58. data/lib/spec/mocks/space.rb +28 -0
  59. data/lib/spec/mocks/spec_methods.rb +30 -0
  60. data/lib/spec/rake/spectask.rb +23 -21
  61. data/lib/spec/rake/verify_rcov.rb +1 -0
  62. data/lib/spec/runner.rb +88 -35
  63. data/lib/spec/runner/backtrace_tweaker.rb +2 -1
  64. data/lib/spec/runner/behaviour_runner.rb +102 -0
  65. data/lib/spec/runner/command_line.rb +5 -17
  66. data/lib/spec/runner/drb_command_line.rb +2 -2
  67. data/lib/spec/runner/extensions/kernel.rb +22 -9
  68. data/lib/spec/runner/formatter.rb +4 -0
  69. data/lib/spec/runner/formatter/base_formatter.rb +63 -0
  70. data/lib/spec/runner/formatter/base_text_formatter.rb +22 -52
  71. data/lib/spec/runner/formatter/failing_behaviours_formatter.rb +25 -0
  72. data/lib/spec/runner/formatter/failing_examples_formatter.rb +22 -0
  73. data/lib/spec/runner/formatter/html_formatter.rb +74 -29
  74. data/lib/spec/runner/formatter/progress_bar_formatter.rb +6 -8
  75. data/lib/spec/runner/formatter/rdoc_formatter.rb +6 -6
  76. data/lib/spec/runner/formatter/snippet_extractor.rb +52 -0
  77. data/lib/spec/runner/formatter/specdoc_formatter.rb +6 -6
  78. data/lib/spec/runner/heckle_runner.rb +8 -7
  79. data/lib/spec/runner/option_parser.rb +136 -55
  80. data/lib/spec/runner/options.rb +26 -0
  81. data/lib/spec/runner/reporter.rb +38 -31
  82. data/lib/spec/runner/spec_parser.rb +22 -13
  83. data/lib/spec/test_case_adapter.rb +10 -0
  84. data/lib/spec/translator.rb +103 -86
  85. data/lib/spec/version.rb +7 -15
  86. data/plugins/mock_frameworks/flexmock.rb +27 -0
  87. data/plugins/mock_frameworks/mocha.rb +21 -0
  88. data/plugins/mock_frameworks/rspec.rb +18 -0
  89. data/spec/spec/dsl/behaviour_eval_spec.rb +49 -0
  90. data/spec/spec/dsl/behaviour_factory_spec.rb +30 -0
  91. data/spec/spec/dsl/behaviour_spec.rb +508 -0
  92. data/spec/spec/dsl/composite_proc_builder_spec.rb +57 -0
  93. data/spec/spec/dsl/configuration_spec.rb +43 -0
  94. data/spec/spec/dsl/description_spec.rb +51 -0
  95. data/spec/spec/dsl/example_class_spec.rb +24 -0
  96. data/spec/spec/dsl/example_instance_spec.rb +140 -0
  97. data/spec/spec/dsl/example_should_raise_spec.rb +137 -0
  98. data/spec/spec/dsl/predicate_matcher_spec.rb +21 -0
  99. data/spec/spec/dsl/shared_behaviour_spec.rb +186 -0
  100. data/spec/spec/expectations/differs/default_spec.rb +12 -12
  101. data/spec/spec/expectations/extensions/object_spec.rb +10 -10
  102. data/spec/spec/expectations/fail_with_spec.rb +20 -20
  103. data/spec/spec/matchers/be_close_spec.rb +37 -31
  104. data/spec/spec/matchers/be_spec.rb +50 -41
  105. data/spec/spec/matchers/change_spec.rb +54 -54
  106. data/spec/spec/matchers/description_generation_spec.rb +43 -31
  107. data/spec/spec/matchers/eql_spec.rb +24 -37
  108. data/spec/spec/matchers/equal_spec.rb +24 -37
  109. data/spec/spec/matchers/exist_spec.rb +48 -0
  110. data/spec/spec/matchers/handler_spec.rb +36 -23
  111. data/spec/spec/matchers/has_spec.rb +8 -8
  112. data/spec/spec/matchers/have_spec.rb +38 -38
  113. data/spec/spec/matchers/include_spec.rb +6 -6
  114. data/spec/spec/matchers/match_spec.rb +8 -8
  115. data/spec/spec/matchers/matcher_methods_spec.rb +24 -31
  116. data/spec/spec/matchers/raise_error_spec.rb +34 -34
  117. data/spec/spec/matchers/respond_to_spec.rb +32 -8
  118. data/spec/spec/matchers/satisfy_spec.rb +6 -6
  119. data/spec/spec/matchers/should_===_spec.rb +38 -0
  120. data/spec/spec/matchers/should_==_spec.rb +37 -0
  121. data/spec/spec/matchers/should_=~_spec.rb +36 -0
  122. data/spec/spec/matchers/throw_symbol_spec.rb +47 -55
  123. data/spec/spec/mocks/any_number_of_times_spec.rb +16 -21
  124. data/spec/spec/mocks/argument_expectation_spec.rb +3 -3
  125. data/spec/spec/mocks/at_least_spec.rb +30 -30
  126. data/spec/spec/mocks/at_most_spec.rb +53 -57
  127. data/spec/spec/mocks/bug_report_10260_spec.rb +8 -0
  128. data/spec/spec/mocks/bug_report_7611_spec.rb +3 -3
  129. data/spec/spec/mocks/bug_report_7805_spec.rb +3 -3
  130. data/spec/spec/mocks/bug_report_8165_spec.rb +5 -5
  131. data/spec/spec/mocks/bug_report_8302_spec.rb +5 -5
  132. data/spec/spec/mocks/failing_mock_argument_constraints_spec.rb +26 -27
  133. data/spec/spec/mocks/mock_ordering_spec.rb +19 -15
  134. data/spec/spec/mocks/mock_space_spec.rb +54 -0
  135. data/spec/spec/mocks/mock_spec.rb +111 -141
  136. data/spec/spec/mocks/multiple_return_value_spec.rb +48 -48
  137. data/spec/spec/mocks/null_object_mock_spec.rb +10 -10
  138. data/spec/spec/mocks/once_counts_spec.rb +32 -35
  139. data/spec/spec/mocks/options_hash_spec.rb +12 -10
  140. data/spec/spec/mocks/partial_mock_spec.rb +15 -15
  141. data/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +24 -22
  142. data/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +19 -19
  143. data/spec/spec/mocks/precise_counts_spec.rb +28 -32
  144. data/spec/spec/mocks/record_messages_spec.rb +10 -10
  145. data/spec/spec/mocks/stub_spec.rb +45 -45
  146. data/spec/spec/mocks/twice_counts_spec.rb +21 -21
  147. data/spec/spec/package/bin_spec_spec.rb +12 -0
  148. data/spec/spec/runner/behaviour_runner_spec.rb +114 -0
  149. data/spec/spec/runner/command_line_spec.rb +8 -8
  150. data/spec/spec/runner/context_matching_spec.rb +14 -15
  151. data/spec/spec/runner/drb_command_line_spec.rb +12 -12
  152. data/spec/spec/runner/execution_context_spec.rb +8 -29
  153. data/spec/spec/runner/extensions/kernel_spec.rb +36 -0
  154. data/spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb +27 -0
  155. data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +28 -0
  156. data/spec/spec/runner/formatter/html_formatter_spec.rb +9 -8
  157. data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +6 -6
  158. data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +10 -10
  159. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +22 -27
  160. data/spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb +6 -5
  161. data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +17 -17
  162. data/spec/spec/runner/formatter/snippet_extractor_spec.rb +11 -0
  163. data/spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb +6 -6
  164. data/spec/spec/runner/formatter/specdoc_formatter_spec.rb +17 -17
  165. data/spec/spec/runner/heckle_runner_spec.rb +21 -21
  166. data/spec/spec/runner/heckler_spec.rb +5 -5
  167. data/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +12 -12
  168. data/spec/spec/runner/object_ext_spec.rb +3 -3
  169. data/spec/spec/runner/option_parser_spec.rb +171 -102
  170. data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +21 -12
  171. data/spec/spec/runner/reporter_spec.rb +106 -97
  172. data/spec/spec/runner/spec_matcher_spec.rb +46 -51
  173. data/spec/spec/runner/spec_parser_spec.rb +72 -16
  174. data/spec/spec/spec_classes.rb +12 -3
  175. data/spec/spec/translator_spec.rb +165 -36
  176. metadata +66 -76
  177. data/RELEASE-PLAN +0 -117
  178. data/examples/auto_spec_name_generation_example.rb +0 -18
  179. data/lib/spec/callback.rb +0 -11
  180. data/lib/spec/callback/callback_container.rb +0 -60
  181. data/lib/spec/callback/extensions/module.rb +0 -24
  182. data/lib/spec/callback/extensions/object.rb +0 -37
  183. data/lib/spec/deprecated.rb +0 -3
  184. data/lib/spec/expectations/extensions/proc.rb +0 -57
  185. data/lib/spec/expectations/should.rb +0 -5
  186. data/lib/spec/expectations/should/base.rb +0 -64
  187. data/lib/spec/expectations/should/change.rb +0 -69
  188. data/lib/spec/expectations/should/have.rb +0 -128
  189. data/lib/spec/expectations/should/not.rb +0 -74
  190. data/lib/spec/expectations/should/should.rb +0 -81
  191. data/lib/spec/expectations/sugar.rb +0 -47
  192. data/lib/spec/runner/context.rb +0 -154
  193. data/lib/spec/runner/context_eval.rb +0 -142
  194. data/lib/spec/runner/context_runner.rb +0 -55
  195. data/lib/spec/runner/execution_context.rb +0 -17
  196. data/lib/spec/runner/spec_matcher.rb +0 -25
  197. data/lib/spec/runner/specification.rb +0 -114
  198. data/spec/spec/callback/callback_container_spec.rb +0 -27
  199. data/spec/spec/callback/module_spec.rb +0 -37
  200. data/spec/spec/callback/object_spec.rb +0 -90
  201. data/spec/spec/callback/object_with_class_callback_spec.rb +0 -19
  202. data/spec/spec/expectations/should/should_==_spec.rb +0 -19
  203. data/spec/spec/expectations/should/should_=~_spec.rb +0 -13
  204. data/spec/spec/expectations/should/should_be_a_kind_of_spec.rb +0 -21
  205. data/spec/spec/expectations/should/should_be_an_instance_of_spec.rb +0 -30
  206. data/spec/spec/expectations/should/should_be_arbitrary_predicate_spec.rb +0 -81
  207. data/spec/spec/expectations/should/should_be_close_spec.rb +0 -18
  208. data/spec/spec/expectations/should/should_be_comparison_operator_spec.rb +0 -44
  209. data/spec/spec/expectations/should/should_be_false_spec.rb +0 -39
  210. data/spec/spec/expectations/should/should_be_spec.rb +0 -11
  211. data/spec/spec/expectations/should/should_be_true_spec.rb +0 -27
  212. data/spec/spec/expectations/should/should_change_spec.rb +0 -184
  213. data/spec/spec/expectations/should/should_eql_spec.rb +0 -11
  214. data/spec/spec/expectations/should/should_equal_spec.rb +0 -11
  215. data/spec/spec/expectations/should/should_have_at_least_spec.rb +0 -53
  216. data/spec/spec/expectations/should/should_have_at_most_spec.rb +0 -45
  217. data/spec/spec/expectations/should/should_have_key_spec.rb +0 -21
  218. data/spec/spec/expectations/should/should_have_spec.rb +0 -64
  219. data/spec/spec/expectations/should/should_include_spec.rb +0 -59
  220. data/spec/spec/expectations/should/should_match_spec.rb +0 -25
  221. data/spec/spec/expectations/should/should_not_==_spec.rb +0 -15
  222. data/spec/spec/expectations/should/should_not_be_a_kind_of_spec.rb +0 -21
  223. data/spec/spec/expectations/should/should_not_be_an_instance_of_spec.rb +0 -11
  224. data/spec/spec/expectations/should/should_not_be_arbitrary_predicate_spec.rb +0 -68
  225. data/spec/spec/expectations/should/should_not_be_spec.rb +0 -11
  226. data/spec/spec/expectations/should/should_not_change_spec.rb +0 -24
  227. data/spec/spec/expectations/should/should_not_eql_spec.rb +0 -11
  228. data/spec/spec/expectations/should/should_not_equal_spec.rb +0 -11
  229. data/spec/spec/expectations/should/should_not_have_key_spec.rb +0 -15
  230. data/spec/spec/expectations/should/should_not_include_spec.rb +0 -58
  231. data/spec/spec/expectations/should/should_not_match_spec.rb +0 -11
  232. data/spec/spec/expectations/should/should_not_raise_spec.rb +0 -75
  233. data/spec/spec/expectations/should/should_not_respond_to_spec.rb +0 -15
  234. data/spec/spec/expectations/should/should_not_throw_spec.rb +0 -35
  235. data/spec/spec/expectations/should/should_raise_spec.rb +0 -66
  236. data/spec/spec/expectations/should/should_respond_to_spec.rb +0 -15
  237. data/spec/spec/expectations/should/should_satisfy_spec.rb +0 -35
  238. data/spec/spec/expectations/should/should_throw_spec.rb +0 -27
  239. data/spec/spec/runner/context_runner_spec.rb +0 -100
  240. data/spec/spec/runner/context_spec.rb +0 -405
  241. data/spec/spec/runner/kernel_ext_spec.rb +0 -16
  242. data/spec/spec/runner/spec_name_generation_spec.rb +0 -102
  243. data/spec/spec/runner/specification_class_spec.rb +0 -72
  244. data/spec/spec/runner/specification_instance_spec.rb +0 -160
  245. data/spec/spec/runner/specification_should_raise_spec.rb +0 -136
data/CHANGES CHANGED
@@ -1,5 +1,121 @@
1
1
  = RSpec Changelog
2
2
 
3
+ == Version 0.9.0
4
+
5
+ This release introduces #describe and #it (aliased as #context and #specify for
6
+ backwards compatibility). This allows you to express specs like this:
7
+
8
+ describe SomeClass do # Creates a Behaviour
9
+ it "should do something" do # Creates an Example
10
+ end
11
+ end
12
+
13
+ The command line features four new options that give you more control over what specs
14
+ are being run and in what order. This can be used to verify that your specs are
15
+ independent (by running in opposite order with --reverse). It can also be used to cut
16
+ down feedback time by running the most recently modified specs first (--loadby mtime --reverse).
17
+
18
+ Further, --example replaces the old --spec option, and it can now take a file name of
19
+ spec names as an alternative to just a spec name. The --format failing_examples:file.txt
20
+ option allows you to output an --example compatible file, which makes it possible to only
21
+ rerun the specs that failed in the last run. Spec::Rails uses all of these four options
22
+ by default to optimise your RSpec experience.
23
+
24
+ There is now a simple configuration model. For Spec::Rails, you do something like this:
25
+
26
+ Spec::Runner.configure do |config|
27
+ config.use_transactional_fixtures = true
28
+ config.use_instantiated_fixtures = false
29
+ config.fixture_path = RAILS_ROOT + '/spec/fixtures'
30
+ end
31
+
32
+ You can now use mocha or flexmock with RSpec if you prefer either to
33
+ RSpec's own mock framework. Just put this:
34
+
35
+ Spec::Runner.configure do |config|
36
+ config.mock_with :mocha
37
+ end
38
+
39
+ or this:
40
+
41
+ Spec::Runner.configure do |config|
42
+ config.mock_with :flexmock
43
+ end
44
+
45
+ in a file that is loaded before your specs. You can also
46
+ configure included modules and predicate_matchers:
47
+
48
+ Spec::Runner.configure do |config|
49
+ config.include SomeModule
50
+ config.predicate_matchers[:does_something?] = :do_something
51
+ end
52
+
53
+ See Spec::DSL::Behaviour for more on predicate_matchers
54
+
55
+ * Sugar FREE!
56
+ * Added [10434 ] Please Make -s synonymous with -e for autotest compat. This is temporary until autotest uses -e instead of -s.
57
+ * Fixed [#10133] custom predicate matchers
58
+ * Applied [#10473] Add should exist (new matcher) - Patch from Bret Pettichord
59
+ * Added another formatter: failing_behaviours. Writes the names of the failing behaviours for use with --example.
60
+ * Applied [#10315] Patch to fix pre_commit bug 10313 - pre_commit_rails: doesn't always build correctly (Patch from Antii Tarvainen)
61
+ * Applied [#10245] Patch to HTML escape the behavior name when using HTML Formatter (Patch from Josh Knowles)
62
+ * Applied [#10410] redirect_to does not behave consistently with regards to query string parameter ordering (Patch from Nicholas Evans)
63
+ * Applied [#9605] Patch for ER 9472, shared behaviour (Patch by Bob Cotton)
64
+ * The '--format rdoc' option no longer causes a dry-run by default. --dry-run must be used explicitly.
65
+ * It's possible to specify the output file in the --format option (See explanation in --help)
66
+ * Several --format options may be specified to output several formats in one run.
67
+ * The --out option is gone. Use --format html:path/to/my.html instead (or similar).
68
+ * Spec::Runner::Formatter::BaseTextFormatter#initialize only takes one argument - an IO. dry_run and color are setters.
69
+ * Made Spec::Ui *much* easier to install. It will be released separately. Check out trunk/spec_ui/examples
70
+ * HTML reports now include a syntax highlighted snippet of the source code where the spec failed (needs the syntax gem)
71
+ * Added [#10262] Better Helper testing of Erb evaluation block helpers
72
+ * Added [#9735] support flexmock (thanks to Jim Weirich for his modifications to flexmock to support this)
73
+ * Spec::Rails controller specs will no longer let mock exception ripple through to the response.
74
+ * Fixed [#9260] IvarProxy does not act like a hash.
75
+ * Applied [#9458] The rspec_resource generator does not take into account class nesting (Patch from Steve Tendon)
76
+ * Applied [#9132] Rakefile spec:doc can fail without preparing database (Patch from Steve Ross)
77
+ * Applied [#9678] Custom runner command line switch, and multi-threaded runner (Patch from Bob Cotton)
78
+ * Applied [#9926] Rakefile - RSPEC_DEPS constant as an Array of Hashes instead of an Array of Arrays (Patch from Scott Taylor)
79
+ * Applied [#9925] Changed ".rhtml" to "template" in REST spec generator (Patch from Scott Taylor)
80
+ * Applied [#9852] Patch for RSpec's Website using Webgen 0.4.2 (Patch from Scott Taylor)
81
+ * Fixed [#6523] Run rspec on rails without a db
82
+ * Fixed [#9295] rake spec should run anything in the spec directory (not just rspec's standard dirs)
83
+ * Added [#9786] infer controller and helper names from the described type
84
+ * Fixed [#7795] form_tag renders action='/view_spec' in view specs
85
+ * Fixed [#9767] rspec_on_rails should not define rescue_action on controllers
86
+ * Fixed [#9421] --line doesn't work with behaviours that use class names
87
+ * Fixed [#9760] rspec generators incompatible with changes to edge rails
88
+ * Added [#9786] infer controller and helper names from the described type
89
+ * Applied a simplified version of [#9282] Change to allow running specs from textmate with rspec installed as a rails plugin (and no rspec gem installed)
90
+ * Applied [#9700] Make Spec::DSL::Example#name public / Add a --timeout switch. A great way to prevent specs from getting slow.
91
+ * In Rails, script/generate rspec will generate a spec.opts file that optimises faster/more efficient running of specs.
92
+ * Added [#9522] support using rspec's expectations with test/unit
93
+ * Moved rspec_on_rails up to the project root, simplifying the download url
94
+ * Fixed [#8103] RSpec not installing spec script correctly.
95
+ * The --spec option is replaced by the --example option.
96
+ * The --loadby option no longer supports a file argument. Use --example file_name instead.
97
+ * The --example option can now take a file name as an argument. The file should contain example names.
98
+ * Internal classes are named Behaviour/Example (rather than Context/Specification).
99
+ * You can now use mocha by saying config.mock_with :mocha in a spec_helper
100
+ * before_context_eval is replaced by before_eval.
101
+ * Applied [#9509] allow spaced options in spec.opts
102
+ * Applied [#9510] Added File for Ruby 1.8.6
103
+ * Applied [#9511] Clarification to README file in spec/
104
+ * Moved all of the Spec::Rails specs down to the plugins directory - now you can run the specs after you install.
105
+ * Updated RSpec.tmbundle to the 0.9 syntax and replaced context/specify with describe/it.
106
+ * Applied [#9232] ActionController::Base#render is sometimes protected (patch from Dan Manges)
107
+ * Added --reverse option, allowing contexts/specs to be run in reverse order.
108
+ * Added --loadby option, allowing better control over load order for spec files. mtime and file.txt supported.
109
+ * Implemented [#8696] --order option (see --reverse and --loadby)
110
+ * Added describe/it as aliases for context/specify - suggestion from Dan North.
111
+ * Applied [#7637] [PATCH] add skip-migration option to rspec_resource generator
112
+ * Added [#9167] string.should have_tag
113
+ * Changed script/rails_spec_server to script/spec_server and added script/spec (w/ path to vendor/plugins/rspec)
114
+ * Fixed [#8897] Error when mixing controller spec with/without integrated views and using template system other than rhtml
115
+ * Updated sample app specs to 0.9 syntax
116
+ * Updated generated specs to 0.9 syntax
117
+ * Applied [#8994] trunk: generated names for be_ specs (Multiple patches from Yurii Rashkovskii)
118
+
3
119
  == Version 0.8.2
4
120
 
5
121
  Replaced assert_select fork with an assert_select wrapper for have_tag. This means that "should have_rjs" no longer supports :hide or :effect, but you can still use should_have_rjs for those.
@@ -46,7 +162,7 @@ It also sports myriad new features, bug fixes, patches and general goodness:
46
162
  * Fixed [#7754] Command-R fails to run spec in TextMate (added instruction from Luke Redpath to the website)
47
163
  * Fixed [#7826] RSpect.tmbundle web page out of date.
48
164
  * RSpec on Rails specs are now running against RoR 1.2.1 and 1.2.2
49
- * rspec_resource now generates specs for views (TODO: make them use the new assert_select, when it's documented)
165
+ * rspec_resource now generates specs for views
50
166
  * In a Rails app, RSpec core is only loaded when RAILS_ENV==test (init.rb)
51
167
  * Added support for target.should arbitrary_expectation_handler and target.should_not arbitrary_expectation_handler
52
168
  * Fixed [#7533] Spec suite fails and the process exits with a code 0
@@ -55,7 +171,7 @@ It also sports myriad new features, bug fixes, patches and general goodness:
55
171
  * Fixed [#7409] default fixtures do not appear to run.
56
172
  * Fixed [#7507] "render..and return" doesn't return
57
173
  * Fixed [#7509] rcov/rspec incorrectly includes boot.rb (Patch from Courtenay)
58
- * Fixed [#7506] unnecessary complex output on failure of response.should_be_redirect
174
+ * Fixed [#7506] unnecessary complex output on failure of response.should be_redirect
59
175
  * Applied [#6098] Make scaffold_resource generator. Based on code from Pat Maddox.
60
176
  * The drbspec command is gone. Use spec --drb instead.
61
177
  * The drb option is gone from the Rake task. Pass --drb to spec_opts instead.
@@ -160,7 +276,7 @@ Bug fixes and a couple o' new features.
160
276
  * Fixed [#6555] should_have_tag does not match documentation
161
277
  * Fixed [#6567] SyntaxError should not stop entire run
162
278
  * Fixed [#6558] integrated views look for template even when redirected
163
- * Fixed [#6547] response.should_be_redirect broken in 0.7.0
279
+ * Fixed [#6547] response.should be_redirect broken in 0.7.0
164
280
  * Applied [#6471] Easy way to spec routes
165
281
  * Applied [#6587] Rspec on Rails displays "Spec::Rails::ContextFactory" as context name
166
282
  * Applied [#6514] Document has trivial typos.
@@ -182,7 +298,7 @@ There are a few changes that will require that you change your existing specs.
182
298
  RSpec now handles equality exactly like ruby does:
183
299
 
184
300
  # actual.should_equal(expected) will pass if actual.equal?(expected) returns true
185
- # actual.should_eql(expected) will pass if actual.eql?(expected) returns true
301
+ # actual.should eql(expected) will pass if actual.eql?(expected) returns true
186
302
  # actual.should == expected will pass if actual == expected) returns true
187
303
 
188
304
  At the high level, eql? implies equivalence, while equal? implies object identity. For more
@@ -206,7 +322,7 @@ Here's what you'll need to do to update your specs:
206
322
  # search for "should_equal" and replace with "should_eql"
207
323
  # run specs
208
324
 
209
- If any specs still fail, they are probably related to should_be(true) or should_be(false) using
325
+ If any specs still fail, they are probably related to should be_true or should_be_false using
210
326
  non-boolean values. Those you'll just have to inspect manually and adjust appropriately (sorry!).
211
327
 
212
328
  --------------------------------------------------
@@ -307,7 +423,7 @@ Things that may break backwards compatibility:
307
423
  * Fixed [#4891] RCOV task failing on windows
308
424
  * Fixed [#4896] Shouldn't modify user's $LOAD_PATH (Tip from Gavin Sinclair)
309
425
  * Fixed [#5369] ruby -w: warnings in RSpec 0.5.16 (Tip from Suraj Kurapati)
310
- * Applied [#5141] SpecMatcher doesn't escape strings before matching (Patch from Nikolai Weibull).
426
+ * Applied [#5141] ExampleMatcher doesn't escape strings before matching (Patch from Nikolai Weibull).
311
427
  * Fixed [#5224] Move 'require diff-lcs' from test_helper.rb to diff_test.rb (Tip from Chris Roos)
312
428
  * Applied [#5449] Rake stats for specs (Patch from Nick Sieger)
313
429
  * Applied [#5468, #5058] Fix spec runner to correctly run controller specs (Patch from Daniel Siemssen)
@@ -321,7 +437,7 @@ This release makes an official commitment to underscore_syntax (with no more sup
321
437
  * Converted ALL tests to use underscore syntax
322
438
  * Fixed all remaining problems with underscores revealed by converting all the tests to underscores
323
439
  * Enhanced sugar to support combinations of methods (i.e. once.and_return)
324
- * Simplified helper structure taking advantage of dot/underscore combos (i.e. should.be.an_instance_of, which can be expressed as should_be_an_instance_of)
440
+ * Simplified helper structure taking advantage of dot/underscore combos (i.e. should.be.an_instance_of, which can be expressed as should be_an_instance_of)
325
441
  * Added support for at_most in mocks
326
442
  * Added support for should_not_receive(:msg) (will be removing should_receive(:msg).never some time soon)
327
443
  * Added support for should_have_exactly(5).items_in_collection
@@ -347,7 +463,7 @@ a experimental support for faster rails specs.
347
463
 
348
464
  * Added proc methods for specifying differences (increments and decrements). See difference_test.rb
349
465
  * Methods can now be defined alongside specs. This obsoletes the need for defining methods in setup. (Patch #5002 from Brian Takita)
350
- * Sugar (underscores) now works correctly with should_be_a_kind_of and should_be_an_instance_of
466
+ * Sugar (underscores) now works correctly with should be_a_kind_of and should be_an_instance_of
351
467
  * Added support for include and inherit in contexts. (Patch #4971 from Brian Takita)
352
468
  * Added rails_spec and rails_spec_server for faster specs on rails (still buggy - help needed)
353
469
  * Fixed bug that caused should_render to break if given a :symbol (in Rails)
@@ -564,7 +680,7 @@ This release adds some improvements to the mock API and minor syntax improvement
564
680
 
565
681
  This release adds some shoulds and improves error reporting
566
682
 
567
- * Added should_be_same_as and should_not_be_same_as.
683
+ * Added should be_same_as and should_not be_same_as.
568
684
  * Improved error reporting for comparison expectations.
569
685
 
570
686
  == Version 0.1.0
@@ -1,12 +1,21 @@
1
- # specs with no names
2
- # * NAME NOT GENERATED
3
- # * NAME NOT GENERATED
4
- # * NAME NOT GENERATED
5
- # * NAME NOT GENERATED
6
- # A mouse
1
+ # Examples with no descriptions
2
+ # * should equal 5
3
+ # * should be < 5
4
+ # * should include "a"
5
+ # * should respond to #size
6
+ # State created in before(:all)
7
+ # * should be accessible from example
8
+ # * should not have sideffects
9
+ # BehaveAsExample::BluesGuitarist
10
+ # * should behave as guitarist
11
+ # BehaveAsExample::RockGuitarist
12
+ # * should behave as guitarist
13
+ # BehaveAsExample::ClassicGuitarist
14
+ # * should not behave as guitarist
15
+ # Animals::Mouse
7
16
  # * should eat cheese
8
17
  # * should not eat cat
9
- # The month march
18
+ # Some integers
10
19
  # * The root of 1 square should be 1
11
20
  # * The root of 2 square should be 2
12
21
  # * The root of 3 square should be 3
@@ -27,6 +36,8 @@
27
36
  # An IoProcessor
28
37
  # * should raise nothing when the file is exactly 32 bytes
29
38
  # * should raise an exception when the file length is less than 32 bytes
39
+ # A legacy spec
40
+ # * should work fine
30
41
  # A consumer of a mock
31
42
  # * should be able to send messages to the mock
32
43
  # a mock
@@ -39,31 +50,39 @@
39
50
  # BDD framework
40
51
  # * should be adopted quickly
41
52
  # * should be intuitive
42
- # State created in context_setup
43
- # * should be accessible from spec
44
- # * should not have sideffects
45
- # A Stack
53
+ # SharedBehaviourExample::OneThing
54
+ # * should do what things do
55
+ # SharedBehaviourExample::AnotherThing
56
+ # * should do what things do
57
+ # Stack (empty)
58
+ # * should be empty
59
+ # * should not be full
46
60
  # * should add to the top when sent #push
61
+ # * should complain when sent #peek
62
+ # * should complain when sent #pop
63
+ # Stack (with one item)
64
+ # * should not be empty
65
+ # * should return the top item when sent #peek
66
+ # * should NOT remove the top item when sent #peek
67
+ # * should return the top item when sent #pop
68
+ # * should remove the top item when sent #pop
69
+ # * should not be full
70
+ # * should add to the top when sent #push
71
+ # Stack (with one item less than capacity)
72
+ # * should not be empty
73
+ # * should return the top item when sent #peek
74
+ # * should NOT remove the top item when sent #peek
75
+ # * should return the top item when sent #pop
76
+ # * should remove the top item when sent #pop
77
+ # * should not be full
78
+ # * should add to the top when sent #push
79
+ # Stack (full)
80
+ # * should be full
81
+ # * should not be empty
47
82
  # * should return the top item when sent #peek
48
83
  # * should NOT remove the top item when sent #peek
49
84
  # * should return the top item when sent #pop
50
85
  # * should remove the top item when sent #pop
51
- # An empty stack
52
- # * NAME NOT GENERATED
53
- # * should no longer be empty after #push
54
- # * should complain when sent #peek
55
- # * should complain when sent #pop
56
- # An almost empty stack (with one item)
57
- # * NAME NOT GENERATED
58
- # * should remain not empty after #peek
59
- # * should become empty after #pop
60
- # An almost full stack (with one item less than capacity)
61
- # * NAME NOT GENERATED
62
- # * should become full when sent #push
63
- # A full stack
64
- # * NAME NOT GENERATED
65
- # * should remain full after #peek
66
- # * should no longer be full after #pop
67
86
  # * should complain on #push
68
87
  # A consumer of a stub
69
88
  # * should be able to stub methods on any Object
@@ -79,3 +98,7 @@
79
98
  # * TestCase#setup should be called.
80
99
  # * RSpec should be able to access TestCase methods
81
100
  # * RSpec should be able to accept included modules
101
+
102
+ Finished in 0.045999 seconds
103
+
104
+ 74 examples, 0 failures
data/README CHANGED
@@ -19,7 +19,7 @@ Spec::Mocks supports creating Mock Objects, Stubs, and adding Mock/Stub
19
19
  behaviour to your existing objects.
20
20
 
21
21
  Spec::Runner provides a very small but powerful DSL for writing executable
22
- specifications.
22
+ examples of how your code should work.
23
23
 
24
24
  == Installation
25
25
 
@@ -47,6 +47,19 @@ In order to run RSpec's full suite of specs (rake pre_commit) you must install t
47
47
  * meta_project # Required in order to make releases at RubyForge
48
48
  * heckle # Required if you use the --heckle switch
49
49
 
50
+ Once those are all installed, you should be able to run the suite with the following steps:
51
+
52
+ svn co svn://rubyforge.org/var/svn/rspec/trunk rspec
53
+ cd rspec
54
+ rake install_dependencies
55
+ cd example_rails_app
56
+ export RSPEC_RAILS_VERSION=1.2.3
57
+ rake rspec:generate_mysql_config
58
+ mysql -u root < db/mysql_setup.sql
59
+ cd ..
60
+ rake pre_commit
61
+
62
+
50
63
  Note that RSpec itself - once built - doesn't have any dependencies outside the Ruby core
51
64
  and stdlib - with a few exceptions:
52
65
 
data/Rakefile CHANGED
@@ -20,15 +20,30 @@ PKG_FILES = FileList[
20
20
  '[A-Z]*',
21
21
  'lib/**/*.rb',
22
22
  'spec/**/*.rb',
23
- 'examples/**/*'
23
+ 'examples/**/*',
24
+ 'plugins/**/*'
24
25
  ]
26
+ FileUtils.touch(File.dirname(__FILE__) + '/previous_failures.txt')
25
27
 
26
- task :default => [:spec, :verify_rcov]
28
+ task :default => [:verify_rcov]
27
29
 
28
30
  desc "Run all specs"
29
31
  Spec::Rake::SpecTask.new do |t|
30
32
  t.spec_files = FileList['spec/**/*_spec.rb', '../RSpec.tmbundle/Support/spec/*_spec.rb']
31
- t.spec_opts = ['--color','--backtrace']
33
+ t.spec_opts = ['--options', 'spec.opts']
34
+ t.rcov = true
35
+ t.rcov_dir = '../doc/output/coverage'
36
+ t.rcov_opts = ['--exclude', 'spec\/spec,bin\/spec,examples']
37
+ end
38
+
39
+ desc "Run all translated specs"
40
+ Spec::Rake::SpecTask.new('translated_specs') do |t|
41
+ t.spec_files = FileList['translated_specs/**/*_spec.rb'].exclude( # These translate, but have other quirks
42
+ 'translated_specs/spec/translator_spec.rb',
43
+ 'translated_specs/spec/runner/formatter/html_formatter_spec.rb',
44
+ 'translated_specs/spec/runner/option_parser_spec.rb'
45
+ )
46
+ t.spec_opts = ['--options', 'spec.opts']
32
47
  t.rcov = true
33
48
  t.rcov_dir = '../doc/output/coverage'
34
49
  t.rcov_opts = ['--exclude', 'spec\/spec,bin\/spec,examples']
@@ -37,7 +52,7 @@ end
37
52
  desc "Run all specs and store html output in doc/output/report.html"
38
53
  Spec::Rake::SpecTask.new('spec_html') do |t|
39
54
  t.spec_files = FileList['spec/**/*_spec.rb', 'vendor/RSpec.tmbundle/Support/spec/*_spec.rb']
40
- t.spec_opts = ['--format html','--backtrace','--out ../doc/output/report.html']
55
+ t.spec_opts = ['--format html:../doc/output/report.html','--backtrace']
41
56
  end
42
57
 
43
58
  desc "Run all failing examples"
@@ -45,14 +60,6 @@ Spec::Rake::SpecTask.new('failing_examples') do |t|
45
60
  t.spec_files = FileList['failing_examples/**/*_spec.rb']
46
61
  end
47
62
 
48
- desc 'Verify that no warnings occur'
49
- task :verify_warnings do
50
- `ruby -w #{File.dirname(__FILE__) + '/bin/spec'} --help 2> warnings.txt`
51
- warnings = File.open('warnings.txt').read
52
- File.rm 'warnings.txt' rescue nil
53
- raise "There were warnings:\n#{warnings}" if warnings =~ /warning/n
54
- end
55
-
56
63
  desc 'Generate HTML documentation for website'
57
64
  task :webgen do
58
65
  Dir.chdir '../doc' do
@@ -71,7 +78,7 @@ desc 'Generate RDoc'
71
78
  rd = Rake::RDocTask.new do |rdoc|
72
79
  rdoc.rdoc_dir = '../doc/output/rdoc'
73
80
  rdoc.options << '--title' << 'RSpec' << '--line-numbers' << '--inline-source' << '--main' << 'README'
74
- rdoc.rdoc_files.include('README', 'CHANGES', 'MIT-LICENSE', 'EXAMPLES.rd', 'RELEASE-PLAN', 'lib/**/*.rb')
81
+ rdoc.rdoc_files.include('README', 'CHANGES', 'MIT-LICENSE', 'EXAMPLES.rd', 'UPGRADE', 'lib/**/*.rb')
75
82
  end
76
83
  task :rdoc => :examples_specdoc # We generate EXAMPLES.rd
77
84
 
@@ -95,7 +102,7 @@ spec = Gem::Specification.new do |s|
95
102
 
96
103
  s.autorequire = 'spec'
97
104
  s.bindir = 'bin'
98
- s.executables = ['spec']
105
+ s.executables = ['spec', 'spec_translator']
99
106
  s.default_executable = 'spec'
100
107
  s.author = ["RSpec Development Team"]
101
108
  s.email = "rspec-devel@rubyforge.org"
@@ -145,24 +152,28 @@ end
145
152
 
146
153
  desc "Creates a tag in svn"
147
154
  task :tag do
155
+ from = `svn info #{File.dirname(__FILE__)}`.match(/URL: (.*)\/rspec/n)[1]
156
+ to = from.gsub(/trunk/, "tags/#{Spec::VERSION::TAG}")
157
+ tag_cmd = "svn cp #{from} #{to} -m \"Tag release #{Spec::VERSION::FULL_VERSION}\""
158
+ raise "Can't tag to the same place: #{tag_cmd}" if to == from
148
159
  puts "Creating tag in SVN"
149
- `svn cp svn+ssh://#{ENV['RUBYFORGE_USER']}@rubyforge.org/var/svn/rspec/trunk svn+ssh://#{ENV['RUBYFORGE_USER']}@rubyforge.org/var/svn/rspec/tags/#{Spec::VERSION::TAG} -m "Tag release #{Spec::VERSION::STRING}"`
150
- puts "Done!"
160
+ `#{tag_cmd}`
161
+ raise "Tagging failed" unless $? == 0
151
162
  end
152
163
 
153
164
  desc "Run this task before you commit. You should see 'OK TO COMMIT'"
154
165
  task :pre_commit => [
155
- :verify_warnings,
156
166
  :website,
157
167
  :examples,
158
- :failing_examples_with_html,
168
+ :translated_specs,
169
+ :failing_examples_with_html
159
170
  ]
160
171
 
161
172
  desc "Build the website, but do not publish it"
162
173
  task :website => [:clobber, :verify_rcov, :spec_html, :webgen, :failing_examples_with_html, :examples_specdoc, :rdoc, :rdoc_rails]
163
174
 
164
175
  task :rdoc_rails do
165
- Dir.chdir '../rspec_on_rails/vendor/plugins/rspec_on_rails' do
176
+ Dir.chdir '../rspec_on_rails' do
166
177
  rake = (PLATFORM == "i386-mswin32") ? "rake.cmd" : "rake"
167
178
  `#{rake} rdoc`
168
179
  end
@@ -174,50 +185,92 @@ end
174
185
 
175
186
  desc "Upload Website to RubyForge"
176
187
  task :publish_website => [:verify_user, :website] do
177
- publisher = Rake::SshDirPublisher.new(
178
- "rspec-website@rubyforge.org",
179
- "/var/www/gforge-projects/#{PKG_NAME}",
180
- "../doc/output"
181
- )
182
-
183
- publisher.upload
188
+ unless Spec::VERSION::RELEASE_CANDIDATE
189
+ publisher = Rake::SshDirPublisher.new(
190
+ "rspec-website@rubyforge.org",
191
+ "/var/www/gforge-projects/#{PKG_NAME}",
192
+ "../doc/output"
193
+ )
194
+ publisher.upload
195
+ else
196
+ puts "** Not publishing packages to RubyForge - this is a prerelease"
197
+ end
184
198
  end
185
199
 
186
200
  desc "Package the RSpec.tmbundle"
187
- task :package_tmbundle => :pkg do
188
- rm_rf 'pkg/RSpec.tmbundle'
201
+ task :package_tmbundle do
202
+ mkdir 'pkg' rescue nil
203
+ rm_rf 'pkg/RSpec.tmbundle' rescue nil
189
204
  `svn export ../RSpec.tmbundle pkg/RSpec.tmbundle`
190
205
  Dir.chdir 'pkg' do
191
206
  `tar cvzf RSpec-#{PKG_VERSION}.tmbundle.tgz RSpec.tmbundle`
192
207
  end
193
208
  end
194
- task :package => :package_tmbundle
209
+ task :pkg => :package_tmbundle
210
+
211
+ desc "Package the Spec::Ui gem"
212
+ task :package_spec_ui do
213
+ Dir.chdir '../spec_ui' do
214
+ `rake clobber gem`
215
+ end
216
+ end
217
+ task :pkg => :package_spec_ui
195
218
 
196
219
  desc "Publish gem+tgz+zip on RubyForge. You must make sure lib/version.rb is aligned with the CHANGELOG file"
197
220
  task :publish_packages => [:verify_user, :package] do
198
- require 'meta_project'
199
- require 'rake/contrib/xforge'
221
+ require File.dirname(__FILE__) + '/../spec_ui/lib/spec/ui/version'
200
222
  release_files = FileList[
201
223
  "pkg/#{PKG_FILE_NAME}.gem",
202
224
  "pkg/#{PKG_FILE_NAME}.tgz",
203
225
  "pkg/#{PKG_FILE_NAME}.zip",
204
- "pkg/RSpec-#{PKG_VERSION}.tmbundle.tgz"
226
+ "pkg/RSpec-#{PKG_VERSION}.tmbundle.tgz",
227
+ "../spec_ui/pkg/spec_ui-#{Spec::Ui::VERSION::STRING}.gem"
205
228
  ]
229
+ unless Spec::VERSION::RELEASE_CANDIDATE
230
+ require 'meta_project'
231
+ require 'rake/contrib/xforge'
232
+
233
+ Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |xf|
234
+ # Never hardcode user name and password in the Rakefile!
235
+ xf.user_name = ENV['RUBYFORGE_USER']
236
+ xf.files = release_files.to_a
237
+ xf.release_name = "RSpec #{PKG_VERSION}"
238
+ end
239
+ else
240
+ puts "SINCE THIS IS A PRERELEASE, FILES ARE UPLOADED WITH SSH, NOT TO THE RUBYFORGE FILE SECTION"
241
+ puts "YOU MUST TYPE THE PASSWORD #{release_files.length} TIMES..."
242
+
243
+ host = "rspec-website@rubyforge.org"
244
+ remote_dir = "/var/www/gforge-projects/#{PKG_NAME}"
206
245
 
207
- Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |xf|
208
- # Never hardcode user name and password in the Rakefile!
209
- xf.user_name = ENV['RUBYFORGE_USER']
210
- xf.files = release_files.to_a
211
- xf.release_name = "RSpec #{PKG_VERSION}"
246
+ publisher = Rake::SshFilePublisher.new(
247
+ host,
248
+ remote_dir,
249
+ File.dirname(__FILE__),
250
+ *release_files
251
+ )
252
+ publisher.upload
253
+
254
+ puts "UPLADED THE FOLLOWING FILES:"
255
+ release_files.each do |file|
256
+ name = file.match(/pkg\/(.*)/)[1]
257
+ puts "* http://rspec.rubyforge.org/#{name}"
258
+ end
259
+
260
+ puts "They are not linked to anywhere, so don't forget to tell people!"
212
261
  end
213
262
  end
214
263
 
215
264
  desc "Publish news on RubyForge"
216
265
  task :publish_news => [:verify_user] do
217
- require 'meta_project'
218
- require 'rake/contrib/xforge'
219
- Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |news|
220
- # Never hardcode user name and password in the Rakefile!
221
- news.user_name = ENV['RUBYFORGE_USER']
266
+ unless Spec::VERSION::RELEASE_CANDIDATE
267
+ require 'meta_project'
268
+ require 'rake/contrib/xforge'
269
+ Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |news|
270
+ # Never hardcode user name and password in the Rakefile!
271
+ news.user_name = ENV['RUBYFORGE_USER']
272
+ end
273
+ else
274
+ puts "** Not publishing news to RubyForge - this is a prerelease"
222
275
  end
223
276
  end