15 May '12, 1pm

Get your callbacks on with FactoryGirl 3.3!

May 15, 2012 Tagged: factory girl callbacks rails testing Comments (View) Get your callbacks on with Factory Girl 3.3 FactoryGirl 3.3.0 was released this weekend with a slew of improvements. To install, add (or change) your Gemfile: gem 'factory_girl_rails', '~> 3.3.0' New Callback Syntax Callbacks have been revamped to work well in conjunction with custom strategies. Instead of declaring callbacks like this: FactoryGirl.define do factory :user do factory :user_with_posts do after_create {|instance| create_list(:post, 5, user: instance) } end end end you can declare callbacks with before and after , passing the symbol of the callback as the name: FactoryGirl.define do factory :user do after(:custom) {|instance| instance.do_something_custom! } factory :user_with_posts do after(:create) {|instance| create_list(:post, 5, user: instance) } end end end Finally, you can use comp...

Full article: http://robots.thoughtbot.com/post/23039827914/get-your-ca...

Tweets

foams

23isback.com 17 May '12, 4pm

@fowlduck You can get a link to a method, but r...

api.rubyonrails.org 17 May '12, 10pm

Encapsulates the pattern of wanting to validate a password or email address field with a confirmation. For example: Model:...

A Week of Workouts — Prior Fat Girl: Get Shareaholic I try to workout about 5 times a week. I find that once I g...

A Week of Workouts — Prior Fat Girl: Get Sharea...

priorfatgirl.com 17 May '12, 5pm

I try to workout about 5 times a week. I find that once I get out of the habit it is that much harder to get in it. So I h...

Who needs to fly to Barcelona when you can get ...

asiatatlerdining.com 21 May '12, 3am

One of the most popular tourist attractions in Barcelona is La Boqueria, a food market filled with stalls and tapas stands...

Coach has released its fine choices of jewelrie...

coach.com 14 May '12, 6am

© 2012 Coach, Inc. COACH, Coach Signature C Design, Coach Op Art Design, Coach & Tag Design, Coach & Lozenge Design, Coach...

How to Get Rid of Unwanted Backlinks

How to Get Rid of Unwanted Backlinks

searchenginewatch.com 14 May '12, 1pm

Domaintools.com : If you want to find out who owns the site your link is on, visit domain tools or type “whois.sc” in fron...

Pssst....shop our sale online now before it hits our stores, Grab the best bargains before anyone else! xx

Pssst....shop our sale online now before it hit...

modainpelle.com 28 May '12, 3pm

Unfortunately your browser does not hava JavaScript capabilities which are required to exploit full functionality of our s...

@Carleigh91 Hi, you can get 'class travel' passes which will work out cheaper Here's more info

@Carleigh91 Hi, you can get 'class travel' pass...

nexus.org.uk 16 May '12, 8am

The Metro Class travel scheme gives discounted Metro journeys for up to 40 children under 16 years old, and ten accompanyi...

Bored With Your Long Run? Get Stronger by Running Different Types of Long Runs #running

Bored With Your Long Run? Get Stronger by Runni...

runaddicts.net 16 May '12, 6am

Interested in writing for RunAddicts.net? Get started now! Ever since I started running 12 years ago, coaches and other ru...