C'mon guys, I know this problem can't be that hard to tackle. Is there anyone out there with some helpful insight?
On Aug 11, 1:35 am, "[email protected]" <[email protected]> wrote: > A little background: > I've been enjoying rails for about a year now tinkering on meaningless > projects here solely for the purpose of learning the framework... not > because I actually needed to use those apps for anything serious. Now > that I started writing my first serious app, naturally I want to dive > into test driven development ("finally" I know - please, no harassment > - I'm trying). 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. So while things like RSpec and Cucumber are all well and > good - they don't really fit my needs. > > 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) 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? > > 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. > > A helping hand in the right direction would be more than appreciated. > > Thanks, > - FJM --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

