-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
acts_as_list_no_update #244
Conversation
ping @brendon |
Hi @randoum, here in New Zealand it's summer and this is our holiday period so I've not been in work mode for some weeks. I'm not ignoring you, just not working on anything right now. I had marked your message to follow up later. The reason why I haven't moved to accept this PR on my own is that I don't own this project and this seems like a reasonably big feature. I'd rather @swanandp sign it off first. @swanandp, looking at the latest code, it seems like a much cleaner solution. Can you give some input and then we can put this one to bed. |
Alright, let's go ahead with this one. We will need to push a new release. |
@brendon Please don't feel like you don't really own this repo, I am perfectly fine if you take decisions. Though, I do agree that on major additions like these, it's best if two people signed off. |
Great guys, thanks for stepping in. |
Thanks @swanandp, that's very helpful :) I agree, a minor release would be appropriate. @randoum, I didn't notice that the postgres tests had failed. The
By default the You might need to tweak this stuff locally to get the tests running. To execute the tests against postgres you just set the environment I hope that helps. Also have a look at the travis test runs. There are a lot of ruby warnings in there that need to be eliminated etc.. These won't show for you locally because ruby hides these by default. |
Concerning the warnings, I see them alright. They are coming from spec lines Bottom line, I propose to leave it like this for now, and then in a next PR work on refactoring the tests. I propose this cause 1) I don't want to touch other unrelated code, for clarity of this PR and 2) there are other improvement that can be done. Examples :
And so on, so perhaps all refactoring could be done in one single PR. What do you think ? |
Also, I'll add : using |
Tests fixed, the problem was just coming from the way PostgreSQL was sorting records |
last1.insert_at(1) | ||
last2.insert_at(1) | ||
assert_equal [1, 2, 3, 4, 5], ListMixin.where(parent_id: 20).order('pos').map(&:pos) | ||
if ENV['DB'] == 'postgresql' and $default_position.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use this: http://stackoverflow.com/a/20959470/129798
So instead of changing what's expected, augment the scope conditionally:
ListMixin.where(parent_id: 20).order('pos NULLS FIRST').map(&:pos)
Thanks @randoum, just added a small note to one line. I was perusing the tests which I hadn't done closely before and noticed how tests for this new feature are interspersed among existing test cases. My initial instinct is that it'd be easier to reason about the tests overall if this feature is tested in its own space/file. Can you explain why you've done it this way? :) |
I agree with your idea to fix those warnings in a different PR. Let's focus on getting this one merged :) Also, is there anything additional that RequestStore does that we should be doing with regards to Thread? |
Because the existing tests was more integration than unit test, i.e you are running a small scenarios where you test records interactions between each others. So I follow the same pattern, and integrated And yes, it would be good to have unit tests AND integration tests, which is not the case now because we only have integration tests (I means kind-of-integration test)
Not in our case. RequestStore is useful if you call Thread variables at different places of your code. Here we call a Thread variable in one single location and clean it in a |
Done |
@randoum, looks like Rails has no support for |
RE your comments on testing. That makes sense, and thank you for documenting that here for future use :) |
Nah it was my fault, though all tests was green on my machine. |
Thanks @randoum, all merged now :) Thank you for your commitment!! |
Awesome |
No description provided.