addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [ruby-121] Pairing project question

From: Andy B.
Sent on: Wednesday, March 20, 2013 4:40 PM
Hi Stuart!
Generally one wouldn't test associations. On one hand, checking that the size of the association for a new object is 0 would be like testing the Rails framework itself. On the other hand you might be feeling like "well I have to right the test first, right?"

The usual consensus is that some other higher level test in your app is going to break if this association is not declared, and that is the camp that I personally fall into. If you're writing a method in your model, you'd want to write a test for that, but your entire application is obviously broken and many features will fail if you remove the association, so most people wouldn't test an association.

As for the message board that sounds like a fantastic idea! We should make this happen, but I don't have the access to do so.

Hope you are well and see you soon I'm sure.

- Andy

On Mar 20, 2013, at 4:21 PM, Stuart <[address removed]> wrote:

> I have a question that came up while working on the pairing project.  I am at the point where I need to create the association between contacts and campaigns.  Obviously I can just add the has_many and belongs_to associations, but my question is:  would you create a test for that association first?  If so, what would that test look like?  I'm assuming it would be a model rspec test, maybe something like "campaign.contacts.s­ize.should eql(0)"?
> 
> Also, would it be possible to enable the Message Board feature for this group so we can post questions and answers without sending email to the entire group?
> Thanks!
> Stuart
> 
> 
> 
> 
> 
> --
> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
> http://ruby.meetu...­
> This message was sent by Stuart ([address removed]) from RubyJax.
> To learn more about Stuart, visit his/her member profile: http://ruby.meetu...­
> Set my mailing list to email me
> 
> As they are sent
> http://ruby.meetu...­
> 
> In one daily email
> http://ruby.meetu...­
> 
> Don't send me mailing list messages
> http://ruby.meetu...­
> Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]
> 

Our Sponsors

  • Ascentis

    Hosts meetings and provides pizza and drinks!

People in this
Meetup are also in:

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