I have a helper file in app/helpers/sessions_helper.rb
that includes a method my_preference
which returns the preference of the currently logged in user. I would like to have access to that method in an integration test. For example, so that I can use get user_path(my_preference)
in my tests.
In other posts I read this is possible by including require sessions_helper
in the test file, but I still get the error NameError: undefined local variable or method 'my_preference'
. What am I doing wrong?
require 'test_helper'
require 'sessions_helper'
class PreferencesTest < ActionDispatch::IntegrationTest
test "my test" do
...
get user_path(my_preference)
end
end