I should clarify what I mean by syntax, sorry. By syntax I mean that in
factory_girl you can do this to define a named factory:

Factory.define :admin, :class => User do |u|
  u.admin               true
end

This gives you access to Factory(:admin). But now think about it like this:
say you want to set up a three-level relationship between Account, Project
and Tickets. You want to create three different setups for testing. To do
this in Factory Girl, you'd have to do:

Factory.define :one, :class => Account do |a|
  a.name "Blah"
end

And then you *could try* to do:

Factory.define :one, :class => Project do |p|

But you'd be overriding the first Factory. You'd instead have to call it
something like account_one and project_one, which is just fugly.

In Machinist however, named blueprints are done on the class so you CAN
define a blueprint with the same name for two different classes:

Account.blueprint(:one) do
  name "Blah"
end

Project.blueprint(:one) do
  name "Longest project ever."
end

And that, is why I love Machinist.



On 21 April 2010 13:39, Pat Allan <[email protected]> wrote:

> Agreed - I find the syntax of Machinist to be far nicer than Factory Girl.
> And there are some *awesome* improvements coming in Machinist v2.
>
> --
> Pat
>
> On 21/04/2010, at 1:30 PM, Ryan Bigg wrote:
>
> > Another +1 to Machinist, use it everywhere. Not because Pete is awesome,
> but I prefer the syntax for defining named blueprints over named factories.
> >
> > On 21 April 2010 13:13, Julian Doherty <[email protected]>
> wrote:
> > Using machinist for a few projects at the moment (mainly because it's
> pretty useful, not just cause Pete Yandell would give me a disapproving
> sneer if I didn't :P )
> >
> >
> > On 21 April 2010 12:59, Jonathan Clarke <[email protected]> wrote:
> > At Railscamp I think he mentioned that he was working on Machinist 2,
> looking forward to checking it out!
> >
> > Jonathan
> >
> >
> > On 21 April 2010 12:55, James Healy <[email protected]> wrote:
> > Jono wrote:
> > > Does anyone know if there any significant differences between the two
> > > libraries apart from syntax that make one stand out from the other?
> >
> > There's at least one significant difference, Machinist is by Pete
> > Yandell ('our Pete').
> >
> > Piffle at technical merits, buy Australian! :)
> >
> > -- James Healy <[email protected]>  Wed, 21 Apr 2010 12:53:27 +1000
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<rails-oceania%[email protected]>
> .
> > For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<rails-oceania%[email protected]>
> .
> > For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<rails-oceania%[email protected]>
> .
> > For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
> >
> >
> >
> > --
> > Ryan Bigg / Radar
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected]<rails-oceania%[email protected]>
> .
> > For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rails-oceania%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>
>


-- 
Ryan Bigg / Radar

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to