I have trying to solve an issue with my Spec tests and I get the following error Failures:

  1) SessionsController POST 'create' with valid email and password should sign in the user
     Failure/Error: Unable to find matching line from backtrace
     SystemStackError:
       stack level too deep
     # /Users/Aurelien/.rvm/gems/ruby-1.9.2-p290@rails3/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:103

Finished in 37.77 seconds
9 examples, 1 failure

Failed examples:

rspec ./spec/controllers/sessions_controller_spec.rb:35 # SessionsController POST 'create' with valid email and password should sign in the user

Prior to this I had problems with associations with my factories.

Factory.define :role do |role|
  role.name                   "Registered"
  role.association :user, :factory => :user
end

Factory.define :admin do |role|
  role.name                   "Admin"
  role.association :user, :factory => :user
end

Factory.define :user do |user|
  user.first_name             "Foo"
  user.last_name              "Bar"
  user.email                  "foo@bar.com"
  user.password               "foobar"
  user.password_confirmation  "foobar"
  user.status                 "At foobar"
  user.description            "Lorem Ipsum sit dolor amet."
  user.username               "foobar"
  user.association :role, :factory => :role
  user.association :admin, :factory => :role
end

Factory.define :user_with_admin_role, :parent => :user do |user|
  user.after_create { |u| Factory(:role, :user => u) }
end

Factory.define :reg_user do |user|
  user.first_name             "bar"
  user.last_name              "foo"
  user.email                  "bar@foo.com"
  user.password               "foobar"
  user.password_confirmation  "foobar"
  user.status                 "At foobar"
  user.description            "Lorem Ipsum sit dolor amet."
  user.username               "barf
Edit
Report