addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonJoin Group on CardStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Re: [ruby-89] Fixture Alternatives

From: Elijah M.
Sent on: Thursday, January 15, 2009 10:49 AM
Miles,

Perhaps I haven't researched the alternatives enough, but I've been
pretty content with valid_model_attribut­es style factories.

  def valid_user_attrs(att­rs = {})
    {
      :name => 'Jerko',
      :login => 'jerko'
    }.merge(attrs)
  end

Somtimes you would like to avoid a costly db operation.

  User.new(valid_user_­attrs(:login => 'jerko2'))


Othertimes you're testing something that requires a db row.

   User.create(valid_us­er_attrs(:login => 'jerko2'))


Certainly the usage is a bit verbose but it's been "available" since
the earliest days of Rails!


On Thu, Jan 15, 2009 at 10:12 AM, Miles Z. Sterrett
<[address removed]> wrote:
> Ladies and Gentlemen -
>
>   I am going to give a presentation on Rails fixture alternatives at the
> February meeting (or, perhaps Davey and I will join forces once again).
> Although I tend to stick to factory_girl, I would like to learn, and teach,
> other alternatives.  Do you have any requests or suggestions?  Is there any
> fixture alternative in which you are particularly interested?  Would you
> rather not hear about alternatives and just hear about how to manage vanilla
> fixtures as your project gets huge?  (Do note that I have decided the answer
> to that question is "use something other than vanilla fixtures", but I am
> willing to look into alternatives to using fixture alternatives.  HA!)
>
>  So, what do you want to hear about?
>
>  Some possibilities:
>
> * Fixture Replacement: http://replacefix...­
> * Dataset, which is the evolution of Scenarios (which is 'deprecated'):
> http://github.com...­
> * ObjectDaddy: http://github.com...­
> * FactoryGirl:
> http://giantrobot...­
>
>   Those are just the ones of which I am aware -- feel free to suggest
> others!
>
>
> MilesZS
>
>
>
>
> --
> Please Note: If you hit "REPLY", your message will be sent to everyone on
> this mailing list ([address removed])
> This message was sent by Miles Z. Sterrett ([address removed]) from
> indy.rb - The Indianapolis Ruby Brigade.
> To learn more about Miles Z. Sterrett, visit his/her member profile
> To unsubscribe or to update your mailing list settings, click here
>
> Meetup Support: [address removed]
> 632 Broadway, New York, NY 10012 USA

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy