Commit 9928c540f8307c859ee7db1e043b9e56f8d4ec9f

Authored by Braulio Bhavamitra
1 parent d908c1c1

people_block: add url_for for views (fix tests)

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 5 # Re-raise errors caught by the controller.
... ...
plugins/people_block/test/unit/friends_block_test.rb
1   -require File.dirname(__FILE__) + '/../test_helper'
  1 +require_relative '../test_helper'
2 2  
3 3 class FriendsBlockTest < ActionView::TestCase
4 4  
... ...
test/test_helper.rb
... ... @@ -154,6 +154,21 @@ class ActiveSupport::TestCase
154 154 self.class.action_view.render(*args)
155 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 172 private
158 173  
159 174 def uses_host(name)
... ... @@ -234,10 +249,6 @@ module NoosferoTestHelper
234 249 def will_paginate(arg1, arg2)
235 250 end
236 251  
237   - def url_for(args = {})
238   - args
239   - end
240   -
241 252 def javascript_tag(any)
242 253 ''
243 254 end
... ...