rspec-rails 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. data/History.txt +57 -0
  2. data/Manifest.txt +158 -0
  3. data/README.txt +81 -0
  4. data/Rakefile +39 -0
  5. data/UPGRADE +7 -0
  6. data/generators/rspec/CHANGES +1 -0
  7. data/generators/rspec/rspec_generator.rb +40 -0
  8. data/generators/rspec/templates/all_stories.rb +4 -0
  9. data/generators/rspec/templates/previous_failures.txt +0 -0
  10. data/generators/rspec/templates/rcov.opts +2 -0
  11. data/generators/rspec/templates/rspec.rake +132 -0
  12. data/generators/rspec/templates/script/autospec +3 -0
  13. data/generators/rspec/templates/script/spec +4 -0
  14. data/generators/rspec/templates/script/spec_server +116 -0
  15. data/generators/rspec/templates/spec.opts +4 -0
  16. data/generators/rspec/templates/spec_helper.rb +47 -0
  17. data/generators/rspec/templates/stories_helper.rb +3 -0
  18. data/generators/rspec_controller/USAGE +33 -0
  19. data/generators/rspec_controller/rspec_controller_generator.rb +49 -0
  20. data/generators/rspec_controller/templates/controller_spec.rb +25 -0
  21. data/generators/rspec_controller/templates/helper_spec.rb +11 -0
  22. data/generators/rspec_controller/templates/view_spec.rb +12 -0
  23. data/generators/rspec_default_values.rb +19 -0
  24. data/generators/rspec_model/USAGE +18 -0
  25. data/generators/rspec_model/rspec_model_generator.rb +35 -0
  26. data/generators/rspec_model/templates/model_spec.rb +15 -0
  27. data/generators/rspec_scaffold/rspec_scaffold_generator.rb +154 -0
  28. data/generators/rspec_scaffold/templates/controller_spec.rb +173 -0
  29. data/generators/rspec_scaffold/templates/edit_erb_spec.rb +26 -0
  30. data/generators/rspec_scaffold/templates/helper_spec.rb +11 -0
  31. data/generators/rspec_scaffold/templates/index_erb_spec.rb +27 -0
  32. data/generators/rspec_scaffold/templates/new_erb_spec.rb +26 -0
  33. data/generators/rspec_scaffold/templates/routing_spec.rb +59 -0
  34. data/generators/rspec_scaffold/templates/show_erb_spec.rb +23 -0
  35. data/init.rb +9 -0
  36. data/lib/autotest/discover.rb +1 -0
  37. data/lib/autotest/rails_rspec.rb +76 -0
  38. data/lib/spec/rails.rb +15 -0
  39. data/lib/spec/rails/example.rb +47 -0
  40. data/lib/spec/rails/example/assigns_hash_proxy.rb +43 -0
  41. data/lib/spec/rails/example/controller_example_group.rb +256 -0
  42. data/lib/spec/rails/example/cookies_proxy.rb +25 -0
  43. data/lib/spec/rails/example/functional_example_group.rb +87 -0
  44. data/lib/spec/rails/example/helper_example_group.rb +166 -0
  45. data/lib/spec/rails/example/model_example_group.rb +14 -0
  46. data/lib/spec/rails/example/rails_example_group.rb +33 -0
  47. data/lib/spec/rails/example/render_observer.rb +93 -0
  48. data/lib/spec/rails/example/view_example_group.rb +183 -0
  49. data/lib/spec/rails/extensions.rb +12 -0
  50. data/lib/spec/rails/extensions/action_controller/base.rb +14 -0
  51. data/lib/spec/rails/extensions/action_controller/rescue.rb +21 -0
  52. data/lib/spec/rails/extensions/action_controller/test_response.rb +11 -0
  53. data/lib/spec/rails/extensions/action_view/base.rb +31 -0
  54. data/lib/spec/rails/extensions/active_record/base.rb +30 -0
  55. data/lib/spec/rails/extensions/object.rb +5 -0
  56. data/lib/spec/rails/extensions/spec/example/configuration.rb +71 -0
  57. data/lib/spec/rails/extensions/spec/matchers/have.rb +21 -0
  58. data/lib/spec/rails/interop/testcase.rb +14 -0
  59. data/lib/spec/rails/matchers.rb +31 -0
  60. data/lib/spec/rails/matchers/assert_select.rb +131 -0
  61. data/lib/spec/rails/matchers/change.rb +11 -0
  62. data/lib/spec/rails/matchers/have_text.rb +57 -0
  63. data/lib/spec/rails/matchers/include_text.rb +54 -0
  64. data/lib/spec/rails/matchers/redirect_to.rb +113 -0
  65. data/lib/spec/rails/matchers/render_template.rb +90 -0
  66. data/lib/spec/rails/mocks.rb +132 -0
  67. data/lib/spec/rails/story_adapter.rb +79 -0
  68. data/lib/spec/rails/version.rb +15 -0
  69. data/spec/rails/autotest/mappings_spec.rb +36 -0
  70. data/spec/rails/example/assigns_hash_proxy_spec.rb +65 -0
  71. data/spec/rails/example/configuration_spec.rb +83 -0
  72. data/spec/rails/example/controller_isolation_spec.rb +62 -0
  73. data/spec/rails/example/controller_spec_spec.rb +272 -0
  74. data/spec/rails/example/cookies_proxy_spec.rb +74 -0
  75. data/spec/rails/example/example_group_factory_spec.rb +112 -0
  76. data/spec/rails/example/helper_spec_spec.rb +161 -0
  77. data/spec/rails/example/model_spec_spec.rb +18 -0
  78. data/spec/rails/example/shared_behaviour_spec.rb +16 -0
  79. data/spec/rails/example/test_unit_assertion_accessibility_spec.rb +33 -0
  80. data/spec/rails/example/view_spec_spec.rb +280 -0
  81. data/spec/rails/extensions/action_controller_rescue_action_spec.rb +54 -0
  82. data/spec/rails/extensions/action_view_base_spec.rb +48 -0
  83. data/spec/rails/extensions/active_record_spec.rb +14 -0
  84. data/spec/rails/interop/testcase_spec.rb +66 -0
  85. data/spec/rails/matchers/assert_select_spec.rb +814 -0
  86. data/spec/rails/matchers/description_generation_spec.rb +37 -0
  87. data/spec/rails/matchers/errors_on_spec.rb +13 -0
  88. data/spec/rails/matchers/have_text_spec.rb +62 -0
  89. data/spec/rails/matchers/include_text_spec.rb +64 -0
  90. data/spec/rails/matchers/redirect_to_spec.rb +209 -0
  91. data/spec/rails/matchers/render_template_spec.rb +176 -0
  92. data/spec/rails/matchers/should_change_spec.rb +15 -0
  93. data/spec/rails/mocks/ar_classes.rb +10 -0
  94. data/spec/rails/mocks/mock_model_spec.rb +106 -0
  95. data/spec/rails/mocks/stub_model_spec.rb +80 -0
  96. data/spec/rails/sample_modified_fixture.rb +8 -0
  97. data/spec/rails/sample_spec.rb +8 -0
  98. data/spec/rails/spec_server_spec.rb +96 -0
  99. data/spec/rails/spec_spec.rb +11 -0
  100. data/spec/rails_suite.rb +7 -0
  101. data/spec/spec_helper.rb +57 -0
  102. data/spec_resources/controllers/action_view_base_spec_controller.rb +2 -0
  103. data/spec_resources/controllers/controller_spec_controller.rb +94 -0
  104. data/spec_resources/controllers/redirect_spec_controller.rb +59 -0
  105. data/spec_resources/controllers/render_spec_controller.rb +30 -0
  106. data/spec_resources/controllers/rjs_spec_controller.rb +58 -0
  107. data/spec_resources/helpers/explicit_helper.rb +38 -0
  108. data/spec_resources/helpers/more_explicit_helper.rb +5 -0
  109. data/spec_resources/helpers/plugin_application_helper.rb +6 -0
  110. data/spec_resources/helpers/view_spec_helper.rb +13 -0
  111. data/spec_resources/views/controller_spec/_partial.rhtml +0 -0
  112. data/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml +1 -0
  113. data/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml +1 -0
  114. data/spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml +0 -0
  115. data/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml +1 -0
  116. data/spec_resources/views/controller_spec/action_with_template.rhtml +1 -0
  117. data/spec_resources/views/layouts/application.rhtml +0 -0
  118. data/spec_resources/views/layouts/simple.rhtml +0 -0
  119. data/spec_resources/views/objects/_object.html.erb +1 -0
  120. data/spec_resources/views/render_spec/_a_partial.rhtml +0 -0
  121. data/spec_resources/views/render_spec/action_with_alternate_layout.rhtml +0 -0
  122. data/spec_resources/views/render_spec/some_action.js.rjs +1 -0
  123. data/spec_resources/views/render_spec/some_action.rhtml +0 -0
  124. data/spec_resources/views/render_spec/some_action.rjs +1 -0
  125. data/spec_resources/views/rjs_spec/_replacement_partial.rhtml +1 -0
  126. data/spec_resources/views/rjs_spec/hide_div.rjs +1 -0
  127. data/spec_resources/views/rjs_spec/hide_page_element.rjs +1 -0
  128. data/spec_resources/views/rjs_spec/insert_html.rjs +1 -0
  129. data/spec_resources/views/rjs_spec/replace.rjs +1 -0
  130. data/spec_resources/views/rjs_spec/replace_html.rjs +1 -0
  131. data/spec_resources/views/rjs_spec/replace_html_with_partial.rjs +1 -0
  132. data/spec_resources/views/rjs_spec/visual_effect.rjs +1 -0
  133. data/spec_resources/views/rjs_spec/visual_toggle_effect.rjs +1 -0
  134. data/spec_resources/views/tag_spec/no_tags.rhtml +1 -0
  135. data/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml +1 -0
  136. data/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml +1 -0
  137. data/spec_resources/views/view_spec/_partial.rhtml +2 -0
  138. data/spec_resources/views/view_spec/_partial_used_twice.rhtml +0 -0
  139. data/spec_resources/views/view_spec/_partial_with_local_variable.rhtml +1 -0
  140. data/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml +1 -0
  141. data/spec_resources/views/view_spec/_spacer.rhtml +1 -0
  142. data/spec_resources/views/view_spec/accessor.rhtml +5 -0
  143. data/spec_resources/views/view_spec/block_helper.rhtml +3 -0
  144. data/spec_resources/views/view_spec/entry_form.rhtml +2 -0
  145. data/spec_resources/views/view_spec/explicit_helper.rhtml +2 -0
  146. data/spec_resources/views/view_spec/foo/show.rhtml +1 -0
  147. data/spec_resources/views/view_spec/implicit_helper.rhtml +2 -0
  148. data/spec_resources/views/view_spec/multiple_helpers.rhtml +3 -0
  149. data/spec_resources/views/view_spec/should_not_receive.rhtml +3 -0
  150. data/spec_resources/views/view_spec/template_with_partial.rhtml +5 -0
  151. data/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml +3 -0
  152. data/spec_resources/views/view_spec/template_with_partial_with_array.rhtml +1 -0
  153. data/stories/all.rb +10 -0
  154. data/stories/configuration/stories.rb +5 -0
  155. data/stories/helper.rb +6 -0
  156. data/stories/steps/people.rb +8 -0
  157. data/stories/transactions_should_rollback +15 -0
  158. data/stories/transactions_should_rollback.rb +25 -0
  159. metadata +234 -0
