One of my rspec tests fails because I can't use a helper method on a decorator rendering a view, while the view works perfectly while running the server normally, here's the error
1) dashboard/index.html.haml render all translations
Failure/Error: render
ActionView::Template::Error:
undefined method `dashboard?' for #<#<Class:0x0000000a9d1020>:0x0000000c2286f0>
the following method is a simple boolean check called inside a decorator method called from the rendered view:
items << h.link_to(...) if h.dashboard?
And the helper method:
def dashboard?
controller_name == "dashboard"
end
I can import the helper module into the decorator but then the error changes to controller_name is undefined, so I guess my question is in two parts:
One, how can I get the helper method to work when the decorator is called from a rendered view through Rspec, and two, how can I set the controller_name to work within the Rspec test.