New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow matched_index.unique to be truthy. #156
Conversation
|
That's a good catch, thanks. Is it possible to add a test for this? |
|
I think so. Let me try. |
|
Hm. The existing tests operate at a pretty high level, and I'm not sure what your style is of testing this kind of thing. Normally, I would stub |
|
We try to avoid stubbing the object under test. How about stubbing something on |
|
Sure thing. Let me just figure out how you guys stub things... |
|
It looks like |
|
We use mocha for this project, so that seems close. But I think it's: |
|
Whew, this is looking nasty. Any thoughts? Am I on the right track? |
|
That all seems right except for the first line; the stub. Since we're referencing the |
|
Ahhh, I was trying to use I'm leaving for the Frozen Rails party at the moment, but I'll try to complete this in a few hours. ;) |
|
Oh I should do that too. |
|
So the issue with doing that is that trying to define the table throws errors on the connection. Since it's now a mock. :( |
|
Arhhhh. Right. OK, stub the SUT, and hopefully the test's description will explain why we're doing such a crazy thing. |
|
Updated. Lemme know what you think. Confirmed that it fails without my refactoring, passes with. |
Currently, there is an assumption that `matched_index.unique` will be `true` and not truthy. This is not always the case. This can cause tests to fail, even though they should pass. This allows `matched_index.unique` to be truthy.
|
Merged, thanks! |
|
Woot! |
Currently, there is an assumption that
matched_index.uniquewillbe
trueand not truthy. This is not always the case. This cancause tests to fail, even though they should pass. This allows
matched_index.uniqueto be truthy.This is just a first go to see what you think, I'm more than happy to adjust, as I've never even used shoulda before, to be honest.
This was inspired by https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-core/MM3Lh2M8QBE , more information is there.