rspec-rails 1.1.11 → 1.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. data/History.txt +29 -0
  2. data/Manifest.txt +94 -94
  3. data/README.txt +5 -7
  4. data/Rakefile +14 -2
  5. data/{spec_resources/views/controller_spec/_partial.rhtml → TODO.txt} +0 -0
  6. data/features/step_definitions/people.rb +6 -0
  7. data/features/support/env.rb +13 -0
  8. data/{stories/transactions_should_rollback → features/transactions/transactions_should_rollback.feature} +4 -3
  9. data/generators/rspec/rspec_generator.rb +0 -4
  10. data/generators/rspec/templates/rspec.rake +130 -104
  11. data/generators/rspec/templates/script/spec_server +17 -8
  12. data/generators/rspec/templates/spec_helper.rb +1 -1
  13. data/generators/rspec_default_values.rb +3 -3
  14. data/generators/rspec_scaffold/templates/edit_erb_spec.rb +7 -6
  15. data/generators/rspec_scaffold/templates/index_erb_spec.rb +9 -8
  16. data/generators/rspec_scaffold/templates/new_erb_spec.rb +7 -6
  17. data/generators/rspec_scaffold/templates/show_erb_spec.rb +9 -9
  18. data/lib/spec/rails.rb +14 -2
  19. data/lib/spec/rails/example/controller_example_group.rb +16 -23
  20. data/lib/spec/rails/example/cookies_proxy.rb +5 -1
  21. data/lib/spec/rails/example/functional_example_group.rb +17 -5
  22. data/lib/spec/rails/example/helper_example_group.rb +5 -4
  23. data/lib/spec/rails/example/rails_example_group.rb +10 -15
  24. data/lib/spec/rails/example/view_example_group.rb +5 -5
  25. data/lib/spec/rails/extensions.rb +1 -3
  26. data/lib/spec/rails/extensions/action_controller/base.rb +1 -1
  27. data/lib/spec/rails/extensions/action_controller/rescue.rb +9 -5
  28. data/lib/spec/rails/extensions/action_controller/test_response.rb +11 -2
  29. data/lib/spec/rails/extensions/action_view/base.rb +4 -2
  30. data/lib/spec/rails/extensions/active_record/base.rb +1 -2
  31. data/lib/spec/rails/extensions/spec/{example → runner}/configuration.rb +12 -7
  32. data/lib/spec/rails/matchers.rb +1 -0
  33. data/lib/spec/rails/matchers/ar_be_valid.rb +41 -0
  34. data/lib/spec/rails/matchers/redirect_to.rb +4 -2
  35. data/lib/spec/rails/matchers/render_template.rb +30 -10
  36. data/lib/spec/rails/mocks.rb +11 -8
  37. data/lib/spec/rails/version.rb +3 -2
  38. data/rspec-rails.gemspec +16 -8
  39. data/spec/{rails/autotest → autotest}/mappings_spec.rb +3 -3
  40. data/{spec_resources → spec/resources}/controllers/action_view_base_spec_controller.rb +0 -0
  41. data/spec/resources/controllers/application.rb +9 -0
  42. data/{spec_resources → spec/resources}/controllers/controller_spec_controller.rb +19 -6
  43. data/{spec_resources → spec/resources}/controllers/redirect_spec_controller.rb +7 -0
  44. data/{spec_resources → spec/resources}/controllers/render_spec_controller.rb +0 -0
  45. data/{spec_resources → spec/resources}/controllers/rjs_spec_controller.rb +0 -0
  46. data/{spec_resources → spec/resources}/helpers/addition_helper.rb +0 -0
  47. data/{spec_resources → spec/resources}/helpers/explicit_helper.rb +8 -0
  48. data/{spec_resources → spec/resources}/helpers/more_explicit_helper.rb +0 -0
  49. data/{spec_resources → spec/resources}/helpers/plugin_application_helper.rb +0 -0
  50. data/{spec_resources → spec/resources}/helpers/view_spec_helper.rb +0 -0
  51. data/spec/resources/models/animal.rb +4 -0
  52. data/spec/resources/models/person.rb +18 -0
  53. data/spec/resources/models/thing.rb +3 -0
  54. data/{spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml → spec/resources/views/controller_spec/_partial.rhtml} +0 -0
  55. data/{spec_resources → spec/resources}/views/controller_spec/action_setting_flash_after_session_reset.rhtml +0 -0
  56. data/{spec_resources → spec/resources}/views/controller_spec/action_setting_flash_before_session_reset.rhtml +0 -0
  57. data/{spec_resources/views/layouts/application.rhtml → spec/resources/views/controller_spec/action_setting_the_assigns_hash.rhtml} +0 -0
  58. data/{spec_resources → spec/resources}/views/controller_spec/action_with_errors_in_template.rhtml +0 -0
  59. data/{spec_resources → spec/resources}/views/controller_spec/action_with_template.rhtml +0 -0
  60. data/{spec_resources/views/layouts/simple.rhtml → spec/resources/views/layouts/application.rhtml} +0 -0
  61. data/{spec_resources/views/render_spec/_a_partial.rhtml → spec/resources/views/layouts/simple.rhtml} +0 -0
  62. data/{spec_resources → spec/resources}/views/objects/_object.html.erb +0 -0
  63. data/{spec_resources/views/render_spec/action_with_alternate_layout.rhtml → spec/resources/views/render_spec/_a_partial.rhtml} +0 -0
  64. data/{spec_resources/views/render_spec/some_action.rhtml → spec/resources/views/render_spec/action_with_alternate_layout.rhtml} +0 -0
  65. data/{spec_resources/views/view_spec/_partial_used_twice.rhtml → spec/resources/views/render_spec/some_action.html.erb} +0 -0
  66. data/{spec_resources → spec/resources}/views/render_spec/some_action.js.rjs +0 -0
  67. data/{spec_resources → spec/resources}/views/render_spec/some_action.rjs +0 -0
  68. data/{spec_resources → spec/resources}/views/rjs_spec/_replacement_partial.rhtml +0 -0
  69. data/{spec_resources → spec/resources}/views/rjs_spec/hide_div.rjs +0 -0
  70. data/{spec_resources → spec/resources}/views/rjs_spec/hide_page_element.rjs +0 -0
  71. data/{spec_resources → spec/resources}/views/rjs_spec/insert_html.rjs +0 -0
  72. data/{spec_resources → spec/resources}/views/rjs_spec/replace.rjs +0 -0
  73. data/{spec_resources → spec/resources}/views/rjs_spec/replace_html.rjs +0 -0
  74. data/{spec_resources → spec/resources}/views/rjs_spec/replace_html_with_partial.rjs +0 -0
  75. data/{spec_resources → spec/resources}/views/rjs_spec/visual_effect.rjs +0 -0
  76. data/{spec_resources → spec/resources}/views/rjs_spec/visual_toggle_effect.rjs +0 -0
  77. data/{spec_resources → spec/resources}/views/tag_spec/no_tags.rhtml +0 -0
  78. data/{spec_resources → spec/resources}/views/tag_spec/single_div_with_no_attributes.rhtml +0 -0
  79. data/{spec_resources → spec/resources}/views/tag_spec/single_div_with_one_attribute.rhtml +0 -0
  80. data/{spec_resources → spec/resources}/views/view_spec/_partial.rhtml +0 -0
  81. data/spec/resources/views/view_spec/_partial_used_twice.rhtml +0 -0
  82. data/{spec_resources → spec/resources}/views/view_spec/_partial_with_local_variable.rhtml +0 -0
  83. data/{spec_resources → spec/resources}/views/view_spec/_partial_with_sub_partial.rhtml +0 -0
  84. data/{spec_resources → spec/resources}/views/view_spec/_spacer.rhtml +0 -0
  85. data/{spec_resources → spec/resources}/views/view_spec/accessor.rhtml +0 -0
  86. data/{spec_resources → spec/resources}/views/view_spec/block_helper.rhtml +0 -0
  87. data/{spec_resources → spec/resources}/views/view_spec/entry_form.rhtml +0 -0
  88. data/{spec_resources → spec/resources}/views/view_spec/explicit_helper.rhtml +0 -0
  89. data/{spec_resources → spec/resources}/views/view_spec/foo/show.rhtml +0 -0
  90. data/{spec_resources → spec/resources}/views/view_spec/implicit_helper.rhtml +0 -0
  91. data/{spec_resources → spec/resources}/views/view_spec/multiple_helpers.rhtml +0 -0
  92. data/spec/resources/views/view_spec/path_params.html.erb +1 -0
  93. data/{spec_resources → spec/resources}/views/view_spec/should_not_receive.rhtml +0 -0
  94. data/{spec_resources → spec/resources}/views/view_spec/template_with_partial.rhtml +0 -0
  95. data/{spec_resources → spec/resources}/views/view_spec/template_with_partial_using_collection.rhtml +0 -0
  96. data/{spec_resources → spec/resources}/views/view_spec/template_with_partial_with_array.rhtml +0 -0
  97. data/spec/{rails → spec/rails}/example/assigns_hash_proxy_spec.rb +1 -1
  98. data/spec/spec/rails/example/configuration_spec.rb +79 -0
  99. data/spec/{rails → spec/rails}/example/controller_isolation_spec.rb +1 -7
  100. data/spec/{rails → spec/rails}/example/controller_spec_spec.rb +63 -6
  101. data/spec/{rails → spec/rails}/example/cookies_proxy_spec.rb +30 -13
  102. data/spec/{rails → spec/rails}/example/example_group_factory_spec.rb +1 -1
  103. data/spec/{rails → spec/rails}/example/helper_spec_spec.rb +28 -1
  104. data/spec/{rails → spec/rails}/example/model_spec_spec.rb +1 -1
  105. data/spec/{rails → spec/rails}/example/shared_behaviour_spec.rb +1 -1
  106. data/spec/{rails → spec/rails}/example/test_unit_assertion_accessibility_spec.rb +1 -1
  107. data/spec/{rails → spec/rails}/example/view_spec_spec.rb +22 -1
  108. data/spec/{rails → spec/rails}/extensions/action_controller_rescue_action_spec.rb +4 -1
  109. data/spec/{rails → spec/rails}/extensions/action_view_base_spec.rb +1 -1
  110. data/spec/{rails → spec/rails}/extensions/active_record_spec.rb +1 -1
  111. data/spec/{rails → spec/rails}/interop/testcase_spec.rb +6 -2
  112. data/spec/spec/rails/matchers/ar_be_valid_spec.rb +35 -0
  113. data/spec/{rails → spec/rails}/matchers/assert_select_spec.rb +1 -5
  114. data/spec/{rails → spec/rails}/matchers/errors_on_spec.rb +1 -1
  115. data/spec/{rails → spec/rails}/matchers/have_text_spec.rb +1 -1
  116. data/spec/{rails → spec/rails}/matchers/include_text_spec.rb +1 -1
  117. data/spec/{rails → spec/rails}/matchers/redirect_to_spec.rb +11 -2
  118. data/spec/{rails → spec/rails}/matchers/render_template_spec.rb +8 -4
  119. data/spec/{rails → spec/rails}/matchers/should_change_spec.rb +1 -1
  120. data/spec/{rails → spec/rails}/mocks/ar_classes.rb +0 -0
  121. data/spec/{rails → spec/rails}/mocks/mock_model_spec.rb +1 -1
  122. data/spec/{rails → spec/rails}/mocks/stub_model_spec.rb +1 -1
  123. data/spec/{rails → spec/rails}/sample_modified_fixture.rb +1 -1
  124. data/spec/{rails → spec/rails}/sample_spec.rb +1 -1
  125. data/spec/spec/rails/spec_server_spec.rb +96 -0
  126. data/spec/{rails → spec/rails}/spec_spec.rb +1 -1
  127. data/spec/spec_helper.rb +23 -14
  128. metadata +111 -100
  129. data/UPGRADE +0 -7
  130. data/generators/rspec/templates/all_stories.rb +0 -4
  131. data/generators/rspec/templates/stories_helper.rb +0 -3
  132. data/lib/spec/rails/extensions/object.rb +0 -5
  133. data/spec/rails/example/configuration_spec.rb +0 -83
  134. data/spec/rails/matchers/description_generation_spec.rb +0 -37
  135. data/spec/rails/spec_server_spec.rb +0 -96
  136. data/stories/all.rb +0 -10
  137. data/stories/configuration/stories.rb +0 -5
  138. data/stories/helper.rb +0 -6
  139. data/stories/steps/people.rb +0 -8
  140. data/stories/transactions_should_rollback.rb +0 -25
