RSpec can't see Rails models -
i have rspec specification:
require 'spec_helper' describe 'session_project' before(:each) @user = user.create( username: 'user', password: 'test', password_confirmation: 'test', email: 'user@example.com' ) @project = project.create(name: 'project 1', active: true, user_id: @user.id) end context 'when on project page project 1' 'knows current project project 1' pending end end end # , on.
user
, project
models of course of study - want test current project beingness saved , cleared session @ right times. when run rspec, complains:
failure/error: @user = user.create( nameerror: uninitialized constant user
if cut-and-paste user.create
rails console creates user fine.
previous people have asked similar problems needed add together require 'spec_helper'
, i've done that. how create rails models available rspec?
under rspec 3.x need rails_helper
if want rails classes loaded up.
https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files
ruby-on-rails-4 rspec
No comments:
Post a Comment