Whats wrong with this spec?
profile.set_start_date('01/02/2012') expect(profile.start_date).to eq(Date.parse('01/02/2012')
Well, probably a couple things, but for simplicities sake, lets assume that you are using that
Date.parse method in your production code that sets the start date and you are just testing that some process sets the date right. Well the issue is that because you use that method in both the test and the spec, you're certain it is getting set, but it might be getting set one month off without you realizing it. This should be a little better:
expect(profile.start_date.month).to eq(1) #=> fails: expected 1, got 2
So, I would suggest using something that would be an invalid date if the parser doesn't do what you expect to begin with, such that you catch subtle bugs such as this much earlier.
profile.set_start_date = '01/31/2012' #=> internal code throws invalid date error expect(profile.start_date.month).to eq(1)
Thanks for reading!