Railroad Tycoon
Railroad Tycoon

Reputation: 147

Rspec fails to load support files

I cannot get rspec to load support files, have tried:

config.include SessionHelper, :type => :controller

In the spec_helper file, Which gives me

NameError: uninitialized constant SessionsSpecHelper

Adding:

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

Gives me:

NoMethodError: undefined method `join' for nil:NilClass

Adding:

require 'support/session_helpers.rb'

Provides no difference

support/session_helper.rb:

module SessionHelpers
def sign_up_with(email, password)
  visit sign_up_path
  fill_in 'Email', with: email
  fill_in 'Password', with: password
  click_button 'Sign up'
end

def sign_in
  user = create(:user)
  visit sign_in_path
  fill_in 'Email', with: user.email
  fill_in 'Password', with: user.password
  click_button 'Sign in'
end
end

Upvotes: 0

Views: 501

Answers (1)

Shani
Shani

Reputation: 2541

Have you noticed the error config.include SessionsHelper, :type => :controller has Sessions

while your module module SessionHelpers has Session

Upvotes: 1

Related Questions