I am trying to include a custom helper module in all my feature tests. I have tried creating the module in spec_helper.rb, but I get the following error:
uninitialized constant FeatureHelper (NameError)
Here is my spec_helper.rb as it currently is:
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
include Warden::Test::Helpers
module FeautreHelper
def login
shop = create(:shop)
user = create(:user)
login_as user, scope: :user
user
end
end
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include FeatureHelper, type: :feature
...
...
( The error is from line 23 config.include FeatureHelper, type: :feature
)
Why is my FeatureHelper
module not being detected, and what can I do to ensure that it is?