Created
March 5, 2013 05:11
-
-
Save chrismo/5088177 to your computer and use it in GitHub Desktop.
DIY fixture base class
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
class BaseFixture | |
def self.create(opts={}) | |
fixture = self.new(opts) | |
fixture.save! | |
fixture | |
end | |
end | |
class UserFixture < BaseFixture | |
def self.new(opts={}) | |
User.new({:first_name => 'Joe', :last_name => 'Bob'}.merge(opts)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment