Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Refactor unit test for SmartAnswer::Question::Base #2340
I was finding it increasingly hard to read and edit the unit test for
The main change in this PR is the grouping together of related tests into Shoulda contexts. I hope the commits are small enough that you can see what's going on in the diffs - you might need to ignore whitespace changes to make things clearer. I've also extracted a method to DRY up the test code a bit.
See the individual commit notes for details.
Given that I've only made changes to a single unit test and no "production" code, these changes should be pretty low risk, but it would be good if someone could give them the once over.
I don't think we ever rescue this exception, so in that sense the only place the message is used is in Errbit reporting or whatever. I think there is some value in testing this message from the point of view that it is doing String interpolation, but I think you're right that we probably don't need to test the message in both of these tests. That in turn would mean that we wouldn't need so much setup for the one in which we don't test the message.