I am going through this User Authentication tutorial..
http://larsgebhardt.de/user-authentication-with-ruby-on-rails-rspec-and-capybara/
..which uses the gem
There are two problems to fix here.
Firstly, there is the notice from the email_spec
gem. To get rid of this, simply require action_mailer
before email_spec
in your rails_helper.rb
:
require "action_mailer"
require "email_spec"
Actually the email_spec
gem will do this for you (hence the notice), but if you want to get rid of the pesky message, this is the solution.
Secondly, there is the issue of config.include(UserHelper)
. This is actually unrelated to the first issue, and happens because the support/user_helper.rb
file is not included when you try to reference the UserHelper
module.
The reason this happens is because the article you're following was written before RSpec 3, and thus before the Rails configurations moved to the rspec_helper.rb
file. (More information on the upgrade here: https://www.relishapp.com/rspec/rspec-rails/docs/upgrade)
To resolve the problem:
Uncomment this line from rails_helper.rb
:
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
This will load all your files from the spec/support
directory tree.
Move all your configurations from spec_helper.rb
to rails_helper.rb
.