Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update rspec and rspec-rails to latest github versions

  • Loading branch information...
commit 0361ef8f0159da3985c7d17cc6f698560753719c 1 parent 4b8089a
@isaackearse isaackearse authored
Showing with 7,018 additions and 2,570 deletions.
  1. +153 −0 lib/tasks/rspec.rake
  2. +5 −0 script/autospec
  3. +1 −0  script/spec
  4. +22 −5 script/spec_server
  5. +2 −5 spec/spec.opts
  6. +7 −0 vendor/plugins/rspec-rails/.gitignore
  7. +105 −0 vendor/plugins/rspec-rails/History.txt
  8. +7 −5 vendor/plugins/{rspec_on_rails/MIT-LICENSE → rspec-rails/License.txt}
  9. +161 −0 vendor/plugins/rspec-rails/Manifest.txt
  10. +46 −0 vendor/plugins/rspec-rails/README.txt
  11. +39 −0 vendor/plugins/rspec-rails/Rakefile
  12. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec/CHANGES
  13. +9 −4 vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec/rspec_generator.rb
  14. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec/templates/all_stories.rb
  15. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec/templates/previous_failures.txt
  16. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec/templates/rcov.opts
  17. +153 −0 vendor/plugins/rspec-rails/generators/rspec/templates/rspec.rake
  18. +5 −0 vendor/plugins/rspec-rails/generators/rspec/templates/script/autospec
  19. +1 −0  vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec/templates/script/spec
  20. +22 −5 vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec/templates/script/spec_server
  21. +4 −0 vendor/plugins/rspec-rails/generators/rspec/templates/spec.opts
  22. +47 −0 vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb
  23. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec/templates/stories_helper.rb
  24. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec_controller/USAGE
  25. +4 −4 vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec_controller/rspec_controller_generator.rb
  26. +6 −4 vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec_controller/templates/controller_spec.rb
  27. +11 −0 vendor/plugins/rspec-rails/generators/rspec_controller/templates/helper_spec.rb
  28. +3 −3 vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec_controller/templates/view_spec.rb
  29. +19 −0 vendor/plugins/rspec-rails/generators/rspec_default_values.rb
  30. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec_model/USAGE
  31. +7 −2 vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec_model/rspec_model_generator.rb
  32. +15 −0 vendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb
  33. +9 −20 vendor/plugins/{rspec_on_rails → rspec-rails}/generators/rspec_scaffold/rspec_scaffold_generator.rb
  34. +173 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/controller_spec.rb
  35. +27 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/edit_erb_spec.rb
  36. +11 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/helper_spec.rb
  37. +28 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/index_erb_spec.rb
  38. +27 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/new_erb_spec.rb
  39. +59 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/routing_spec.rb
  40. +23 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/show_erb_spec.rb
  41. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/init.rb
  42. +1 −0  vendor/plugins/rspec-rails/lib/autotest/discover.rb
  43. +76 −0 vendor/plugins/rspec-rails/lib/autotest/rails_rspec.rb
  44. +15 −0 vendor/plugins/rspec-rails/lib/spec/rails.rb
  45. +13 −6 vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/example.rb
  46. +40 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/assigns_hash_proxy.rb
  47. +64 −49 ...mple/behaviour/controller_example.rb → rspec-rails/lib/spec/rails/example/controller_example_group.rb}
  48. +25 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/cookies_proxy.rb
  49. +87 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/functional_example_group.rb
  50. +170 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/helper_example_group.rb
  51. +2 −2 .../rails/example/behaviour/model_example.rb → rspec-rails/lib/spec/rails/example/model_example_group.rb}
  52. +28 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/rails_example_group.rb
  53. +93 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb
  54. +33 −22 ...ec/rails/example/behaviour/view_example.rb → rspec-rails/lib/spec/rails/example/view_example_group.rb}
  55. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/extensions.rb
  56. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/extensions/action_controller/base.rb
  57. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/extensions/action_controller/rescue.rb
  58. 0  ...or/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/extensions/action_controller/test_response.rb
  59. +10 −4 vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/extensions/action_view/base.rb
  60. +30 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/active_record/base.rb
  61. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/extensions/object.rb
  62. +76 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/example/configuration.rb
  63. +2 −2 vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/extensions/spec/matchers/have.rb
  64. +14 −0 vendor/plugins/rspec-rails/lib/spec/rails/interop/testcase.rb
  65. +2 −0  vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/matchers.rb
  66. +1 −0  vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/matchers/assert_select.rb
  67. +11 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/change.rb
  68. +6 −4 vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/matchers/have_text.rb
  69. +54 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/include_text.rb
  70. +1 −2  vendor/plugins/{rspec_on_rails → rspec-rails}/lib/spec/rails/matchers/redirect_to.rb
  71. +100 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/render_template.rb
  72. +132 −0 vendor/plugins/rspec-rails/lib/spec/rails/mocks.rb
  73. +79 −0 vendor/plugins/rspec-rails/lib/spec/rails/story_adapter.rb
  74. +16 −0 vendor/plugins/rspec-rails/lib/spec/rails/version.rb
  75. +35 −0 vendor/plugins/rspec-rails/rspec-rails.gemspec
  76. +36 −0 vendor/plugins/rspec-rails/spec/rails/autotest/mappings_spec.rb
  77. +96 −0 vendor/plugins/rspec-rails/spec/rails/example/assigns_hash_proxy_spec.rb
  78. +79 −0 vendor/plugins/rspec-rails/spec/rails/example/configuration_spec.rb
  79. +22 −3 .../plugins/{rspec_on_rails/spec/rails/dsl → rspec-rails/spec/rails/example}/controller_isolation_spec.rb
  80. +279 −0 vendor/plugins/rspec-rails/spec/rails/example/controller_spec_spec.rb
  81. +74 −0 vendor/plugins/rspec-rails/spec/rails/example/cookies_proxy_spec.rb
  82. +112 −0 vendor/plugins/rspec-rails/spec/rails/example/example_group_factory_spec.rb
  83. +174 −0 vendor/plugins/rspec-rails/spec/rails/example/helper_spec_spec.rb
  84. +18 −0 vendor/plugins/rspec-rails/spec/rails/example/model_spec_spec.rb
  85. +3 −3 vendor/plugins/{rspec_on_rails/spec/rails/dsl → rspec-rails/spec/rails/example}/shared_behaviour_spec.rb
  86. +5 −5 ...ec_on_rails/spec/rails/dsl → rspec-rails/spec/rails/example}/test_unit_assertion_accessibility_spec.rb
  87. +308 −0 vendor/plugins/rspec-rails/spec/rails/example/view_spec_spec.rb
  88. 0  ...r/plugins/{rspec_on_rails → rspec-rails}/spec/rails/extensions/action_controller_rescue_action_spec.rb
  89. +48 −0 vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb
  90. +1 −4 vendor/plugins/{rspec_on_rails → rspec-rails}/spec/rails/extensions/active_record_spec.rb
  91. +66 −0 vendor/plugins/rspec-rails/spec/rails/interop/testcase_spec.rb
  92. +42 −11 vendor/plugins/{rspec_on_rails → rspec-rails}/spec/rails/matchers/assert_select_spec.rb
  93. +2 −5 vendor/plugins/{rspec_on_rails → rspec-rails}/spec/rails/matchers/description_generation_spec.rb
  94. +25 −0 vendor/plugins/rspec-rails/spec/rails/matchers/errors_on_spec.rb
  95. +62 −0 vendor/plugins/rspec-rails/spec/rails/matchers/have_text_spec.rb
  96. +64 −0 vendor/plugins/rspec-rails/spec/rails/matchers/include_text_spec.rb
  97. +11 −5 vendor/plugins/{rspec_on_rails → rspec-rails}/spec/rails/matchers/redirect_to_spec.rb
  98. +176 −0 vendor/plugins/rspec-rails/spec/rails/matchers/render_template_spec.rb
  99. +15 −0 vendor/plugins/rspec-rails/spec/rails/matchers/should_change_spec.rb
  100. +10 −0 vendor/plugins/rspec-rails/spec/rails/mocks/ar_classes.rb
  101. +106 −0 vendor/plugins/rspec-rails/spec/rails/mocks/mock_model_spec.rb
  102. +80 −0 vendor/plugins/rspec-rails/spec/rails/mocks/stub_model_spec.rb
  103. +8 −0 vendor/plugins/rspec-rails/spec/rails/sample_modified_fixture.rb
  104. +8 −0 vendor/plugins/rspec-rails/spec/rails/sample_spec.rb
  105. +96 −0 vendor/plugins/rspec-rails/spec/rails/spec_server_spec.rb
  106. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/spec/rails/spec_spec.rb
  107. 0  vendor/plugins/{rspec_on_rails → rspec-rails}/spec/rails_suite.rb
  108. 0  ..._on_rails/spec_resources → rspec-rails/spec/resources}/controllers/action_view_base_spec_controller.rb
  109. +99 −0 vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb
  110. 0  ...s/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/controllers/redirect_spec_controller.rb
  111. +8 −0 ...ins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/controllers/render_spec_controller.rb
  112. 0  ...lugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/controllers/rjs_spec_controller.rb
  113. +5 −0 vendor/plugins/rspec-rails/spec/resources/helpers/addition_helper.rb
  114. +38 −0 vendor/plugins/rspec-rails/spec/resources/helpers/explicit_helper.rb
  115. 0  ...r/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/helpers/more_explicit_helper.rb
  116. 0  ...gins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/helpers/plugin_application_helper.rb
  117. 0  vendor/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/helpers/view_spec_helper.rb
  118. 0  ...gins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/controller_spec/_partial.rhtml
  119. 0  ...ces → rspec-rails/spec/resources}/views/controller_spec/action_setting_flash_after_session_reset.rhtml
  120. 0  ...es → rspec-rails/spec/resources}/views/controller_spec/action_setting_flash_before_session_reset.rhtml
  121. 0  ...ec_resources → rspec-rails/spec/resources}/views/controller_spec/action_setting_the_assigns_hash.rhtml
  122. 0  ...pec_resources → rspec-rails/spec/resources}/views/controller_spec/action_with_errors_in_template.rhtml
  123. 0  ...on_rails/spec_resources → rspec-rails/spec/resources}/views/controller_spec/action_with_template.rhtml
  124. 0  ...iews/view_spec/_partial_used_twice.rhtml → rspec-rails/spec/resources/views/layouts/application.rhtml}
  125. 0  ...resources/views/render_spec/some_action.rhtml → rspec-rails/spec/resources/views/layouts/simple.rhtml}
  126. +1 −0  vendor/plugins/rspec-rails/spec/resources/views/objects/_object.html.erb
  127. 0  ...lugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/render_spec/_a_partial.rhtml
  128. 0  vendor/plugins/rspec-rails/spec/resources/views/render_spec/action_with_alternate_layout.rhtml
  129. 0  ...gins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/render_spec/some_action.js.rjs
  130. 0  vendor/plugins/rspec-rails/spec/resources/views/render_spec/some_action.rhtml
  131. 0  ...plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/render_spec/some_action.rjs
  132. 0  ...{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/_replacement_partial.rhtml
  133. 0  vendor/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/hide_div.rjs
  134. 0  ...gins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/hide_page_element.rjs
  135. 0  ...or/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/insert_html.rjs
  136. 0  vendor/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/replace.rjs
  137. 0  ...r/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/replace_html.rjs
  138. 0  ...pec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/replace_html_with_partial.rjs
  139. 0  .../plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/visual_effect.rjs
  140. 0  ...s/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/rjs_spec/visual_toggle_effect.rjs
  141. 0  vendor/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/tag_spec/no_tags.rhtml
  142. 0  ..._rails/spec_resources → rspec-rails/spec/resources}/views/tag_spec/single_div_with_no_attributes.rhtml
  143. 0  ..._rails/spec_resources → rspec-rails/spec/resources}/views/tag_spec/single_div_with_one_attribute.rhtml
  144. 0  ...or/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/_partial.rhtml
  145. 0  vendor/plugins/rspec-rails/spec/resources/views/view_spec/_partial_used_twice.rhtml
  146. 0  ..._rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/_partial_with_local_variable.rhtml
  147. 0  ..._on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/_partial_with_sub_partial.rhtml
  148. 0  vendor/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/_spacer.rhtml
  149. +5 −0 vendor/plugins/rspec-rails/spec/resources/views/view_spec/accessor.rhtml
  150. +3 −0  vendor/plugins/rspec-rails/spec/resources/views/view_spec/block_helper.rhtml
  151. 0  .../plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/entry_form.rhtml
  152. 0  ...ins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/explicit_helper.rhtml
  153. 0  ...or/plugins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/foo/show.rhtml
  154. 0  ...ins/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/implicit_helper.rhtml
  155. 0  ...ns/{rspec_on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/multiple_helpers.rhtml
  156. +1 −0  vendor/plugins/rspec-rails/spec/resources/views/view_spec/path_params.html.erb
  157. +3 −0  vendor/plugins/rspec-rails/spec/resources/views/view_spec/should_not_receive.rhtml
  158. 0  ...spec_on_rails/spec_resources → rspec-rails/spec/resources}/views/view_spec/template_with_partial.rhtml
  159. 0  ...c_resources → rspec-rails/spec/resources}/views/view_spec/template_with_partial_using_collection.rhtml
  160. 0  ...ls/spec_resources → rspec-rails/spec/resources}/views/view_spec/template_with_partial_with_array.rhtml
  161. +58 −0 vendor/plugins/rspec-rails/spec/spec_helper.rb
  162. +10 −0 vendor/plugins/rspec-rails/stories/all.rb
  163. +5 −0 vendor/plugins/rspec-rails/stories/configuration/stories.rb
  164. +6 −0 vendor/plugins/rspec-rails/stories/helper.rb
  165. +8 −0 vendor/plugins/rspec-rails/stories/steps/people.rb
  166. +15 −0 vendor/plugins/rspec-rails/stories/transactions_should_rollback
  167. +25 −0 vendor/plugins/rspec-rails/stories/transactions_should_rollback.rb
  168. +4 −0 vendor/plugins/rspec/.autotest
  169. +9 −0 vendor/plugins/rspec/.gitignore
  170. +301 −59 vendor/plugins/rspec/{CHANGES → History.txt}
  171. +3 −1 vendor/plugins/rspec/{MIT-LICENSE → License.txt}
  172. +389 −0 vendor/plugins/rspec/Manifest.txt
  173. +0 −72 vendor/plugins/rspec/README
  174. +39 −0 vendor/plugins/rspec/README.txt
  175. +43 −235 vendor/plugins/rspec/Rakefile
  176. +0 −88 vendor/plugins/rspec/TODO
  177. +10 −0 vendor/plugins/rspec/TODO.txt
  178. +0 −31 vendor/plugins/rspec/UPGRADE
  179. +0 −6 vendor/plugins/rspec/autotest/discover.rb
  180. +0 −1  vendor/plugins/rspec/autotest/rspec.rb
  181. +4 −0 vendor/plugins/rspec/bin/autospec
  182. +2 −1  vendor/plugins/rspec/bin/spec
  183. +0 −8 vendor/plugins/rspec/bin/spec_translator
  184. +7 −0 vendor/plugins/rspec/examples/failing/README.txt
  185. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/diffing_spec.rb
  186. +19 −0 vendor/plugins/rspec/examples/failing/failing_autogenerated_docstrings_example.rb
  187. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/failure_in_setup.rb
  188. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/failure_in_teardown.rb
  189. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/mocking_example.rb
  190. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/mocking_with_flexmock.rb
  191. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/mocking_with_mocha.rb
  192. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/mocking_with_rr.rb
  193. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/partial_mock_example.rb
  194. +5 −0 vendor/plugins/rspec/{failing_examples → examples/failing}/predicate_example.rb
  195. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/raising_example.rb
  196. +1 −1  vendor/plugins/rspec/{failing_examples → examples/failing}/spec_helper.rb
  197. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/syntax_error_example.rb
  198. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/team_spec.rb
  199. 0  vendor/plugins/rspec/{failing_examples → examples/failing}/timeout_behaviour.rb
  200. +10 −4 ...s/rspec/examples/{pure/auto_spec_description_example.rb → passing/autogenerated_docstrings_example.rb}
  201. 0  vendor/plugins/rspec/examples/{pure → passing}/before_and_after_example.rb
  202. 0  vendor/plugins/rspec/examples/{pure → passing}/behave_as_example.rb
  203. 0  vendor/plugins/rspec/examples/{pure → passing}/custom_expectation_matchers.rb
  204. +1 −1  vendor/plugins/rspec/examples/{pure → passing}/custom_formatter.rb
  205. +2 −2 vendor/plugins/rspec/examples/{pure → passing}/dynamic_spec.rb
  206. 0  vendor/plugins/rspec/examples/{pure → passing}/file_accessor.rb
  207. 0  vendor/plugins/rspec/examples/{pure → passing}/file_accessor_spec.rb
  208. 0  vendor/plugins/rspec/examples/{pure → passing}/greeter_spec.rb
  209. +14 −0 vendor/plugins/rspec/examples/passing/helper_method_example.rb
  210. 0  vendor/plugins/rspec/examples/{pure → passing}/io_processor.rb
  211. 0  vendor/plugins/rspec/examples/{pure → passing}/io_processor_spec.rb
  212. 0  vendor/plugins/rspec/examples/{pure → passing}/legacy_spec.rb
  213. 0  vendor/plugins/rspec/examples/{pure → passing}/mocking_example.rb
  214. +6 −5 vendor/plugins/rspec/examples/{pure → passing}/multi_threaded_behaviour_runner.rb
  215. +36 −0 vendor/plugins/rspec/examples/passing/nested_classes_example.rb
  216. +1 −0  vendor/plugins/rspec/examples/{pure → passing}/partial_mock_example.rb
  217. 0  vendor/plugins/rspec/examples/{pure → passing}/pending_example.rb
  218. 0  vendor/plugins/rspec/examples/{pure → passing}/predicate_example.rb
  219. 0  vendor/plugins/rspec/examples/{pure → passing}/priority.txt
  220. +81 −0 vendor/plugins/rspec/examples/passing/shared_example_group_example.rb
  221. +36 −0 vendor/plugins/rspec/examples/passing/shared_stack_examples.rb
  222. +31 −0 vendor/plugins/rspec/examples/passing/simple_matcher_example.rb
  223. 0  vendor/plugins/rspec/examples/{pure → passing}/spec_helper.rb
  224. 0  vendor/plugins/rspec/examples/{pure → passing}/stack.rb
  225. +4 −37 vendor/plugins/rspec/examples/{pure → passing}/stack_spec.rb
  226. +67 −0 vendor/plugins/rspec/examples/passing/stack_spec_with_nested_example_groups.rb
  227. 0  vendor/plugins/rspec/examples/{pure → passing}/stubbing_example.rb
  228. +33 −0 vendor/plugins/rspec/examples/passing/yielding_example.rb
  229. +0 −11 vendor/plugins/rspec/examples/pure/helper_method_example.rb
  230. +0 −26 vendor/plugins/rspec/examples/pure/nested_example.rb
  231. +0 −66 vendor/plugins/rspec/examples/pure/shared_example_group_example.rb
  232. +0 −13 vendor/plugins/rspec/examples/stories/adder.rb
  233. +0 −34 vendor/plugins/rspec/examples/stories/addition
  234. +0 −9 vendor/plugins/rspec/examples/stories/addition.rb
  235. +0 −65 vendor/plugins/rspec/examples/stories/calculator.rb
  236. +0 −5 vendor/plugins/rspec/examples/stories/game-of-life/.loadpath
  237. +0 −21 vendor/plugins/rspec/examples/stories/game-of-life/README.txt
  238. +0 −6 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/everything.rb
  239. +0 −3  vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/examples.rb
  240. +0 −35 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb
  241. +0 −66 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
  242. +0 −21 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story
  243. +0 −21 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
  244. +0 −42 ...ugins/rspec/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story
  245. +0 −42 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story
  246. +0 −17 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story
  247. +0 −53 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story
  248. +0 −52 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb
  249. +0 −6 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/helper.rb
  250. +0 −26 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb
  251. +0 −5 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/steps.rb
  252. +0 −3  vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.rb
  253. +0 −22 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.txt
  254. +0 −3  vendor/plugins/rspec/examples/stories/game-of-life/life.rb
  255. +0 −23 vendor/plugins/rspec/examples/stories/game-of-life/life/game.rb
  256. +0 −43 vendor/plugins/rspec/examples/stories/game-of-life/life/grid.rb
  257. +0 −9 vendor/plugins/rspec/examples/stories/helper.rb
  258. +0 −16 vendor/plugins/rspec/examples/stories/steps/addition_steps.rb
  259. +1 −1  vendor/plugins/rspec/lib/autotest/discover.rb
  260. +27 −74 vendor/plugins/rspec/lib/autotest/rspec.rb
  261. +23 −27 vendor/plugins/rspec/lib/spec.rb
  262. +1 −0  vendor/plugins/rspec/lib/spec/adapters.rb
  263. +26 −0 vendor/plugins/rspec/lib/spec/adapters/ruby_engine.rb
  264. +8 −0 vendor/plugins/rspec/lib/spec/adapters/ruby_engine/mri.rb
  265. +8 −0 vendor/plugins/rspec/lib/spec/adapters/ruby_engine/rubinius.rb
  266. +1 −0  vendor/plugins/rspec/lib/spec/dsl.rb
  267. +82 −0 vendor/plugins/rspec/lib/spec/dsl/main.rb
  268. +27 −5 vendor/plugins/rspec/lib/spec/example.rb
  269. +81 −0 vendor/plugins/rspec/lib/spec/example/before_and_after_hooks.rb
  270. +84 −49 vendor/plugins/rspec/lib/spec/example/configuration.rb
  271. +23 −2 vendor/plugins/rspec/lib/spec/example/errors.rb
  272. +0 −25 vendor/plugins/rspec/lib/spec/example/example.rb
  273. +14 −4 vendor/plugins/rspec/lib/spec/example/example_group.rb
  274. +0 −88 vendor/plugins/rspec/lib/spec/example/example_group_description.rb
  275. +53 −74 vendor/plugins/rspec/lib/spec/example/example_group_factory.rb
  276. +268 −199 vendor/plugins/rspec/lib/spec/example/example_group_methods.rb
  277. +12 −10 vendor/plugins/rspec/lib/spec/example/example_matcher.rb
  278. +135 −39 vendor/plugins/rspec/lib/spec/example/example_methods.rb
  279. +0 −124 vendor/plugins/rspec/lib/spec/example/example_runner.rb
  280. +0 −121 vendor/plugins/rspec/lib/spec/example/example_suite.rb
  281. +1 −0  vendor/plugins/rspec/lib/spec/example/module_reopening_fix.rb
  282. +36 −32 vendor/plugins/rspec/lib/spec/example/shared_example_group.rb
  283. +23 −18 vendor/plugins/rspec/lib/spec/expectations.rb
  284. +1 −1  vendor/plugins/rspec/lib/spec/expectations/differs/default.rb
  285. +7 −1 vendor/plugins/rspec/lib/spec/expectations/errors.rb
  286. +4 −12 vendor/plugins/rspec/lib/spec/expectations/extensions/object.rb
  287. +24 −29 vendor/plugins/rspec/lib/spec/expectations/handler.rb
  288. +56 −0 vendor/plugins/rspec/lib/spec/expectations/wrap_expectation.rb
  289. +0 −2  vendor/plugins/rspec/lib/spec/extensions.rb
  290. +0 −49 vendor/plugins/rspec/lib/spec/extensions/main.rb
  291. +0 −10 vendor/plugins/rspec/lib/spec/extensions/object.rb
  292. +0 −14 vendor/plugins/rspec/lib/spec/extensions/test.rb
  293. +0 −34 vendor/plugins/rspec/lib/spec/extensions/test/unit/example_group.rb
  294. +0 −11 vendor/plugins/rspec/lib/spec/extensions/test/unit/example_suite.rb
  295. +0 −5 vendor/plugins/rspec/lib/spec/extensions/test/unit/rspectestresult.rb
  296. +0 −10 vendor/plugins/rspec/lib/spec/extensions/test/unit/ui/testrunnermediator.rb
  297. +12 −0 vendor/plugins/rspec/lib/spec/interop/test.rb
  298. 0  vendor/plugins/rspec/lib/spec/{extensions → interop}/test/unit/autorunner.rb
  299. +73 −0 vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
  300. +6 −0 vendor/plugins/rspec/lib/spec/interop/test/unit/testresult.rb
