Can you tell how to call the method? I have tried SearchHelper::formatResultDate(r.date) and formatResultDate(r.date) but get yet another "undefined method". Thks
–
Helio SantosJan 18 '13 at 16:56

Is that your own helper? Is SearchHelper a module? If so, just replace inlucde ActionView::Helpers by include SearchHelper, and then you should just be able to call the method with formatResultDate(r.date).
–
shioyamaJan 18 '13 at 22:07

For anyone coming late to this question, it is answered on the Relish site.

require "spec_helper"
describe "items/search.html.haml" do
before do
controller.singleton_class.class_eval do
protected
def current_user
FactoryGirl.build_stubbed(:merchant)
end
helper_method :current_user
end
end
it "renders the not found message when @items is empty" do
render
expect(
rendered
).to match("Sorry, we can't find any items matching &quot;&quot;.")
end
end

I'm assuming you're trying to test the helper method. In order to do this you'll have to put your spec file into spec/helpers/. Given you're using the rspec-rails gem, this will provide you a helper method that allows you to call any helper method on it.