exception2db 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/Rakefile +48 -0
  3. data/app/controllers/exception2db/main_controller.rb +34 -0
  4. data/app/models/e2db.rb +68 -0
  5. data/app/views/exception2db/main/index.html.erb +15 -0
  6. data/app/views/exception2db/main/show.html.erb +77 -0
  7. data/app/views/layouts/exception2db.html.erb +25 -0
  8. data/config/routes.rb +12 -0
  9. data/init.rb +23 -0
  10. data/lib/css/style.css +377 -0
  11. data/lib/exception2db.rb +27 -0
  12. data/lib/exception2db/config.rb +22 -0
  13. data/lib/exception2db/railtie.rb +12 -0
  14. data/lib/exception2db/util.rb +17 -0
  15. data/lib/exception2db/version.rb +3 -0
  16. data/lib/js/app.js +1 -0
  17. data/spec/exception2db_spec.rb +74 -0
  18. data/spec/spec_helper.rb +175 -0
  19. data/test/error_xml.rb +134 -0
  20. data/test/rails_root/Rakefile +10 -0
  21. data/test/rails_root/app/controllers/application_controller.rb +10 -0
  22. data/test/rails_root/app/controllers/articles_controller.rb +7 -0
  23. data/test/rails_root/app/models/article.rb +25 -0
  24. data/test/rails_root/app/models/city.rb +15 -0
  25. data/test/rails_root/app/models/comment.rb +13 -0
  26. data/test/rails_root/app/models/tech_magazine.rb +2 -0
  27. data/test/rails_root/app/models/vehicle/car.rb +4 -0
  28. data/test/rails_root/app/models/vehicle/door.rb +3 -0
  29. data/test/rails_root/app/models/vehicle/engine.rb +3 -0
  30. data/test/rails_root/config/boot.rb +110 -0
  31. data/test/rails_root/config/database.yml +14 -0
  32. data/test/rails_root/config/environment.rb +17 -0
  33. data/test/rails_root/config/environments/cucumber.rb +26 -0
  34. data/test/rails_root/config/environments/development.rb +0 -0
  35. data/test/rails_root/config/environments/test.rb +0 -0
  36. data/test/rails_root/config/initializers/new_rails_defaults.rb +19 -0
  37. data/test/rails_root/config/routes.rb +6 -0
  38. data/test/rails_root/db/migrate/20090809061114_create_tables.rb +15 -0
  39. data/test/rails_root/db/schema.rb +74 -0
  40. data/test/rails_root/db/sqlite3.db +0 -0
  41. data/test/rails_root/log/cucumber.log +3531 -0
  42. data/test/rails_root/log/development.log +445 -0
  43. data/test/rails_root/log/test.log +59223 -0
  44. data/test/rails_root/script/console +3 -0
  45. data/test/rails_root/script/dbconsole +3 -0
  46. data/test/rails_root/script/runner +3 -0
  47. data/test/rails_root/script/server +3 -0
  48. data/test/rspec-rails/Contribute.rdoc +4 -0
  49. data/test/rspec-rails/History.rdoc +283 -0
  50. data/test/rspec-rails/License.txt +33 -0
  51. data/test/rspec-rails/Manifest.txt +165 -0
  52. data/test/rspec-rails/README.rdoc +45 -0
  53. data/test/rspec-rails/Rakefile +72 -0
  54. data/test/rspec-rails/TODO.txt +17 -0
  55. data/test/rspec-rails/Upgrade.rdoc +148 -0
  56. data/test/rspec-rails/generators/integration_spec/integration_spec_generator.rb +10 -0
  57. data/test/rspec-rails/generators/integration_spec/templates/integration_spec.rb +4 -0
  58. data/test/rspec-rails/generators/rspec/CHANGES +1 -0
  59. data/test/rspec-rails/generators/rspec/rspec_generator.rb +53 -0
  60. data/test/rspec-rails/generators/rspec/templates/previous_failures.txt +0 -0
  61. data/test/rspec-rails/generators/rspec/templates/rcov.opts +2 -0
  62. data/test/rspec-rails/generators/rspec/templates/rspec.rake +144 -0
  63. data/test/rspec-rails/generators/rspec/templates/script/autospec +6 -0
  64. data/test/rspec-rails/generators/rspec/templates/script/spec +10 -0
  65. data/test/rspec-rails/generators/rspec/templates/spec.opts +4 -0
  66. data/test/rspec-rails/generators/rspec/templates/spec_helper.rb +54 -0
  67. data/test/rspec-rails/generators/rspec_controller/USAGE +33 -0
  68. data/test/rspec-rails/generators/rspec_controller/rspec_controller_generator.rb +47 -0
  69. data/test/rspec-rails/generators/rspec_controller/templates/controller_spec.rb +25 -0
  70. data/test/rspec-rails/generators/rspec_controller/templates/helper_spec.rb +11 -0
  71. data/test/rspec-rails/generators/rspec_controller/templates/view_spec.rb +12 -0
  72. data/test/rspec-rails/generators/rspec_default_values.rb +28 -0
  73. data/test/rspec-rails/generators/rspec_model/USAGE +18 -0
  74. data/test/rspec-rails/generators/rspec_model/rspec_model_generator.rb +35 -0
  75. data/test/rspec-rails/generators/rspec_model/templates/model_spec.rb +13 -0
  76. data/test/rspec-rails/generators/rspec_scaffold/rspec_scaffold_generator.rb +154 -0
  77. data/test/rspec-rails/generators/rspec_scaffold/templates/controller_spec.rb +131 -0
  78. data/test/rspec-rails/generators/rspec_scaffold/templates/edit_erb_spec.rb +25 -0
  79. data/test/rspec-rails/generators/rspec_scaffold/templates/helper_spec.rb +11 -0
  80. data/test/rspec-rails/generators/rspec_scaffold/templates/index_erb_spec.rb +27 -0
  81. data/test/rspec-rails/generators/rspec_scaffold/templates/new_erb_spec.rb +25 -0
  82. data/test/rspec-rails/generators/rspec_scaffold/templates/routing_spec.rb +33 -0
  83. data/test/rspec-rails/generators/rspec_scaffold/templates/show_erb_spec.rb +22 -0
  84. data/test/rspec-rails/init.rb +9 -0
  85. data/test/rspec-rails/lib/autotest/discover.rb +5 -0
  86. data/test/rspec-rails/lib/autotest/rails_rspec.rb +76 -0
  87. data/test/rspec-rails/lib/spec/rails.rb +26 -0
  88. data/test/rspec-rails/lib/spec/rails/example.rb +48 -0
  89. data/test/rspec-rails/lib/spec/rails/example/assigns_hash_proxy.rb +39 -0
  90. data/test/rspec-rails/lib/spec/rails/example/controller_example_group.rb +278 -0
  91. data/test/rspec-rails/lib/spec/rails/example/cookies_proxy.rb +29 -0
  92. data/test/rspec-rails/lib/spec/rails/example/functional_example_group.rb +106 -0
  93. data/test/rspec-rails/lib/spec/rails/example/helper_example_group.rb +153 -0
  94. data/test/rspec-rails/lib/spec/rails/example/integration_example_group.rb +16 -0
  95. data/test/rspec-rails/lib/spec/rails/example/model_example_group.rb +14 -0
  96. data/test/rspec-rails/lib/spec/rails/example/render_observer.rb +80 -0
  97. data/test/rspec-rails/lib/spec/rails/example/routing_example_group.rb +13 -0
  98. data/test/rspec-rails/lib/spec/rails/example/routing_helpers.rb +66 -0
  99. data/test/rspec-rails/lib/spec/rails/example/view_example_group.rb +199 -0
  100. data/test/rspec-rails/lib/spec/rails/extensions.rb +11 -0
  101. data/test/rspec-rails/lib/spec/rails/extensions/action_controller/rescue.rb +42 -0
  102. data/test/rspec-rails/lib/spec/rails/extensions/action_controller/test_case.rb +16 -0
  103. data/test/rspec-rails/lib/spec/rails/extensions/action_controller/test_response.rb +21 -0
  104. data/test/rspec-rails/lib/spec/rails/extensions/action_view/base.rb +33 -0
  105. data/test/rspec-rails/lib/spec/rails/extensions/active_record/base.rb +45 -0
  106. data/test/rspec-rails/lib/spec/rails/extensions/active_support/test_case.rb +7 -0
  107. data/test/rspec-rails/lib/spec/rails/extensions/spec/matchers/have.rb +23 -0
  108. data/test/rspec-rails/lib/spec/rails/extensions/spec/runner/configuration.rb +44 -0
  109. data/test/rspec-rails/lib/spec/rails/interop/testcase.rb +14 -0
  110. data/test/rspec-rails/lib/spec/rails/matchers.rb +33 -0
  111. data/test/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb +46 -0
  112. data/test/rspec-rails/lib/spec/rails/matchers/assert_select.rb +180 -0
  113. data/test/rspec-rails/lib/spec/rails/matchers/change.rb +13 -0
  114. data/test/rspec-rails/lib/spec/rails/matchers/have_text.rb +57 -0
  115. data/test/rspec-rails/lib/spec/rails/matchers/include_text.rb +54 -0
  116. data/test/rspec-rails/lib/spec/rails/matchers/redirect_to.rb +126 -0
  117. data/test/rspec-rails/lib/spec/rails/matchers/render_template.rb +129 -0
  118. data/test/rspec-rails/lib/spec/rails/matchers/route_to.rb +149 -0
  119. data/test/rspec-rails/lib/spec/rails/mocks.rb +135 -0
  120. data/test/rspec-rails/lib/spec/rails/version.rb +16 -0
  121. data/test/rspec-rails/spec/autotest/mappings_spec.rb +86 -0
  122. data/test/rspec-rails/spec/rails_suite.rb +7 -0
  123. data/test/rspec-rails/spec/resources/controllers/action_view_base_spec_controller.rb +2 -0
  124. data/test/rspec-rails/spec/resources/controllers/application.rb +9 -0
  125. data/test/rspec-rails/spec/resources/controllers/controller_spec_controller.rb +127 -0
  126. data/test/rspec-rails/spec/resources/controllers/example.txt +1 -0
  127. data/test/rspec-rails/spec/resources/controllers/redirect_spec_controller.rb +70 -0
  128. data/test/rspec-rails/spec/resources/controllers/render_spec_controller.rb +34 -0
  129. data/test/rspec-rails/spec/resources/controllers/rjs_spec_controller.rb +58 -0
  130. data/test/rspec-rails/spec/resources/helpers/addition_helper.rb +5 -0
  131. data/test/rspec-rails/spec/resources/helpers/explicit_helper.rb +46 -0
  132. data/test/rspec-rails/spec/resources/helpers/more_explicit_helper.rb +5 -0
  133. data/test/rspec-rails/spec/resources/helpers/plugin_application_helper.rb +6 -0
  134. data/test/rspec-rails/spec/resources/helpers/view_spec_helper.rb +13 -0
  135. data/test/rspec-rails/spec/resources/models/animal.rb +4 -0
  136. data/test/rspec-rails/spec/resources/models/person.rb +18 -0
  137. data/test/rspec-rails/spec/resources/models/thing.rb +3 -0
  138. data/test/rspec-rails/spec/resources/views/controller_spec/_partial.html.erb +0 -0
  139. data/test/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_after_session_reset.html.erb +1 -0
  140. data/test/rspec-rails/spec/resources/views/controller_spec/action_setting_flash_before_session_reset.html.erb +1 -0
  141. data/test/rspec-rails/spec/resources/views/controller_spec/action_setting_the_assigns_hash.html.erb +0 -0
  142. data/test/rspec-rails/spec/resources/views/controller_spec/action_with_errors_in_template.html.erb +1 -0
  143. data/test/rspec-rails/spec/resources/views/controller_spec/action_with_template.html.erb +1 -0
  144. data/test/rspec-rails/spec/resources/views/controller_spec/non_existent_action_with_existent_template.html.erb +0 -0
  145. data/test/rspec-rails/spec/resources/views/layouts/application.html.erb +0 -0
  146. data/test/rspec-rails/spec/resources/views/layouts/simple.html.erb +0 -0
  147. data/test/rspec-rails/spec/resources/views/objects/_object.html.erb +1 -0
  148. data/test/rspec-rails/spec/resources/views/render_spec/_a_partial.html.erb +0 -0
  149. data/test/rspec-rails/spec/resources/views/render_spec/action_with_alternate_layout.html.erb +0 -0
  150. data/test/rspec-rails/spec/resources/views/render_spec/some_action.html.erb +0 -0
  151. data/test/rspec-rails/spec/resources/views/render_spec/some_action.js.rjs +1 -0
  152. data/test/rspec-rails/spec/resources/views/rjs_spec/_replacement_partial.html.erb +1 -0
  153. data/test/rspec-rails/spec/resources/views/rjs_spec/hide_div.js.rjs +1 -0
  154. data/test/rspec-rails/spec/resources/views/rjs_spec/hide_page_element.js.rjs +1 -0
  155. data/test/rspec-rails/spec/resources/views/rjs_spec/insert_html.js.rjs +1 -0
  156. data/test/rspec-rails/spec/resources/views/rjs_spec/replace.js.rjs +1 -0
  157. data/test/rspec-rails/spec/resources/views/rjs_spec/replace_html.js.rjs +1 -0
  158. data/test/rspec-rails/spec/resources/views/rjs_spec/replace_html_with_partial.js.rjs +1 -0
  159. data/test/rspec-rails/spec/resources/views/rjs_spec/visual_effect.js.rjs +1 -0
  160. data/test/rspec-rails/spec/resources/views/rjs_spec/visual_toggle_effect.js.rjs +1 -0
  161. data/test/rspec-rails/spec/resources/views/tag_spec/no_tags.html.erb +1 -0
  162. data/test/rspec-rails/spec/resources/views/tag_spec/single_div_with_no_attributes.html.erb +1 -0
  163. data/test/rspec-rails/spec/resources/views/tag_spec/single_div_with_one_attribute.html.erb +1 -0
  164. data/test/rspec-rails/spec/resources/views/view_spec/_partial.html.erb +2 -0
  165. data/test/rspec-rails/spec/resources/views/view_spec/_partial_used_twice.html.erb +0 -0
  166. data/test/rspec-rails/spec/resources/views/view_spec/_partial_with_local_variable.html.erb +1 -0
  167. data/test/rspec-rails/spec/resources/views/view_spec/_partial_with_sub_partial.html.erb +1 -0
  168. data/test/rspec-rails/spec/resources/views/view_spec/_spacer.html.erb +1 -0
  169. data/test/rspec-rails/spec/resources/views/view_spec/accessor.html.erb +5 -0
  170. data/test/rspec-rails/spec/resources/views/view_spec/block_helper.html.erb +3 -0
  171. data/test/rspec-rails/spec/resources/views/view_spec/entry_form.html.erb +2 -0
  172. data/test/rspec-rails/spec/resources/views/view_spec/explicit_helper.html.erb +2 -0
  173. data/test/rspec-rails/spec/resources/views/view_spec/foo/show.html.erb +1 -0
  174. data/test/rspec-rails/spec/resources/views/view_spec/implicit_helper.html.erb +2 -0
  175. data/test/rspec-rails/spec/resources/views/view_spec/multiple_helpers.html.erb +3 -0
  176. data/test/rspec-rails/spec/resources/views/view_spec/path_params.html.erb +1 -0
  177. data/test/rspec-rails/spec/resources/views/view_spec/should_not_receive.html.erb +3 -0
  178. data/test/rspec-rails/spec/resources/views/view_spec/template_with_partial.html.erb +5 -0
  179. data/test/rspec-rails/spec/resources/views/view_spec/template_with_partial_using_collection.html.erb +3 -0
  180. data/test/rspec-rails/spec/resources/views/view_spec/template_with_partial_with_array.html.erb +1 -0
  181. data/test/rspec-rails/spec/resources/views/view_spec/view_helpers.html.erb +1 -0
  182. data/test/rspec-rails/spec/spec/rails/example/assigns_hash_proxy_spec.rb +109 -0
  183. data/test/rspec-rails/spec/spec/rails/example/configuration_spec.rb +65 -0
  184. data/test/rspec-rails/spec/spec/rails/example/controller_example_group_spec.rb +307 -0
  185. data/test/rspec-rails/spec/spec/rails/example/controller_isolation_spec.rb +75 -0
  186. data/test/rspec-rails/spec/spec/rails/example/cookies_proxy_spec.rb +87 -0
  187. data/test/rspec-rails/spec/spec/rails/example/error_handling_spec.rb +90 -0
  188. data/test/rspec-rails/spec/spec/rails/example/example_group_factory_spec.rb +112 -0
  189. data/test/rspec-rails/spec/spec/rails/example/helper_example_group_spec.rb +233 -0
  190. data/test/rspec-rails/spec/spec/rails/example/model_example_group_spec.rb +20 -0
  191. data/test/rspec-rails/spec/spec/rails/example/routing_example_group_spec.rb +10 -0
  192. data/test/rspec-rails/spec/spec/rails/example/shared_routing_example_group_examples.rb +237 -0
  193. data/test/rspec-rails/spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb +33 -0
  194. data/test/rspec-rails/spec/spec/rails/example/view_example_group_spec.rb +349 -0
  195. data/test/rspec-rails/spec/spec/rails/extensions/action_view_base_spec.rb +74 -0
  196. data/test/rspec-rails/spec/spec/rails/extensions/active_record_spec.rb +14 -0
  197. data/test/rspec-rails/spec/spec/rails/interop/testcase_spec.rb +70 -0
  198. data/test/rspec-rails/spec/spec/rails/matchers/ar_be_valid_spec.rb +19 -0
  199. data/test/rspec-rails/spec/spec/rails/matchers/assert_select_spec.rb +835 -0
  200. data/test/rspec-rails/spec/spec/rails/matchers/errors_on_spec.rb +37 -0
  201. data/test/rspec-rails/spec/spec/rails/matchers/have_text_spec.rb +69 -0
  202. data/test/rspec-rails/spec/spec/rails/matchers/include_text_spec.rb +62 -0
  203. data/test/rspec-rails/spec/spec/rails/matchers/redirect_to_spec.rb +253 -0
  204. data/test/rspec-rails/spec/spec/rails/matchers/render_template_spec.rb +208 -0
  205. data/test/rspec-rails/spec/spec/rails/matchers/should_change_spec.rb +15 -0
  206. data/test/rspec-rails/spec/spec/rails/mocks/ar_classes.rb +10 -0
  207. data/test/rspec-rails/spec/spec/rails/mocks/mock_model_spec.rb +106 -0
  208. data/test/rspec-rails/spec/spec/rails/mocks/stub_model_spec.rb +80 -0
  209. data/test/rspec-rails/spec/spec/rails/sample_modified_fixture.rb +8 -0
  210. data/test/rspec-rails/spec/spec/rails/sample_spec.rb +8 -0
  211. data/test/rspec-rails/spec/spec/rails/spec_spec.rb +11 -0
  212. data/test/rspec-rails/spec/spec_helper.rb +78 -0
  213. metadata +476 -0
