ApplicationController methods/helpers from rspec
Here's a tiny snippet that will save you some headaches when trying to access a protected ApplicationController method or a helper method (i.e. one that's defined in ApplicationController with helper_method :foo) from an rspec controller spec.
class ApplicationController < ActionController::Base
protected
def my_special_url()
"/special-url"
end
helper_method :my_special_url
end
controller.view_context.my_special_url()
Written by Cezar Halmagean
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#