I'm trying to use a method from a helper module, but rspec does not seem to recognize the test helpers in spec/features . Note that the only change to spec_helper.rb was the addition of require 'capybara/rspec' .
I tried moving helper.rb to spec/support , spec/helpers and spec/features (the directory containing my tests), but no luck. The test continues to indicate that the helper method is undefined.
The only way to make it βworkβ is to move my test to another directory, for example spec/integration . But now capybara will not work ( visit undefined ) because it is not in spec/features .
Here is my helper module ( authentication_helper.rb ):
module AuthenticationHelper def sign_in_as!(user) visit '/users/sign_in' fill_in "Email", with: user.email fill_in "Password", with: "password" click_button "Sign in" page.should have_content("Signed in successfully.") end end RSpec.configure do |c| c.include AuthenticationHelper, type: :request end
source share