Your messagae error says:
NameError: undefined local variable or method 'my_preference'
which means that you do not have access to the my_preference method. To make this available in your class, you must include use the module in your class.
You must include your module: SessionsHelper in your PreferencesTest class.
include SessionsHelper
Then the instance method my_preference will be available for use in your test.
So you want to do:
require 'test_helper' require 'sessions_helper' class PreferencesTest < ActionDispatch::IntegrationTest include SessionsHelper test "my test" do ... get user_path(my_preference) end end
source share