How to include a module in a factory_girl factory?
I'm trying to reuse a helper method in all my factories, however I cannot get it to work. Here's my setup: Helper module (in spec/support/test_helpers.rb) module Tests module Helpers # not guaranteed to be unique, useful for generating passwords def random_string(length = 20) chars = ['A'..'Z', 'a'..'z', '0'..'9'].map{|r|r.to_a}.flatten (0...length).map{ chars[rand(chars.size)] }.join end end end A factory (in spec/factories/users.rb) FactoryGirl.define do factory :user do sequence(:username) { |n| "username-#{n}" } password random_string password_confirmation { |u| u.password } end end If I