Permalink
Browse files

Installed rspec

  • Loading branch information...
1 parent a6b73a6 commit f0871d848857e63a3606a4df88094af53ce410fc @ariejan ariejan committed Oct 23, 2008
Showing with 13,857 additions and 0 deletions.
  1. +132 −0 lib/tasks/rspec.rake
  2. +5 −0 script/autospec
  3. +116 −0 script/spec_server
  4. +2 −0 spec/rcov.opts
  5. +4 −0 spec/spec.opts
  6. +47 −0 spec/spec_helper.rb
  7. +4 −0 stories/all.rb
  8. +3 −0 stories/helper.rb
  9. +7 −0 vendor/plugins/rspec-rails/.gitignore
  10. +85 −0 vendor/plugins/rspec-rails/History.txt
  11. +33 −0 vendor/plugins/rspec-rails/License.txt
  12. +159 −0 vendor/plugins/rspec-rails/Manifest.txt
  13. +46 −0 vendor/plugins/rspec-rails/README.txt
  14. +39 −0 vendor/plugins/rspec-rails/Rakefile
  15. +7 −0 vendor/plugins/rspec-rails/UPGRADE
  16. +1 −0 vendor/plugins/rspec-rails/generators/rspec/CHANGES
  17. +40 −0 vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
  18. +4 −0 vendor/plugins/rspec-rails/generators/rspec/templates/all_stories.rb
  19. 0 vendor/plugins/rspec-rails/generators/rspec/templates/previous_failures.txt
  20. +2 −0 vendor/plugins/rspec-rails/generators/rspec/templates/rcov.opts
  21. +132 −0 vendor/plugins/rspec-rails/generators/rspec/templates/rspec.rake
  22. +5 −0 vendor/plugins/rspec-rails/generators/rspec/templates/script/autospec
  23. +5 −0 vendor/plugins/rspec-rails/generators/rspec/templates/script/spec
  24. +116 −0 vendor/plugins/rspec-rails/generators/rspec/templates/script/spec_server
  25. +4 −0 vendor/plugins/rspec-rails/generators/rspec/templates/spec.opts
  26. +47 −0 vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb
  27. +3 −0 vendor/plugins/rspec-rails/generators/rspec/templates/stories_helper.rb
  28. +33 −0 vendor/plugins/rspec-rails/generators/rspec_controller/USAGE
  29. +49 −0 vendor/plugins/rspec-rails/generators/rspec_controller/rspec_controller_generator.rb
  30. +25 −0 vendor/plugins/rspec-rails/generators/rspec_controller/templates/controller_spec.rb
  31. +11 −0 vendor/plugins/rspec-rails/generators/rspec_controller/templates/helper_spec.rb
  32. +12 −0 vendor/plugins/rspec-rails/generators/rspec_controller/templates/view_spec.rb
  33. +19 −0 vendor/plugins/rspec-rails/generators/rspec_default_values.rb
  34. +18 −0 vendor/plugins/rspec-rails/generators/rspec_model/USAGE
  35. +35 −0 vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
  36. +15 −0 vendor/plugins/rspec-rails/generators/rspec_model/templates/model_spec.rb
  37. +154 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb
  38. +173 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/controller_spec.rb
  39. +26 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/edit_erb_spec.rb
  40. +11 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/helper_spec.rb
  41. +27 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/index_erb_spec.rb
  42. +26 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/new_erb_spec.rb
  43. +59 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/routing_spec.rb
  44. +23 −0 vendor/plugins/rspec-rails/generators/rspec_scaffold/templates/show_erb_spec.rb
  45. +9 −0 vendor/plugins/rspec-rails/init.rb
  46. +1 −0 vendor/plugins/rspec-rails/lib/autotest/discover.rb
  47. +76 −0 vendor/plugins/rspec-rails/lib/autotest/rails_rspec.rb
  48. +15 −0 vendor/plugins/rspec-rails/lib/spec/rails.rb
  49. +47 −0 vendor/plugins/rspec-rails/lib/spec/rails/example.rb
  50. +40 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/assigns_hash_proxy.rb
  51. +256 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/controller_example_group.rb
  52. +25 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/cookies_proxy.rb
  53. +87 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/functional_example_group.rb
  54. +170 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/helper_example_group.rb
  55. +14 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/model_example_group.rb
  56. +33 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/rails_example_group.rb
  57. +93 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/render_observer.rb
  58. +183 −0 vendor/plugins/rspec-rails/lib/spec/rails/example/view_example_group.rb
  59. +12 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions.rb
  60. +14 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_controller/base.rb
  61. +21 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_controller/rescue.rb
  62. +11 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_controller/test_response.rb
  63. +31 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/action_view/base.rb
  64. +30 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/active_record/base.rb
  65. +5 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/object.rb
  66. +71 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/example/configuration.rb
  67. +21 −0 vendor/plugins/rspec-rails/lib/spec/rails/extensions/spec/matchers/have.rb
  68. +14 −0 vendor/plugins/rspec-rails/lib/spec/rails/interop/testcase.rb
  69. +31 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers.rb
  70. +131 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/assert_select.rb
  71. +11 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/change.rb
  72. +57 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/have_text.rb
  73. +54 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/include_text.rb
  74. +113 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/redirect_to.rb
  75. +90 −0 vendor/plugins/rspec-rails/lib/spec/rails/matchers/render_template.rb
  76. +132 −0 vendor/plugins/rspec-rails/lib/spec/rails/mocks.rb
  77. +79 −0 vendor/plugins/rspec-rails/lib/spec/rails/story_adapter.rb
  78. +15 −0 vendor/plugins/rspec-rails/lib/spec/rails/version.rb
  79. +37 −0 vendor/plugins/rspec-rails/rspec-rails.gemspec
  80. +36 −0 vendor/plugins/rspec-rails/spec/rails/autotest/mappings_spec.rb
  81. +96 −0 vendor/plugins/rspec-rails/spec/rails/example/assigns_hash_proxy_spec.rb
  82. +83 −0 vendor/plugins/rspec-rails/spec/rails/example/configuration_spec.rb
  83. +62 −0 vendor/plugins/rspec-rails/spec/rails/example/controller_isolation_spec.rb
  84. +279 −0 vendor/plugins/rspec-rails/spec/rails/example/controller_spec_spec.rb
  85. +74 −0 vendor/plugins/rspec-rails/spec/rails/example/cookies_proxy_spec.rb
  86. +112 −0 vendor/plugins/rspec-rails/spec/rails/example/example_group_factory_spec.rb
  87. +174 −0 vendor/plugins/rspec-rails/spec/rails/example/helper_spec_spec.rb
  88. +18 −0 vendor/plugins/rspec-rails/spec/rails/example/model_spec_spec.rb
  89. +16 −0 vendor/plugins/rspec-rails/spec/rails/example/shared_behaviour_spec.rb
  90. +33 −0 vendor/plugins/rspec-rails/spec/rails/example/test_unit_assertion_accessibility_spec.rb
  91. +287 −0 vendor/plugins/rspec-rails/spec/rails/example/view_spec_spec.rb
  92. +54 −0 vendor/plugins/rspec-rails/spec/rails/extensions/action_controller_rescue_action_spec.rb
  93. +48 −0 vendor/plugins/rspec-rails/spec/rails/extensions/action_view_base_spec.rb
  94. +14 −0 vendor/plugins/rspec-rails/spec/rails/extensions/active_record_spec.rb
  95. +66 −0 vendor/plugins/rspec-rails/spec/rails/interop/testcase_spec.rb
  96. +814 −0 vendor/plugins/rspec-rails/spec/rails/matchers/assert_select_spec.rb
  97. +37 −0 vendor/plugins/rspec-rails/spec/rails/matchers/description_generation_spec.rb
  98. +25 −0 vendor/plugins/rspec-rails/spec/rails/matchers/errors_on_spec.rb
  99. +62 −0 vendor/plugins/rspec-rails/spec/rails/matchers/have_text_spec.rb
  100. +64 −0 vendor/plugins/rspec-rails/spec/rails/matchers/include_text_spec.rb
  101. +209 −0 vendor/plugins/rspec-rails/spec/rails/matchers/redirect_to_spec.rb
  102. +176 −0 vendor/plugins/rspec-rails/spec/rails/matchers/render_template_spec.rb
  103. +15 −0 vendor/plugins/rspec-rails/spec/rails/matchers/should_change_spec.rb
  104. +10 −0 vendor/plugins/rspec-rails/spec/rails/mocks/ar_classes.rb
  105. +106 −0 vendor/plugins/rspec-rails/spec/rails/mocks/mock_model_spec.rb
  106. +80 −0 vendor/plugins/rspec-rails/spec/rails/mocks/stub_model_spec.rb
  107. +8 −0 vendor/plugins/rspec-rails/spec/rails/sample_modified_fixture.rb
  108. +8 −0 vendor/plugins/rspec-rails/spec/rails/sample_spec.rb
  109. +96 −0 vendor/plugins/rspec-rails/spec/rails/spec_server_spec.rb
  110. +11 −0 vendor/plugins/rspec-rails/spec/rails/spec_spec.rb
  111. +7 −0 vendor/plugins/rspec-rails/spec/rails_suite.rb
  112. +58 −0 vendor/plugins/rspec-rails/spec/spec_helper.rb
  113. +2 −0 vendor/plugins/rspec-rails/spec_resources/controllers/action_view_base_spec_controller.rb
  114. +99 −0 vendor/plugins/rspec-rails/spec_resources/controllers/controller_spec_controller.rb
  115. +59 −0 vendor/plugins/rspec-rails/spec_resources/controllers/redirect_spec_controller.rb
  116. +30 −0 vendor/plugins/rspec-rails/spec_resources/controllers/render_spec_controller.rb
  117. +58 −0 vendor/plugins/rspec-rails/spec_resources/controllers/rjs_spec_controller.rb
  118. +5 −0 vendor/plugins/rspec-rails/spec_resources/helpers/addition_helper.rb
  119. +38 −0 vendor/plugins/rspec-rails/spec_resources/helpers/explicit_helper.rb
  120. +5 −0 vendor/plugins/rspec-rails/spec_resources/helpers/more_explicit_helper.rb
  121. +6 −0 vendor/plugins/rspec-rails/spec_resources/helpers/plugin_application_helper.rb
  122. +13 −0 vendor/plugins/rspec-rails/spec_resources/helpers/view_spec_helper.rb
  123. 0 vendor/plugins/rspec-rails/spec_resources/views/controller_spec/_partial.rhtml
  124. +1 −0 ...s/rspec-rails/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml
  125. +1 −0 .../rspec-rails/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml
  126. 0 ...or/plugins/rspec-rails/spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml
  127. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml
  128. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/controller_spec/action_with_template.rhtml
  129. 0 vendor/plugins/rspec-rails/spec_resources/views/layouts/application.rhtml
  130. 0 vendor/plugins/rspec-rails/spec_resources/views/layouts/simple.rhtml
  131. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/objects/_object.html.erb
  132. 0 vendor/plugins/rspec-rails/spec_resources/views/render_spec/_a_partial.rhtml
  133. 0 vendor/plugins/rspec-rails/spec_resources/views/render_spec/action_with_alternate_layout.rhtml
  134. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/render_spec/some_action.js.rjs
  135. 0 vendor/plugins/rspec-rails/spec_resources/views/render_spec/some_action.rhtml
  136. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/render_spec/some_action.rjs
  137. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/_replacement_partial.rhtml
  138. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/hide_div.rjs
  139. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/hide_page_element.rjs
  140. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/insert_html.rjs
  141. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/replace.rjs
  142. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/replace_html.rjs
  143. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/replace_html_with_partial.rjs
  144. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/visual_effect.rjs
  145. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/rjs_spec/visual_toggle_effect.rjs
  146. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/tag_spec/no_tags.rhtml
  147. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml
  148. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml
  149. +2 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/_partial.rhtml
  150. 0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/_partial_used_twice.rhtml
  151. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/_partial_with_local_variable.rhtml
  152. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml
  153. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/_spacer.rhtml
  154. +5 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/accessor.rhtml
  155. +3 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/block_helper.rhtml
  156. +2 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/entry_form.rhtml
  157. +2 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/explicit_helper.rhtml
  158. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/foo/show.rhtml
  159. +2 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/implicit_helper.rhtml
  160. +3 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/multiple_helpers.rhtml
  161. +3 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/should_not_receive.rhtml
  162. +5 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/template_with_partial.rhtml
  163. +3 −0 ...r/plugins/rspec-rails/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml
  164. +1 −0 vendor/plugins/rspec-rails/spec_resources/views/view_spec/template_with_partial_with_array.rhtml
  165. +10 −0 vendor/plugins/rspec-rails/stories/all.rb
  166. +5 −0 vendor/plugins/rspec-rails/stories/configuration/stories.rb
  167. +6 −0 vendor/plugins/rspec-rails/stories/helper.rb
  168. +8 −0 vendor/plugins/rspec-rails/stories/steps/people.rb
  169. +15 −0 vendor/plugins/rspec-rails/stories/transactions_should_rollback
  170. +25 −0 vendor/plugins/rspec-rails/stories/transactions_should_rollback.rb
  171. +4 −0 vendor/plugins/rspec/.autotest
  172. +9 −0 vendor/plugins/rspec/.gitignore
  173. +1,191 −0 vendor/plugins/rspec/History.txt
  174. +22 −0 vendor/plugins/rspec/License.txt
  175. +403 −0 vendor/plugins/rspec/Manifest.txt
  176. +39 −0 vendor/plugins/rspec/README.txt
  177. +90 −0 vendor/plugins/rspec/Rakefile
  178. +10 −0 vendor/plugins/rspec/TODO.txt
  179. +4 −0 vendor/plugins/rspec/bin/autospec
  180. +4 −0 vendor/plugins/rspec/bin/spec
  181. +19 −0 vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb
  182. +40 −0 vendor/plugins/rspec/examples/pure/before_and_after_example.rb
  183. +45 −0 vendor/plugins/rspec/examples/pure/behave_as_example.rb
  184. +54 −0 vendor/plugins/rspec/examples/pure/custom_expectation_matchers.rb
  185. +12 −0 vendor/plugins/rspec/examples/pure/custom_formatter.rb
  186. +9 −0 vendor/plugins/rspec/examples/pure/dynamic_spec.rb
  187. +19 −0 vendor/plugins/rspec/examples/pure/file_accessor.rb
  188. +38 −0 vendor/plugins/rspec/examples/pure/file_accessor_spec.rb
  189. +31 −0 vendor/plugins/rspec/examples/pure/greeter_spec.rb
  190. +14 −0 vendor/plugins/rspec/examples/pure/helper_method_example.rb
  191. +8 −0 vendor/plugins/rspec/examples/pure/io_processor.rb
  192. +21 −0 vendor/plugins/rspec/examples/pure/io_processor_spec.rb
  193. +11 −0 vendor/plugins/rspec/examples/pure/legacy_spec.rb
  194. +27 −0 vendor/plugins/rspec/examples/pure/mocking_example.rb
  195. +28 −0 vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb
  196. +36 −0 vendor/plugins/rspec/examples/pure/nested_classes_example.rb
  197. +29 −0 vendor/plugins/rspec/examples/pure/partial_mock_example.rb
  198. +20 −0 vendor/plugins/rspec/examples/pure/pending_example.rb
  199. +27 −0 vendor/plugins/rspec/examples/pure/predicate_example.rb
  200. +1 −0 vendor/plugins/rspec/examples/pure/priority.txt
  201. +81 −0 vendor/plugins/rspec/examples/pure/shared_example_group_example.rb
  202. +38 −0 vendor/plugins/rspec/examples/pure/shared_stack_examples.rb
  203. +3 −0 vendor/plugins/rspec/examples/pure/spec_helper.rb
  204. +36 −0 vendor/plugins/rspec/examples/pure/stack.rb
  205. +63 −0 vendor/plugins/rspec/examples/pure/stack_spec.rb
  206. +67 −0 vendor/plugins/rspec/examples/pure/stack_spec_with_nested_example_groups.rb
  207. +69 −0 vendor/plugins/rspec/examples/pure/stubbing_example.rb
  208. +33 −0 vendor/plugins/rspec/examples/pure/yielding_example.rb
  209. +13 −0 vendor/plugins/rspec/examples/stories/adder.rb
  210. +34 −0 vendor/plugins/rspec/examples/stories/addition
  211. +9 −0 vendor/plugins/rspec/examples/stories/addition.rb
  212. +65 −0 vendor/plugins/rspec/examples/stories/calculator.rb
  213. +5 −0 vendor/plugins/rspec/examples/stories/game-of-life/.loadpath
  214. +21 −0 vendor/plugins/rspec/examples/stories/game-of-life/README.txt
  215. +6 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/everything.rb
  216. +3 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/examples.rb
  217. +35 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb
  218. +66 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb
  219. +21 −0 ...ins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story
  220. +21 −0 ...s/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story
  221. +42 −0 ...c/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story
  222. +42 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story
  223. +17 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story
  224. +53 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story
  225. +52 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb
  226. +6 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/helper.rb
  227. +26 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb
  228. +5 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/steps.rb
  229. +3 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.rb
  230. +22 −0 vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.txt
  231. +3 −0 vendor/plugins/rspec/examples/stories/game-of-life/life.rb
  232. +23 −0 vendor/plugins/rspec/examples/stories/game-of-life/life/game.rb
  233. +43 −0 vendor/plugins/rspec/examples/stories/game-of-life/life/grid.rb
  234. +9 −0 vendor/plugins/rspec/examples/stories/helper.rb
  235. +18 −0 vendor/plugins/rspec/examples/stories/steps/addition_steps.rb
  236. +7 −0 vendor/plugins/rspec/failing_examples/README.txt
  237. +36 −0 vendor/plugins/rspec/failing_examples/diffing_spec.rb
  238. +19 −0 vendor/plugins/rspec/failing_examples/failing_autogenerated_docstrings_example.rb
  239. +10 −0 vendor/plugins/rspec/failing_examples/failure_in_setup.rb
  240. +10 −0 vendor/plugins/rspec/failing_examples/failure_in_teardown.rb
  241. +40 −0 vendor/plugins/rspec/failing_examples/mocking_example.rb
  242. +26 −0 vendor/plugins/rspec/failing_examples/mocking_with_flexmock.rb
  243. +25 −0 vendor/plugins/rspec/failing_examples/mocking_with_mocha.rb
  244. +27 −0 vendor/plugins/rspec/failing_examples/mocking_with_rr.rb
  245. +20 −0 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
  246. +29 −0 vendor/plugins/rspec/failing_examples/predicate_example.rb
  247. +47 −0 vendor/plugins/rspec/failing_examples/raising_example.rb
  248. +3 −0 vendor/plugins/rspec/failing_examples/spec_helper.rb
  249. +7 −0 vendor/plugins/rspec/failing_examples/syntax_error_example.rb
  250. +44 −0 vendor/plugins/rspec/failing_examples/team_spec.rb
  251. +7 −0 vendor/plugins/rspec/failing_examples/timeout_behaviour.rb
  252. +9 −0 vendor/plugins/rspec/init.rb
  253. +3 −0 vendor/plugins/rspec/lib/autotest/discover.rb
  254. +46 −0 vendor/plugins/rspec/lib/autotest/rspec.rb
  255. +32 −0 vendor/plugins/rspec/lib/spec.rb
  256. +1 −0 vendor/plugins/rspec/lib/spec/adapters.rb
  257. +26 −0 vendor/plugins/rspec/lib/spec/adapters/ruby_engine.rb
  258. +8 −0 vendor/plugins/rspec/lib/spec/adapters/ruby_engine/mri.rb
  259. +8 −0 vendor/plugins/rspec/lib/spec/adapters/ruby_engine/rubinius.rb
  260. +12 −0 vendor/plugins/rspec/lib/spec/example.rb
  261. +93 −0 vendor/plugins/rspec/lib/spec/example/before_and_after_hooks.rb
  262. +167 −0 vendor/plugins/rspec/lib/spec/example/configuration.rb
  263. +30 −0 vendor/plugins/rspec/lib/spec/example/errors.rb
  264. +25 −0 vendor/plugins/rspec/lib/spec/example/example_group.rb
  265. +81 −0 vendor/plugins/rspec/lib/spec/example/example_group_factory.rb
  266. +368 −0 vendor/plugins/rspec/lib/spec/example/example_group_methods.rb
  267. +44 −0 vendor/plugins/rspec/lib/spec/example/example_matcher.rb
  268. +105 −0 vendor/plugins/rspec/lib/spec/example/example_methods.rb
  269. +21 −0 vendor/plugins/rspec/lib/spec/example/module_reopening_fix.rb
  270. +18 −0 vendor/plugins/rspec/lib/spec/example/pending.rb
  271. +52 −0 vendor/plugins/rspec/lib/spec/example/shared_example_group.rb
  272. +56 −0 vendor/plugins/rspec/lib/spec/expectations.rb
  273. +66 −0 vendor/plugins/rspec/lib/spec/expectations/differs/default.rb
  274. +12 −0 vendor/plugins/rspec/lib/spec/expectations/errors.rb
  275. +2 −0 vendor/plugins/rspec/lib/spec/expectations/extensions.rb
  276. +63 −0 vendor/plugins/rspec/lib/spec/expectations/extensions/object.rb
  277. +17 −0 vendor/plugins/rspec/lib/spec/expectations/extensions/string_and_symbol.rb
  278. +52 −0 vendor/plugins/rspec/lib/spec/expectations/handler.rb
  279. +4 −0 vendor/plugins/rspec/lib/spec/extensions.rb
  280. +24 −0 vendor/plugins/rspec/lib/spec/extensions/class.rb
  281. +87 −0 vendor/plugins/rspec/lib/spec/extensions/main.rb
  282. +7 −0 vendor/plugins/rspec/lib/spec/extensions/metaclass.rb
  283. +6 −0 vendor/plugins/rspec/lib/spec/extensions/object.rb
  284. +12 −0 vendor/plugins/rspec/lib/spec/interop/test.rb
  285. +6 −0 vendor/plugins/rspec/lib/spec/interop/test/unit/autorunner.rb
  286. +71 −0 vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb
  287. +6 −0 vendor/plugins/rspec/lib/spec/interop/test/unit/testresult.rb
  288. +34 −0 vendor/plugins/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb
  289. +61 −0 vendor/plugins/rspec/lib/spec/interop/test/unit/ui/console/testrunner.rb
  290. +162 −0 vendor/plugins/rspec/lib/spec/matchers.rb
  291. +221 −0 vendor/plugins/rspec/lib/spec/matchers/be.rb
  292. +37 −0 vendor/plugins/rspec/lib/spec/matchers/be_close.rb
  293. +148 −0 vendor/plugins/rspec/lib/spec/matchers/change.rb
  294. +43 −0 vendor/plugins/rspec/lib/spec/matchers/eql.rb
  295. +43 −0 vendor/plugins/rspec/lib/spec/matchers/equal.rb
  296. +22 −0 vendor/plugins/rspec/lib/spec/matchers/exist.rb
  297. +34 −0 vendor/plugins/rspec/lib/spec/matchers/has.rb
  298. +150 −0 vendor/plugins/rspec/lib/spec/matchers/have.rb
  299. +77 −0 vendor/plugins/rspec/lib/spec/matchers/include.rb
  300. +41 −0 vendor/plugins/rspec/lib/spec/matchers/match.rb
