[email protected] wrote:
[...]
> Now the way I see it, the standard testing framework is
> more than sufficient for my needs and as time goes on it's only going
> to improve. 

Not necessarily.  I don't use Test::Unit, so I could be wrong (and 
someone please correct me if I am), but it seems that all the important 
work these days is being done with RSpec and Cucumber, and Test::Unit 
has more or less stagnated (with a couple of exceptions, such as Phlip's 
plugins).

> So while things like RSpec and Cucumber are all well and
> good - they don't really fit my needs.

Try them out before you say that.

* The reason I don't use Test::Unit is that RSpec has a syntax and 
philosophy that I like much better.  Test::Unit feels clunky and hard to 
use by comparison.

* Cucumber, however, is a completely different animal, complementary to 
RSpec/Test::Unit.  It takes a little while to figure out how to use it, 
but once you do, you'll wonder how you lived without it.  Please don't 
ignore it.

> 
> With that out of the way - I dove right into creating fixtures and --
> halt. Fixtures, while improving - are still cumbersome for nested
> models. Take for example my Quote model - it has_many
> QuotableOperations and QuotableQuantities. When I test them I want to
> have complete associations... Fixtures don't seem to like assigning to
> has_many unless I do it from the belongs_to side (which feels
> unnatural) 

I don't find this to be a problem, but I agree that fixtures are clumsy 
and hard to work with once you get a serious test suite going.  Use 
factories.

> so I gave up on fixtures and started working with Factories
> (Factory Girl)... Now, a few days into Factory Girl and it also seems
> too cumbersome for the job at hand. I'm not sure, but it seems like
> either:
> 
> *I'm doing it wrong*
> 
> or
> 
> *There's a better way*
> 
> Can anyone point me towards the light?

Try Machinist.

> 
> Take this very simple test for example:
> 
> I have a
> 
> Quote(:description => "Some job to quote")
> - with one QuotableOperation(:operation_name => "Engineering")
> - and two QuotableQuantities(:quantity => "5", :rate => "0.21") &
> QuotableQuantities(:quantity => "10", :rate => "0.21")
> 
> :description, :quote_operations and :quote_quantities are
> validate_presence_of'd on the Quote model.
> 
> SO - a simple test like:
> 
> test "the description of the quote is not blank" do
>     ***test***
> end
> 
> seems to be more trouble than it's worth because I need a fully
> associated Quote object.

With Machinist, once you set up the blueprints (which you only have to 
do once), Quote.make will give you a fully associated Quote.

> 
> A helping hand in the right direction would be more than appreciated.

Good luck!  Please ask if you have further questions.

> 
> Thanks,
> - FJM

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to