rspec-rails 1.3.4 → 2.0.0.a2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. data/.gitignore +1 -7
  2. data/README.markdown +58 -0
  3. data/Rakefile +51 -9
  4. data/example_app_template.rb +33 -0
  5. data/lib/generators/rspec.rb +25 -0
  6. data/lib/generators/rspec/controller/controller_generator.rb +26 -0
  7. data/lib/generators/rspec/controller/templates/controller_spec.rb +15 -0
  8. data/lib/generators/rspec/controller/templates/view_spec.rb +12 -0
  9. data/lib/generators/rspec/helper/helper_generator.rb +11 -0
  10. data/lib/generators/rspec/helper/templates/helper_spec.rb +14 -0
  11. data/lib/generators/rspec/install/install_generator.rb +29 -0
  12. data/lib/generators/rspec/install/templates/lib/tasks/rspec.rake +119 -0
  13. data/lib/generators/rspec/install/templates/script/rspec.tt +4 -0
  14. data/{generators/rspec/templates → lib/generators/rspec/install/templates/spec}/rcov.opts +0 -0
  15. data/{generators/rspec/templates → lib/generators/rspec/install/templates/spec}/spec.opts +0 -0
  16. data/{generators/rspec/templates → lib/generators/rspec/install/templates/spec}/spec_helper.rb +14 -12
  17. data/lib/generators/rspec/integration/integration_generator.rb +12 -0
  18. data/{generators/integration_spec/templates/integration_spec.rb → lib/generators/rspec/integration/templates/request_spec.rb} +0 -0
  19. data/lib/generators/rspec/mailer/mailer_generator.rb +21 -0
  20. data/lib/generators/rspec/mailer/templates/fixture +3 -0
  21. data/lib/generators/rspec/mailer/templates/mailer_spec.rb +14 -0
  22. data/lib/generators/rspec/model/model_generator.rb +22 -0
  23. data/lib/generators/rspec/model/templates/fixtures.yml +19 -0
  24. data/{generators/rspec_model → lib/generators/rspec/model}/templates/model_spec.rb +1 -1
  25. data/lib/generators/rspec/observer/observer_generator.rb +12 -0
  26. data/lib/generators/rspec/observer/templates/observer_spec.rb +5 -0
  27. data/lib/generators/rspec/plugin/plugin_generator.rb +11 -0
  28. data/lib/generators/rspec/plugin/templates/%file_name%_spec.rb.tt +5 -0
  29. data/lib/generators/rspec/plugin/templates/test_helper.rb +5 -0
  30. data/lib/generators/rspec/scaffold/scaffold_generator.rb +112 -0
  31. data/lib/generators/rspec/scaffold/templates/controller_spec.rb +127 -0
  32. data/{generators/rspec_scaffold/templates/edit_erb_spec.rb → lib/generators/rspec/scaffold/templates/edit_spec.rb} +3 -3
  33. data/{generators/rspec_scaffold/templates/index_erb_spec.rb → lib/generators/rspec/scaffold/templates/index_spec.rb} +4 -4
  34. data/{generators/rspec_scaffold/templates/new_erb_spec.rb → lib/generators/rspec/scaffold/templates/new_spec.rb} +3 -3
  35. data/{generators/rspec_scaffold → lib/generators/rspec/scaffold}/templates/routing_spec.rb +4 -0
  36. data/{generators/rspec_scaffold/templates/show_erb_spec.rb → lib/generators/rspec/scaffold/templates/show_spec.rb} +4 -4
  37. data/lib/rspec/rails.rb +2 -0
  38. data/lib/rspec/rails/example.rb +2 -0
  39. data/lib/rspec/rails/example/controller_example_group.rb +31 -0
  40. data/lib/rspec/rails/example/request_example_group.rb +26 -0
  41. data/lib/rspec/rails/matchers.rb +14 -0
  42. data/lib/rspec/rails/transactional_database_support.rb +38 -0
  43. data/lib/rspec/rails/version.rb +16 -0
  44. data/rspec-rails.gemspec +78 -18
  45. metadata +97 -321
  46. data/.document +0 -7
  47. data/Contribute.rdoc +0 -4
  48. data/Gemfile +0 -4
  49. data/Gemfile.lock +0 -27
  50. data/History.rdoc +0 -321
  51. data/License.txt +0 -33
  52. data/Manifest.txt +0 -165
  53. data/README.rdoc +0 -48
  54. data/TODO.txt +0 -17
  55. data/Upgrade.rdoc +0 -148
  56. data/generators/integration_spec/integration_spec_generator.rb +0 -10
  57. data/generators/rspec/CHANGES +0 -1
  58. data/generators/rspec/rspec_generator.rb +0 -72
  59. data/generators/rspec/templates/previous_failures.txt +0 -0
  60. data/generators/rspec/templates/rspec.rake +0 -144
  61. data/generators/rspec/templates/script/autospec +0 -6
  62. data/generators/rspec/templates/script/spec +0 -10
  63. data/generators/rspec_controller/USAGE +0 -33
  64. data/generators/rspec_controller/rspec_controller_generator.rb +0 -47
  65. data/generators/rspec_controller/templates/controller_spec.rb +0 -25
  66. data/generators/rspec_controller/templates/helper_spec.rb +0 -11
  67. data/generators/rspec_controller/templates/view_spec.rb +0 -12
  68. data/generators/rspec_default_values.rb +0 -28
  69. data/generators/rspec_model/USAGE +0 -18
  70. data/generators/rspec_model/rspec_model_generator.rb +0 -35
  71. data/generators/rspec_scaffold/rspec_scaffold_generator.rb +0 -154
  72. data/generators/rspec_scaffold/templates/controller_spec.rb +0 -131
  73. data/generators/rspec_scaffold/templates/helper_spec.rb +0 -11
  74. data/init.rb +0 -9
  75. data/lib/autotest/discover.rb +0 -5
  76. data/lib/autotest/rails_rspec.rb +0 -76
  77. data/lib/spec/rails.rb +0 -26
  78. data/lib/spec/rails/example.rb +0 -48
  79. data/lib/spec/rails/example/assigns_hash_proxy.rb +0 -39
  80. data/lib/spec/rails/example/controller_example_group.rb +0 -285
  81. data/lib/spec/rails/example/cookies_proxy.rb +0 -29
  82. data/lib/spec/rails/example/functional_example_group.rb +0 -106
  83. data/lib/spec/rails/example/helper_example_group.rb +0 -153
  84. data/lib/spec/rails/example/integration_example_group.rb +0 -16
  85. data/lib/spec/rails/example/model_example_group.rb +0 -15
  86. data/lib/spec/rails/example/render_observer.rb +0 -80
  87. data/lib/spec/rails/example/routing_example_group.rb +0 -16
  88. data/lib/spec/rails/example/routing_helpers.rb +0 -66
  89. data/lib/spec/rails/example/view_example_group.rb +0 -203
  90. data/lib/spec/rails/extensions.rb +0 -11
  91. data/lib/spec/rails/extensions/action_controller/rescue.rb +0 -42
  92. data/lib/spec/rails/extensions/action_controller/test_case.rb +0 -16
  93. data/lib/spec/rails/extensions/action_controller/test_response.rb +0 -21
  94. data/lib/spec/rails/extensions/action_view/base.rb +0 -35
  95. data/lib/spec/rails/extensions/active_record/base.rb +0 -45
  96. data/lib/spec/rails/extensions/active_support/test_case.rb +0 -7
  97. data/lib/spec/rails/extensions/spec/matchers/have.rb +0 -23
  98. data/lib/spec/rails/extensions/spec/runner/configuration.rb +0 -45
  99. data/lib/spec/rails/interop/testcase.rb +0 -14
  100. data/lib/spec/rails/matchers.rb +0 -32
  101. data/lib/spec/rails/matchers/ar_be_valid.rb +0 -27
  102. data/lib/spec/rails/matchers/assert_select.rb +0 -180
  103. data/lib/spec/rails/matchers/change.rb +0 -13
  104. data/lib/spec/rails/matchers/have_text.rb +0 -57
  105. data/lib/spec/rails/matchers/include_text.rb +0 -54
  106. data/lib/spec/rails/matchers/redirect_to.rb +0 -126
  107. data/lib/spec/rails/matchers/render_template.rb +0 -129
  108. data/lib/spec/rails/matchers/route_to.rb +0 -149
  109. data/lib/spec/rails/mocks.rb +0 -140
  110. data/lib/spec/rails/version.rb +0 -16
  111. data/spec/autotest/mappings_spec.rb +0 -86
  112. data/spec/rails_suite.rb +0 -7
  113. data/spec/resources/controllers/action_view_base_spec_controller.rb +0 -2
  114. data/spec/resources/controllers/application.rb +0 -9
  115. data/spec/resources/controllers/controller_spec_controller.rb +0 -127
  116. data/spec/resources/controllers/example.txt +0 -1
  117. data/spec/resources/controllers/redirect_spec_controller.rb +0 -70
  118. data/spec/resources/controllers/render_spec_controller.rb +0 -34
  119. data/spec/resources/controllers/rjs_spec_controller.rb +0 -58
  120. data/spec/resources/helpers/addition_helper.rb +0 -5
  121. data/spec/resources/helpers/explicit_helper.rb +0 -46
  122. data/spec/resources/helpers/more_explicit_helper.rb +0 -5
  123. data/spec/resources/helpers/plugin_application_helper.rb +0 -6
  124. data/spec/resources/helpers/view_spec_helper.rb +0 -13
  125. data/spec/resources/models/animal.rb +0 -4
  126. data/spec/resources/models/person.rb +0 -18
  127. data/spec/resources/models/thing.rb +0 -3
  128. data/spec/resources/views/controller_spec/_partial.html.erb +0 -0
  129. data/spec/resources/views/controller_spec/action_setting_flash_after_session_reset.html.erb +0 -1
  130. data/spec/resources/views/controller_spec/action_setting_flash_before_session_reset.html.erb +0 -1
  131. data/spec/resources/views/controller_spec/action_setting_the_assigns_hash.html.erb +0 -0
  132. data/spec/resources/views/controller_spec/action_with_errors_in_template.html.erb +0 -1
  133. data/spec/resources/views/controller_spec/action_with_template.html.erb +0 -1
  134. data/spec/resources/views/controller_spec/non_existent_action_with_existent_template.html.erb +0 -1
  135. data/spec/resources/views/layouts/application.html.erb +0 -0
  136. data/spec/resources/views/layouts/simple.html.erb +0 -0
  137. data/spec/resources/views/objects/_object.html.erb +0 -1
  138. data/spec/resources/views/render_spec/_a_partial.html.erb +0 -0
  139. data/spec/resources/views/render_spec/action_with_alternate_layout.html.erb +0 -0
  140. data/spec/resources/views/render_spec/some_action.html.erb +0 -0
  141. data/spec/resources/views/render_spec/some_action.js.rjs +0 -1
  142. data/spec/resources/views/rjs_spec/_replacement_partial.html.erb +0 -1
  143. data/spec/resources/views/rjs_spec/hide_div.js.rjs +0 -1
  144. data/spec/resources/views/rjs_spec/hide_page_element.js.rjs +0 -1
  145. data/spec/resources/views/rjs_spec/insert_html.js.rjs +0 -1
  146. data/spec/resources/views/rjs_spec/replace.js.rjs +0 -1
  147. data/spec/resources/views/rjs_spec/replace_html.js.rjs +0 -1
  148. data/spec/resources/views/rjs_spec/replace_html_with_partial.js.rjs +0 -1
  149. data/spec/resources/views/rjs_spec/visual_effect.js.rjs +0 -1
  150. data/spec/resources/views/rjs_spec/visual_toggle_effect.js.rjs +0 -1
  151. data/spec/resources/views/tag_spec/no_tags.html.erb +0 -1
  152. data/spec/resources/views/tag_spec/single_div_with_no_attributes.html.erb +0 -1
  153. data/spec/resources/views/tag_spec/single_div_with_one_attribute.html.erb +0 -1
  154. data/spec/resources/views/view_spec/_partial.html.erb +0 -2
  155. data/spec/resources/views/view_spec/_partial_used_twice.html.erb +0 -0
  156. data/spec/resources/views/view_spec/_partial_with_local_variable.html.erb +0 -1
  157. data/spec/resources/views/view_spec/_partial_with_sub_partial.html.erb +0 -1
  158. data/spec/resources/views/view_spec/_spacer.html.erb +0 -1
  159. data/spec/resources/views/view_spec/accessor.html.erb +0 -6
  160. data/spec/resources/views/view_spec/block_helper.html.erb +0 -3
  161. data/spec/resources/views/view_spec/entry_form.html.erb +0 -2
  162. data/spec/resources/views/view_spec/explicit_helper.html.erb +0 -2
  163. data/spec/resources/views/view_spec/foo/show.html.erb +0 -1
  164. data/spec/resources/views/view_spec/implicit_helper.html.erb +0 -2
  165. data/spec/resources/views/view_spec/multiple_helpers.html.erb +0 -3
  166. data/spec/resources/views/view_spec/path_params.html.erb +0 -1
  167. data/spec/resources/views/view_spec/should_not_receive.html.erb +0 -3
  168. data/spec/resources/views/view_spec/template_with_partial.html.erb +0 -5
  169. data/spec/resources/views/view_spec/template_with_partial_using_collection.html.erb +0 -3
  170. data/spec/resources/views/view_spec/template_with_partial_with_array.html.erb +0 -1
  171. data/spec/resources/views/view_spec/view_helpers.html.erb +0 -1
  172. data/spec/spec/rails/example/assigns_hash_proxy_spec.rb +0 -109
  173. data/spec/spec/rails/example/configuration_spec.rb +0 -67
  174. data/spec/spec/rails/example/controller_example_group_spec.rb +0 -307
  175. data/spec/spec/rails/example/controller_isolation_spec.rb +0 -75
  176. data/spec/spec/rails/example/cookies_proxy_spec.rb +0 -87
  177. data/spec/spec/rails/example/error_handling_spec.rb +0 -90
  178. data/spec/spec/rails/example/example_group_factory_spec.rb +0 -112
  179. data/spec/spec/rails/example/helper_example_group_spec.rb +0 -247
  180. data/spec/spec/rails/example/model_example_group_spec.rb +0 -32
  181. data/spec/spec/rails/example/routing_example_group_spec.rb +0 -9
  182. data/spec/spec/rails/example/shared_routing_example_group_examples.rb +0 -237
  183. data/spec/spec/rails/example/test_unit_assertion_accessibility_spec.rb +0 -33
  184. data/spec/spec/rails/example/view_example_group_spec.rb +0 -346
  185. data/spec/spec/rails/extensions/action_view_base_spec.rb +0 -79
  186. data/spec/spec/rails/extensions/active_record_spec.rb +0 -14
  187. data/spec/spec/rails/interop/testcase_spec.rb +0 -70
  188. data/spec/spec/rails/matchers/ar_be_valid_spec.rb +0 -19
  189. data/spec/spec/rails/matchers/assert_select_spec.rb +0 -835
  190. data/spec/spec/rails/matchers/errors_on_spec.rb +0 -37
  191. data/spec/spec/rails/matchers/have_text_spec.rb +0 -69
  192. data/spec/spec/rails/matchers/include_text_spec.rb +0 -62
  193. data/spec/spec/rails/matchers/redirect_to_spec.rb +0 -253
  194. data/spec/spec/rails/matchers/render_template_spec.rb +0 -208
  195. data/spec/spec/rails/matchers/should_change_spec.rb +0 -15
  196. data/spec/spec/rails/mocks/ar_classes.rb +0 -10
  197. data/spec/spec/rails/mocks/mock_model_spec.rb +0 -112
  198. data/spec/spec/rails/mocks/stub_model_spec.rb +0 -80
  199. data/spec/spec/rails/sample_modified_fixture.rb +0 -8
  200. data/spec/spec/rails/sample_spec.rb +0 -8
  201. data/spec/spec/rails/spec_spec.rb +0 -11
  202. data/spec/spec_helper.rb +0 -78