Sorry, we could not display the entire diff because too many files (575) changed.
View
132 lib/tasks/rspec.rake
@@ -0,0 +1,132 @@
+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)
+require 'spec/rake/spectask'
+
+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 specs"
+ 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 specs under 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 specs under 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
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
116 script/spec_server
@@ -0,0 +1,116 @@
+#!/usr/bin/env ruby
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
+require 'rubygems'
+require 'drb/drb'
+require 'rbconfig'
+require 'spec'
+require 'optparse'
+
+# This is based on Florian Weber's TDDMate
+module Spec
+ module Runner
+ class RailsSpecServer
+ def run(argv, stderr, stdout)
+ $stdout = stdout
+ $stderr = stderr
+
+ base = ActiveRecord::Base
+ def base.clear_reloadable_connections!
+ active_connections.each do |name, conn|
+ if conn.requires_reloading?
+ conn.disconnect!
+ active_connections.delete(name)
+ end
+ end
+ end
+
+ 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,
+ $stderr,
+ $stdout
+ )
+ )
+ 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
+puts "Loading Rails environment"
+
+ENV["RAILS_ENV"] = "test"
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
+require 'dispatcher'
+
+def restart_test_server
+ puts "restarting"
+ config = ::Config::CONFIG
+ ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
+ command_line = [ruby, $0, ARGV].flatten.join(' ')
+ exec(command_line)
+end
+
+def daemonize(pid_file = nil)
+ return yield if $DEBUG
+ pid = Process.fork{
+ Process.setsid
+ Dir.chdir(RAILS_ROOT)
+ trap("SIGINT"){ exit! 0 }
+ trap("SIGTERM"){ exit! 0 }
+ trap("SIGHUP"){ restart_test_server }
+ File.open("/dev/null"){|f|
+ STDERR.reopen f
+ STDIN.reopen f
+ STDOUT.reopen f
+ }
+ yield
+ }
+ puts "spec_server launched. (PID: %d)" % pid
+ File.open(pid_file,"w"){|f| f.puts pid } if pid_file
+ exit! 0
+end
+
+options = Hash.new
+opts = OptionParser.new
+opts.on("-d", "--daemon"){|v| options[:daemon] = true }
+opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
+opts.parse!(ARGV)
+
+puts "Ready"
+exec_server = lambda {
+ trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
+ DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new)
+ DRb.thread.join
+}
+
+if options[:daemon]
+ daemonize(options[:pid], &exec_server)
+else
+ exec_server.call
+end
View
2 spec/rcov.opts
@@ -0,0 +1,2 @@
+--exclude "spec/*,gems/*"
+--rails
View
4 spec/spec.opts
@@ -0,0 +1,4 @@
+--colour
+--format progress
+--loadby mtime
+--reverse
View
47 spec/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
4 stories/all.rb
@@ -0,0 +1,4 @@
+dir = File.dirname(__FILE__)
+Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
+ require file
+end
View
3 stories/helper.rb
@@ -0,0 +1,3 @@
+ENV["RAILS_ENV"] = "test"
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
+require 'spec/rails/story_adapter'
View
7 vendor/plugins/rspec-rails/.gitignore
@@ -0,0 +1,7 @@
+tmtags
+.DS_Store
+.emacs-project
+*~
+pkg
+doc
+email.txt
View
85 vendor/plugins/rspec-rails/History.txt
@@ -0,0 +1,85 @@
+=== 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
33 vendor/plugins/rspec-rails/License.txt
@@ -0,0 +1,33 @@
+(The MIT License)
+
+====================================================================
+==== RSpec, RSpec-Rails
+Copyright (c) 2005-2008 The RSpec Development Team
+====================================================================
+==== ARTS
+Copyright (c) 2006 Kevin Clark, Jake Howerton
+====================================================================
+==== ZenTest
+Copyright (c) 2001-2006 Ryan Davis, Eric Hodel, Zen Spider Software
+====================================================================
+==== AssertSelect
+Copyright (c) 2006 Assaf Arkin
+====================================================================
+
+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.
View
159 vendor/plugins/rspec-rails/Manifest.txt
@@ -0,0 +1,159 @@
+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
+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/spec_helper.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/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
+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.9"]]
+ 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
7 vendor/plugins/rspec-rails/UPGRADE
@@ -0,0 +1,7 @@
+== Upgrade
+
+ script/generate rspec
+
+Or modify spec_helper.rb based on the template, which can be found at:
+
+ vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb
View
1 vendor/plugins/rspec-rails/generators/rspec/CHANGES
@@ -0,0 +1 @@
+Please refer to the CHANGES file for RSpec's core
View
40 vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
@@ -0,0 +1,40 @@
+require 'rbconfig'
+
+# This generator bootstraps a Rails project for use with RSpec
+class RspecGenerator < Rails::Generator::Base
+ DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
+ Config::CONFIG['ruby_install_name'])
+
+ def initialize(runtime_args, runtime_options = {})
+ Dir.mkdir('lib/tasks') unless File.directory?('lib/tasks')
+ super
+ end
+
+ 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.file 'rcov.opts', 'spec/rcov.opts'
+ 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'
+ m.file 'stories_helper.rb', 'stories/helper.rb'
+ end
+ end
+
+protected
+
+ def banner
+ "Usage: #{$0} rspec"
+ end
+
+end
View
4 vendor/plugins/rspec-rails/generators/rspec/templates/all_stories.rb
@@ -0,0 +1,4 @@
+dir = File.dirname(__FILE__)
+Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
+ require file
+end
View
0 vendor/plugins/rspec-rails/generators/rspec/templates/previous_failures.txt
No changes.
View
2 vendor/plugins/rspec-rails/generators/rspec/templates/rcov.opts
@@ -0,0 +1,2 @@
+--exclude "spec/*,gems/*"
+--rails
View
132 vendor/plugins/rspec-rails/generators/rspec/templates/rspec.rake
@@ -0,0 +1,132 @@
+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)
+require 'spec/rake/spectask'
+
+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 specs"
+ 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 specs under 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 specs under 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
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
5 vendor/plugins/rspec-rails/generators/rspec/templates/script/spec
@@ -0,0 +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
116 vendor/plugins/rspec-rails/generators/rspec/templates/script/spec_server
@@ -0,0 +1,116 @@
+#!/usr/bin/env ruby
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
+require 'rubygems'
+require 'drb/drb'
+require 'rbconfig'
+require 'spec'
+require 'optparse'
+
+# This is based on Florian Weber's TDDMate
+module Spec
+ module Runner
+ class RailsSpecServer
+ def run(argv, stderr, stdout)
+ $stdout = stdout
+ $stderr = stderr
+
+ base = ActiveRecord::Base
+ def base.clear_reloadable_connections!
+ active_connections.each do |name, conn|
+ if conn.requires_reloading?
+ conn.disconnect!
+ active_connections.delete(name)
+ end
+ end
+ end
+
+ 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,
+ $stderr,
+ $stdout
+ )
+ )
+ 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
+puts "Loading Rails environment"
+
+ENV["RAILS_ENV"] = "test"
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
+require 'dispatcher'
+
+def restart_test_server
+ puts "restarting"
+ config = ::Config::CONFIG
+ ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
+ command_line = [ruby, $0, ARGV].flatten.join(' ')
+ exec(command_line)
+end
+
+def daemonize(pid_file = nil)
+ return yield if $DEBUG
+ pid = Process.fork{
+ Process.setsid
+ Dir.chdir(RAILS_ROOT)
+ trap("SIGINT"){ exit! 0 }
+ trap("SIGTERM"){ exit! 0 }
+ trap("SIGHUP"){ restart_test_server }
+ File.open("/dev/null"){|f|
+ STDERR.reopen f
+ STDIN.reopen f
+ STDOUT.reopen f
+ }
+ yield
+ }
+ puts "spec_server launched. (PID: %d)" % pid
+ File.open(pid_file,"w"){|f| f.puts pid } if pid_file
+ exit! 0
+end
+
+options = Hash.new
+opts = OptionParser.new
+opts.on("-d", "--daemon"){|v| options[:daemon] = true }
+opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
+opts.parse!(ARGV)
+
+puts "Ready"
+exec_server = lambda {
+ trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
+ DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new)
+ DRb.thread.join
+}
+
+if options[:daemon]
+ daemonize(options[:pid], &exec_server)
+else
+ exec_server.call
+end
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
3 vendor/plugins/rspec-rails/generators/rspec/templates/stories_helper.rb
@@ -0,0 +1,3 @@
+ENV["RAILS_ENV"] = "test"
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
+require 'spec/rails/story_adapter'
View
33 vendor/plugins/rspec-rails/generators/rspec_controller/USAGE
@@ -0,0 +1,33 @@
+Description:
+ The rspec_controller generator creates stub specs and files for a new
+ controller and its views.
+
+ The generator takes a controller name and a list of views as arguments.
+ The controller name may be given in CamelCase or under_score and should
+ not be suffixed with 'Controller'. To create a controller within a
+ module, specify the controller name as 'module/controller'.
+
+ The generator creates stubs for a controller (and spec), a view (and spec)
+ for each view in the argument list, plus a helper.
+
+Example:
+ ./script/generate rspec_controller dog bark fetch
+ ...
+ create spec/controllers/dog_controller_spec.rb
+ create app/controllers/dog_controller.rb
+ create app/helpers/dog_helper.rb
+ create spec/views/dog/bark_view_spec.rb
+ create app/views/dog/bark.rhtml
+ create spec/views/dog/fetch_view_spec.rb
+ create app/views/dog/fetch.rhtml
+
+Modules Example:
+ ./script/generate rspec_controller 'pets/dog' bark fetch
+ ...
+ create spec/controllers/pets/dog_controller_spec.rb
+ create app/controllers/pets/dog_controller.rb
+ create app/helpers/pets/dog_helper.rb
+ create spec/views/pets/dog/bark_view_spec.rb
+ create app/views/pets/dog/bark.rhtml
+ create spec/views/pets/dog/fetch_view_spec.rb
+ create app/views/pets/dog/fetch.rhtml
View
49 vendor/plugins/rspec-rails/generators/rspec_controller/rspec_controller_generator.rb
@@ -0,0 +1,49 @@
+require 'rails_generator/generators/components/controller/controller_generator'
+
+class RspecControllerGenerator < ControllerGenerator
+
+ def manifest
+ record do |m|
+ # Check for class naming collisions.
+ m.class_collisions class_path, "#{class_name}Controller", "#{class_name}Helper"
+
+ # Controller, helper, views, and spec directories.
+ m.directory File.join('app/controllers', class_path)
+ m.directory File.join('app/helpers', class_path)
+ m.directory File.join('app/views', class_path, file_name)
+ m.directory File.join('spec/controllers', class_path)
+ m.directory File.join('spec/helpers', class_path)
+ m.directory File.join('spec/views', class_path, file_name)
+
+ if Rails::VERSION::STRING < "2.0.0"
+ @default_file_extension = "rhtml"
+ else
+ @default_file_extension = "html.erb"
+ end
+
+ # Controller spec, class, and helper.
+ m.template 'controller_spec.rb',
+ File.join('spec/controllers', class_path, "#{file_name}_controller_spec.rb")
+
+ m.template 'helper_spec.rb',
+ File.join('spec/helpers', class_path, "#{file_name}_helper_spec.rb")
+
+ m.template 'controller:controller.rb',
+ File.join('app/controllers', class_path, "#{file_name}_controller.rb")
+
+ m.template 'controller:helper.rb',
+ File.join('app/helpers', class_path, "#{file_name}_helper.rb")
+
+ # Spec and view template for each action.
+ actions.each do |action|
+ m.template 'view_spec.rb',
+ File.join('spec/views', class_path, file_name, "#{action}.#{@default_file_extension}_spec.rb"),
+ :assigns => { :action => action, :model => file_name }
+ path = File.join('app/views', class_path, file_name, "#{action}.#{@default_file_extension}")
+ m.template "controller:view.#{@default_file_extension}",
+ path,
+ :assigns => { :action => action, :path => path }
+ end
+ end
+ end
+end
View
25 vendor/plugins/rspec-rails/generators/rspec_controller/templates/controller_spec.rb
@@ -0,0 +1,25 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
+
+describe <%= class_name %>Controller do
+
+<% if actions.empty? -%>
+ #Delete this example and add some real ones
+<% else -%>
+ #Delete these examples and add some real ones
+<% end -%>
+ it "should use <%= class_name %>Controller" do
+ controller.should be_an_instance_of(<%= class_name %>Controller)
+ end
+
+<% unless actions.empty? -%>
+<% for action in actions -%>
+
+ describe "GET '<%= action %>'" do
+ it "should be successful" do
+ get '<%= action %>'
+ response.should be_success
+ end
+ 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
12 vendor/plugins/rspec-rails/generators/rspec_controller/templates/view_spec.rb
@@ -0,0 +1,12 @@
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
+
+describe "/<%= class_name.underscore %>/<%= action %>" 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', %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
18 vendor/plugins/rspec-rails/generators/rspec_model/USAGE
@@ -0,0 +1,18 @@
+Description:
+ The rspec_model generator creates stubs for a new model.
+
+ The generator takes a model name as its argument. The model name may be
+ given in CamelCase or under_score and should not be suffixed with 'Model'.
+
+ The generator creates a model class in app/models, an RSpec spec in
+ spec/models, database fixtures in spec/fixtures/plural_name.yml, and a migration
+ in db/migrate.
+
+Example:
+ ./script/generate rspec_model Account
+
+ This will create an Account model:
+ Model: app/models/account.rb
+ Spec: spec/models/account_spec.rb
+ Fixtures: spec/fixtures/accounts.yml
+ Migration: db/migrate/XXX_add_accounts.rb
View
35 vendor/plugins/rspec-rails/generators/rspec_model/rspec_model_generator.rb
@@ -0,0 +1,35 @@
+require 'rails_generator/generators/components/model/model_generator'
+require File.dirname(__FILE__) + '/../rspec_default_values'
+
+class RspecModelGenerator < ModelGenerator
+
+ def manifest
+
+ record do |m|
+ # Check for class naming collisions.
+ m.class_collisions class_path, class_name
+
+ # Model, spec, and fixture directories.
+ m.directory File.join('app/models', class_path)
+ m.directory File.join('spec/models', 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_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 => {
+ :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
+ }, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
+ end
+
+ end
+ end
+
+end
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
154 vendor/plugins/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb
@@ -0,0 +1,154 @@
+require File.dirname(__FILE__) + '/../rspec_default_values'
+
+class RspecScaffoldGenerator < Rails::Generator::NamedBase
+ default_options :skip_migration => false
+
+ attr_reader :controller_name,
+ :controller_class_path,
+ :controller_file_path,
+ :controller_class_nesting,
+ :controller_class_nesting_depth,
+ :controller_class_name,
+ :controller_singular_name,
+ :controller_plural_name,
+ :resource_edit_path,
+ :default_file_extension
+ alias_method :controller_file_name, :controller_singular_name
+ alias_method :controller_table_name, :controller_plural_name
+
+ def initialize(runtime_args, runtime_options = {})
+ super
+
+ @controller_name = @name.pluralize
+
+ base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
+ @controller_class_name_without_nesting, @controller_singular_name, @controller_plural_name = inflect_names(base_name)
+
+ if @controller_class_nesting.empty?
+ @controller_class_name = @controller_class_name_without_nesting
+ else
+ @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
+ end
+
+ 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)
+ @resource_edit_path = "/edit"
+ else
+ @resource_edit_path = ";edit"
+ end
+ end
+
+ def manifest
+ record do |m|
+
+ # Check for class naming collisions.
+ m.class_collisions(controller_class_path, "#{controller_class_name}Controller", "#{controller_class_name}Helper")
+ m.class_collisions(class_path, "#{class_name}")
+
+ # Controller, helper, views, and spec directories.
+ m.directory(File.join('app/models', class_path))
+ m.directory(File.join('app/controllers', controller_class_path))
+ m.directory(File.join('app/helpers', controller_class_path))
+ m.directory(File.join('app/views', controller_class_path, controller_file_name))
+ m.directory(File.join('spec/controllers', controller_class_path))
+ m.directory(File.join('spec/models', class_path))
+ m.directory(File.join('spec/helpers', class_path))
+ m.directory File.join('spec/fixtures', class_path)
+ 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")
+
+ m.template "#{@resource_generator}:controller.rb",
+ File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
+
+ m.template 'rspec_scaffold:helper_spec.rb',
+ File.join('spec/helpers', class_path, "#{controller_file_name}_helper_spec.rb")
+
+ m.template "#{@resource_generator}:helper.rb",
+ File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb")
+
+ for action in scaffold_views
+ m.template(
+ "#{@resource_generator}:view_#{action}.#{@default_file_extension}",
+ File.join('app/views', controller_class_path, controller_file_name, "#{action}.#{default_file_extension}")
+ )
+ end
+
+ # Model class, unit test, 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 'rspec_model:model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
+
+ # View specs
+ m.template "rspec_scaffold:edit_erb_spec.rb",
+ File.join('spec/views', controller_class_path, controller_file_name, "edit.#{default_file_extension}_spec.rb")
+ m.template "rspec_scaffold:index_erb_spec.rb",
+ File.join('spec/views', controller_class_path, controller_file_name, "index.#{default_file_extension}_spec.rb")
+ m.template "rspec_scaffold:new_erb_spec.rb",
+ File.join('spec/views', controller_class_path, controller_file_name, "new.#{default_file_extension}_spec.rb")
+ m.template "rspec_scaffold:show_erb_spec.rb",
+ File.join('spec/views', controller_class_path, controller_file_name, "show.#{default_file_extension}_spec.rb")
+
+ unless options[:skip_migration]
+ m.migration_template(
+ 'model:migration.rb', 'db/migrate',
+ :assigns => {
+ :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}",
+ :attributes => attributes
+ },
+ :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
+ )
+ end
+
+ m.route_resources controller_file_name
+
+ end
+ end
+
+ protected
+ # Override with your own usage banner.
+ def banner
+ "Usage: #{$0} rspec_scaffold ModelName [field:type field:type]"
+ end
+
+ def add_options!(opt)
+ opt.separator ''
+ opt.separator 'Options:'
+ opt.on("--skip-migration",
+ "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
+ end
+
+ def scaffold_views
+ %w[ index show new edit ]
+ end
+
+ def model_name
+ class_name.demodulize
+ end
+end
+
+module Rails
+ module Generator
+ class GeneratedAttribute
+ def input_type
+ @input_type ||= case type
+ when :text then "textarea"
+ else
+ "input"
+ end
+ end
+ end
+ end
+end
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