Sorry, we could not display the entire diff because too many files (620) changed.
View
153 lib/tasks/rspec.rake
@@ -0,0 +1,153 @@
+raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec pkg]))
+raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec-rails" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec-rails pkg]))
+
+# In rails 1.2, plugins aren't available in the path until they're loaded.
+# Check to see if the rspec plugin is installed first and require
+# it if it is. If not, use the gem version.
+rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec/lib')
+$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
+
+begin
+ require 'spec/rake/spectask'
+ Rake.application.instance_variable_get('@tasks').delete('default')
+
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
+ task :noop do
+ end
+
+ task :default => :spec
+ task :stats => "spec:statsetup"
+
+ desc "Run all specs in spec directory (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
+ end
+
+ namespace :spec do
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:rcov) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
+ t.rcov = true
+ t.rcov_opts = lambda do
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
+ end
+ end
+
+ desc "Print Specdoc for all specs (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:doc) do |t|
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
+ end
+
+ desc "Print Specdoc for all plugin examples"
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
+ end
+
+ [:models, :controllers, :views, :helpers, :lib].each do |sub|
+ desc "Run the code examples in spec/#{sub}"
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
+ end
+ end
+
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
+ end
+
+ namespace :plugins do
+ desc "Runs the examples for rspec_on_rails"
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
+ end
+ end
+
+ # Setup specs for stats
+ task :statsetup do
+ require 'code_statistics'
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
+ end
+
+ namespace :db do
+ namespace :fixtures do
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
+ task :load => :environment do
+ require 'active_record/fixtures'
+ ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
+ Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
+ end
+ end
+ end
+ end
+
+ namespace :server do
+ daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp")
+
+ desc "start spec_server."
+ task :start do
+ if File.exist?(daemonized_server_pid)
+ $stderr.puts "spec_server is already running."
+ else
+ $stderr.puts "Starting up spec server."
+ system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
+ end
+ end
+
+ desc "stop spec_server."
+ task :stop do
+ unless File.exist?(daemonized_server_pid)
+ $stderr.puts "No server running."
+ else
+ $stderr.puts "Shutting down spec_server."
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
+ File.delete(daemonized_server_pid)
+ end
+ end
+
+ desc "reload spec_server."
+ task :restart do
+ unless File.exist?(daemonized_server_pid)
+ $stderr.puts "No server running."
+ else
+ $stderr.puts "Reloading down spec_server."
+ system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip)
+ end
+ end
+ end
+ end
+rescue MissingSourceFile
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
+ require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
+
+ # ... otherwise, do this:
+ raise <<-MSG
+
+ You have rspec-rails rake tasks installed in
+ #{__FILE__},
+ but rspec-rails is not configured as a gem in
+ config/environment.rb
+
+ Either remove #{__FILE__}
+ or configure the rspec-rails gem in config/environment.rb.
+
+MSG
+end
+
View
5 script/autospec
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+ENV['RSPEC'] = 'true' # allows autotest to discover rspec
+ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
+system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
+ $stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
View
1  script/spec 100644 → 100755
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
+require 'rubygems'
require 'spec'
exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))
View
27 script/spec_server 100644 → 100755
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../rspec/lib' # For svn
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
require 'rubygems'
require 'drb/drb'
@@ -23,17 +22,29 @@ module Spec
active_connections.delete(name)
end
end
- end
+ end
- if ::Dispatcher.respond_to?(:cleanup_application)
- ::Dispatcher.cleanup_application
+ if ActionController.const_defined?(:Dispatcher)
+ dispatcher = ::ActionController::Dispatcher.new($stdout)
+ dispatcher.cleanup_application
elsif ::Dispatcher.respond_to?(:reset_application!)
::Dispatcher.reset_application!
+ else
+ raise "Application reloading failed"
+ end
+ if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
+ Fixtures.reset_cache
end
+
::Dependencies.mechanism = :load
require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
+ if in_memory_database?
+ load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
+ ActiveRecord::Migrator.up('db/migrate') # use migrations
+ end
+
::Spec::Runner::CommandLine.run(
::Spec::Runner::OptionParser.parse(
argv,
@@ -42,6 +53,12 @@ module Spec
)
)
end
+
+ def in_memory_database?
+ ENV["RAILS_ENV"] == "test" and
+ ::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
+ ::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
+ end
end
end
end
@@ -88,7 +105,7 @@ opts.parse!(ARGV)
puts "Ready"
exec_server = lambda {
trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
- DRb.start_service("druby://localhost:8989", Spec::Runner::RailsSpecServer.new)
+ DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new)
DRb.thread.join
}
View
7 spec/spec.opts
@@ -1,7 +1,4 @@
--colour
---format
-progress
---loadby
-mtime
+--format progress
+--loadby mtime
--reverse
---backtrace
View
7 vendor/plugins/rspec-rails/.gitignore
@@ -0,0 +1,7 @@
+tmtags
+.DS_Store
+.emacs-project
+*~
+pkg
+doc
+email.txt
View
105 vendor/plugins/rspec-rails/History.txt
@@ -0,0 +1,105 @@
+=== Maintenance
+
+* 2 major enhancements
+
+ * support controller and action path params in view specs (Mike Vincent).
+ * use ActiveSupport::TestCase when available, else Test::Unit::TestCase - supports Rails 1.2.6 (Brandon Keepers). Closes #620.
+
+* 2 minor enhancements
+
+ * improve rdoc for render_template (Patch from Andrew Premdas). Fixes #571.
+ * use more liberal globs to allow for specs in symlinked dirs (Martin Luder). Closes #361.
+
+=== Version 1.1.11 / 2008-10-24
+
+* No changes to rspec-rails - release to align with bug-fix release in rspec ... again :(
+
+=== Version 1.1.10 / 2008-10-24
+
+* No changes to rspec-rails - release to align with bug-fix release in rspec
+
+=== Version 1.1.9 / 2008-10-20
+
+* 4 bug fixes
+
+ * require 'rubygems' in script/spec
+ * fix failure message for error_on and errors_on (Patch from Mike Vincent). Fixes #566.
+ * fix issues that arise in view spec if passing actual template name to render (Patch from Mike Vincent). Fixes #551.
+ * fixed bug accessing assigns from helper examples
+
+=== Version 1.1.8 / 2008-10-03
+
+* 2 bug fixes
+
+ * correctly handle assigns that are false. Fixes #552.
+ * ensure that NotYetImplemented examples report as pending (fixed in rspec, not rspec-rails). Fixes #553.
+
+=== Version 1.1.7 / 2008-10-02
+
+* 1 bug fix
+
+ * depend on the correct version of rspec
+
+=== Version 1.1.6 / 2008-10-02
+
+* 1 bug fix
+
+ * fixed regression where values assigned to the assigns hash were not accessible from the example (#549)
+
+=== Version 1.1.5 / 2008-09-28
+
+IMPORTANT: use 'script/autospec' (or just 'autospec' if you have the rspec gem
+installed) instead of 'autotest'. We changed the way autotest discovers rspec
+so the autotest executable won't automatically load rspec anymore. This allows
+rspec to live side by side other spec frameworks without always co-opting
+autotest through autotest's discovery mechanism.
+
+ALSO IMPORTANT: Rails v2.1.1 changed assert_select_rjs such that it doesn't
+always fail when it should. Please see
+http://rails.lighthouseapp.com/projects/8994/tickets/982.
+
+* Generated route specs have shorter names, making it less painful to modify their implementation
+* Add conditional so Rails 2.1.0 doesn't warn about cache_template_extensions (patch from James Herdman)
+* Fixed stub_model examples to work with Rails 2.1.0 (the code was fine, just the examples needed patching)
+* use hoe for build/release
+* reworked generated examples for rspec_scaffold - thanks to Mikel Lindsaar and Dan Manges for their feedback
+* bye, bye translator
+* Added proxy to cookies so you can set them in examples the same way you set them in controllers
+* Added script/autospec so you can run autospec without installing the gem
+* Support --skip-fixture in the rspec_model generator (patches from Alex Tomlins and Niels Ganser)
+* Add mock_model#as_new_record (patch from Zach Dennis)
+* mock(:null_object=>true) plays nice with HTML (patch from Gerrit Kaiser)
+* Suppress a deprecation notice in Rails 2.1 (James Herdman)
+* quiet deprecation warning on inflector (RSL)
+* rspec-rails gem (Ben Mabey)
+* updated generated code examples
+* Make rspec_model generator honour --skip-fixtures tag (Niels Ganser, Alex Tomlins)
+* Fix to create new models with attributes in command line (Nicolas)
+* fix to_param in mock_model with stubbed id incorrectly returning autogenerated id (Adam Meehan)
+* Call Rail's TestCase setup/teardown callbacks (Jonathan del Strother)
+* Only run TestUnitTesting once (Jonathan del Strother)
+* use require_dependency instead of require (Brandon Keepers)
+* Fixed a problem caused by controller action names getting out of sync between rspec-dev and rspec-rails for speccing (Matt Patterson)
+* don't mutate hash passed to mock_model (Reg Vos)
+
+=== Version 1.1.4
+
+Maintenance release.
+
+* Moved mock_model and stub_model to their own module: Spec::Rails::Mocks
+* Setting mock_model object id with stubs hash - patch from Adam Meehan
+* Added as_new_record to stub_model e.g. stub_model(Foo).as_new_record
+* Improved stub_model such that new_record? does "the right thing"
+* Patch from Pat Maddox to get integrate_views to work in nested example groups.
+* Patch from Pat Maddox to get controller_name to work in nested example groups.
+* Patch from Corey Haines to add include_text matcher
+* Added stub_model method which creates a real model instance with :id stubbed and data access prohibited.
+* Applied patch from Pat Maddox to handle redirect_to w/ SSL. Closes #320.
+* Added #helper and #assigns to helper specs.
+* Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162.
+* Tweaked list of exceptions (ignores) for autotest
+* Applied patch from Rick Olson to get rspec_on_rails working with rails edge (>= 8862)
+* Applied patch from Wincent Colaiuta to invert sense of "spec --diff". Closes #281.
+* Allow any type of render in view specs. Closes #57.
+* Applied patch from Ian White to get rspec working with edge rails (8804). Closes #271.
+* Applied patch from Jon Strother to have spec_server reload fixtures. Closes #344.
View
12 vendor/plugins/rspec_on_rails/MIT-LICENSE → vendor/plugins/rspec-rails/License.txt
@@ -1,14 +1,16 @@
+(The MIT License)
+
====================================================================
-== RSpec
-Copyright (c) 2005-2007 The RSpec Development Team
+==== RSpec, RSpec-Rails
+Copyright (c) 2005-2008 The RSpec Development Team
====================================================================
-== ARTS
+==== ARTS
Copyright (c) 2006 Kevin Clark, Jake Howerton
====================================================================
-== ZenTest
+==== ZenTest
Copyright (c) 2001-2006 Ryan Davis, Eric Hodel, Zen Spider Software
====================================================================
-== AssertSelect
+==== AssertSelect
Copyright (c) 2006 Assaf Arkin
====================================================================
View
161 vendor/plugins/rspec-rails/Manifest.txt
@@ -0,0 +1,161 @@
+History.txt
+License.txt
+Manifest.txt
+README.txt
+Rakefile
+UPGRADE
+generators/rspec/CHANGES
+generators/rspec/rspec_generator.rb
+generators/rspec/templates/all_stories.rb
+generators/rspec/templates/previous_failures.txt
+generators/rspec/templates/rcov.opts
+generators/rspec/templates/rspec.rake
+generators/rspec/templates/script/autospec
+generators/rspec/templates/script/spec
+generators/rspec/templates/script/spec_server
+generators/rspec/templates/spec.opts
+generators/rspec/templates/spec_helper.rb
+generators/rspec/templates/stories_helper.rb
+generators/rspec_controller/USAGE
+generators/rspec_controller/rspec_controller_generator.rb
+generators/rspec_controller/templates/controller_spec.rb
+generators/rspec_controller/templates/helper_spec.rb
+generators/rspec_controller/templates/view_spec.rb
+generators/rspec_default_values.rb
+generators/rspec_model/USAGE
+generators/rspec_model/rspec_model_generator.rb
+generators/rspec_model/templates/model_spec.rb
+generators/rspec_scaffold/rspec_scaffold_generator.rb
+generators/rspec_scaffold/templates/controller_spec.rb
+generators/rspec_scaffold/templates/edit_erb_spec.rb
+generators/rspec_scaffold/templates/helper_spec.rb
+generators/rspec_scaffold/templates/index_erb_spec.rb
+generators/rspec_scaffold/templates/new_erb_spec.rb
+generators/rspec_scaffold/templates/routing_spec.rb
+generators/rspec_scaffold/templates/show_erb_spec.rb
+init.rb
+lib/autotest/discover.rb
+lib/autotest/rails_rspec.rb
+lib/spec/rails.rb
+lib/spec/rails/example.rb
+lib/spec/rails/example/assigns_hash_proxy.rb
+lib/spec/rails/example/controller_example_group.rb
+lib/spec/rails/example/cookies_proxy.rb
+lib/spec/rails/example/functional_example_group.rb
+lib/spec/rails/example/helper_example_group.rb
+lib/spec/rails/example/model_example_group.rb
+lib/spec/rails/example/rails_example_group.rb
+lib/spec/rails/example/render_observer.rb
+lib/spec/rails/example/view_example_group.rb
+lib/spec/rails/extensions.rb
+lib/spec/rails/extensions/action_controller/base.rb
+lib/spec/rails/extensions/action_controller/rescue.rb
+lib/spec/rails/extensions/action_controller/test_response.rb
+lib/spec/rails/extensions/action_view/base.rb
+lib/spec/rails/extensions/active_record/base.rb
+lib/spec/rails/extensions/object.rb
+lib/spec/rails/extensions/spec/example/configuration.rb
+lib/spec/rails/extensions/spec/matchers/have.rb
+lib/spec/rails/interop/testcase.rb
+lib/spec/rails/matchers.rb
+lib/spec/rails/matchers/assert_select.rb
+lib/spec/rails/matchers/change.rb
+lib/spec/rails/matchers/have_text.rb
+lib/spec/rails/matchers/include_text.rb
+lib/spec/rails/matchers/redirect_to.rb
+lib/spec/rails/matchers/render_template.rb
+lib/spec/rails/mocks.rb
+lib/spec/rails/story_adapter.rb
+lib/spec/rails/version.rb
+rspec-rails.gemspec
+spec/rails/autotest/mappings_spec.rb
+spec/rails/example/assigns_hash_proxy_spec.rb
+spec/rails/example/configuration_spec.rb
+spec/rails/example/controller_isolation_spec.rb
+spec/rails/example/controller_spec_spec.rb
+spec/rails/example/cookies_proxy_spec.rb
+spec/rails/example/example_group_factory_spec.rb
+spec/rails/example/helper_spec_spec.rb
+spec/rails/example/model_spec_spec.rb
+spec/rails/example/shared_behaviour_spec.rb
+spec/rails/example/test_unit_assertion_accessibility_spec.rb
+spec/rails/example/view_spec_spec.rb
+spec/rails/extensions/action_controller_rescue_action_spec.rb
+spec/rails/extensions/action_view_base_spec.rb
+spec/rails/extensions/active_record_spec.rb
+spec/rails/interop/testcase_spec.rb
+spec/rails/matchers/assert_select_spec.rb
+spec/rails/matchers/description_generation_spec.rb
+spec/rails/matchers/errors_on_spec.rb
+spec/rails/matchers/have_text_spec.rb
+spec/rails/matchers/include_text_spec.rb
+spec/rails/matchers/redirect_to_spec.rb
+spec/rails/matchers/render_template_spec.rb
+spec/rails/matchers/should_change_spec.rb
+spec/rails/mocks/ar_classes.rb
+spec/rails/mocks/mock_model_spec.rb
+spec/rails/mocks/stub_model_spec.rb
+spec/rails/sample_modified_fixture.rb
+spec/rails/sample_spec.rb
+spec/rails/spec_server_spec.rb
+spec/rails/spec_spec.rb
+spec/rails_suite.rb
+spec/resources/controllers/action_view_base_spec_controller.rb
+spec/resources/controllers/controller_spec_controller.rb
+spec/resources/controllers/redirect_spec_controller.rb
+spec/resources/controllers/render_spec_controller.rb
+spec/resources/controllers/rjs_spec_controller.rb
+spec/resources/helpers/addition_helper.rb
+spec/resources/helpers/explicit_helper.rb
+spec/resources/helpers/more_explicit_helper.rb
+spec/resources/helpers/plugin_application_helper.rb
+spec/resources/helpers/view_spec_helper.rb
+spec/resources/views/controller_spec/_partial.rhtml
+spec/resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml
+spec/resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml
+spec/resources/views/controller_spec/action_setting_the_assigns_hash.rhtml
+spec/resources/views/controller_spec/action_with_errors_in_template.rhtml
+spec/resources/views/controller_spec/action_with_template.rhtml
+spec/resources/views/layouts/application.rhtml
+spec/resources/views/layouts/simple.rhtml
+spec/resources/views/objects/_object.html.erb
+spec/resources/views/render_spec/_a_partial.rhtml
+spec/resources/views/render_spec/action_with_alternate_layout.rhtml
+spec/resources/views/render_spec/some_action.js.rjs
+spec/resources/views/render_spec/some_action.rhtml
+spec/resources/views/render_spec/some_action.rjs
+spec/resources/views/rjs_spec/_replacement_partial.rhtml
+spec/resources/views/rjs_spec/hide_div.rjs
+spec/resources/views/rjs_spec/hide_page_element.rjs
+spec/resources/views/rjs_spec/insert_html.rjs
+spec/resources/views/rjs_spec/replace.rjs
+spec/resources/views/rjs_spec/replace_html.rjs
+spec/resources/views/rjs_spec/replace_html_with_partial.rjs
+spec/resources/views/rjs_spec/visual_effect.rjs
+spec/resources/views/rjs_spec/visual_toggle_effect.rjs
+spec/resources/views/tag_spec/no_tags.rhtml
+spec/resources/views/tag_spec/single_div_with_no_attributes.rhtml
+spec/resources/views/tag_spec/single_div_with_one_attribute.rhtml
+spec/resources/views/view_spec/_partial.rhtml
+spec/resources/views/view_spec/_partial_used_twice.rhtml
+spec/resources/views/view_spec/_partial_with_local_variable.rhtml
+spec/resources/views/view_spec/_partial_with_sub_partial.rhtml
+spec/resources/views/view_spec/_spacer.rhtml
+spec/resources/views/view_spec/accessor.rhtml
+spec/resources/views/view_spec/block_helper.rhtml
+spec/resources/views/view_spec/entry_form.rhtml
+spec/resources/views/view_spec/explicit_helper.rhtml
+spec/resources/views/view_spec/foo/show.rhtml
+spec/resources/views/view_spec/implicit_helper.rhtml
+spec/resources/views/view_spec/multiple_helpers.rhtml
+spec/resources/views/view_spec/should_not_receive.rhtml
+spec/resources/views/view_spec/template_with_partial.rhtml
+spec/resources/views/view_spec/template_with_partial_using_collection.rhtml
+spec/resources/views/view_spec/template_with_partial_with_array.rhtml
+spec/spec_helper.rb
+stories/all.rb
+stories/configuration/stories.rb
+stories/helper.rb
+stories/steps/people.rb
+stories/transactions_should_rollback
+stories/transactions_should_rollback.rb
View
46 vendor/plugins/rspec-rails/README.txt
@@ -0,0 +1,46 @@
+= Spec::Rails
+
+* http://rspec.info
+* http://rspec.info/rdoc-rails/
+* http://rubyforge.org/projects/rspec
+* http://github.com/dchelimsky/rspec-rails/wikis
+* mailto:rspec-devel@rubyforge.org
+
+== DESCRIPTION:
+
+Behaviour Driven Development for Ruby on Rails.
+
+Spec::Rails (a.k.a. RSpec on Rails) is a Ruby on Rails plugin that allows you
+to drive the development of your RoR application using RSpec, a framework that
+aims to enable Example Driven Development in Ruby.
+
+== FEATURES:
+
+* Use RSpec to independently specify Rails Models, Views, Controllers and Helpers
+* Integrated fixture loading
+* Special generators for Resources, Models, Views and Controllers that generate Specs instead of Tests.
+
+== VISION:
+
+For people for whom TDD is a brand new concept, the testing support built into
+Ruby on Rails is a huge leap forward. The fact that it is built right in is
+fantastic, and Ruby on Rails apps are generally much easier to maintain than
+they might have been without such support.
+
+For those of us coming from a history with TDD, and now BDD, the existing
+support presents some problems related to dependencies across examples. To
+that end, RSpec on Rails supports 4 types of examples. We’ve also built in
+first class mocking and stubbing support in order to break dependencies across
+these different concerns.
+
+== MORE INFORMATION:
+
+See Spec::Rails::Runner for information about the different kinds of example
+groups you can use to spec the different Rails components
+
+See Spec::Rails::Expectations for information about Rails-specific
+expectations you can set on responses and models, etc.
+
+== INSTALL
+
+* Visit http://github.com/dchelimsky/rspec-rails/wikis for installation instructions.
View
39 vendor/plugins/rspec-rails/Rakefile
@@ -0,0 +1,39 @@
+require 'rubygems'
+require 'hoe'
+require './lib/spec/rails/version'
+
+class Hoe
+ def extra_deps
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
+ @extra_deps
+ end
+end
+
+Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
+ p.summary = Spec::Rails::VERSION::SUMMARY
+ p.url = 'http://rspec.info/'
+ p.description = "Behaviour Driven Development for Ruby on Rails."
+ p.rubyforge_name = 'rspec'
+ p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
+ p.extra_deps = [["rspec","1.1.11.1"]]
+ p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
+end
+
+['audit','test','test_deps','default','post_blog', 'release'].each do |task|
+ Rake.application.instance_variable_get('@tasks').delete(task)
+end
+
+task :release => [:clean, :package] do |t|
+ version = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
+ abort "Versions don't match #{version} vs #{Spec::Rails::VERSION::STRING}" unless version == Spec::Rails::VERSION::STRING
+ pkg = "pkg/rspec-rails-#{version}"
+
+ rubyforge = RubyForge.new.configure
+ puts "Logging in to rubyforge ..."
+ rubyforge.login
+
+ puts "Releasing rspec-rails version #{version} ..."
+ ["#{pkg}.gem", "#{pkg}.tgz"].each do |file|
+ rubyforge.add_file('rspec', 'rspec', Spec::Rails::VERSION::STRING, file)
+ end
+end
View
0  ...r/plugins/rspec_on_rails/generators/rspec/CHANGES → vendor/plugins/rspec-rails/generators/rspec/CHANGES
File renamed without changes
View
13 ...spec_on_rails/generators/rspec/rspec_generator.rb → ...s/rspec-rails/generators/rspec/rspec_generator.rb
@@ -6,6 +6,7 @@ class RspecGenerator < Rails::Generator::Base
Config::CONFIG['ruby_install_name'])
def initialize(runtime_args, runtime_options = {})
+ Dir.mkdir('lib/tasks') unless File.directory?('lib/tasks')
super
end
@@ -13,12 +14,16 @@ def manifest
record do |m|
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
+ m.file 'rspec.rake', 'lib/tasks/rspec.rake'
+
+ m.file 'script/autospec', 'script/autospec', script_options
+ m.file 'script/spec', 'script/spec', script_options
+ m.file 'script/spec_server', 'script/spec_server', script_options
+
m.directory 'spec'
- m.template 'spec_helper.rb', 'spec/spec_helper.rb'
- m.file 'spec.opts', 'spec/spec.opts'
m.file 'rcov.opts', 'spec/rcov.opts'
- m.file 'script/spec_server', 'script/spec_server', script_options
- m.file 'script/spec', 'script/spec', script_options
+ m.file 'spec.opts', 'spec/spec.opts'
+ m.template 'spec_helper.rb', 'spec/spec_helper.rb'
m.directory 'stories'
m.file 'all_stories.rb', 'stories/all.rb'
View
0  ...n_rails/generators/rspec/templates/all_stories.rb → ...c-rails/generators/rspec/templates/all_stories.rb
File renamed without changes
View
0  .../generators/rspec/templates/previous_failures.txt → .../generators/rspec/templates/previous_failures.txt
File renamed without changes
View
0  ...pec_on_rails/generators/rspec/templates/rcov.opts → .../rspec-rails/generators/rspec/templates/rcov.opts
File renamed without changes
View
153 vendor/plugins/rspec-rails/generators/rspec/templates/rspec.rake
@@ -0,0 +1,153 @@
+raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec pkg]))
+raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec-rails" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec-rails pkg]))
+
+# In rails 1.2, plugins aren't available in the path until they're loaded.
+# Check to see if the rspec plugin is installed first and require
+# it if it is. If not, use the gem version.
+rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec/lib')
+$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
+
+begin
+ require 'spec/rake/spectask'
+ Rake.application.instance_variable_get('@tasks').delete('default')
+
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
+ task :noop do
+ end
+
+ task :default => :spec
+ task :stats => "spec:statsetup"
+
+ desc "Run all specs in spec directory (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
+ end
+
+ namespace :spec do
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:rcov) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
+ t.rcov = true
+ t.rcov_opts = lambda do
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
+ end
+ end
+
+ desc "Print Specdoc for all specs (excluding plugin specs)"
+ Spec::Rake::SpecTask.new(:doc) do |t|
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
+ end
+
+ desc "Print Specdoc for all plugin examples"
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
+ end
+
+ [:models, :controllers, :views, :helpers, :lib].each do |sub|
+ desc "Run the code examples in spec/#{sub}"
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
+ end
+ end
+
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
+ end
+
+ namespace :plugins do
+ desc "Runs the examples for rspec_on_rails"
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
+ end
+ end
+
+ # Setup specs for stats
+ task :statsetup do
+ require 'code_statistics'
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
+ end
+
+ namespace :db do
+ namespace :fixtures do
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
+ task :load => :environment do
+ require 'active_record/fixtures'
+ ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
+ Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
+ end
+ end
+ end
+ end
+
+ namespace :server do
+ daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp")
+
+ desc "start spec_server."
+ task :start do
+ if File.exist?(daemonized_server_pid)
+ $stderr.puts "spec_server is already running."
+ else
+ $stderr.puts "Starting up spec server."
+ system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
+ end
+ end
+
+ desc "stop spec_server."
+ task :stop do
+ unless File.exist?(daemonized_server_pid)
+ $stderr.puts "No server running."
+ else
+ $stderr.puts "Shutting down spec_server."
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
+ File.delete(daemonized_server_pid)
+ end
+ end
+
+ desc "reload spec_server."
+ task :restart do
+ unless File.exist?(daemonized_server_pid)
+ $stderr.puts "No server running."
+ else
+ $stderr.puts "Reloading down spec_server."
+ system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip)
+ end
+ end
+ end
+ end
+rescue MissingSourceFile
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
+ require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
+
+ # ... otherwise, do this:
+ raise <<-MSG
+
+ You have rspec-rails rake tasks installed in
+ #{__FILE__},
+ but rspec-rails is not configured as a gem in
+ config/environment.rb
+
+ Either remove #{__FILE__}
+ or configure the rspec-rails gem in config/environment.rb.
+
+MSG
+end
+
View
5 vendor/plugins/rspec-rails/generators/rspec/templates/script/autospec
@@ -0,0 +1,5 @@
+#!/usr/bin/env ruby
+ENV['RSPEC'] = 'true' # allows autotest to discover rspec
+ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
+system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
+ $stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
View
1  ...c_on_rails/generators/rspec/templates/script/spec → ...spec-rails/generators/rspec/templates/script/spec
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/rspec/lib"))
+require 'rubygems'
require 'spec'
exit ::Spec::Runner::CommandLine.run(::Spec::Runner::OptionParser.parse(ARGV, STDERR, STDOUT))
View
27 ...ils/generators/rspec/templates/script/spec_server → ...ils/generators/rspec/templates/script/spec_server
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
-$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../rspec/lib' # For svn
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
require 'rubygems'
require 'drb/drb'
@@ -23,17 +22,29 @@ module Spec
active_connections.delete(name)
end
end
- end
+ end
- if ::Dispatcher.respond_to?(:cleanup_application)
- ::Dispatcher.cleanup_application
+ if ActionController.const_defined?(:Dispatcher)
+ dispatcher = ::ActionController::Dispatcher.new($stdout)
+ dispatcher.cleanup_application
elsif ::Dispatcher.respond_to?(:reset_application!)
::Dispatcher.reset_application!
+ else
+ raise "Application reloading failed"
+ end
+ if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
+ Fixtures.reset_cache
end
+
::Dependencies.mechanism = :load
require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
+ if in_memory_database?
+ load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
+ ActiveRecord::Migrator.up('db/migrate') # use migrations
+ end
+
::Spec::Runner::CommandLine.run(
::Spec::Runner::OptionParser.parse(
argv,
@@ -42,6 +53,12 @@ module Spec
)
)
end
+
+ def in_memory_database?
+ ENV["RAILS_ENV"] == "test" and
+ ::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
+ ::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
+ end
end
end
end
@@ -88,7 +105,7 @@ opts.parse!(ARGV)
puts "Ready"
exec_server = lambda {
trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
- DRb.start_service("druby://localhost:8989", Spec::Runner::RailsSpecServer.new)
+ DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new)
DRb.thread.join
}
View
4 vendor/plugins/rspec-rails/generators/rspec/templates/spec.opts
@@ -0,0 +1,4 @@
+--colour
+--format progress
+--loadby mtime
+--reverse
View
47 vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb
@@ -0,0 +1,47 @@
+# This file is copied to ~/spec when you run 'ruby script/generate rspec'
+# from the project root directory.
+ENV["RAILS_ENV"] = "test"
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
+require 'spec'
+require 'spec/rails'
+
+Spec::Runner.configure do |config|
+ # If you're not using ActiveRecord you should remove these
+ # lines, delete config/database.yml and disable :active_record
+ # in your config/boot.rb
+ config.use_transactional_fixtures = true
+ config.use_instantiated_fixtures = false
+ config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
+
+ # == Fixtures
+ #
+ # You can declare fixtures for each example_group like this:
+ # describe "...." do
+ # fixtures :table_a, :table_b
+ #
+ # Alternatively, if you prefer to declare them only once, you can
+ # do so right here. Just uncomment the next line and replace the fixture
+ # names with your fixtures.
+ #
+ # config.global_fixtures = :table_a, :table_b
+ #
+ # If you declare global fixtures, be aware that they will be declared
+ # for all of your examples, even those that don't use them.
+ #
+ # You can also declare which fixtures to use (for example fixtures for test/fixtures):
+ #
+ # config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
+ #
+ # == Mock Framework
+ #
+ # RSpec uses it's own mocking framework by default. If you prefer to
+ # use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ #
+ # == Notes
+ #
+ # For more information take a look at Spec::Example::Configuration and Spec::Runner
+end
View
0  ...ails/generators/rspec/templates/stories_helper.rb → ...ails/generators/rspec/templates/stories_helper.rb
File renamed without changes
View
0  .../rspec_on_rails/generators/rspec_controller/USAGE → ...ins/rspec-rails/generators/rspec_controller/USAGE
File renamed without changes
View
8 ...rs/rspec_controller/rspec_controller_generator.rb → ...rs/rspec_controller/rspec_controller_generator.rb
@@ -1,6 +1,7 @@
require 'rails_generator/generators/components/controller/controller_generator'
class RspecControllerGenerator < ControllerGenerator
+
def manifest
record do |m|
# Check for class naming collisions.
@@ -14,11 +15,10 @@ def manifest
m.directory File.join('spec/helpers', class_path)
m.directory File.join('spec/views', class_path, file_name)
- if ActionView::Base.const_defined?('DEFAULT_TEMPLATE_HANDLER_PREFERENCE') &&
- ActionView::Base::DEFAULT_TEMPLATE_HANDLER_PREFERENCE.include?(:erb) then
- @default_file_extension = "html.erb"
- else
+ if Rails::VERSION::STRING < "2.0.0"
@default_file_extension = "rhtml"
+ else
+ @default_file_extension = "html.erb"
end
# Controller spec, class, and helper.
View
10 ...ors/rspec_controller/templates/controller_spec.rb → ...ors/rspec_controller/templates/controller_spec.rb
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
describe <%= class_name %>Controller do
@@ -14,9 +14,11 @@
<% unless actions.empty? -%>
<% for action in actions -%>
- it "GET '<%= action %>' should be successful" do
- get '<%= action %>'
- response.should be_success
+ describe "GET '<%= action %>'" do
+ it "should be successful" do
+ get '<%= action %>'
+ response.should be_success
+ end
end
<% end -%>
<% end -%>
View
11 vendor/plugins/rspec-rails/generators/rspec_controller/templates/helper_spec.rb
@@ -0,0 +1,11 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
+
+describe <%= class_name %>Helper do
+
+ #Delete this example and add some real ones or delete this file
+ it "should be included in the object returned by #helper" do
+ included_modules = (class << helper; self; end).send :included_modules
+ included_modules.should include(<%= class_name %>Helper)
+ end
+
+end
View
6 ...enerators/rspec_controller/templates/view_spec.rb → ...enerators/rspec_controller/templates/view_spec.rb
@@ -1,12 +1,12 @@
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
describe "/<%= class_name.underscore %>/<%= action %>" do
- before do
+ before(:each) do
render '<%= class_name.underscore %>/<%= action %>'
end
#Delete this example and add some real ones or delete this file
it "should tell you where to find the file" do
- response.should have_tag('p', /Find me in app\/views\/<%= class_name.underscore %>\/<%= action %>/)
+ response.should have_tag('p', %r[Find me in app/views/<%= class_name.underscore %>/<%= action %>])
end
end
View
19 vendor/plugins/rspec-rails/generators/rspec_default_values.rb
@@ -0,0 +1,19 @@
+module Rails
+ module Generator
+ class GeneratedAttribute
+ def default_value
+ @default_value ||= case type
+ when :int, :integer then "\"1\""
+ when :float then "\"1.5\""
+ when :decimal then "\"9.99\""
+ when :datetime, :timestamp, :time then "Time.now"
+ when :date then "Date.today"
+ when :string, :text then "\"value for #{@name}\""
+ when :boolean then "false"
+ else
+ ""
+ end
+ end
+ end
+ end
+end
View
0  ...ugins/rspec_on_rails/generators/rspec_model/USAGE → .../plugins/rspec-rails/generators/rspec_model/USAGE
File renamed without changes
View
9 ...s/generators/rspec_model/rspec_model_generator.rb → ...s/generators/rspec_model/rspec_model_generator.rb
@@ -1,4 +1,5 @@
require 'rails_generator/generators/components/model/model_generator'
+require File.dirname(__FILE__) + '/../rspec_default_values'
class RspecModelGenerator < ModelGenerator
@@ -11,12 +12,16 @@ def manifest
# Model, spec, and fixture directories.
m.directory File.join('app/models', class_path)
m.directory File.join('spec/models', class_path)
- m.directory File.join('spec/fixtures', class_path)
+ unless options[:skip_fixture]
+ m.directory File.join('spec/fixtures', class_path)
+ end
# Model class, spec and fixtures.
m.template 'model:model.rb', File.join('app/models', class_path, "#{file_name}.rb")
- m.template 'model:fixtures.yml', File.join('spec/fixtures', class_path, "#{table_name}.yml")
m.template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
+ unless options[:skip_fixture]
+ m.template 'model:fixtures.yml', File.join('spec/fixtures', "#{table_name}.yml")
+ end
unless options[:skip_migration]
m.migration_template 'model:migration.rb', 'db/migrate', :assigns => {
View
15 vendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb
@@ -0,0 +1,15 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
+
+describe <%= class_name %> do
+ before(:each) do
+ @valid_attributes = {
+<% attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == attributes.length - 1 ? '' : ','%>
+<% end -%>
+ }
+ end
+
+ it "should create a new instance given valid attributes" do
+ <%= class_name %>.create!(@valid_attributes)
+ end
+end
View
29 ...rators/rspec_scaffold/rspec_scaffold_generator.rb → ...rators/rspec_scaffold/rspec_scaffold_generator.rb
@@ -1,3 +1,5 @@
+require File.dirname(__FILE__) + '/../rspec_default_values'
+
class RspecScaffoldGenerator < Rails::Generator::NamedBase
default_options :skip_migration => false
@@ -28,13 +30,12 @@ def initialize(runtime_args, runtime_options = {})
@controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
end
- if ActionView::Base.const_defined?('DEFAULT_TEMPLATE_HANDLER_PREFERENCE') &&
- ActionView::Base::DEFAULT_TEMPLATE_HANDLER_PREFERENCE.include?(:erb) then
- @resource_generator = "scaffold"
- @default_file_extension = "html.erb"
- else
+ if Rails::VERSION::STRING < "2.0.0"
@resource_generator = "scaffold_resource"
@default_file_extension = "rhtml"
+ else
+ @resource_generator = "scaffold"
+ @default_file_extension = "html.erb"
end
if ActionController::Base.respond_to?(:resource_action_separator)
@@ -63,6 +64,9 @@ def manifest
m.directory File.join('spec/views', controller_class_path, controller_file_name)
# Controller spec, class, and helper.
+ m.template 'rspec_scaffold:routing_spec.rb',
+ File.join('spec/controllers', controller_class_path, "#{controller_file_name}_routing_spec.rb")
+
m.template 'rspec_scaffold:controller_spec.rb',
File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
@@ -138,21 +142,6 @@ def model_name
module Rails
module Generator
class GeneratedAttribute
- def default_value
- @default_value ||= case type
- when :int, :integer then "\"1\""
- when :float then "\"1.5\""
- when :decimal then "\"9.99\""
- when :datetime, :timestamp, :time then "Time.now"
- when :date then "Date.today"
- when :string then "\"MyString\""
- when :text then "\"MyText\""
- when :boolean then "false"
- else
- ""
- end
- end
-
def input_type
@input_type ||= case type
when :text then "textarea"
View
173 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/controller_spec.rb
@@ -0,0 +1,173 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
+
+describe <%= controller_class_name %>Controller do
+
+ def mock_<%= file_name %>(stubs={})
+ @mock_<%= file_name %> ||= mock_model(<%= class_name %>, stubs)
+ end
+
+ describe "responding to GET index" do
+
+ it "should expose all <%= table_name.pluralize %> as @<%= table_name.pluralize %>" do
+ <%= class_name %>.should_receive(:find).with(:all).and_return([mock_<%= file_name %>])
+ get :index
+ assigns[:<%= table_name %>].should == [mock_<%= file_name %>]
+ end
+
+ describe "with mime type of xml" do
+
+ it "should render all <%= table_name.pluralize %> as xml" do
+ request.env["HTTP_ACCEPT"] = "application/xml"
+ <%= class_name %>.should_receive(:find).with(:all).and_return(<%= file_name.pluralize %> = mock("Array of <%= class_name.pluralize %>"))
+ <%= file_name.pluralize %>.should_receive(:to_xml).and_return("generated XML")
+ get :index
+ response.body.should == "generated XML"
+ end
+
+ end
+
+ end
+
+ describe "responding to GET show" do
+
+ it "should expose the requested <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ get :show, :id => "37"
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+
+ describe "with mime type of xml" do
+
+ it "should render the requested <%= file_name %> as xml" do
+ request.env["HTTP_ACCEPT"] = "application/xml"
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ mock_<%= file_name %>.should_receive(:to_xml).and_return("generated XML")
+ get :show, :id => "37"
+ response.body.should == "generated XML"
+ end
+
+ end
+
+ end
+
+ describe "responding to GET new" do
+
+ it "should expose a new <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.should_receive(:new).and_return(mock_<%= file_name %>)
+ get :new
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+
+ end
+
+ describe "responding to GET edit" do
+
+ it "should expose the requested <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ get :edit, :id => "37"
+ assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
+ end
+
+ end
+
+ describe "responding to POST create" do
+
+ describe "with valid params" do
+
+ it "should expose a newly created <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.should_receive(:new).with({'these' => 'params'}).and_return(mock_<%= file_name %>(:save => true))
+ post :create, :<%= file_name %> => {:these => 'params'}
+ assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
+ end
+
+ it "should redirect to the created <%= file_name %>" do
+ <%= class_name %>.stub!(:new).and_return(mock_<%= file_name %>(:save => true))
+ post :create, :<%= file_name %> => {}
+ response.should redirect_to(<%= table_name.singularize %>_url(mock_<%= file_name %>))
+ end
+
+ end
+
+ describe "with invalid params" do
+
+ it "should expose a newly created but unsaved <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:new).with({'these' => 'params'}).and_return(mock_<%= file_name %>(:save => false))
+ post :create, :<%= file_name %> => {:these => 'params'}
+ assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
+ end
+
+ it "should re-render the 'new' template" do
+ <%= class_name %>.stub!(:new).and_return(mock_<%= file_name %>(:save => false))
+ post :create, :<%= file_name %> => {}
+ response.should render_template('new')
+ end
+
+ end
+
+ end
+
+ describe "responding to PUT udpate" do
+
+ describe "with valid params" do
+
+ it "should update the requested <%= file_name %>" do
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ mock_<%= file_name %>.should_receive(:update_attributes).with({'these' => 'params'})
+ put :update, :id => "37", :<%= file_name %> => {:these => 'params'}
+ end
+
+ it "should expose the requested <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => true))
+ put :update, :id => "1"
+ assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
+ end
+
+ it "should redirect to the <%= file_name %>" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => true))
+ put :update, :id => "1"
+ response.should redirect_to(<%= table_name.singularize %>_url(mock_<%= file_name %>))
+ end
+
+ end
+
+ describe "with invalid params" do
+
+ it "should update the requested <%= file_name %>" do
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ mock_<%= file_name %>.should_receive(:update_attributes).with({'these' => 'params'})
+ put :update, :id => "37", :<%= file_name %> => {:these => 'params'}
+ end
+
+ it "should expose the <%= file_name %> as @<%= file_name %>" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => false))
+ put :update, :id => "1"
+ assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
+ end
+
+ it "should re-render the 'edit' template" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:update_attributes => false))
+ put :update, :id => "1"
+ response.should render_template('edit')
+ end
+
+ end
+
+ end
+
+ describe "responding to DELETE destroy" do
+
+ it "should destroy the requested <%= file_name %>" do
+ <%= class_name %>.should_receive(:find).with("37").and_return(mock_<%= file_name %>)
+ mock_<%= file_name %>.should_receive(:destroy)
+ delete :destroy, :id => "37"
+ end
+
+ it "should redirect to the <%= table_name %> list" do
+ <%= class_name %>.stub!(:find).and_return(mock_<%= file_name %>(:destroy => true))
+ delete :destroy, :id => "1"
+ response.should redirect_to(<%= table_name %>_url)
+ end
+
+ end
+
+end
View
27 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/edit_erb_spec.rb
@@ -0,0 +1,27 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
+
+<% output_attributes = attributes.reject{|attribute| attribute.name =~ /_id/ || [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
+describe "/<%= table_name %>/edit.<%= default_file_extension %>" do
+ include <%= controller_class_name %>Helper
+
+ before(:each) do
+ assigns[:<%= file_name %>] = @<%= file_name %> = stub_model(<%= class_name %>,
+ :new_record? => false<%= output_attributes.empty? ? '' : ',' %>
+<% output_attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
+<% end -%>
+ )
+ end
+
+ it "should render edit form" do
+ render "/<%= table_name %>/edit.<%= default_file_extension %>"
+
+ response.should have_tag("form[action=#{<%= file_name %>_path(@<%= file_name %>)}][method=post]") do
+<% for attribute in output_attributes -%>
+ with_tag('<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>[name=?]', "<%= file_name %>[<%= attribute.name %>]")
+<% end -%>
+ end
+ end
+end
+
+
View
11 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/helper_spec.rb
@@ -0,0 +1,11 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
+
+describe <%= controller_class_name %>Helper do
+
+ #Delete this example and add some real ones or delete this file
+ it "should be included in the object returned by #helper" do
+ included_modules = (class << helper; self; end).send :included_modules
+ included_modules.should include(<%= controller_class_name %>Helper)
+ end
+
+end
View
28 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/index_erb_spec.rb
@@ -0,0 +1,28 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
+
+<% output_attributes = attributes.reject{|attribute| attribute.name =~ /_id/ || [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
+describe "/<%= table_name %>/index.<%= default_file_extension %>" do
+ include <%= controller_class_name %>Helper
+
+ before(:each) do
+ assigns[:<%= table_name %>] = [
+<% [1,2].each_with_index do |id, model_index| -%>
+ stub_model(<%= class_name %><%= output_attributes.empty? ? (model_index == 1 ? ')' : '),') : ',' %>
+<% output_attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
+<% end -%>
+<% if !output_attributes.empty? -%>
+ <%= model_index == 1 ? ')' : '),' %>
+<% end -%>
+<% end -%>
+ ]
+ end
+
+ it "should render list of <%= table_name %>" do
+ render "/<%= table_name %>/index.<%= default_file_extension %>"
+<% for attribute in output_attributes -%>
+ response.should have_tag("tr>td", <%= attribute.default_value %>, 2)
+<% end -%>
+ end
+end
+
View
27 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/new_erb_spec.rb
@@ -0,0 +1,27 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
+
+<% output_attributes = attributes.reject{|attribute| attribute.name =~ /_id/ || [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
+describe "/<%= table_name %>/new.<%= default_file_extension %>" do
+ include <%= controller_class_name %>Helper
+
+ before(:each) do
+ assigns[:<%= file_name %>] = stub_model(<%= class_name %>,
+ :new_record? => true<%= output_attributes.empty? ? '' : ',' %>
+<% output_attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
+<% end -%>
+ )
+ end
+
+ it "should render new form" do
+ render "/<%= table_name %>/new.<%= default_file_extension %>"
+
+ response.should have_tag("form[action=?][method=post]", <%= table_name %>_path) do
+<% for attribute in output_attributes -%>
+ with_tag("<%= attribute.input_type -%>#<%= file_name %>_<%= attribute.name %>[name=?]", "<%= file_name %>[<%= attribute.name %>]")
+<% end -%>
+ end
+ end
+end
+
+
View
59 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/routing_spec.rb
@@ -0,0 +1,59 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
+
+describe <%= controller_class_name %>Controller do
+ describe "route generation" do
+ it "should map #index" do
+ route_for(:controller => "<%= table_name %>", :action => "index").should == "/<%= table_name %>"
+ end
+
+ it "should map #new" do
+ route_for(:controller => "<%= table_name %>", :action => "new").should == "/<%= table_name %>/new"
+ end
+
+ it "should map #show" do
+ route_for(:controller => "<%= table_name %>", :action => "show", :id => 1).should == "/<%= table_name %>/1"
+ end
+
+ it "should map #edit" do
+ route_for(:controller => "<%= table_name %>", :action => "edit", :id => 1).should == "/<%= table_name %>/1<%= resource_edit_path %>"
+ end
+
+ it "should map #update" do
+ route_for(:controller => "<%= table_name %>", :action => "update", :id => 1).should == "/<%= table_name %>/1"
+ end
+
+ it "should map #destroy" do
+ route_for(:controller => "<%= table_name %>", :action => "destroy", :id => 1).should == "/<%= table_name %>/1"
+ end
+ end
+
+ describe "route recognition" do
+ it "should generate params for #index" do
+ params_from(:get, "/<%= table_name %>").should == {:controller => "<%= table_name %>", :action => "index"}
+ end
+
+ it "should generate params for #new" do
+ params_from(:get, "/<%= table_name %>/new").should == {:controller => "<%= table_name %>", :action => "new"}
+ end
+
+ it "should generate params for #create" do
+ params_from(:post, "/<%= table_name %>").should == {:controller => "<%= table_name %>", :action => "create"}
+ end
+
+ it "should generate params for #show" do
+ params_from(:get, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "show", :id => "1"}
+ end
+
+ it "should generate params for #edit" do
+ params_from(:get, "/<%= table_name %>/1<%= resource_edit_path %>").should == {:controller => "<%= table_name %>", :action => "edit", :id => "1"}
+ end
+
+ it "should generate params for #update" do
+ params_from(:put, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "update", :id => "1"}
+ end
+
+ it "should generate params for #destroy" do
+ params_from(:delete, "/<%= table_name %>/1").should == {:controller => "<%= table_name %>", :action => "destroy", :id => "1"}
+ end
+ end
+end
View
23 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/show_erb_spec.rb
@@ -0,0 +1,23 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
+
+<% output_attributes = attributes.reject{|attribute| attribute.name =~ /_id/ || [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
+describe "/<%= table_name %>/show.<%= default_file_extension %>" do
+ include <%= controller_class_name %>Helper
+ before(:each) do
+ assigns[:<%= file_name %>] = @<%= file_name %> = stub_model(<%= class_name %><%= output_attributes.empty? ? ')' : ',' %>
+<% output_attributes.each_with_index do |attribute, attribute_index| -%>
+ :<%= attribute.name %> => <%= attribute.default_value %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
+<% end -%>
+<% if !output_attributes.empty? -%>
+ )
+<% end -%>
+ end
+
+ it "should render attributes in <p>" do
+ render "/<%= table_name %>/show.<%= default_file_extension %>"
+<% for attribute in output_attributes -%>
+ response.should have_text(/<%= Regexp.escape(attribute.default_value)[1..-2]%>/)
+<% end -%>
+ end
+end
+
View
0  vendor/plugins/rspec_on_rails/init.rb → vendor/plugins/rspec-rails/init.rb
File renamed without changes
View
1  vendor/plugins/rspec-rails/lib/autotest/discover.rb
@@ -0,0 +1 @@
+# This needs to be here for >= ZenTest-3.9.0 to add this directory to the load path.
View
76 vendor/plugins/rspec-rails/lib/autotest/rails_rspec.rb
@@ -0,0 +1,76 @@
+# (c) Copyright 2006 Nick Sieger <nicksieger@gmail.com>
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+$:.push(*Dir["vendor/rails/*/lib"])
+
+require 'active_support'
+require 'autotest/rspec'
+
+Autotest.add_hook :initialize do |at|
+ %w{config/ coverage/ db/ doc/ log/ public/ script/ tmp/ vendor/rails vendor/plugins previous_failures.txt}.each do |exception|
+ at.add_exception(exception)
+ end
+
+ at.clear_mappings
+
+ at.add_mapping(%r%^(test|spec)/fixtures/(.*).yml$%) { |_, m|
+ ["spec/models/#{m[2].singularize}_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%)
+ }
+ at.add_mapping(%r%^spec/(models|controllers|views|helpers|lib)/.*rb$%) { |filename, _|
+ filename
+ }
+ at.add_mapping(%r%^app/models/(.*)\.rb$%) { |_, m|
+ ["spec/models/#{m[1]}_spec.rb"]
+ }
+ at.add_mapping(%r%^app/views/(.*)$%) { |_, m|
+ at.files_matching %r%^spec/views/#{m[1]}_spec.rb$%
+ }
+ at.add_mapping(%r%^app/controllers/(.*)\.rb$%) { |_, m|
+ if m[1] == "application"
+ at.files_matching %r%^spec/controllers/.*_spec\.rb$%
+ else
+ ["spec/controllers/#{m[1]}_spec.rb"]
+ end
+ }
+ at.add_mapping(%r%^app/helpers/(.*)_helper\.rb$%) { |_, m|
+ if m[1] == "application" then
+ at.files_matching(%r%^spec/(views|helpers)/.*_spec\.rb$%)
+ else
+ ["spec/helpers/#{m[1]}_helper_spec.rb"] + at.files_matching(%r%^spec\/views\/#{m[1]}/.*_spec\.rb$%)
+ end
+ }
+ at.add_mapping(%r%^config/routes\.rb$%) {
+ at.files_matching %r%^spec/(controllers|views|helpers)/.*_spec\.rb$%
+ }
+ at.add_mapping(%r%^config/database\.yml$%) { |_, m|
+ at.files_matching %r%^spec/models/.*_spec\.rb$%
+ }
+ at.add_mapping(%r%^(spec/(spec_helper|shared/.*)|config/(boot|environment(s/test)?))\.rb$%) {
+ at.files_matching %r%^spec/(models|controllers|views|helpers)/.*_spec\.rb$%
+ }
+ at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
+ ["spec/lib/#{m[1]}_spec.rb"]
+ }
+end
+
+class Autotest::RailsRspec < Autotest::Rspec
+end
View
15 vendor/plugins/rspec-rails/lib/spec/rails.rb
@@ -0,0 +1,15 @@
+silence_warnings { RAILS_ENV = "test" }
+
+require_dependency 'application'
+require 'action_controller/test_process'
+require 'action_controller/integration'
+require 'active_record/fixtures' if defined?(ActiveRecord::Base)
+require 'test/unit'
+
+require 'spec'
+
+require 'spec/rails/matchers'
+require 'spec/rails/mocks'
+require 'spec/rails/example'
+require 'spec/rails/extensions'
+require 'spec/rails/interop/testcase'
View
19 .../plugins/rspec_on_rails/lib/spec/rails/example.rb → vendor/plugins/rspec-rails/lib/spec/rails/example.rb
@@ -1,8 +1,15 @@
dir = File.dirname(__FILE__)
-require 'spec/rails/example/ivar_proxy'