Testing (RSpec) with Devise's confirmable module

In your test environment ActionMailer::Base.delivery_method should be set to :test, which means that these emails will not be sent out. If this setting is set to something else such as smtp by way of a configuration in say config/environments.rb, then emails will be sent out.

If that setting's already there, then to use the User object (as in, to be actually able to log in) you'll need to call confirm! on it:

user = User.first
user.confirm!

for latest FactoryGirl version:

FactoryGirl.define do

  factory :confirmed_user, :parent => :user do
    after(:create) { |user| user.confirm! }
  end

end

If you are using factory_girl to generate your models, you can use after_create to confirm each new user.

Factory.define :confirmed_user, :parent => :user do |f|
  f.after_create { |user| user.confirm! }
end