ruby on rails - uninitialized constant TestFactories (NameError) -
i beginner in ruby on rails , writing "user sign in" spec wiki project, , getting next error:
uninitialized constant testfactories (nameerror)
this sign_in_spec.rb
require 'rails_helper' describe "sign in flow" include testfactories before @user = authenticated_user end describe "successful" "redirects user wikis index" user = authenticated_user visit root_path end end end
this test_factories.rb file:
module testfactories def authenticated_user(options={}) user_options = { email: "email#{rand}@fake.com", password: 'password' }.merge(options) user = user.new(user_options) user.skip_confirmation! user.save user end end
this gemfile:
source 'https://rubygems.org' gem 'rails' grouping :assets gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'bootstrap-sass', '~> 3.2.0' gem 'autoprefixer-rails' gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails' # testing grouping :develpment, :test gem 'rspec-rails' gem 'capybara' gem 'database_cleaner' gem 'factory_girl_rails', '~> 4.0' gem 'pry-rails' end # databases # developemnt gem 'sqlite3'
or can in sepc helper
rspec.configure |config| config.include testfactories end
ruby-on-rails ruby rspec factories
No comments:
Post a Comment