The title is self explanatory.
Everything I\'ve tried led to a \"undefined method\".
To clarify, I am not trying to test a helper method. I am trying to use a he
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.
There's a nice example over in the official rspec-rails documentation:
require "spec_helper"
describe ApplicationHelper do
describe "#page_title" do
it "returns the default title" do
expect(helper.page_title).to eq("RSpec is your friend")
end
end
end