title: Custom url helper method in presenter causing test error
body: <p>I'm writing tests for a presenter class and am getting the following error when running them, coming from a custom url helper method.</p>
  
  <pre><code>Error:
  PersonPresenterTest#test_0011_should get email icon:
  ArgumentError: arguments passed to url_for can't be handled. Please require routes or provide your own implementation
  app/helpers/people_helper.rb:4:in `link_fa_to'
  app/presenters/base_presenter.rb:14:in `method_missing'
  app/presenters/person_presenter.rb:54:in `email_icon'
  test/presenters/person_presenter_test.rb:59:in `block in &lt;class:PersonPresenterTest&gt;'
  </code></pre>
  
  <p><strong>person_presenter_test.rb</strong></p>
  
  <pre><code> class PersonPresenterTest &lt; ActionView::TestCase
    add_template_helper(PeopleHelper)
  
    def setup
      @person = FactoryGirl.create(:person)
      @presenter = PersonPresenter.new(@person, view)
    end
  
    test 'should get email icon' do
      expected = '&lt;a class="icon-link" href="/people/1"&gt;&lt;i class="fa fa-envelope fa-1x"&gt;&lt;/i&gt;&lt;/a&gt;'
      actual = @presenter.email_icon
      assert_equal(expected, actual)
    end
  end
  </code></pre>
  
  <p><strong>person_presenter.rb</strong></p>
  
  <pre><code>class PersonPresenter &lt; BasePresenter
    presents :person
  
    def email_icon
      link_fa_to('envelope fa-1x', person) if person.email.present?
    end
  end
  </code></pre>
  
  <p><strong>base_presenter.rb</strong></p>
  
  <pre><code>class BasePresenter
    def initialize(object, template)
      @object = object
      @template = template
    end
  
    def self.presents(name)
      define_method(name) do
        @object
      end
    end
  
    def method_missing(*args, &amp;block)
      @template.send(*args, &amp;block)
    end
  end
  </code></pre>
  
  <p><strong>people_helper.rb</strong></p>
  
  <pre><code>module PeopleHelper
  
    def link_fa_to(icon_name, link)
      link_to content_tag(:i, '', class: "fa fa-#{icon_name}"), link, class: "icon-link"
    end
  end
  </code></pre>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>Rails.application.routes.draw do
  
    resources :organisations
    resources :people
    resources :reset_password, only: [:edit, :update, :new, :index, :create]
    resources :dashboards, only: [:index]
    resources :users
  
    get 'profile' =&gt; 'users#show', as: :profile
  
    controller :sessions do
      get 'login' =&gt; :new
      post 'login' =&gt; :create
    end
  
    get '/auth/:provider/callback', to: 'sessions#create'
    get "sessions/create"
    get 'sessions' =&gt; "sessions#destroy", as: :logout
  
    root 'sessions#new'
  end
  </code></pre>
  
  <p>I can test presenter methods which use <code>link_to</code> successfully, and would expect methods calling <code>link_fa_to</code> to 'fall' through to the template in the same way. This is only affecting tests, the method works perfectly when running the application.</p>
  
  <p>Any help much appreciated.</p>
  
  <p><strong>edit:</strong></p>
  
  <p>If I remove <code>add_template_helper(PeopleHelper)</code> from <code>person_presenter_test.rb</code>, the error is:</p>
  
  <pre><code>Error:
  PersonPresenterTest#test_0011_should get email icon:
  NoMethodError: undefined method `link_fa_to' for #&lt;#&lt;Class:0x007fcdb6bb19e0&gt;:0x007fcdb6bb15a8&gt;
  Did you mean?  link_to
  app/presenters/base_presenter.rb:14:in `method_missing'
  app/presenters/person_presenter.rb:54:in `email_icon'
  test/presenters/person_presenter_test.rb:58:in `block in &lt;class:PersonPresenterTest&gt;'
  </code></pre>
  
  <p><strong>edit 2:</strong>
  After updating <code>people_helper.rb</code> to the following in response to Shishir's answer, the error message remains the same:</p>
  
  <pre><code>module PeopleHelper
  
    def link_fa_to(icon_name, link)
      link_to link, class: "icon-link" do
        content_tag(:i, '', class: "fa fa-#{icon_name}")
      end
    end
  
  end
  </code></pre>