rspec-rails 1.1.12 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +7 -0
- data/History.txt +55 -0
- data/License.txt +1 -1
- data/Manifest.txt +53 -48
- data/README.txt +5 -4
- data/Rakefile +9 -2
- data/TODO.txt +1 -0
- data/Upgrade.markdown +103 -0
- data/generators/rspec/rspec_generator.rb +1 -0
- data/generators/rspec/templates/rspec.rake +134 -111
- data/generators/rspec/templates/script/autospec +1 -0
- data/generators/rspec/templates/script/spec +21 -4
- data/generators/rspec/templates/script/spec_server +34 -107
- data/generators/rspec/templates/spec_helper.rb +1 -1
- data/generators/rspec_controller/rspec_controller_generator.rb +1 -5
- data/generators/rspec_scaffold/rspec_scaffold_generator.rb +13 -17
- data/generators/rspec_scaffold/templates/controller_spec.rb +27 -29
- data/generators/rspec_scaffold/templates/edit_erb_spec.rb +2 -2
- data/generators/rspec_scaffold/templates/helper_spec.rb +1 -1
- data/generators/rspec_scaffold/templates/index_erb_spec.rb +2 -2
- data/generators/rspec_scaffold/templates/new_erb_spec.rb +2 -2
- data/generators/rspec_scaffold/templates/routing_spec.rb +24 -20
- data/generators/rspec_scaffold/templates/show_erb_spec.rb +2 -2
- data/lib/spec/rails.rb +10 -9
- data/lib/spec/rails/example.rb +2 -2
- data/lib/spec/rails/example/assigns_hash_proxy.rb +1 -2
- data/lib/spec/rails/example/controller_example_group.rb +117 -123
- data/lib/spec/rails/example/functional_example_group.rb +7 -22
- data/lib/spec/rails/example/helper_example_group.rb +15 -33
- data/lib/spec/rails/example/model_example_group.rb +1 -1
- data/lib/spec/rails/example/render_observer.rb +0 -26
- data/lib/spec/rails/example/routing_example_group.rb +13 -0
- data/lib/spec/rails/example/routing_helpers.rb +68 -0
- data/lib/spec/rails/example/view_example_group.rb +50 -47
- data/lib/spec/rails/extensions.rb +2 -1
- data/lib/spec/rails/extensions/action_controller/rescue.rb +25 -8
- data/lib/spec/rails/extensions/action_controller/test_case.rb +16 -0
- data/lib/spec/rails/extensions/action_controller/test_response.rb +4 -3
- data/lib/spec/rails/extensions/action_view/base.rb +9 -9
- data/lib/spec/rails/extensions/active_record/base.rb +39 -23
- data/lib/spec/rails/extensions/active_support/test_case.rb +7 -0
- data/lib/spec/rails/extensions/spec/matchers/have.rb +8 -6
- data/lib/spec/rails/extensions/spec/runner/configuration.rb +12 -44
- data/lib/spec/rails/matchers/ar_be_valid.rb +8 -5
- data/lib/spec/rails/matchers/assert_select.rb +36 -21
- data/lib/spec/rails/matchers/have_text.rb +3 -3
- data/lib/spec/rails/matchers/include_text.rb +4 -4
- data/lib/spec/rails/matchers/redirect_to.rb +30 -19
- data/lib/spec/rails/matchers/render_template.rb +7 -3
- data/lib/spec/rails/mocks.rb +1 -1
- data/lib/spec/rails/spec_server.rb +97 -0
- data/lib/spec/rails/story_adapter.rb +4 -4
- data/lib/spec/rails/version.rb +2 -2
- data/spec/resources/controllers/controller_spec_controller.rb +14 -6
- data/spec/resources/controllers/example.txt +1 -0
- data/spec/resources/controllers/redirect_spec_controller.rb +4 -0
- data/spec/resources/controllers/render_spec_controller.rb +1 -1
- data/spec/resources/controllers/rjs_spec_controller.rb +1 -1
- data/spec/resources/helpers/explicit_helper.rb +1 -1
- data/spec/resources/views/controller_spec/{_partial.rhtml → _partial.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_setting_flash_after_session_reset.rhtml → action_setting_flash_after_session_reset.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_setting_flash_before_session_reset.rhtml → action_setting_flash_before_session_reset.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_setting_the_assigns_hash.rhtml → action_setting_the_assigns_hash.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_with_errors_in_template.rhtml → action_with_errors_in_template.html.erb} +0 -0
- data/spec/resources/views/controller_spec/{action_with_template.rhtml → action_with_template.html.erb} +0 -0
- data/spec/resources/views/layouts/{application.rhtml → application.html.erb} +0 -0
- data/spec/resources/views/layouts/{simple.rhtml → simple.html.erb} +0 -0
- data/spec/resources/views/render_spec/{_a_partial.rhtml → _a_partial.html.erb} +0 -0
- data/spec/resources/views/render_spec/{action_with_alternate_layout.rhtml → action_with_alternate_layout.html.erb} +0 -0
- data/spec/resources/views/rjs_spec/{_replacement_partial.rhtml → _replacement_partial.html.erb} +0 -0
- data/spec/resources/views/rjs_spec/{hide_div.rjs → hide_div.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{hide_page_element.rjs → hide_page_element.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{insert_html.rjs → insert_html.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{replace.rjs → replace.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{replace_html.rjs → replace_html.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{replace_html_with_partial.rjs → replace_html_with_partial.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{visual_effect.rjs → visual_effect.js.rjs} +0 -0
- data/spec/resources/views/rjs_spec/{visual_toggle_effect.rjs → visual_toggle_effect.js.rjs} +0 -0
- data/spec/resources/views/tag_spec/{no_tags.rhtml → no_tags.html.erb} +0 -0
- data/spec/resources/views/tag_spec/{single_div_with_no_attributes.rhtml → single_div_with_no_attributes.html.erb} +0 -0
- data/spec/resources/views/tag_spec/{single_div_with_one_attribute.rhtml → single_div_with_one_attribute.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_partial.rhtml → _partial.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_partial_used_twice.rhtml → _partial_used_twice.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_partial_with_local_variable.rhtml → _partial_with_local_variable.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_partial_with_sub_partial.rhtml → _partial_with_sub_partial.html.erb} +0 -0
- data/spec/resources/views/view_spec/{_spacer.rhtml → _spacer.html.erb} +0 -0
- data/spec/resources/views/view_spec/{accessor.rhtml → accessor.html.erb} +0 -0
- data/spec/resources/views/view_spec/{block_helper.rhtml → block_helper.html.erb} +0 -0
- data/spec/resources/views/view_spec/{entry_form.rhtml → entry_form.html.erb} +0 -0
- data/spec/resources/views/view_spec/{explicit_helper.rhtml → explicit_helper.html.erb} +0 -0
- data/spec/resources/views/view_spec/foo/{show.rhtml → show.html.erb} +0 -0
- data/spec/resources/views/view_spec/{implicit_helper.rhtml → implicit_helper.html.erb} +0 -0
- data/spec/resources/views/view_spec/{multiple_helpers.rhtml → multiple_helpers.html.erb} +0 -0
- data/spec/resources/views/view_spec/{should_not_receive.rhtml → should_not_receive.html.erb} +0 -0
- data/spec/resources/views/view_spec/{template_with_partial.rhtml → template_with_partial.html.erb} +0 -0
- data/spec/resources/views/view_spec/{template_with_partial_using_collection.rhtml → template_with_partial_using_collection.html.erb} +0 -0
- data/spec/resources/views/view_spec/{template_with_partial_with_array.rhtml → template_with_partial_with_array.html.erb} +0 -0
- data/spec/spec/rails/example/assigns_hash_proxy_spec.rb +18 -5
- data/spec/spec/rails/example/configuration_spec.rb +15 -29
- data/spec/spec/rails/example/{controller_spec_spec.rb → controller_example_group_spec.rb} +40 -96
- data/spec/spec/rails/example/cookies_proxy_spec.rb +32 -36
- data/spec/spec/rails/example/error_handling_spec.rb +90 -0
- data/spec/spec/rails/example/example_group_factory_spec.rb +5 -5
- data/spec/spec/rails/example/{helper_spec_spec.rb → helper_example_group_spec.rb} +45 -13
- data/spec/spec/rails/example/{model_spec_spec.rb → model_example_group_spec.rb} +3 -1
- data/spec/spec/rails/example/routing_example_group_spec.rb +9 -0
- data/spec/spec/rails/example/shared_routing_example_group_examples.rb +45 -0
- data/spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb +1 -1
- data/spec/spec/rails/example/{view_spec_spec.rb → view_example_group_spec.rb} +44 -17
- data/spec/spec/rails/matchers/ar_be_valid_spec.rb +10 -0
- data/spec/spec/rails/matchers/assert_select_spec.rb +59 -60
- data/spec/spec/rails/matchers/have_text_spec.rb +12 -4
- data/spec/spec/rails/matchers/include_text_spec.rb +11 -13
- data/spec/spec/rails/matchers/redirect_to_spec.rb +224 -189
- data/spec/spec/rails/matchers/render_template_spec.rb +169 -158
- data/spec/spec/rails/spec_server_spec.rb +18 -7
- data/spec/spec_helper.rb +21 -9
- metadata +68 -53
- data/lib/spec/rails/example/rails_example_group.rb +0 -28
- data/lib/spec/rails/extensions/action_controller/base.rb +0 -14
- data/rspec-rails.gemspec +0 -36
- data/spec/resources/views/render_spec/some_action.rjs +0 -1
- data/spec/spec/rails/example/shared_behaviour_spec.rb +0 -16
- data/spec/spec/rails/extensions/action_controller_rescue_action_spec.rb +0 -57
data/.document
ADDED
data/History.txt
CHANGED
@@ -1,3 +1,58 @@
|
|
1
|
+
=== Version 1.1.99.x (in git)
|
2
|
+
|
3
|
+
IMPORTANT: See Upgrade.markdown for information about upgrading to rspec-rails-1.1.99.4
|
4
|
+
|
5
|
+
IMPORTANT: This release includes the following backwards-compatibility-breaking changes.
|
6
|
+
|
7
|
+
* rspec-rails supports rails 2.0.2, 2.1.2 and 2.2.2.
|
8
|
+
|
9
|
+
* We are no longer supporting 1.x versions of rails.
|
10
|
+
|
11
|
+
* expect_render and stub_render have been removed.
|
12
|
+
|
13
|
+
* Both of these methods were deprecated in rspec-rails-1.1.5, released in Sept, 2008.
|
14
|
+
|
15
|
+
* { route_for(args).should == "/path" } now delegates to assert_generates (in rails)
|
16
|
+
|
17
|
+
* see Upgrade.txt for more information
|
18
|
+
|
19
|
+
* deprecations
|
20
|
+
|
21
|
+
* controller.use_rails_error_handling! is deprecated
|
22
|
+
* use rescue_action_in_public! (from rails) instead
|
23
|
+
|
24
|
+
* enhancements
|
25
|
+
|
26
|
+
* Adding status codes to redirect_to matcher (Damian Janowski). Closes #570.
|
27
|
+
* Initialize current URL before executing any examples in a ViewExampleGroup (Wilson Bilkovich). Closes #654.
|
28
|
+
* Support query strings in params_from (Wilson Bilkovich). Closes #652.
|
29
|
+
* delegate route_for to assert_recognizes (less brittle)
|
30
|
+
* it { should be_valid } (Kakutani). Closes #665.
|
31
|
+
* controller is implicit subject in controller specs (Joe Ferris). #686.
|
32
|
+
* template is implicit subject in view specs (Joe Ferris). #686.
|
33
|
+
* redirect_to and render_template matchers can accept controller or response (Joe Ferris). Closes #686.
|
34
|
+
* generated specs use declarative docstrings
|
35
|
+
* rspec_scaffold generator generates layout and stylesheet (per Rails-2.3)
|
36
|
+
* add bypass_rescue for controller specs
|
37
|
+
* infer template path from the first arg passed to describe in view specs
|
38
|
+
* separate routing specs (in spec/routing)
|
39
|
+
|
40
|
+
* bug fixes
|
41
|
+
|
42
|
+
* you no longer *have* to load ActionMailer to get specs to run. Closes #650.
|
43
|
+
* query_params are now parsed by Rack::Utils.parse_query in redirect_to matcher. Closes #684.
|
44
|
+
* cleaned up spec_server (there was a bunch of pre-rails 2.0 material). Closes #685.
|
45
|
+
* rspec's rake tasks are not loaded when running "rake gems" or any of its subtasks
|
46
|
+
* only warn when rspec is not installed when trying to invoke an rspec rake task
|
47
|
+
* support 2 arg version of ActionController::Base#render (reported by Nathan Wilmes)
|
48
|
+
* rake spec:server:start doesn't choke if there is no tmp directory
|
49
|
+
* force cache_classes = false when running with spec_server. Closes #287.
|
50
|
+
* keep spec_server working against edge rails (Jonathan Tron). Closes #685.
|
51
|
+
* create lib/tasks if not present when running script/generate rspec. Closes #687.
|
52
|
+
* fixed regression (and added spec so it won't regress again) where
|
53
|
+
render => :inline didn't render unless integrate_views was set
|
54
|
+
* fixed nil.with_output_buffer bug in helper specs. Closes #719.
|
55
|
+
|
1
56
|
=== Version 1.1.12 / 2009-01-11
|
2
57
|
|
3
58
|
* 2 deprecations
|
data/License.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
====================================================================
|
4
4
|
==== RSpec, RSpec-Rails
|
5
|
-
Copyright (c) 2005-
|
5
|
+
Copyright (c) 2005-2009 The RSpec Development Team
|
6
6
|
====================================================================
|
7
7
|
==== ARTS
|
8
8
|
Copyright (c) 2006 Kevin Clark, Jake Howerton
|
data/Manifest.txt
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
.document
|
1
2
|
History.txt
|
2
3
|
License.txt
|
3
4
|
Manifest.txt
|
4
5
|
README.txt
|
5
6
|
Rakefile
|
6
7
|
TODO.txt
|
8
|
+
Upgrade.markdown
|
7
9
|
features/step_definitions/people.rb
|
8
10
|
features/support/env.rb
|
9
11
|
features/transactions/transactions_should_rollback.feature
|
@@ -45,15 +47,17 @@ lib/spec/rails/example/cookies_proxy.rb
|
|
45
47
|
lib/spec/rails/example/functional_example_group.rb
|
46
48
|
lib/spec/rails/example/helper_example_group.rb
|
47
49
|
lib/spec/rails/example/model_example_group.rb
|
48
|
-
lib/spec/rails/example/rails_example_group.rb
|
49
50
|
lib/spec/rails/example/render_observer.rb
|
51
|
+
lib/spec/rails/example/routing_example_group.rb
|
52
|
+
lib/spec/rails/example/routing_helpers.rb
|
50
53
|
lib/spec/rails/example/view_example_group.rb
|
51
54
|
lib/spec/rails/extensions.rb
|
52
|
-
lib/spec/rails/extensions/action_controller/base.rb
|
53
55
|
lib/spec/rails/extensions/action_controller/rescue.rb
|
56
|
+
lib/spec/rails/extensions/action_controller/test_case.rb
|
54
57
|
lib/spec/rails/extensions/action_controller/test_response.rb
|
55
58
|
lib/spec/rails/extensions/action_view/base.rb
|
56
59
|
lib/spec/rails/extensions/active_record/base.rb
|
60
|
+
lib/spec/rails/extensions/active_support/test_case.rb
|
57
61
|
lib/spec/rails/extensions/spec/matchers/have.rb
|
58
62
|
lib/spec/rails/extensions/spec/runner/configuration.rb
|
59
63
|
lib/spec/rails/interop/testcase.rb
|
@@ -66,14 +70,15 @@ lib/spec/rails/matchers/include_text.rb
|
|
66
70
|
lib/spec/rails/matchers/redirect_to.rb
|
67
71
|
lib/spec/rails/matchers/render_template.rb
|
68
72
|
lib/spec/rails/mocks.rb
|
73
|
+
lib/spec/rails/spec_server.rb
|
69
74
|
lib/spec/rails/story_adapter.rb
|
70
75
|
lib/spec/rails/version.rb
|
71
|
-
rspec-rails.gemspec
|
72
76
|
spec/autotest/mappings_spec.rb
|
73
77
|
spec/rails_suite.rb
|
74
78
|
spec/resources/controllers/action_view_base_spec_controller.rb
|
75
79
|
spec/resources/controllers/application.rb
|
76
80
|
spec/resources/controllers/controller_spec_controller.rb
|
81
|
+
spec/resources/controllers/example.txt
|
77
82
|
spec/resources/controllers/redirect_spec_controller.rb
|
78
83
|
spec/resources/controllers/render_spec_controller.rb
|
79
84
|
spec/resources/controllers/rjs_spec_controller.rb
|
@@ -85,61 +90,61 @@ spec/resources/helpers/view_spec_helper.rb
|
|
85
90
|
spec/resources/models/animal.rb
|
86
91
|
spec/resources/models/person.rb
|
87
92
|
spec/resources/models/thing.rb
|
88
|
-
spec/resources/views/controller_spec/_partial.
|
89
|
-
spec/resources/views/controller_spec/action_setting_flash_after_session_reset.
|
90
|
-
spec/resources/views/controller_spec/action_setting_flash_before_session_reset.
|
91
|
-
spec/resources/views/controller_spec/action_setting_the_assigns_hash.
|
92
|
-
spec/resources/views/controller_spec/action_with_errors_in_template.
|
93
|
-
spec/resources/views/controller_spec/action_with_template.
|
94
|
-
spec/resources/views/layouts/application.
|
95
|
-
spec/resources/views/layouts/simple.
|
93
|
+
spec/resources/views/controller_spec/_partial.html.erb
|
94
|
+
spec/resources/views/controller_spec/action_setting_flash_after_session_reset.html.erb
|
95
|
+
spec/resources/views/controller_spec/action_setting_flash_before_session_reset.html.erb
|
96
|
+
spec/resources/views/controller_spec/action_setting_the_assigns_hash.html.erb
|
97
|
+
spec/resources/views/controller_spec/action_with_errors_in_template.html.erb
|
98
|
+
spec/resources/views/controller_spec/action_with_template.html.erb
|
99
|
+
spec/resources/views/layouts/application.html.erb
|
100
|
+
spec/resources/views/layouts/simple.html.erb
|
96
101
|
spec/resources/views/objects/_object.html.erb
|
97
|
-
spec/resources/views/render_spec/_a_partial.
|
98
|
-
spec/resources/views/render_spec/action_with_alternate_layout.
|
102
|
+
spec/resources/views/render_spec/_a_partial.html.erb
|
103
|
+
spec/resources/views/render_spec/action_with_alternate_layout.html.erb
|
99
104
|
spec/resources/views/render_spec/some_action.html.erb
|
100
105
|
spec/resources/views/render_spec/some_action.js.rjs
|
101
|
-
spec/resources/views/
|
102
|
-
spec/resources/views/rjs_spec/
|
103
|
-
spec/resources/views/rjs_spec/
|
104
|
-
spec/resources/views/rjs_spec/
|
105
|
-
spec/resources/views/rjs_spec/
|
106
|
-
spec/resources/views/rjs_spec/
|
107
|
-
spec/resources/views/rjs_spec/
|
108
|
-
spec/resources/views/rjs_spec/
|
109
|
-
spec/resources/views/rjs_spec/
|
110
|
-
spec/resources/views/
|
111
|
-
spec/resources/views/tag_spec/
|
112
|
-
spec/resources/views/tag_spec/
|
113
|
-
spec/resources/views/
|
114
|
-
spec/resources/views/view_spec/
|
115
|
-
spec/resources/views/view_spec/
|
116
|
-
spec/resources/views/view_spec/
|
117
|
-
spec/resources/views/view_spec/
|
118
|
-
spec/resources/views/view_spec/
|
119
|
-
spec/resources/views/view_spec/
|
120
|
-
spec/resources/views/view_spec/
|
121
|
-
spec/resources/views/view_spec/
|
122
|
-
spec/resources/views/view_spec/
|
123
|
-
spec/resources/views/view_spec/
|
124
|
-
spec/resources/views/view_spec/
|
125
|
-
spec/resources/views/view_spec/multiple_helpers.rhtml
|
106
|
+
spec/resources/views/rjs_spec/_replacement_partial.html.erb
|
107
|
+
spec/resources/views/rjs_spec/hide_div.js.rjs
|
108
|
+
spec/resources/views/rjs_spec/hide_page_element.js.rjs
|
109
|
+
spec/resources/views/rjs_spec/insert_html.js.rjs
|
110
|
+
spec/resources/views/rjs_spec/replace.js.rjs
|
111
|
+
spec/resources/views/rjs_spec/replace_html.js.rjs
|
112
|
+
spec/resources/views/rjs_spec/replace_html_with_partial.js.rjs
|
113
|
+
spec/resources/views/rjs_spec/visual_effect.js.rjs
|
114
|
+
spec/resources/views/rjs_spec/visual_toggle_effect.js.rjs
|
115
|
+
spec/resources/views/tag_spec/no_tags.html.erb
|
116
|
+
spec/resources/views/tag_spec/single_div_with_no_attributes.html.erb
|
117
|
+
spec/resources/views/tag_spec/single_div_with_one_attribute.html.erb
|
118
|
+
spec/resources/views/view_spec/_partial.html.erb
|
119
|
+
spec/resources/views/view_spec/_partial_used_twice.html.erb
|
120
|
+
spec/resources/views/view_spec/_partial_with_local_variable.html.erb
|
121
|
+
spec/resources/views/view_spec/_partial_with_sub_partial.html.erb
|
122
|
+
spec/resources/views/view_spec/_spacer.html.erb
|
123
|
+
spec/resources/views/view_spec/accessor.html.erb
|
124
|
+
spec/resources/views/view_spec/block_helper.html.erb
|
125
|
+
spec/resources/views/view_spec/entry_form.html.erb
|
126
|
+
spec/resources/views/view_spec/explicit_helper.html.erb
|
127
|
+
spec/resources/views/view_spec/foo/show.html.erb
|
128
|
+
spec/resources/views/view_spec/implicit_helper.html.erb
|
129
|
+
spec/resources/views/view_spec/multiple_helpers.html.erb
|
126
130
|
spec/resources/views/view_spec/path_params.html.erb
|
127
|
-
spec/resources/views/view_spec/should_not_receive.
|
128
|
-
spec/resources/views/view_spec/template_with_partial.
|
129
|
-
spec/resources/views/view_spec/template_with_partial_using_collection.
|
130
|
-
spec/resources/views/view_spec/template_with_partial_with_array.
|
131
|
+
spec/resources/views/view_spec/should_not_receive.html.erb
|
132
|
+
spec/resources/views/view_spec/template_with_partial.html.erb
|
133
|
+
spec/resources/views/view_spec/template_with_partial_using_collection.html.erb
|
134
|
+
spec/resources/views/view_spec/template_with_partial_with_array.html.erb
|
131
135
|
spec/spec/rails/example/assigns_hash_proxy_spec.rb
|
132
136
|
spec/spec/rails/example/configuration_spec.rb
|
137
|
+
spec/spec/rails/example/controller_example_group_spec.rb
|
133
138
|
spec/spec/rails/example/controller_isolation_spec.rb
|
134
|
-
spec/spec/rails/example/controller_spec_spec.rb
|
135
139
|
spec/spec/rails/example/cookies_proxy_spec.rb
|
140
|
+
spec/spec/rails/example/error_handling_spec.rb
|
136
141
|
spec/spec/rails/example/example_group_factory_spec.rb
|
137
|
-
spec/spec/rails/example/
|
138
|
-
spec/spec/rails/example/
|
139
|
-
spec/spec/rails/example/
|
142
|
+
spec/spec/rails/example/helper_example_group_spec.rb
|
143
|
+
spec/spec/rails/example/model_example_group_spec.rb
|
144
|
+
spec/spec/rails/example/routing_example_group_spec.rb
|
145
|
+
spec/spec/rails/example/shared_routing_example_group_examples.rb
|
140
146
|
spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb
|
141
|
-
spec/spec/rails/example/
|
142
|
-
spec/spec/rails/extensions/action_controller_rescue_action_spec.rb
|
147
|
+
spec/spec/rails/example/view_example_group_spec.rb
|
143
148
|
spec/spec/rails/extensions/action_view_base_spec.rb
|
144
149
|
spec/spec/rails/extensions/active_record_spec.rb
|
145
150
|
spec/spec/rails/interop/testcase_spec.rb
|
data/README.txt
CHANGED
@@ -2,15 +2,16 @@
|
|
2
2
|
|
3
3
|
* http://rspec.info
|
4
4
|
* http://rubyforge.org/projects/rspec
|
5
|
-
* http://github.com/dchelimsky/rspec-rails
|
5
|
+
* http://github.com/dchelimsky/rspec-rails
|
6
|
+
* http://wiki.github.com/dchelimsky/rspec/rails
|
6
7
|
* mailto:rspec-devel@rubyforge.org
|
7
8
|
|
8
9
|
== DESCRIPTION:
|
9
10
|
|
10
11
|
Behaviour Driven Development for Ruby on Rails.
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
rspec-rails is an RSpec extension that allows you to drive the development of
|
14
|
+
Ruby on Rails applications with RSpec.
|
14
15
|
|
15
16
|
== FEATURES:
|
16
17
|
|
@@ -41,4 +42,4 @@ expectations you can set on responses and models, etc.
|
|
41
42
|
|
42
43
|
== INSTALL
|
43
44
|
|
44
|
-
* Visit http://github.com/dchelimsky/rspec
|
45
|
+
* Visit http://wiki.github.com/dchelimsky/rspec/rails for installation instructions.
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
|
|
20
20
|
p.description = "Behaviour Driven Development for Ruby on Rails."
|
21
21
|
p.rubyforge_name = 'rspec'
|
22
22
|
p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
|
23
|
-
p.extra_deps = [["rspec","1.
|
23
|
+
p.extra_deps = [["rspec","1.2.0"],["rack",">=0.4.0"]]
|
24
24
|
p.extra_dev_deps = [["cucumber",">= 0.1.13"]]
|
25
25
|
p.remote_rdoc_dir = "rspec-rails/#{Spec::Rails::VERSION::STRING}"
|
26
26
|
end
|
@@ -48,4 +48,11 @@ Spec::Rake::SpecTask.new
|
|
48
48
|
|
49
49
|
Cucumber::Rake::Task.new
|
50
50
|
|
51
|
-
task :default => [:features]
|
51
|
+
task :default => [:features]
|
52
|
+
|
53
|
+
namespace :update do
|
54
|
+
desc "update the manfest"
|
55
|
+
task :manifest do
|
56
|
+
system %q[touch Manifest.txt; rake check_manifest | grep -v "(in " | patch]
|
57
|
+
end
|
58
|
+
end
|
data/TODO.txt
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
* delegate params_from to assert_recognizes
|
data/Upgrade.markdown
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# Upgrade to rspec-rails-1.1.99.x (pre rspec-rails-1.2)
|
2
|
+
|
3
|
+
## What's changed
|
4
|
+
|
5
|
+
### Supported Rails Versions
|
6
|
+
|
7
|
+
This release supports the following versions of rails:
|
8
|
+
|
9
|
+
* 2.0.5
|
10
|
+
* 2.1.2
|
11
|
+
* 2.2.2
|
12
|
+
* 2.3.1
|
13
|
+
|
14
|
+
### update generated files
|
15
|
+
|
16
|
+
Be sure to run "script/generate rspec" and allow the following files to be overwritten:
|
17
|
+
|
18
|
+
* lib/tasks/rspec.rake
|
19
|
+
* script/spec
|
20
|
+
* script/spec_server
|
21
|
+
|
22
|
+
### ``controller.use_rails_error_handling!`` is deprecated
|
23
|
+
|
24
|
+
Use ``rescue_action_in_public!`` instead. It comes directly from rails and does
|
25
|
+
exactly the same thing
|
26
|
+
|
27
|
+
### route_for
|
28
|
+
|
29
|
+
After a change to edge rails broke our monkey-patched ``route_for`` method, I
|
30
|
+
decided to just delegate to rails' ``assert_generates`` method. For most cases,
|
31
|
+
this will not present a problem, but for some it might. You'll know if you
|
32
|
+
upgrade and see any newly failing, route-related examples. Here are the things
|
33
|
+
that you might need to change.
|
34
|
+
|
35
|
+
#### Make sure IDs are strings
|
36
|
+
|
37
|
+
If you had :id => 1 before, you need to change that to :id => "1"
|
38
|
+
|
39
|
+
#old
|
40
|
+
route_for(:controller => 'things', :action => 'show', :id => 1).should == "/things/1"
|
41
|
+
|
42
|
+
#new
|
43
|
+
route_for(:controller => 'things', :action => 'show', :id => "1").should == "/things/1"
|
44
|
+
|
45
|
+
#### Convert paths for non-get methods to hashes
|
46
|
+
|
47
|
+
If you had an example with a route that requires post, put, or delete, you'll
|
48
|
+
need to declare that explicitly.
|
49
|
+
|
50
|
+
#old
|
51
|
+
route_for(:controller => 'things', :action => 'create').should == "/things"
|
52
|
+
|
53
|
+
#new
|
54
|
+
route_for(:controller => 'things', :action => 'create').should == {:path => "/things", :method => :post}
|
55
|
+
|
56
|
+
### Controller/template isolation
|
57
|
+
|
58
|
+
Even though controller specs do not render views by default (use
|
59
|
+
``integrate_views`` to get them to render views), the way this works has
|
60
|
+
changed in this version.
|
61
|
+
|
62
|
+
It used to be that the view template need not even exist, but due to changes
|
63
|
+
in rails it became much more difficult to manage that for all the different
|
64
|
+
versions of rails that rspec-rails supports. So now the template must exist,
|
65
|
+
but it still won't be rendered unless you declare ``integrate_views``.
|
66
|
+
|
67
|
+
## What's new
|
68
|
+
|
69
|
+
### render no longer requires a path
|
70
|
+
|
71
|
+
The ``render()`` method in view specs will infer the path from the
|
72
|
+
first argument passed to ``describe()``.
|
73
|
+
|
74
|
+
describe "players/show" do
|
75
|
+
it "does something" do
|
76
|
+
render
|
77
|
+
response.should have_tag("....")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
### routing specs live in spec/routing
|
82
|
+
|
83
|
+
``script/generate rspec_scaffold`` now generates its routing spec in
|
84
|
+
``spec/routing/``.
|
85
|
+
|
86
|
+
### bypass_rescue
|
87
|
+
|
88
|
+
Added a new ``bypass_rescue()`` declaration for controller specs. Use this
|
89
|
+
when you want to specify that an error is raised by an action, even if that
|
90
|
+
error is later captured by a ``rescue_from()`` declaration.
|
91
|
+
|
92
|
+
describe AccountController do
|
93
|
+
describe "GET @account" do
|
94
|
+
context "requested by anonymous user" do
|
95
|
+
it "denies access" do
|
96
|
+
bypass_rescue
|
97
|
+
lambda do
|
98
|
+
get :show, :id => "37"
|
99
|
+
end.should raise_error(AccessDenied)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -14,6 +14,7 @@ class RspecGenerator < Rails::Generator::Base
|
|
14
14
|
record do |m|
|
15
15
|
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
16
16
|
|
17
|
+
m.directory 'lib/tasks'
|
17
18
|
m.file 'rspec.rake', 'lib/tasks/rspec.rake'
|
18
19
|
|
19
20
|
m.file 'script/autospec', 'script/autospec', script_options
|
@@ -1,3 +1,4 @@
|
|
1
|
+
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
1
2
|
rspec_gem_dir = nil
|
2
3
|
Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
|
3
4
|
rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
|
@@ -14,145 +15,167 @@ elsif File.exist?(rspec_plugin_dir)
|
|
14
15
|
$LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
|
15
16
|
end
|
16
17
|
|
18
|
+
# Don't load rspec if running "rake gems:*"
|
19
|
+
unless ARGV.any? {|a| a =~ /^gems/}
|
20
|
+
|
17
21
|
begin
|
18
22
|
require 'spec/rake/spectask'
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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.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
|
23
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
|
24
53
|
|
25
|
-
|
26
|
-
|
54
|
+
task :default => :spec
|
55
|
+
task :stats => "spec:statsetup"
|
27
56
|
|
28
|
-
|
29
|
-
|
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|
|
30
66
|
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
31
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
|
32
72
|
end
|
33
73
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
43
|
-
end
|
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
|
44
79
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
50
85
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
t.
|
86
|
+
[:models, :controllers, :views, :helpers, :lib].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"]
|
55
91
|
end
|
92
|
+
end
|
56
93
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
63
|
-
end
|
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
|
64
99
|
|
65
|
-
|
66
|
-
|
100
|
+
namespace :plugins do
|
101
|
+
desc "Runs the examples for rspec_on_rails"
|
102
|
+
Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
|
67
103
|
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
68
|
-
t.spec_files = FileList['vendor/plugins
|
69
|
-
end
|
70
|
-
|
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']
|
76
|
-
end
|
104
|
+
t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
|
77
105
|
end
|
106
|
+
end
|
78
107
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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/lib) if File.exist?('spec/routing')
|
117
|
+
::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
|
118
|
+
::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
|
119
|
+
::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
|
120
|
+
::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
|
121
|
+
::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
|
122
|
+
::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
|
123
|
+
::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
|
124
|
+
end
|
94
125
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
126
|
+
namespace :db do
|
127
|
+
namespace :fixtures do
|
128
|
+
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."
|
129
|
+
task :load => :environment do
|
130
|
+
ActiveRecord::Base.establish_connection(Rails.env)
|
131
|
+
base_dir = File.join(Rails.root, 'spec', 'fixtures')
|
132
|
+
fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
|
133
|
+
|
134
|
+
require 'active_record/fixtures'
|
135
|
+
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
|
136
|
+
Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
|
106
137
|
end
|
107
138
|
end
|
108
139
|
end
|
140
|
+
end
|
109
141
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
142
|
+
namespace :server do
|
143
|
+
daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
|
144
|
+
|
145
|
+
desc "start spec_server."
|
146
|
+
task :start do
|
147
|
+
if File.exist?(daemonized_server_pid)
|
148
|
+
$stderr.puts "spec_server is already running."
|
149
|
+
else
|
150
|
+
$stderr.puts %Q{Starting up spec_server ...}
|
151
|
+
FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
|
152
|
+
system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
|
121
153
|
end
|
154
|
+
end
|
122
155
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
end
|
156
|
+
desc "stop spec_server."
|
157
|
+
task :stop do
|
158
|
+
unless File.exist?(daemonized_server_pid)
|
159
|
+
$stderr.puts "No server running."
|
160
|
+
else
|
161
|
+
$stderr.puts "Shutting down spec_server ..."
|
162
|
+
system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
|
163
|
+
File.delete(daemonized_server_pid)
|
132
164
|
end
|
165
|
+
end
|
133
166
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
167
|
+
desc "restart spec_server."
|
168
|
+
task :restart => [:stop, :start]
|
169
|
+
|
170
|
+
desc "check if spec server is running"
|
171
|
+
task :status do
|
172
|
+
if File.exist?(daemonized_server_pid)
|
173
|
+
$stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
|
174
|
+
else
|
175
|
+
$stderr.puts "No server running."
|
142
176
|
end
|
143
177
|
end
|
144
178
|
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
|
157
179
|
end
|
158
180
|
|
181
|
+
end
|