[rspec-users] rspec-rails - expected helper_method behaviour in view specs

Evgeniy Dolzhenko dolzenko at gmail.com
Thu Nov 11 02:23:41 EST 2010


Not sure why helper_method doesn't work, but just `helper` definetely
works for us
https://github.com/rails/rails/blob/master/actionpack/lib/abstract_controller/helpers.rb#L96
(supports various ways to specify desired helper).

+1 on question about Rails including all helpers vs. RSpec doing it
the Rails 2 way

On Wed, Nov 10, 2010 at 3:18 AM, Jonathan del Strother
<jdelstrother at gmail.com> wrote:
> Heya,
>
> Say I had the following app controller :
> class ApplicationController<ActionController::Base
>  def logged_in?
>    true
>  end
>  helper_method :logged_in?
> end
>
> Under a rspec-rails1 view-spec, a view template would be able to call
> logged_in?.  It seems this behaviour has gone away in rspec-rails2.
> Was this behaviour intentional?  What's the recommended alternative -
> mixing in a helper to stub out all these methods with
> config.include(HelperMethodsStubber, :type=>:view)  ?
>
>
> In addition, rspec-rails1 used to mix all helpers into the view
> template, right?   rspec-rails2 mixes in only the ApplicationHelper
> and the helper for the current spec, but this seems a strange choice
> when Rails includes all helpers by default.
>
> Any thoughts?
>
> -Jonathan
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list