@@ -1,3 +1,32 @@
1
+ === Version 1.1.12 / 2009-01-11
2
+
3
+ * 2 deprecations
4
+
5
+ * TestResponse#[] is deprecated if you're using Rails <= 2.2.x and removed if you're using Rails 2.3
6
+ * add_stubs(model, {:method => value}) is deprecated. Use model.stub!(:method => value) instead.
7
+
8
+ * 2 major enhancements
9
+
10
+ * support controller and action path params in view specs (Mike Vincent).
11
+ * use ActiveSupport::TestCase when available, else Test::Unit::TestCase - supports Rails 1.2.6 (Brandon Keepers). Closes #620.
12
+ * support form tag helpers in helpers (Ivo Dancet). Closes #641.
13
+
14
+ * 3 minor enhancements
15
+
16
+ * improve rdoc for render_template (Patch from Andrew Premdas). Fixes #571.
17
+ * use more liberal globs to allow for specs in symlinked dirs (Martin Luder). Closes #361.
18
+ * Enable loading fixtures from arbitrary locations (Jacek Becela). Closes #464.
19
+
20
+ * 7 bug fixes
21
+
22
+ * Attempt to load application_controller before falling back to application (Geoff Garside). Closes #626.
23
+ * Include _id and reduce quoting of default values in view specs (Steen Lehmann). Closes #598.
24
+ * Record calls to render and check rendered[:template] and rendered[:partial] for edge rails (> v2.2.2). Closes #633.
25
+ * config.gem 'rspec' can't be unpacked. Closes #629.
26
+ * spec_server not working with Rails 2.2.2 (Andreas Wolff). Closes #631.
27
+ * redirect_to doesn't work with http method constrained urls (Maxim Kulkin). Closes #648.
28
+ * rescue_with declarations are no longer by-passed (Brandon Keepers). #85
29
+
1
30
  === Version 1.1.11 / 2008-10-24