@@ -1,7 +0,0 @@
1
- dir = File.dirname(__FILE__)
2
- Dir["#{dir}/**/*_example.rb"].each do |file|
3
- require file
4
- end
5
- Dir["#{dir}/**/*_spec.rb"].each do |file|
6
- require file
7
- end
@@ -1,2 +0,0 @@
1
- class ActionViewBaseSpecController < ActionController::Base
2
- end
@@ -1,9 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- before_filter :i_should_only_be_run_once,
3
- :only => 'action_with_inherited_before_filter'
4
-
5
- def i_should_only_be_run_once
6
- true
7
- end
8
- private :i_should_only_be_run_once
9
- end
@@ -1,127 +0,0 @@
1
- class ControllerSpecController < ActionController::Base
2
- before_filter :raise_error, :only => :action_with_skipped_before_filter
3
-
4
- def raise_error
5
- raise "from a before filter"
6
- end
7
-
8
- skip_before_filter :raise_error
9
-
10
- prepend_view_path File.join(File.dirname(__FILE__), "..", "views")
11
-
12
- def some_action
13
- render :template => "template/that/does/not/actually/exist"
14
- end
15
-
16
- def some_action_with_implied_template
17
- end
18
-
19
- def action_with_template
20
- render :template => "controller_spec/action_with_template"
21
- end
22
-
23
- def action_which_sets_flash
24
- flash[:flash_key] = "flash value"
25
- render :text => ""
26
- end
27
-
28
- def action_which_gets_session
29
- raise "expected #{params[:session_key].inspect}\ngot #{session[:session_key].inspect}" unless (session[:session_key] == params[:expected])
30
- render :text => ""
31
- end
32
-
33
- def action_which_sets_session
34
- session[:session_key] = "session value"
35
- end
36
-
37
- def action_which_gets_cookie
38
- raise "expected #{params[:expected].inspect}, got #{cookies[:cookie_key].inspect}" unless (cookies[:cookie_key] == params[:expected])
39
- render :text => ""
40
- end
41
-
42
- def action_which_sets_cookie
43
- cookies['cookie_key'] = params[:value]
44
- render :text => ""
45
- end
46
-
47
- def action_with_partial
48
- render :partial => "controller_spec/partial"
49
- end
50
-
51
- def action_with_partial_with_object
52
- render :partial => "controller_spec/partial", :object => params[:thing]
53
- end
54
-
55
- def action_with_partial_with_locals
56
- render :partial => "controller_spec/partial", :locals => {:thing => params[:thing]}
57
- end
58
-
59
- def action_with_errors_in_template
60
- render :template => "controller_spec/action_with_errors_in_template"
61
- end
62
-
63
- def action_setting_the_assigns_hash
64
- @indirect_assigns_key = :indirect_assigns_key_value
65
- end
66
-
67
- def action_setting_flash_after_session_reset
68
- reset_session
69
- flash[:after_reset] = "available"
70
- end
71
-
72
- def action_setting_flash_before_session_reset
73
- flash[:before_reset] = 'available'
74
- reset_session
75
- end
76
-
77
- def action_with_render_update
78
- render :update do |page|
79
- page.replace :bottom, 'replace_me',
80
- :partial => 'non_existent_partial'
81
- end
82
- end
83
-
84
- def action_with_skipped_before_filter
85
- render :text => ""
86
- end
87
-
88
- def action_that_renders_inline
89
- render :inline => "<%= 'inline code' %>"
90
- end
91
-
92
- def action_that_assigns_false_to_a_variable
93
- @a_variable = false
94
- render :text => ""
95
- end
96
-
97
- def action_with_two_arg_render
98
- render :update, :status => 404 do |page|
99
- page.visual_effect :highlight, 'user_list'
100
- end
101
- end
102
-
103
- class RescuedError < Exception; end
104
- class UnRescuedError < Exception; end
105
-
106
- rescue_from RescuedError do |e|
107
- render :text => 'Rescued!'
108
- end
109
-
110
- def rescued_error_action
111
- raise ControllerSpecController::RescuedError
112
- end
113
-
114
- def un_rescued_error_action
115
- raise ControllerSpecController::UnRescuedError
116
- end
117
-
118
- def action_that_returns_headers
119
- render :text => request.headers[params[:header]]
120
- end
121
- end
122
-
123
- class ControllerInheritingFromApplicationControllerController < ApplicationController
124
- def action_with_inherited_before_filter
125
- render :text => ""
126
- end
127
- end
@@ -1 +0,0 @@
1
- This is an example file to download.
@@ -1,70 +0,0 @@
1
- class RedirectSpecController < ApplicationController
2
-
3
- def action_with_no_redirect
4
- render :text => "this is just here to keep this from causing a MissingTemplate error"
5
- end
6
-
7
- def action_with_redirect_to_somewhere
8
- redirect_to :action => 'somewhere'
9
- end
10
-
11
- def action_with_redirect_to_other_somewhere
12
- redirect_to :controller => 'render_spec', :action => 'text_action'
13
- end
14
-
15
- def action_with_redirect_to_somewhere_and_return
16
- redirect_to :action => 'somewhere' and return
17
- render :text => "this is after the return"
18
- end
19
-
20
- def somewhere
21
- render :text => "this is just here to keep this from causing a MissingTemplate error"
22
- end
23
-
24
- def action_with_redirect_to_rspec_site
25
- redirect_to "http://rspec.rubyforge.org"
26
- end
27
-
28
- def action_with_redirect_back
29
- redirect_to :back
30
- end
31
-
32
- def action_with_redirect_in_respond_to
33
- respond_to do |wants|
34
- wants.html { redirect_to :action => 'somewhere' }
35
- end
36
- end
37
-
38
- def action_with_redirect_which_creates_query_string
39
- redirect_to :action => "somewhere", :id => 1111, :param1 => "value1", :param2 => "value2"
40
- end
41
-
42
- # note: sometimes this is the URL which rails will generate from the hash in
43
- # action_with_redirect_which_creates_query_string
44
- def action_with_redirect_with_query_string_order1
45
- redirect_to "http://test.host/redirect_spec/somewhere/1111?param1=value1&param2=value2"
46
- end
47
-
48
- # note: sometimes this is the URL which rails will generate from the hash in
49
- # action_with_redirect_which_creates_query_string
50
- def action_with_redirect_with_query_string_order2
51
- redirect_to "http://test.host/redirect_spec/somewhere/1111?param2=value2&param1=value1"
52
- end
53
-
54
- def action_with_redirect_to_unroutable_url_inside_app
55
- redirect_to :controller => "nonexistant", :action => "none"
56
- end
57
-
58
- def action_with_method_restriction
59
- render :text => ''
60
- end
61
-
62
- def action_to_redirect_to_action_with_method_restriction
63
- redirect_to :action => 'action_with_method_restriction'
64
- end
65
-
66
- def action_with_redirect_to_somewhere_with_status
67
- redirect_to :action => 'somewhere', :status => 301
68
- end
69
- end
70
-
@@ -1,34 +0,0 @@
1
- class RenderSpecController < ApplicationController
2
- prepend_view_path File.join(File.dirname(__FILE__), "..", "views")
3
-
4
- def some_action
5
- respond_to do |format|
6
- format.html
7
- format.js
8
- end
9
- end
10
-
11
- def action_which_renders_template_from_other_controller
12
- render :template => 'controller_spec/action_with_template'
13
- end
14
-
15
- def text_action
16
- render :text => "this is the text for this action"
17
- end
18
-
19
- def action_with_redirect
20
- redirect_to :action => :some_action
21
- end
22
-
23
- def action_with_partial
24
- render :partial => "a_partial"
25
- end
26
-
27
- def action_that_renders_nothing
28
- render :nothing => true
29
- end
30
-
31
- def action_with_alternate_layout
32
- render :layout => 'simple'
33
- end
34
- end
@@ -1,58 +0,0 @@
1
- class RjsSpecController < ApplicationController
2
- prepend_view_path File.join(File.dirname(__FILE__), "..", "views")
3
-
4
- def replace_html
5
- end
6
-
7
- def insert_html
8
- end
9
-
10
- def replace
11
- end
12
-
13
- def hide_div
14
- end
15
-
16
- def hide_page_element
17
- end
18
-
19
- def replace_html_with_partial
20
- end
21
-
22
- def render_replace_html
23
- render :update do |page|
24
- page.replace_html 'mydiv', 'replacement text'
25
- page.replace_html 'myotherdiv', 'other replacement text'
26
- end
27
- end
28
-
29
- def render_replace_html_with_partial
30
- render :update do |page|
31
- page.replace_html 'mydiv', :partial => 'rjs_spec/replacement_partial'
32
- end
33
- end
34
-
35
- def render_insert_html
36
- render :update do |page|
37
- page.insert_html 'mydiv', 'replacement text'
38
- end
39
- end
40
-
41
- def render_replace
42
- render :update do |page|
43
- page.replace 'mydiv', 'replacement text'
44
- end
45
- end
46
-
47
- def render_hide_div
48
- render :update do |page|
49
- page.hide 'mydiv'
50
- end
51
- end
52
-
53
- def render_hide_page_element
54
- render :update do |page|
55
- page['mydiv'].hide
56
- end
57
- end
58
- end
@@ -1,5 +0,0 @@
1
- module AdditionHelper
2
- def plus(addend)
3
- @addend + addend
4
- end
5
- end
@@ -1,46 +0,0 @@
1
- module ExplicitHelper
2
- def method_in_explicit_helper
3
- "<div>This is text from a method in the ExplicitHelper</div>"
4
- end
5
-
6
- # this is an example of a method spec'able with eval_erb in helper specs
7
- def prepend(arg, &block)
8
- begin # rails edge after 2.1.0 eliminated need for block.binding
9
- concat(arg) + block.call
10
- rescue
11
- concat(arg, block.binding) + block.call
12
- end
13
- end
14
-
15
- def named_url
16
- rspec_on_rails_specs_url
17
- end
18
-
19
- def named_path
20
- rspec_on_rails_specs_path
21
- end
22
-
23
- def params_foo
24
- params[:foo]
25
- end
26
-
27
- def session_foo
28
- session[:foo]
29
- end
30
-
31
- def request_thing
32
- request.thing
33
- end
34
-
35
- def flash_thing
36
- flash[:thing]
37
- end
38
-
39
- def method_using_output_buffer
40
- concat("the_text_from_concat")
41
- end
42
-
43
- def method_using_template
44
- update_page { |p| p["#some_id"].replace_html "" }
45
- end
46
- end
@@ -1,5 +0,0 @@
1
- module MoreExplicitHelper
2
- def method_in_more_explicit_helper
3
- "<div>This is text from a method in the MoreExplicitHelper</div>"
4
- end
5
- end
@@ -1,6 +0,0 @@
1
- # Methods added to this helper will be available to all templates in the application.
2
- module ApplicationHelper
3
- def method_in_plugin_application_helper
4
- "<div>This is text from a method in the ApplicationHelper</div>"
5
- end
6
- end
@@ -1,13 +0,0 @@
1
- module ViewSpecHelper
2
- def method_in_helper
3
- "<div>This is text from a method in the ViewSpecHelper</div>"
4
- end
5
-
6
- def method_in_template_with_partial
7
- "<div>method_in_template_with_partial in ViewSpecHelper</div>"
8
- end
9
-
10
- def method_in_partial
11
- "<div>method_in_partial in ViewSpecHelper</div>"
12
- end
13
- end
@@ -1,4 +0,0 @@
1
- class Animal < ActiveRecord::Base
2
- belongs_to :person
3
- validates_uniqueness_of :name
4
- end
@@ -1,18 +0,0 @@
1
- class Person < ActiveRecord::Base
2
- has_many :animals do
3
- def pups
4
- find(:all, :conditions => 'age < 1')
5
- end
6
- def adults
7
- find(:all, :conditions => 'age >= 1')
8
- end
9
- end
10
- validates_presence_of :name
11
-
12
- def add_animal animal
13
- animal.person = self
14
- animals << animal
15
- animal.save
16
- end
17
-
18
- end
@@ -1,3 +0,0 @@
1
- class Thing < ActiveRecord::Base
2
- validates_presence_of :name
3
- end