run callback on factorygirl
===

I have a callback in my `user.rb` model something like:

    class User
      include Mongoid::Document
      include Mongoid::Timestamps::Created
       .
       .
       .
       .
        #add a first board for user
        after_create :first_board
          def first_board
            board = self.boards.new(:title => self.username, :category_id => Category.find_or_create_by(slug: "other"))
            board.save!
          end
    end

When a user is created, the app create a new board with above callback.

In my `spec/factories/users.rb` I have:

    FactoryGirl.define do
      factory :user do
        name 'Test User'
        username 'test username'
        password 'please'
        password_confirmation 'please'
        # required if the Devise Confirmable module is used
        confirmed_at Time.now
      end
    end

In my `spec/controllers/users_controller_spec.rb` I have:

    require 'spec_helper'
    
    describe UsersController do
      before :each do
        request.env['devise.mapping'] = Devise.mappings[:user]
      end
      include Devise::TestHelpers
      before (:each) do
        @user = FactoryGirl.create(:user)
        sign_in @user
      end
    
      describe "GET 'show'" do
        
        it "should be successful" do
          get :show, :id => @user.id
          response.should be_success
        end
        
        it "should find the right user" do
          get :show, :id => @user.slug
          assigns(:user).should == @user
        end
        
      end
    
    end

**How can I run my callback with factorygirl?**

**I get 2 errors:**

    Failures:
    
      1) UsersController GET 'show' should be successful
         Failure/Error: @user = FactoryGirl.create(:user)
         Errno::ECONNREFUSED:
           Connection refused - connect(2)
         # (eval):2:in `post'
         # ./app/models/user.rb:190:in `first_board'
         # ./spec/controllers/users_controller_spec.rb:10:in `block (2 levels) in <top (required)>'
    
      2) UsersController GET 'show' should find the right user
         Failure/Error: @user = FactoryGirl.create(:user)
         Errno::ECONNREFUSED:
           Connection refused - connect(2)
         # (eval):2:in `post'
         # ./app/models/user.rb:190:in `first_board'
         # ./spec/controllers/users_controller_spec.rb:10:in `block (2 levels) in <top (required)>'