2
31
 
3
32
  * No changes to rspec-rails - release to align with bug-fix release in rspec ... again :(
@@ -3,10 +3,12 @@ License.txt
3
3
  Manifest.txt
4
4
  README.txt
5
5
  Rakefile
6
- UPGRADE
6
+ TODO.txt
7
+ features/step_definitions/people.rb
8
+ features/support/env.rb
9
+ features/transactions/transactions_should_rollback.feature
7
10
  generators/rspec/CHANGES
8
11
  generators/rspec/rspec_generator.rb
9
- generators/rspec/templates/all_stories.rb
10
12
  generators/rspec/templates/previous_failures.txt
11
13
  generators/rspec/templates/rcov.opts
12
14
  generators/rspec/templates/rspec.rake
@@ -15,7 +17,6 @@ generators/rspec/templates/script/spec
15
17
  generators/rspec/templates/script/spec_server
16
18
  generators/rspec/templates/spec.opts
17
19
  generators/rspec/templates/spec_helper.rb
18
- generators/rspec/templates/stories_helper.rb
19
20
  generators/rspec_controller/USAGE
20
21
  generators/rspec_controller/rspec_controller_generator.rb
21
22
  generators/rspec_controller/templates/controller_spec.rb
@@ -53,11 +54,11 @@ lib/spec/rails/extensions/action_controller/rescue.rb
53
54
  lib/spec/rails/extensions/action_controller/test_response.rb
54
55
  lib/spec/rails/extensions/action_view/base.rb
55
56
  lib/spec/rails/extensions/active_record/base.rb
56
- lib/spec/rails/extensions/object.rb
57
- lib/spec/rails/extensions/spec/example/configuration.rb
58
57
  lib/spec/rails/extensions/spec/matchers/have.rb
58
+ lib/spec/rails/extensions/spec/runner/configuration.rb
59
59
  lib/spec/rails/interop/testcase.rb
60
60
  lib/spec/rails/matchers.rb
61
+ lib/spec/rails/matchers/ar_be_valid.rb
61
62
  lib/spec/rails/matchers/assert_select.rb
62
63
  lib/spec/rails/matchers/change.rb
63
64
  lib/spec/rails/matchers/have_text.rb
@@ -68,94 +69,93 @@ lib/spec/rails/mocks.rb
68
69
  lib/spec/rails/story_adapter.rb
69
70
  lib/spec/rails/version.rb
70
71
  rspec-rails.gemspec
71
- spec/rails/autotest/mappings_spec.rb
72
- spec/rails/example/assigns_hash_proxy_spec.rb
73
- spec/rails/example/configuration_spec.rb
74
- spec/rails/example/controller_isolation_spec.rb
75
- spec/rails/example/controller_spec_spec.rb
76
- spec/rails/example/cookies_proxy_spec.rb
77
- spec/rails/example/example_group_factory_spec.rb
78
- spec/rails/example/helper_spec_spec.rb
79
- spec/rails/example/model_spec_spec.rb
80
- spec/rails/example/shared_behaviour_spec.rb
81
- spec/rails/example/test_unit_assertion_accessibility_spec.rb
82
- spec/rails/example/view_spec_spec.rb
83
- spec/rails/extensions/action_controller_rescue_action_spec.rb
84
- spec/rails/extensions/action_view_base_spec.rb
85
- spec/rails/extensions/active_record_spec.rb
86
- spec/rails/interop/testcase_spec.rb
87
- spec/rails/matchers/assert_select_spec.rb
88
- spec/rails/matchers/description_generation_spec.rb
89
- spec/rails/matchers/errors_on_spec.rb
90
- spec/rails/matchers/have_text_spec.rb
91
- spec/rails/matchers/include_text_spec.rb
92
- spec/rails/matchers/redirect_to_spec.rb
93
- spec/rails/matchers/render_template_spec.rb
94
- spec/rails/matchers/should_change_spec.rb
95
- spec/rails/mocks/ar_classes.rb
96
- spec/rails/mocks/mock_model_spec.rb
97
- spec/rails/mocks/stub_model_spec.rb
98
- spec/rails/sample_modified_fixture.rb
99
- spec/rails/sample_spec.rb
100
- spec/rails/spec_server_spec.rb
101
- spec/rails/spec_spec.rb
72
+ spec/autotest/mappings_spec.rb
102
73
  spec/rails_suite.rb
74
+ spec/resources/controllers/action_view_base_spec_controller.rb
75
+ spec/resources/controllers/application.rb
76
+ spec/resources/controllers/controller_spec_controller.rb
77
+ spec/resources/controllers/redirect_spec_controller.rb
78
+ spec/resources/controllers/render_spec_controller.rb
79
+ spec/resources/controllers/rjs_spec_controller.rb
80
+ spec/resources/helpers/addition_helper.rb
81
+ spec/resources/helpers/explicit_helper.rb
82
+ spec/resources/helpers/more_explicit_helper.rb
83
+ spec/resources/helpers/plugin_application_helper.rb
84
+ spec/resources/helpers/view_spec_helper.rb
85
+ spec/resources/models/animal.rb
86
+ spec/resources/models/person.rb
87
+ spec/resources/models/thing.rb
88
+ spec/resources/views/controller_spec/_partial.rhtml
89
+ spec/resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml
90
+ spec/resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml
91
+ spec/resources/views/controller_spec/action_setting_the_assigns_hash.rhtml
92
+ spec/resources/views/controller_spec/action_with_errors_in_template.rhtml
93
+ spec/resources/views/controller_spec/action_with_template.rhtml
94
+ spec/resources/views/layouts/application.rhtml
95
+ spec/resources/views/layouts/simple.rhtml
96
+ spec/resources/views/objects/_object.html.erb
97
+ spec/resources/views/render_spec/_a_partial.rhtml
98
+ spec/resources/views/render_spec/action_with_alternate_layout.rhtml
99
+ spec/resources/views/render_spec/some_action.html.erb
100
+ spec/resources/views/render_spec/some_action.js.rjs
101
+ spec/resources/views/render_spec/some_action.rjs
102
+ spec/resources/views/rjs_spec/_replacement_partial.rhtml
103
+ spec/resources/views/rjs_spec/hide_div.rjs
104
+ spec/resources/views/rjs_spec/hide_page_element.rjs
105
+ spec/resources/views/rjs_spec/insert_html.rjs
106
+ spec/resources/views/rjs_spec/replace.rjs
107
+ spec/resources/views/rjs_spec/replace_html.rjs
108
+ spec/resources/views/rjs_spec/replace_html_with_partial.rjs
109
+ spec/resources/views/rjs_spec/visual_effect.rjs
110
+ spec/resources/views/rjs_spec/visual_toggle_effect.rjs
111
+ spec/resources/views/tag_spec/no_tags.rhtml
112
+ spec/resources/views/tag_spec/single_div_with_no_attributes.rhtml
113
+ spec/resources/views/tag_spec/single_div_with_one_attribute.rhtml
114
+ spec/resources/views/view_spec/_partial.rhtml
115
+ spec/resources/views/view_spec/_partial_used_twice.rhtml
116
+ spec/resources/views/view_spec/_partial_with_local_variable.rhtml
117
+ spec/resources/views/view_spec/_partial_with_sub_partial.rhtml
118
+ spec/resources/views/view_spec/_spacer.rhtml
119
+ spec/resources/views/view_spec/accessor.rhtml
120
+ spec/resources/views/view_spec/block_helper.rhtml
121
+ spec/resources/views/view_spec/entry_form.rhtml
122
+ spec/resources/views/view_spec/explicit_helper.rhtml
123
+ spec/resources/views/view_spec/foo/show.rhtml
124
+ spec/resources/views/view_spec/implicit_helper.rhtml
125
+ spec/resources/views/view_spec/multiple_helpers.rhtml
126
+ spec/resources/views/view_spec/path_params.html.erb
127
+ spec/resources/views/view_spec/should_not_receive.rhtml
128
+ spec/resources/views/view_spec/template_with_partial.rhtml
129
+ spec/resources/views/view_spec/template_with_partial_using_collection.rhtml
130
+ spec/resources/views/view_spec/template_with_partial_with_array.rhtml
131
+ spec/spec/rails/example/assigns_hash_proxy_spec.rb
132
+ spec/spec/rails/example/configuration_spec.rb
133
+ spec/spec/rails/example/controller_isolation_spec.rb
134
+ spec/spec/rails/example/controller_spec_spec.rb
135
+ spec/spec/rails/example/cookies_proxy_spec.rb
136
+ spec/spec/rails/example/example_group_factory_spec.rb
137
+ spec/spec/rails/example/helper_spec_spec.rb
138
+ spec/spec/rails/example/model_spec_spec.rb
139
+ spec/spec/rails/example/shared_behaviour_spec.rb
140
+ spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb
141
+ spec/spec/rails/example/view_spec_spec.rb
142
+ spec/spec/rails/extensions/action_controller_rescue_action_spec.rb
143
+ spec/spec/rails/extensions/action_view_base_spec.rb
144
+ spec/spec/rails/extensions/active_record_spec.rb
145
+ spec/spec/rails/interop/testcase_spec.rb
146
+ spec/spec/rails/matchers/ar_be_valid_spec.rb
147
+ spec/spec/rails/matchers/assert_select_spec.rb
148
+ spec/spec/rails/matchers/errors_on_spec.rb
149
+ spec/spec/rails/matchers/have_text_spec.rb
150
+ spec/spec/rails/matchers/include_text_spec.rb
151
+ spec/spec/rails/matchers/redirect_to_spec.rb
152
+ spec/spec/rails/matchers/render_template_spec.rb
153
+ spec/spec/rails/matchers/should_change_spec.rb
154
+ spec/spec/rails/mocks/ar_classes.rb
155
+ spec/spec/rails/mocks/mock_model_spec.rb
156
+ spec/spec/rails/mocks/stub_model_spec.rb
157
+ spec/spec/rails/sample_modified_fixture.rb
158
+ spec/spec/rails/sample_spec.rb
159
+ spec/spec/rails/spec_server_spec.rb
160
+ spec/spec/rails/spec_spec.rb
103
161
  spec/spec_helper.rb
104
- spec_resources/controllers/action_view_base_spec_controller.rb
105
- spec_resources/controllers/controller_spec_controller.rb
106
- spec_resources/controllers/redirect_spec_controller.rb
107
- spec_resources/controllers/render_spec_controller.rb
108
- spec_resources/controllers/rjs_spec_controller.rb
109
- spec_resources/helpers/addition_helper.rb
110
- spec_resources/helpers/explicit_helper.rb
111
- spec_resources/helpers/more_explicit_helper.rb
112
- spec_resources/helpers/plugin_application_helper.rb
113
- spec_resources/helpers/view_spec_helper.rb
114
- spec_resources/views/controller_spec/_partial.rhtml
115
- spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml
116
- spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml
117
- spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml
118
- spec_resources/views/controller_spec/action_with_errors_in_template.rhtml
119
- spec_resources/views/controller_spec/action_with_template.rhtml
120
- spec_resources/views/layouts/application.rhtml
121
- spec_resources/views/layouts/simple.rhtml
122
- spec_resources/views/objects/_object.html.erb
123
- spec_resources/views/render_spec/_a_partial.rhtml
124
- spec_resources/views/render_spec/action_with_alternate_layout.rhtml
125
- spec_resources/views/render_spec/some_action.js.rjs
126
- spec_resources/views/render_spec/some_action.rhtml
127
- spec_resources/views/render_spec/some_action.rjs
128
- spec_resources/views/rjs_spec/_replacement_partial.rhtml
129
- spec_resources/views/rjs_spec/hide_div.rjs
130
- spec_resources/views/rjs_spec/hide_page_element.rjs
131
- spec_resources/views/rjs_spec/insert_html.rjs
132
- spec_resources/views/rjs_spec/replace.rjs
133
- spec_resources/views/rjs_spec/replace_html.rjs
134
- spec_resources/views/rjs_spec/replace_html_with_partial.rjs
135
- spec_resources/views/rjs_spec/visual_effect.rjs
136
- spec_resources/views/rjs_spec/visual_toggle_effect.rjs
137
- spec_resources/views/tag_spec/no_tags.rhtml
138
- spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml
139
- spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml
140
- spec_resources/views/view_spec/_partial.rhtml
141
- spec_resources/views/view_spec/_partial_used_twice.rhtml
142
- spec_resources/views/view_spec/_partial_with_local_variable.rhtml
143
- spec_resources/views/view_spec/_partial_with_sub_partial.rhtml
144
- spec_resources/views/view_spec/_spacer.rhtml
145
- spec_resources/views/view_spec/accessor.rhtml
146
- spec_resources/views/view_spec/block_helper.rhtml
147
- spec_resources/views/view_spec/entry_form.rhtml
148
- spec_resources/views/view_spec/explicit_helper.rhtml
149
- spec_resources/views/view_spec/foo/show.rhtml
150
- spec_resources/views/view_spec/implicit_helper.rhtml
151
- spec_resources/views/view_spec/multiple_helpers.rhtml
152
- spec_resources/views/view_spec/should_not_receive.rhtml
153
- spec_resources/views/view_spec/template_with_partial.rhtml
154
- spec_resources/views/view_spec/template_with_partial_using_collection.rhtml
155
- spec_resources/views/view_spec/template_with_partial_with_array.rhtml
156
- stories/all.rb
157
- stories/configuration/stories.rb
158
- stories/helper.rb
159
- stories/steps/people.rb
160
- stories/transactions_should_rollback
161
- stories/transactions_should_rollback.rb
data/README.txt CHANGED
@@ -1,7 +1,6 @@
1
1
  = Spec::Rails
2
2
 
3
3
  * http://rspec.info
4
- * http://rspec.info/rdoc-rails/
5
4
  * http://rubyforge.org/projects/rspec
6
5
  * http://github.com/dchelimsky/rspec-rails/wikis
7
6
  * mailto:rspec-devel@rubyforge.org
@@ -10,15 +9,14 @@
10
9
 
11
10
  Behaviour Driven Development for Ruby on Rails.
12
11
 
13
- Spec::Rails (a.k.a. RSpec on Rails) is a Ruby on Rails plugin that allows you
14
- to drive the development of your RoR application using RSpec, a framework that
15
- aims to enable Example Driven Development in Ruby.
12
+ Spec::Rails (a.k.a. RSpec on Rails) is an RSpec extension that allows you
13
+ to drive the development of your RoR application using RSpec.
16
14
 
17
15
  == FEATURES:
18
16
 
19
17
  * Use RSpec to independently specify Rails Models, Views, Controllers and Helpers
20
18
  * Integrated fixture loading
21
- * Special generators for Resources, Models, Views and Controllers that generate Specs instead of Tests.
19
+ * Special generators for Resources, Models, Views and Controllers that generate RSpec code examples.
22
20
 
23
21
  == VISION:
24
22
 
@@ -35,10 +33,10 @@ these different concerns.
35
33
 
36
34
  == MORE INFORMATION:
37
35
 
38
- See Spec::Rails::Runner for information about the different kinds of example
36
+ See Spec::Rails::Example for information about the different kinds of example
39
37
  groups you can use to spec the different Rails components
40
38
 
41
- See Spec::Rails::Expectations for information about Rails-specific
39
+ See Spec::Rails::Matchers for information about Rails-specific
42
40
  expectations you can set on responses and models, etc.
43
41
 
44
42
  == INSTALL
data/Rakefile CHANGED
@@ -1,6 +1,11 @@
1
1
  require 'rubygems'
2
2
  require 'hoe'
3
3
  require './lib/spec/rails/version'
4
+ require 'cucumber/rake/task'
5
+
6
+ $:.unshift(File.join(File.dirname(__FILE__), "/../rspec/lib"))
7
+
8
+ require 'spec/rake/spectask'
4
9
 
5
10
  class Hoe
6
11
  def extra_deps
@@ -15,7 +20,8 @@ Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
15
20
  p.description = "Behaviour Driven Development for Ruby on Rails."
16
21
  p.rubyforge_name = 'rspec'
17
22
  p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
18
- p.extra_deps = [["rspec","1.1.11"]]
23
+ p.extra_deps = [["rspec","1.1.12"]]
24
+ p.extra_dev_deps = [["cucumber",">= 0.1.13"]]
19
25
  p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
20
26
  end
21
27
 
@@ -36,4 +42,10 @@ task :release => [:clean, :package] do |t|
36
42
  ["#{pkg}.gem", "#{pkg}.tgz"].each do |file|
37
43
  rubyforge.add_file('rspec', 'rspec', Spec::Rails::VERSION::STRING, file)
38
44
  end
39
- end
45
+ end
46
+
47
+ Spec::Rake::SpecTask.new
48
+
49
+ Cucumber::Rake::Task.new
50
+
51
+ task :default => [:features]
@@ -0,0 +1,6 @@
1
+ When "I add a Person" do
2
+ Person.create!(:name => "Foo")
3
+ end
4
+ Then "there should be one person" do
5
+ Person.count.should == 1
6
+ end
@@ -0,0 +1,13 @@
1
+ # Sets up the Rails environment for Cucumber
2
+ ENV["RAILS_ENV"] = "test"
3
+ require File.expand_path(File.dirname(__FILE__) + '/../../../../../config/environment')
4
+ require 'cucumber/rails/world'
5
+ Cucumber::Rails.use_transactional_fixtures
6
+
7
+ # require 'webrat/rails'
8
+
9
+ # Comment out the next two lines if you're not using RSpec's matchers (should / should_not) in your steps.
10
+ require 'cucumber/rails/rspec'
11
+ # require 'webrat/rspec-rails'
12
+
13
+ require File.join(File.dirname(__FILE__), "/../../spec/resources/models/person")
@@ -5,11 +5,12 @@ Story: transactions should rollback in plain text
5
5
 
6
6
  Scenario: add one Person
7
7
  When I add a Person
8
+ Then there should be one person
8
9
 
9
- Scenario: add another person
10
- GivenScenario: add one Person
10
+ Scenario: add one Person for the second time
11
+ When I add a Person
11
12
  Then there should be one person
12
13
 
13
14
  Scenario: add yet another person
14
- GivenScenario: add one Person
15
+ When I add a Person
15
16
  Then there should be one person
@@ -24,10 +24,6 @@ class RspecGenerator < Rails::Generator::Base
24
24
  m.file 'rcov.opts', 'spec/rcov.opts'
25
25
  m.file 'spec.opts', 'spec/spec.opts'
26
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
27
  end
32
28
  end
33
29
 
@@ -1,132 +1,158 @@
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
1
+ rspec_gem_dir = nil
2
+ Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
3
+ rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
13
4
  end
5
+ rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
14
6
 
15
- task :default => :spec
16
- task :stats => "spec:statsetup"
7
+ if rspec_gem_dir && (test ?d, rspec_plugin_dir)
8
+ 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"
9
+ end
17
10
 
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']
11
+ if rspec_gem_dir
12
+ $LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
13
+ elsif File.exist?(rspec_plugin_dir)
14
+ $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
22
15
  end
23
16
 
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
17
+ begin
18
+ require 'spec/rake/spectask'
19
+ Rake.application.instance_variable_get('@tasks').delete('default')
40
20
 
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/*')
21
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
22
+ task :noop do
45
23
  end
46
24
 
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|
25
+ task :default => :spec
26
+ task :stats => "spec:statsetup"
27
+
28
+ desc "Run all specs in spec directory (excluding plugin specs)"
29
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
57
30
  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/*")
31
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
59
32
  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|
33
+
34
+ namespace :spec do
35
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
36
+ Spec::Rake::SpecTask.new(:rcov) do |t|
64
37
  t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
65
- t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
38
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
39
+ t.rcov = true
40
+ t.rcov_opts = lambda do
41
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
42
+ end
66
43
  end
67
- end
68
44
 
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
45
+ desc "Print Specdoc for all specs (excluding plugin specs)"
46
+ Spec::Rake::SpecTask.new(:doc) do |t|
47
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
48
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
49
+ end
84
50
 
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
51
+ desc "Print Specdoc for all plugin examples"
52
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
53
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
54
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
55
+ end
56
+
57
+ [:models, :controllers, :views, :helpers, :lib].each do |sub|
58
+ desc "Run the code examples in spec/#{sub}"
59
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
60
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
61
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
94
62
  end
95
63
  end
96
- end
97
64
 
98
- namespace :server do
99
- daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp")
65
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
66
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
67
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
68
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
69
+ end
100
70
 
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)
71
+ namespace :plugins do
72
+ desc "Runs the examples for rspec_on_rails"
73
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
74
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
75
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
108
76
  end
109
77
  end
110
78
 
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)
79
+ # Setup specs for stats
80
+ task :statsetup do
81
+ require 'code_statistics'
82
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
83
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
84
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
85
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
86
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
87
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
88
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
89
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
90
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
91
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
92
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
93
+ end
94
+
95
+ namespace :db do
96
+ namespace :fixtures do
97
+ 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."
98
+ task :load => :environment do
99
+ ActiveRecord::Base.establish_connection(Rails.env)
100
+ base_dir = File.join(Rails.root, 'spec', 'fixtures')
101
+ fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
102
+
103
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
104
+ Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
105
+ end
106
+ end
119
107
  end
120
108
  end
121
109
 
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)
110
+ namespace :server do
111
+ daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp")
112
+
113
+ desc "start spec_server."
114
+ task :start do
115
+ if File.exist?(daemonized_server_pid)
116
+ $stderr.puts "spec_server is already running."
117
+ else
118
+ $stderr.puts "Starting up spec server."
119
+ system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
120
+ end
121
+ end
122
+
123
+ desc "stop spec_server."
124
+ task :stop do
125
+ unless File.exist?(daemonized_server_pid)
126
+ $stderr.puts "No server running."
127
+ else
128
+ $stderr.puts "Shutting down spec_server."
129
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
130
+ File.delete(daemonized_server_pid)
131
+ end
132
+ end
133
+
134
+ desc "reload spec_server."
135
+ task :restart do
136
+ unless File.exist?(daemonized_server_pid)
137
+ $stderr.puts "No server running."
138
+ else
139
+ $stderr.puts "Reloading down spec_server."
140
+ system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip)
141
+ end
129
142
  end
130
143
  end
131
144
  end
145
+ rescue MissingSourceFile
146
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
147
+ require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
148
+
149
+ # ... otherwise, do this:
150
+ raise <<-MSG
151
+
152
+ You have rspec rake tasks installed in
153
+ #{__FILE__},
154
+ but rspec can not be found in vendor/gems, vendor/plugins or on the system.
155
+
156
+ MSG
132
157
  end
158
+