@@ -0,0 +1,57 @@
1
+ === Version 1.1.5
2
+
3
+ IMPORTANT: use 'script/autospec' (or just 'autospec' if you have the rspec gem
4
+ installed) instead of 'autotest'. We changed the way autotest discovers rspec
5
+ so the autotest executable won't automatically load rspec anymore. This allows
6
+ rspec to live side by side other spec frameworks without always co-opting
7
+ autotest through autotest's discovery mechanism.
8
+
9
+ ALSO IMPORTANT: Rails v2.1.1 changed assert_select_rjs such that it doesn't
10
+ always fail when it should. Please see
11
+ http://rails.lighthouseapp.com/projects/8994/tickets/982.
12
+
13
+ * Generated route specs have shorter names, making it less painful to modify their implementation
14
+ * Add conditional so Rails 2.1.0 doesn't warn about cache_template_extensions (patch from James Herdman)
15
+ * Fixed stub_model examples to work with Rails 2.1.0 (the code was fine, just the examples needed patching)
16
+ * use hoe for build/release
17
+ * reworked generated examples for rspec_scaffold - thanks to Mikel Lindsaar and Dan Manges for their feedback
18
+ * bye, bye translator
19
+ * Added proxy to cookies so you can set them in examples the same way you set them in controllers
20
+ * Added script/autospec so you can run autospec without installing the gem
21
+ * Support --skip-fixture in the rspec_model generator (patches from Alex Tomlins and Niels Ganser)
22
+ * Add mock_model#as_new_record (patch from Zach Dennis)
23
+ * mock(:null_object=>true) plays nice with HTML (patch from Gerrit Kaiser)
24
+ * Suppress a deprecation notice in Rails 2.1 (James Herdman)
25
+ * quiet deprecation warning on inflector (RSL)
26
+ * rspec-rails gem (Ben Mabey)
27
+ * updated generated code examples
28
+ * Make rspec_model generator honour --skip-fixtures tag (Niels Ganser, Alex Tomlins)
29
+ * Fix to create new models with attributes in command line (Nicolas)
30
+ * fix to_param in mock_model with stubbed id incorrectly returning autogenerated id (Adam Meehan)
31
+ * Call Rail's TestCase setup/teardown callbacks (Jonathan del Strother)
32
+ * Only run TestUnitTesting once (Jonathan del Strother)
33
+ * use require_dependency instead of require (Brandon Keepers)
34
+ * Fixed a problem caused by controller action names getting out of sync between rspec-dev and rspec-rails for speccing (Matt Patterson)
35
+ * don't mutate hash passed to mock_model (Reg Vos)
36
+
37
+ === Version 1.1.4
38
+
39
+ Maintenance release.
40
+
41
+ * Moved mock_model and stub_model to their own module: Spec::Rails::Mocks
42
+ * Setting mock_model object id with stubs hash - patch from Adam Meehan
43
+ * Added as_new_record to stub_model e.g. stub_model(Foo).as_new_record
44
+ * Improved stub_model such that new_record? does "the right thing"
45
+ * Patch from Pat Maddox to get integrate_views to work in nested example groups.
46
+ * Patch from Pat Maddox to get controller_name to work in nested example groups.
47
+ * Patch from Corey Haines to add include_text matcher
48
+ * Added stub_model method which creates a real model instance with :id stubbed and data access prohibited.
49
+ * Applied patch from Pat Maddox to handle redirect_to w/ SSL. Closes #320.
50
+ * Added #helper and #assigns to helper specs.
51
+ * Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162.
52
+ * Tweaked list of exceptions (ignores) for autotest
53
+ * Applied patch from Rick Olson to get rspec_on_rails working with rails edge (>= 8862)
54
+ * Applied patch from Wincent Colaiuta to invert sense of "spec --diff". Closes #281.
55
+ * Allow any type of render in view specs. Closes #57.
56
+ * Applied patch from Ian White to get rspec working with edge rails (8804). Closes #271.
57
+ * Applied patch from Jon Strother to have spec_server reload fixtures. Closes #344.
@@ -0,0 +1,158 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ UPGRADE
6
+ generators/rspec/CHANGES
7
+ generators/rspec/rspec_generator.rb
8
+ generators/rspec/templates/all_stories.rb
9
+ generators/rspec/templates/previous_failures.txt
10
+ generators/rspec/templates/rcov.opts
11
+ generators/rspec/templates/rspec.rake
12
+ generators/rspec/templates/script/autospec
13
+ generators/rspec/templates/script/spec
14
+ generators/rspec/templates/script/spec_server
15
+ generators/rspec/templates/spec.opts
16
+ generators/rspec/templates/spec_helper.rb
17
+ generators/rspec/templates/stories_helper.rb
18
+ generators/rspec_controller/USAGE
19
+ generators/rspec_controller/rspec_controller_generator.rb
20
+ generators/rspec_controller/templates/controller_spec.rb
21
+ generators/rspec_controller/templates/helper_spec.rb
22
+ generators/rspec_controller/templates/view_spec.rb
23
+ generators/rspec_default_values.rb
24
+ generators/rspec_model/USAGE
25
+ generators/rspec_model/rspec_model_generator.rb
26
+ generators/rspec_model/templates/model_spec.rb
27
+ generators/rspec_scaffold/rspec_scaffold_generator.rb
28
+ generators/rspec_scaffold/templates/controller_spec.rb
29
+ generators/rspec_scaffold/templates/edit_erb_spec.rb
30
+ generators/rspec_scaffold/templates/helper_spec.rb
31
+ generators/rspec_scaffold/templates/index_erb_spec.rb
32
+ generators/rspec_scaffold/templates/new_erb_spec.rb
33
+ generators/rspec_scaffold/templates/routing_spec.rb
34
+ generators/rspec_scaffold/templates/show_erb_spec.rb
35
+ init.rb
36
+ lib/autotest/discover.rb
37
+ lib/autotest/rails_rspec.rb
38
+ lib/spec/rails.rb
39
+ lib/spec/rails/example.rb
40
+ lib/spec/rails/example/assigns_hash_proxy.rb
41
+ lib/spec/rails/example/controller_example_group.rb
42
+ lib/spec/rails/example/cookies_proxy.rb
43
+ lib/spec/rails/example/functional_example_group.rb
44
+ lib/spec/rails/example/helper_example_group.rb
45
+ lib/spec/rails/example/model_example_group.rb
46
+ lib/spec/rails/example/rails_example_group.rb
47
+ lib/spec/rails/example/render_observer.rb
48
+ lib/spec/rails/example/view_example_group.rb
49
+ lib/spec/rails/extensions.rb
50
+ lib/spec/rails/extensions/action_controller/base.rb
51
+ lib/spec/rails/extensions/action_controller/rescue.rb
52
+ lib/spec/rails/extensions/action_controller/test_response.rb
53
+ lib/spec/rails/extensions/action_view/base.rb
54
+ lib/spec/rails/extensions/active_record/base.rb
55
+ lib/spec/rails/extensions/object.rb
56
+ lib/spec/rails/extensions/spec/example/configuration.rb
57
+ lib/spec/rails/extensions/spec/matchers/have.rb
58
+ lib/spec/rails/interop/testcase.rb
59
+ lib/spec/rails/matchers.rb
60
+ lib/spec/rails/matchers/assert_select.rb
61
+ lib/spec/rails/matchers/change.rb
62
+ lib/spec/rails/matchers/have_text.rb
63
+ lib/spec/rails/matchers/include_text.rb
64
+ lib/spec/rails/matchers/redirect_to.rb
65
+ lib/spec/rails/matchers/render_template.rb
66
+ lib/spec/rails/mocks.rb
67
+ lib/spec/rails/story_adapter.rb
68
+ lib/spec/rails/version.rb
69
+ spec/rails/autotest/mappings_spec.rb
70
+ spec/rails/example/assigns_hash_proxy_spec.rb
71
+ spec/rails/example/configuration_spec.rb
72
+ spec/rails/example/controller_isolation_spec.rb
73
+ spec/rails/example/controller_spec_spec.rb
74
+ spec/rails/example/cookies_proxy_spec.rb
75
+ spec/rails/example/example_group_factory_spec.rb
76
+ spec/rails/example/helper_spec_spec.rb
77
+ spec/rails/example/model_spec_spec.rb
78
+ spec/rails/example/shared_behaviour_spec.rb
79
+ spec/rails/example/test_unit_assertion_accessibility_spec.rb
80
+ spec/rails/example/view_spec_spec.rb
81
+ spec/rails/extensions/action_controller_rescue_action_spec.rb
82
+ spec/rails/extensions/action_view_base_spec.rb
83
+ spec/rails/extensions/active_record_spec.rb
84
+ spec/rails/interop/testcase_spec.rb
85
+ spec/rails/matchers/assert_select_spec.rb
86
+ spec/rails/matchers/description_generation_spec.rb
87
+ spec/rails/matchers/errors_on_spec.rb
88
+ spec/rails/matchers/have_text_spec.rb
89
+ spec/rails/matchers/include_text_spec.rb
90
+ spec/rails/matchers/redirect_to_spec.rb
91
+ spec/rails/matchers/render_template_spec.rb
92
+ spec/rails/matchers/should_change_spec.rb
93
+ spec/rails/mocks/ar_classes.rb
94
+ spec/rails/mocks/mock_model_spec.rb
95
+ spec/rails/mocks/stub_model_spec.rb
96
+ spec/rails/sample_modified_fixture.rb
97
+ spec/rails/sample_spec.rb
98
+ spec/rails/spec_server_spec.rb
99
+ spec/rails/spec_spec.rb
100
+ spec/rails_suite.rb
101
+ spec/spec_helper.rb
102
+ spec_resources/controllers/action_view_base_spec_controller.rb
103
+ spec_resources/controllers/controller_spec_controller.rb
104
+ spec_resources/controllers/redirect_spec_controller.rb
105
+ spec_resources/controllers/render_spec_controller.rb
106
+ spec_resources/controllers/rjs_spec_controller.rb
107
+ spec_resources/helpers/explicit_helper.rb
108
+ spec_resources/helpers/more_explicit_helper.rb
109
+ spec_resources/helpers/plugin_application_helper.rb
110
+ spec_resources/helpers/view_spec_helper.rb
111
+ spec_resources/views/controller_spec/_partial.rhtml
112
+ spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml
113
+ spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml
114
+ spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml
115
+ spec_resources/views/controller_spec/action_with_errors_in_template.rhtml
116
+ spec_resources/views/controller_spec/action_with_template.rhtml
117
+ spec_resources/views/layouts/application.rhtml
118
+ spec_resources/views/layouts/simple.rhtml
119
+ spec_resources/views/objects/_object.html.erb
120
+ spec_resources/views/render_spec/_a_partial.rhtml
121
+ spec_resources/views/render_spec/action_with_alternate_layout.rhtml
122
+ spec_resources/views/render_spec/some_action.js.rjs
123
+ spec_resources/views/render_spec/some_action.rhtml
124
+ spec_resources/views/render_spec/some_action.rjs
125
+ spec_resources/views/rjs_spec/_replacement_partial.rhtml
126
+ spec_resources/views/rjs_spec/hide_div.rjs
127
+ spec_resources/views/rjs_spec/hide_page_element.rjs
128
+ spec_resources/views/rjs_spec/insert_html.rjs
129
+ spec_resources/views/rjs_spec/replace.rjs
130
+ spec_resources/views/rjs_spec/replace_html.rjs
131
+ spec_resources/views/rjs_spec/replace_html_with_partial.rjs
132
+ spec_resources/views/rjs_spec/visual_effect.rjs
133
+ spec_resources/views/rjs_spec/visual_toggle_effect.rjs
134
+ spec_resources/views/tag_spec/no_tags.rhtml
135
+ spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml
136
+ spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml
137
+ spec_resources/views/view_spec/_partial.rhtml
138
+ spec_resources/views/view_spec/_partial_used_twice.rhtml
139
+ spec_resources/views/view_spec/_partial_with_local_variable.rhtml
140
+ spec_resources/views/view_spec/_partial_with_sub_partial.rhtml
141
+ spec_resources/views/view_spec/_spacer.rhtml
142
+ spec_resources/views/view_spec/accessor.rhtml
143
+ spec_resources/views/view_spec/block_helper.rhtml
144
+ spec_resources/views/view_spec/entry_form.rhtml
145
+ spec_resources/views/view_spec/explicit_helper.rhtml
146
+ spec_resources/views/view_spec/foo/show.rhtml
147
+ spec_resources/views/view_spec/implicit_helper.rhtml
148
+ spec_resources/views/view_spec/multiple_helpers.rhtml
149
+ spec_resources/views/view_spec/should_not_receive.rhtml
150
+ spec_resources/views/view_spec/template_with_partial.rhtml
151
+ spec_resources/views/view_spec/template_with_partial_using_collection.rhtml
152
+ spec_resources/views/view_spec/template_with_partial_with_array.rhtml
153
+ stories/all.rb
154
+ stories/configuration/stories.rb
155
+ stories/helper.rb
156
+ stories/steps/people.rb
157
+ stories/transactions_should_rollback
158
+ stories/transactions_should_rollback.rb
@@ -0,0 +1,81 @@
1
+ = Spec::Rails
2
+
3
+ * http://rspec.info
4
+ * http://rspec.info/rdoc-rails/
5
+ * http://github.com/dchelimsky/rspec-rails/wikis
6
+ * mailto:rspec-devel@rubyforge.org
7
+
8
+ == DESCRIPTION:
9
+
10
+ Behaviour Driven Development for Ruby on Rails.
11
+
12
+ Spec::Rails (a.k.a. RSpec on Rails) is a Ruby on Rails plugin that allows you
13
+ to drive the development of your RoR application using RSpec, a framework that
14
+ aims to enable Example Driven Development in Ruby.
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 Specs instead of Tests.
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::Runner for information about the different kinds of example
38
+ groups you can use to spec the different Rails components
39
+
40
+ See Spec::Rails::Expectations for information about Rails-specific
41
+ expectations you can set on responses and models, etc.
42
+
43
+ == INSTALL
44
+
45
+ * Visit http://github.com/dchelimsky/rspec-rails/wikis for installation instructions.
46
+
47
+ == LICENSE
48
+
49
+ (The MIT License)
50
+
51
+ ====================================================================
52
+ ==== RSpec, RSpec-Rails
53
+ Copyright (c) 2005-2008 The RSpec Development Team
54
+ ====================================================================
55
+ ==== ARTS
56
+ Copyright (c) 2006 Kevin Clark, Jake Howerton
57
+ ====================================================================
58
+ ==== ZenTest
59
+ Copyright (c) 2001-2006 Ryan Davis, Eric Hodel, Zen Spider Software
60
+ ====================================================================
61
+ ==== AssertSelect
62
+ Copyright (c) 2006 Assaf Arkin
63
+ ====================================================================
64
+
65
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
66
+ this software and associated documentation files (the "Software"), to deal in
67
+ the Software without restriction, including without limitation the rights to
68
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
69
+ of the Software, and to permit persons to whom the Software is furnished to do
70
+ so, subject to the following conditions:
71
+
72
+ The above copyright notice and this permission notice shall be included in all
73
+ copies or substantial portions of the Software.
74
+
75
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
76
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
78
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
79
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
80
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
81
+ SOFTWARE.
@@ -0,0 +1,39 @@
1
+ require 'rubygems'
2
+ require 'hoe'
3
+ require './lib/spec/rails/version'
4
+
5
+ class Hoe
6
+ def extra_deps
7
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
8
+ @extra_deps
9
+ end
10
+ end
11
+
12
+ Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
13
+ p.summary = Spec::Rails::VERSION::SUMMARY
14
+ p.url = 'http://rspec.info/'
15
+ p.description = "Behaviour Driven Development for Ruby on Rails."
16
+ p.rubyforge_name = 'rspec'
17
+ p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
18
+ p.extra_deps = [["rspec","1.1.5"]]
19
+ p.spec_extras = { :to_ruby => lambda { |str| File.open("rspec-rails.gemspec", "w+"){ |f| f.puts str } } }
20
+ end
21
+
22
+ ['audit','test','test_deps','default','publish_docs','post_blog', 'release'].each do |task|
23
+ Rake.application.instance_variable_get('@tasks').delete(task)
24
+ end
25
+
26
+ task :release => [:clean, :package] do |t|
27
+ version = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
28
+ abort "Versions don't match #{version} vs #{Spec::Rails::VERSION::STRING}" unless version == Spec::Rails::VERSION::STRING
29
+ pkg = "pkg/rspec-rails-#{version}"
30
+
31
+ rubyforge = RubyForge.new.configure
32
+ puts "Logging in to rubyforge ..."
33
+ rubyforge.login
34
+
35
+ puts "Releasing rspec-rails version #{version} ..."
36
+ ["#{pkg}.gem", "#{pkg}.tgz"].each do |file|
37
+ rubyforge.add_file('rspec', 'rspec', Spec::Rails::VERSION::STRING, file)
38
+ end
39
+ end
data/UPGRADE ADDED
@@ -0,0 +1,7 @@
1
+ == Upgrade
2
+
3
+ script/generate rspec
4
+
5
+ Or modify spec_helper.rb based on the template, which can be found at:
6
+
7
+ vendor/plugins/rspec-rails/generators/rspec/templates/spec_helper.rb
@@ -0,0 +1 @@
1
+ Please refer to the CHANGES file for RSpec's core
@@ -0,0 +1,40 @@
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
+ Dir.mkdir('lib/tasks') unless File.directory?('lib/tasks')
10
+ super
11
+ end
12
+
13
+ def manifest
14
+ record do |m|
15
+ script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
16
+
17
+ m.file 'rspec.rake', 'lib/tasks/rspec.rake'
18
+
19
+ m.file 'script/autospec', 'script/autospec', script_options
20
+ m.file 'script/spec', 'script/spec', script_options
21
+ m.file 'script/spec_server', 'script/spec_server', script_options
22
+
23
+ m.directory 'spec'
24
+ m.file 'rcov.opts', 'spec/rcov.opts'
25
+ m.file 'spec.opts', 'spec/spec.opts'
26
+ m.template 'spec_helper.rb', 'spec/spec_helper.rb'
27
+
28
+ m.directory 'stories'
29
+ m.file 'all_stories.rb', 'stories/all.rb'
30
+ m.file 'stories_helper.rb', 'stories/helper.rb'
31
+ end
32
+ end
33
+
34
+ protected
35
+
36
+ def banner
37
+ "Usage: #{$0} rspec"
38
+ end
39
+
40
+ end
@@ -0,0 +1,4 @@
1
+ dir = File.dirname(__FILE__)
2
+ Dir[File.expand_path("#{dir}/**/*.rb")].uniq.each do |file|
3
+ require file
4
+ end
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
@@ -0,0 +1,132 @@
1
+ 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]))
2
+ 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]))
3
+
4
+ # In rails 1.2, plugins aren't available in the path until they're loaded.
5
+ # Check to see if the rspec plugin is installed first and require
6
+ # it if it is. If not, use the gem version.
7
+ rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec/lib')
8
+ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
9
+ require 'spec/rake/spectask'
10
+
11
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
12
+ task :noop do
13
+ end
14
+
15
+ task :default => :spec
16
+ task :stats => "spec:statsetup"
17
+
18
+ desc "Run all specs in spec directory (excluding plugin specs)"
19
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
20
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
21
+ t.spec_files = FileList['spec/**/*_spec.rb']
22
+ end
23
+
24
+ namespace :spec do
25
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
26
+ Spec::Rake::SpecTask.new(:rcov) do |t|
27
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
28
+ t.spec_files = FileList['spec/**/*_spec.rb']
29
+ t.rcov = true
30
+ t.rcov_opts = lambda do
31
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
32
+ end
33
+ end
34
+
35
+ desc "Print Specdoc for all specs (excluding plugin specs)"
36
+ Spec::Rake::SpecTask.new(:doc) do |t|
37
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
38
+ t.spec_files = FileList['spec/**/*_spec.rb']
39
+ end
40
+
41
+ desc "Print Specdoc for all plugin specs"
42
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
43
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
44
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
45
+ end
46
+
47
+ [:models, :controllers, :views, :helpers, :lib].each do |sub|
48
+ desc "Run the specs under spec/#{sub}"
49
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
50
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
51
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
52
+ end
53
+ end
54
+
55
+ desc "Run the specs under vendor/plugins (except RSpec's own)"
56
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
57
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
58
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
59
+ end
60
+
61
+ namespace :plugins do
62
+ desc "Runs the examples for rspec_on_rails"
63
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
64
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
65
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
66
+ end
67
+ end
68
+
69
+ # Setup specs for stats
70
+ task :statsetup do
71
+ require 'code_statistics'
72
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
73
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
74
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
75
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
76
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
77
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
78
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
79
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
80
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
81
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
82
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
83
+ end
84
+
85
+ namespace :db do
86
+ namespace :fixtures do
87
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
88
+ task :load => :environment do
89
+ require 'active_record/fixtures'
90
+ ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
91
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
92
+ Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
93
+ end
94
+ end
95
+ end
96
+ end
97
+
98
+ namespace :server do
99
+ daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp")
100
+
101
+ desc "start spec_server."
102
+ task :start do
103
+ if File.exist?(daemonized_server_pid)
104
+ $stderr.puts "spec_server is already running."
105
+ else
106
+ $stderr.puts "Starting up spec server."
107
+ system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
108
+ end
109
+ end
110
+
111
+ desc "stop spec_server."
112
+ task :stop do
113
+ unless File.exist?(daemonized_server_pid)
114
+ $stderr.puts "No server running."
115
+ else
116
+ $stderr.puts "Shutting down spec_server."
117
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
118
+ File.delete(daemonized_server_pid)
119
+ end
120
+ end
121
+
122
+ desc "reload spec_server."
123
+ task :restart do
124
+ unless File.exist?(daemonized_server_pid)
125
+ $stderr.puts "No server running."
126
+ else
127
+ $stderr.puts "Reloading down spec_server."
128
+ system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip)
129
+ end
130
+ end
131
+ end
132
+ end