@@ -0,0 +1,45 @@
1
+ = Spec::Rails
2
+
3
+ * http://rspec.info
4
+ * http://rubyforge.org/projects/rspec
5
+ * http://github.com/dchelimsky/rspec-rails
6
+ * http://wiki.github.com/dchelimsky/rspec/rails
7
+ * mailto:rspec-devel@rubyforge.org
8
+
9
+ == DESCRIPTION:
10
+
11
+ Behaviour Driven Development for Ruby on Rails.
12
+
13
+ rspec-rails is an RSpec extension that allows you to drive the development of
14
+ Ruby on Rails applications with RSpec.
15
+
16
+ == FEATURES:
17
+
18
+ * Use RSpec to independently specify Rails Models, Views, Controllers and Helpers
19
+ * Integrated fixture loading
20
+ * Special generators for Resources, Models, Views and Controllers that generate RSpec code examples.
21
+
22
+ == VISION:
23
+
24
+ For people for whom TDD is a brand new concept, the testing support built into
25
+ Ruby on Rails is a huge leap forward. The fact that it is built right in is
26
+ fantastic, and Ruby on Rails apps are generally much easier to maintain than
27
+ they might have been without such support.
28
+
29
+ For those of us coming from a history with TDD, and now BDD, the existing
30
+ support presents some problems related to dependencies across examples. To
31
+ that end, RSpec on Rails supports 4 types of examples. We’ve also built in
32
+ first class mocking and stubbing support in order to break dependencies across
33
+ these different concerns.
34
+
35
+ == MORE INFORMATION:
36
+
37
+ See Spec::Rails::Example for information about the different kinds of example
38
+ groups you can use to spec the different Rails components
39
+
40
+ See Spec::Rails::Matchers for information about Rails-specific
41
+ expectations you can set on responses and models, etc.
42
+
43
+ == INSTALL
44
+
45
+ * Visit http://wiki.github.com/dchelimsky/rspec/rails for installation instructions.
@@ -0,0 +1,72 @@
1
+ # -*- ruby -*-
2
+ gem 'hoe', '>=2.0.0'
3
+ require 'hoe'
4
+
5
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__),"..","rspec","lib")))
6
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__),"lib")))
7
+
8
+ require 'spec/rails/version'
9
+ require 'spec/rake/spectask'
10
+ require 'cucumber/rake/task'
11
+
12
+ Hoe.spec 'rspec-rails' do
13
+ self.version = Spec::Rails::VERSION::STRING
14
+ self.summary = Spec::Rails::VERSION::SUMMARY
15
+ self.description = "Behaviour Driven Development for Ruby on Rails."
16
+ self.rubyforge_name = 'rspec'
17
+ self.developer 'RSpec Development Team', 'rspec-devel@rubyforge.org'
18
+ self.extra_deps = [["rspec",">=1.2.9"],["rack",">=1.0.0"]]
19
+ self.extra_dev_deps = [["cucumber",">= 0.3.99"]]
20
+ self.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
21
+ self.history_file = 'History.rdoc'
22
+ self.readme_file = 'README.rdoc'
23
+ self.post_install_message = <<-POST_INSTALL_MESSAGE
24
+ #{'*'*50}
25
+
26
+ Thank you for installing rspec-rails-#{Spec::Rails::VERSION::STRING}
27
+
28
+ If you are upgrading, do this in each of your rails apps
29
+ that you want to upgrade:
30
+
31
+ $ ruby script/generate rspec
32
+
33
+ Please be sure to read History.rdoc and Upgrade.rdoc
34
+ for useful information about this release.
35
+
36
+ #{'*'*50}
37
+ POST_INSTALL_MESSAGE
38
+ end
39
+
40
+ ['audit','test','test_deps','default','post_blog', 'release'].each do |task|
41
+ Rake.application.instance_variable_get('@tasks').delete(task)
42
+ end
43
+
44
+ task :post_blog do
45
+ # no-op
46
+ end
47
+
48
+ task :release => [:clean, :package] do |t|
49
+ version = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
50
+ abort "Versions don't match #{version} vs #{Spec::Rails::VERSION::STRING}" unless version == Spec::Rails::VERSION::STRING
51
+ pkg = "pkg/rspec-rails-#{version}"
52
+
53
+ rubyforge = RubyForge.new.configure
54
+ puts "Logging in to rubyforge ..."
55
+ rubyforge.login
56
+
57
+ puts "Releasing rspec-rails version #{version} ..."
58
+ ["#{pkg}.gem", "#{pkg}.tgz"].each do |file|
59
+ rubyforge.add_file('rspec', 'rspec', Spec::Rails::VERSION::STRING, file)
60
+ end
61
+ end
62
+
63
+ Cucumber::Rake::Task.new
64
+
65
+ task :default => [:features]
66
+
67
+ namespace :update do
68
+ desc "update the manifest"
69
+ task :manifest do
70
+ system %q[touch Manifest.txt; rake check_manifest | grep -v "(in " | patch]
71
+ end
72
+ end
@@ -0,0 +1,17 @@
1
+ * wiki
2
+ * need a matrix of which rspec-rails versions support which rails versions
3
+ * CI
4
+ * need a robust CI setup that runs
5
+ * Multiple rubies
6
+ * MRI: 1.8.6
7
+ * MRI: 1.8.7
8
+ * MRI: 1.9.1
9
+ * JRuby
10
+ * IronRuby??? (perhaps using mono)
11
+ * Multiple rails-es
12
+ * 2.0.5
13
+ * 2.1.2
14
+ * 2.2.2
15
+ * 2.3.4
16
+ * 3.0 (once available)
17
+ * With and without ActiveRecord
@@ -0,0 +1,148 @@
1
+ = Upgrade to 1.2.8 (in git)
2
+
3
+ == What's new
4
+
5
+ === route_to and be_routable matchers
6
+
7
+ Stop using route_for and params_from today! These new matchers from Randy
8
+ Harmon are more expressive and more reliable. Here's how you use them:
9
+
10
+ { :put => "/projects/37" }.should route_to(:controller => 'projects', :action => 'update', :id => '37')
11
+
12
+ { :get => "/nonexisting_route" }.should_not be_routable
13
+
14
+ == What's changed
15
+
16
+ === spec_server has been removed
17
+
18
+ spec_server was deprecated in 1.2.7 and has now been removed. Admittedly, this
19
+ was a short deprecation cycle, but spec server never quite worked right in all
20
+ situations and spork is a great solution that you can use today! This is all
21
+ you need to do:
22
+
23
+ [sudo] gem install spork
24
+ cd path/to/project
25
+ spork --bootsrap
26
+
27
+ Now open up spec/spec_helper.rb and follow the directions at the top. You'll
28
+ be up and running in no time.
29
+
30
+ For more info:
31
+
32
+ * http://github.com/timcharper/spork
33
+ * http://groups.google.com/group/sporkgem
34
+
35
+ = Upgrade to 1.2.7
36
+
37
+ == What's changed
38
+
39
+ === spec_server is deprecated
40
+
41
+ spec_server is deprecated in favor of Tim Harper's new spork library
42
+ (http://github.com/timcharper/spork). Get it. Use it. Love it.
43
+
44
+ gem install spork
45
+
46
+ = Upgrade to 1.2.0-1.2.6
47
+
48
+ == What's changed
49
+
50
+ === Supported Rails Versions
51
+
52
+ This release supports the following versions of rails:
53
+
54
+ * 2.0.5
55
+ * 2.1.2
56
+ * 2.2.2
57
+ * 2.3.2
58
+
59
+ === update generated files
60
+
61
+ Be sure to run "script/generate rspec" and allow the following files to be overwritten:
62
+
63
+ * lib/tasks/rspec.rake
64
+ * script/spec
65
+ * script/spec_server
66
+
67
+ === controller.use_rails_error_handling! is deprecated
68
+
69
+ Use <tt>rescue_action_in_public!</tt> instead. It comes directly from rails and does
70
+ exactly the same thing
71
+
72
+ === route_for
73
+
74
+ After a change to edge rails broke our monkey-patched <tt>route_for</tt> method, I
75
+ decided to just delegate to rails' <tt>assert_generates</tt> method. For most cases,
76
+ this will not present a problem, but for some it might. You'll know if you
77
+ upgrade and see any newly failing, route-related examples. Here are the things
78
+ that you might need to change.
79
+
80
+ ==== Make sure IDs are strings
81
+
82
+ If you had :id => 1 before, you need to change that to :id => "1"
83
+
84
+ #old
85
+ route_for(:controller => 'things', :action => 'show', :id => 1).should == "/things/1"
86
+
87
+ #new
88
+ route_for(:controller => 'things', :action => 'show', :id => "1").should == "/things/1"
89
+
90
+ ==== Convert paths for non-get methods to hashes
91
+
92
+ If you had an example with a route that requires post, put, or delete, you'll
93
+ need to declare that explicitly.
94
+
95
+ #old
96
+ route_for(:controller => 'things', :action => 'create').should == "/things"
97
+
98
+ #new
99
+ route_for(:controller => 'things', :action => 'create').should == {:path => "/things", :method => :post}
100
+
101
+ === Controller/template isolation
102
+
103
+ Even though controller specs do not render views by default (use
104
+ <tt>integrate_views</tt> to get them to render views), the way this works has
105
+ changed in this version.
106
+
107
+ It used to be that the view template need not even exist, but due to changes
108
+ in rails it became much more difficult to manage that for all the different
109
+ versions of rails that rspec-rails supports. So now the template must exist,
110
+ but it still won't be rendered unless you declare <tt>integrate_views</tt>.
111
+
112
+ == What's new
113
+
114
+ === render no longer requires a path
115
+
116
+ The <tt>render()</tt> method in view specs will infer the path from the
117
+ first argument passed to <tt>describe()</tt>.
118
+
119
+ describe "players/show" do
120
+ it "does something" do
121
+ render
122
+ response.should have_tag("....")
123
+ end
124
+ end
125
+
126
+ === routing specs live in spec/routing
127
+
128
+ <tt>script/generate rspec_scaffold</tt> now generates its routing spec in
129
+ <tt>spec/routing/</tt>.
130
+
131
+ === bypass_rescue
132
+
133
+ Added a new <tt>bypass_rescue()</tt> declaration for controller specs. Use this
134
+ when you want to specify that an error is raised by an action, even if that
135
+ error is later captured by a <tt>rescue_from()</tt> declaration.
136
+
137
+ describe AccountController do
138
+ describe "GET @account" do
139
+ context "requested by anonymous user" do
140
+ it "denies access" do
141
+ bypass_rescue
142
+ lambda do
143
+ get :show, :id => "37"
144
+ end.should raise_error(AccessDenied)
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../rspec_default_values'
2
+
3
+ class IntegrationSpecGenerator < ModelGenerator
4
+ def manifest
5
+ record do |m|
6
+ m.class_collisions class_path, class_name
7
+ m.template 'integration_spec.rb', File.join('spec/integration', class_path, "#{class_name.tableize}_spec.rb")
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe "<%= class_name.pluralize %>" do
4
+ end
@@ -0,0 +1 @@
1
+ Please refer to the CHANGES file for RSpec's core
@@ -0,0 +1,53 @@
1
+ require 'rbconfig'
2
+
3
+ # This generator bootstraps a Rails project for use with RSpec
4
+ class RspecGenerator < Rails::Generator::Base
5
+ DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
6
+ Config::CONFIG['ruby_install_name'])
7
+
8
+ def initialize(runtime_args, runtime_options = {})
9
+ if test ?f, 'spec/spec_helper.rb'
10
+
11
+ puts <<-HELPFUL_INSTRUCTIONS
12
+
13
+ It looks like you are upgrading rspec-rails in this application. Please let
14
+ this script overwrite everything it wants to with the following exceptions,
15
+ *if* you have customized any of these files:
16
+
17
+ * spec/spec.opts
18
+ * spec/rcov.opts
19
+ * spec/spec_helper.rb
20
+
21
+ If you have customized spec/spec_helper.rb, please set aside a copy of that
22
+ file so that it can be updated and you can manually restore your changes.
23
+
24
+ HELPFUL_INSTRUCTIONS
25
+ end
26
+ Dir.mkdir('lib/tasks') unless File.directory?('lib/tasks')
27
+ super
28
+ end
29
+
30
+ def manifest
31
+ record do |m|
32
+ script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
33
+
34
+ m.directory 'lib/tasks'
35
+ m.file 'rspec.rake', 'lib/tasks/rspec.rake'
36
+
37
+ m.file 'script/autospec', 'script/autospec', script_options
38
+ m.file 'script/spec', 'script/spec', script_options
39
+
40
+ m.directory 'spec'
41
+ m.file 'rcov.opts', 'spec/rcov.opts'
42
+ m.file 'spec.opts', 'spec/spec.opts'
43
+ m.template 'spec_helper.rb', 'spec/spec_helper.rb'
44
+ end
45
+ end
46
+
47
+ protected
48
+
49
+ def banner
50
+ "Usage: #{$0} rspec"
51
+ end
52
+
53
+ end
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
@@ -0,0 +1,144 @@
1
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
2
+ rspec_gem_dir = nil
3
+ Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
4
+ rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
5
+ end
6
+ rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
7
+
8
+ if rspec_gem_dir && (test ?d, rspec_plugin_dir)
9
+ raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
10
+ end
11
+
12
+ if rspec_gem_dir
13
+ $LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
14
+ elsif File.exist?(rspec_plugin_dir)
15
+ $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
16
+ end
17
+
18
+ # Don't load rspec if running "rake gems:*"
19
+ unless ARGV.any? {|a| a =~ /^gems/}
20
+
21
+ begin
22
+ require 'spec/rake/spectask'
23
+ rescue MissingSourceFile
24
+ module Spec
25
+ module Rake
26
+ class SpecTask
27
+ def initialize(name)
28
+ task name do
29
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
30
+ require File.expand_path(File.join(File.dirname(__FILE__),"..","..","config","environment"))
31
+
32
+ # ... otherwise, do this:
33
+ raise <<-MSG
34
+
35
+ #{"*" * 80}
36
+ * You are trying to run an rspec rake task defined in
37
+ * #{__FILE__},
38
+ * but rspec can not be found in vendor/gems, vendor/plugins or system gems.
39
+ #{"*" * 80}
40
+ MSG
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ Rake.application.instance_variable_get('@tasks').delete('default')
49
+
50
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
51
+ task :noop do
52
+ end
53
+
54
+ task :default => :spec
55
+ task :stats => "spec:statsetup"
56
+
57
+ desc "Run all specs in spec directory (excluding plugin specs)"
58
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
59
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
60
+ t.spec_files = FileList['spec/**/*_spec.rb']
61
+ end
62
+
63
+ namespace :spec do
64
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
65
+ Spec::Rake::SpecTask.new(:rcov) do |t|
66
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
67
+ t.spec_files = FileList['spec/**/*_spec.rb']
68
+ t.rcov = true
69
+ t.rcov_opts = lambda do
70
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
71
+ end
72
+ end
73
+
74
+ desc "Print Specdoc for all specs (excluding plugin specs)"
75
+ Spec::Rake::SpecTask.new(:doc) do |t|
76
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
77
+ t.spec_files = FileList['spec/**/*_spec.rb']
78
+ end
79
+
80
+ desc "Print Specdoc for all plugin examples"
81
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
82
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
83
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
84
+ end
85
+
86
+ [:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
87
+ desc "Run the code examples in spec/#{sub}"
88
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
89
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
90
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
91
+ end
92
+ end
93
+
94
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
95
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
96
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
97
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
98
+ end
99
+
100
+ namespace :plugins do
101
+ desc "Runs the examples for rspec_on_rails"
102
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
103
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
104
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
105
+ end
106
+ end
107
+
108
+ # Setup specs for stats
109
+ task :statsetup do
110
+ require 'code_statistics'
111
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
112
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
113
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
114
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
115
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
116
+ ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
117
+ ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
118
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
119
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
120
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
121
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
122
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
123
+ ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
124
+ ::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration')
125
+ end
126
+
127
+ namespace :db do
128
+ namespace :fixtures do
129
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
130
+ task :load => :environment do
131
+ ActiveRecord::Base.establish_connection(Rails.env)
132
+ base_dir = File.join(Rails.root, 'spec', 'fixtures')
133
+ fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
134
+
135
+ require 'active_record/fixtures'
136
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
137
+ Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ end