In rspec undefined method `destroyed?' for nil:NilClass #205

Closed
railsfactory-dhibika opened this Issue Dec 1, 2011 · 1 comment

Comments

Projects
None yet
2 participants
@railsfactory-dhibika

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

@mislav

This comment has been minimized.

Show comment Hide comment
@mislav

mislav Dec 20, 2011

Owner

What does this have to do with will_paginate?

Owner

mislav commented Dec 20, 2011

What does this have to do with will_paginate?

@mislav mislav closed this Dec 20, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment