Created
October 4, 2011 22:02
-
-
Save wireframe/1262967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/factory_girl_with.rb | |
# replace instance variables and before blocks with memoized factory instances | |
module FactoryGirl | |
module With | |
def with(name, options = {}) | |
let(name) { ::Factory.create(name, options) } | |
end | |
end | |
end | |
# spec/spec_helper.rb | |
# add factory_girl_with extension to rspec env | |
RSpec.configure do |config| | |
config.extend FactoryGirl::With | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment