Im creating a helper login to my Rspec tests.
On my spec_helper.rb I have:
RSpec.configure do |config|
#adding a login method for all tests
config.include Helpers::Authentication, type: :feature
end
And in my folder -> spec/support/helpers/authentication.rb
module Helpers
module Authentication
def sign_in_as(user)
visit 'spud/user_session/new'
fill_in 'Login', with: ''
fill_in 'Password', with: ''
click_on 'Login'
end
end
end
When I run rspec it gives me this error:
spec_helper.rb:46:in `block in <top (required)>': uninitialized constant Helpers (NameError)
The line 46 its exactly the "config.include Helpers::Authentication, type: :feature"
What Im missing here?
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require_dependency f }
. This loads everything from spec/support. – Sergio Tulentsev