Note that there are some explanatory texts on larger screens.

plurals
  1. POexpected nil not to be a new record
    text
    copied!<p>hello community i'm doing an simple application which an user can be able to registrer (as a new user), so im trying to create a new user with my Usercontroller:</p> <pre><code>class UserController &lt; ApplicationController def create @users = User.new if @users.save flash[:notice] = 'new user was successfully created.' redirect_to posts_path else render :action =&gt; :new end end def new @user = User.new end end </code></pre> <p>here is my rspec test user_controller_spec:</p> <pre><code>require 'spec/spec_helper' describe UserController do it "create new user" do get :create assigns[:users].should_not be_new_record end end </code></pre> <p>when i test it, it show this error:</p> <p>Failures:</p> <p>1) UserController create new user</p> <pre><code> Failure/Error: assigns[:users].should_not be_new_record expected nil not to be a new record # ./spec/controllers/user_controller_spec.rb:7 </code></pre> <p>Finished in 0.15482 seconds 1 example, 1 failure</p> <p>for last here is my model </p> <pre><code>class User &lt; ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me # attr_accessible :title, :body has_many :cars validates_presence_of :email end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload