plataformatec/devise — Issue #1478: rspec-undefined method `destroyed?' for nil:NilClass
Author: railsfactory-dhibika
Created: 2011-12-01 06:23:11+00:00
State: open

describe GuardiansController do

before(:each) do
@user_attr = Factory.attributes_for(:user)
@current_user=User.create!(@user_attr)
end

In factories.rb

Factory.define :user, :class => User do |a|
a.email "parent@gmail.com"
a.password "123456"
a.password_confirmation "123456"
a.first_name "user"
a.last_name "user"
a.account_role "Parent"
a.sign_in_count "50"
a.current_sign_in_at "2011-11-28 06:13:41"
a.last_sign_in_at "2011-11-28 06:13:41"
a.current_sign_in_ip "127.0.0.1"
a.last_sign_in_ip "127.0.0.1"
end

But when i execute rspec for this controller it shows error
Failure/Error: @current_user=User.create!(@user_attr)
NoMethodError:
undefined method `destroyed?' for nil:NilClass

How i get the @current_user