Hi guys

Thanks for the many replies, I appreciate the support. I posted that and 
disappeared a little!

Warren, Pat, Ben - I know what you mean, there's a thin line between testing 
rails features and testing my own code. I suppose as a newbie I was writing the 
tests to give myself a level of confidence. Perhaps in a few months I'll not 
even consider testing such things. Also, I hadn't considered that a higher 
level integration test would pick this up anyway. Thanks.

Ben, Warren - I especially appreciate you describing an alternative 
(test-driven) mindset. As you can tell I'm from a database model-first 
background and that's why I've started here.  

Brian - good to see you on here putting your ten-cents in, it's appreciated 
too. I thought I'd put the records into the database so that I could later test 
that (for example) I wasn't able to associate a release and an artist twice. 
Perhaps that wasn't necessary though because in rails I'd probably restrict 
that in the model rather then with a composite primary key.

Adam - I need to get myself into the BDD mindset too. If you've settled on 
using Remarkable then it's definitely something I'll have a look at using.

Matt - thanks for the link to the article. I'm about to sit down with a cup of 
tea right now and have a gander. From the outset I like the look of your suite. 
Reminds me of that used by Ryan Bates…

I think the general conclusion I've come to is that; it's reasonable, if not a 
bit conservative, to test the more complex associations between your models, 
but there are probably more fast and concise tools/syntaxes that can be used to 
express the tests. I get a warm feeling that my specs are green - showing me 
that my models are associated as intended - but perhaps if I TDD/BBD'd the 
application from interface down instead of database up then I would have 
implicitly tested these relationships in my integration tests anyway…

Again guys, really appreciate the feedback. It's good to have a source for 
vibrant discussion at my fingertips. I'm a month 'off the boat' from Scotland 
so I haven't met any of you guys in person yet, but I'll be there to say help 
at this months gathering.

Stu  


On Saturday, 10 September 2011 at 21:11, Matt wrote:

> Stuart I did some research on the current practices as I wanted to
> know too - wrote up my findings here:
> http://webtempest.com/ruby-on-rails-3-testing-getting-into-the-groove/
>  
> On Sep 10, 3:53 pm, Stuart Liston <[email protected] 
> (http://gmail.com)> wrote:
> > Hi ladies and gents
> >  
> > I joined this group a few week ago and keep an eye on it but am a little too
> > 'green' to help out a lot of the time. Instead, my first mail will be to
> > look for advice!
> >  
> > I'm looking to test some model (HABTM) relationships in a small application
> > I'm building, and I'm keen to show some more experienced developers how I'm
> > going about it so that I don't start to get into bad habits.
> >  
> > So with that in mind, does anyone fancy having a quick gander over the
> > following gist and telling me if I'm approaching the problem in a reasonable
> > way? My specs *are* green, it's more a 'best practice' thing...
> >  
> > https://gist.github.com/1207931
> >  
> > (The assumption would be that I have rspec and factorygirl set up correctly)
> >  
> > Thanks for your time in advance!
> > Stu
>  
> --  
> 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] 
> (mailto:[email protected]).
> To unsubscribe from this group, send email to 
> [email protected] 
> (mailto:[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].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to