Commit 9928c540f8307c859ee7db1e043b9e56f8d4ec9f
1 parent
d908c1c1
Exists in
master
and in
29 other branches
people_block: add url_for for views (fix tests)
Showing
3 changed files
with
18 additions
and
7 deletions
Show diff stats
plugins/people_block/test/functional/people_block_plugin_profile_controller_test.rb
1 | -require File.dirname(__FILE__) + '/../test_helper' | ||
2 | -require File.dirname(__FILE__) + '/../../controllers/people_block_plugin_profile_controller' | 1 | +require_relative '../test_helper' |
2 | +require_relative '../../controllers/people_block_plugin_profile_controller' | ||
3 | 3 | ||
4 | 4 | ||
5 | # Re-raise errors caught by the controller. | 5 | # Re-raise errors caught by the controller. |
plugins/people_block/test/unit/friends_block_test.rb
test/test_helper.rb
@@ -154,6 +154,21 @@ class ActiveSupport::TestCase | @@ -154,6 +154,21 @@ class ActiveSupport::TestCase | ||
154 | self.class.action_view.render(*args) | 154 | self.class.action_view.render(*args) |
155 | end | 155 | end |
156 | 156 | ||
157 | + def url_for args = {} | ||
158 | + args | ||
159 | + end | ||
160 | + | ||
161 | + # url_for inside views (partials) | ||
162 | + # from http://stackoverflow.com/a/13704257/670229 | ||
163 | + ActionView::TestCase::TestController.instance_eval do | ||
164 | + helper Noosfero::Application.routes.url_helpers | ||
165 | + end | ||
166 | + ActionView::TestCase::TestController.class_eval do | ||
167 | + def _routes | ||
168 | + Noosfero::Application.routes | ||
169 | + end | ||
170 | + end | ||
171 | + | ||
157 | private | 172 | private |
158 | 173 | ||
159 | def uses_host(name) | 174 | def uses_host(name) |
@@ -234,10 +249,6 @@ module NoosferoTestHelper | @@ -234,10 +249,6 @@ module NoosferoTestHelper | ||
234 | def will_paginate(arg1, arg2) | 249 | def will_paginate(arg1, arg2) |
235 | end | 250 | end |
236 | 251 | ||
237 | - def url_for(args = {}) | ||
238 | - args | ||
239 | - end | ||
240 | - | ||
241 | def javascript_tag(any) | 252 | def javascript_tag(any) |
242 | '' | 253 | '' |
243 | end | 254 | end |