Skip to content

Conversation

@nashby
Copy link
Contributor

@nashby nashby commented Mar 18, 2016

I couldn't find an easy way to test that method is called in minitest though.
fixes #56

@nashby nashby force-pushed the after-commit-callback branch from 302777a to 0986c14 Compare April 24, 2016 13:25
@nashby
Copy link
Contributor Author

nashby commented Apr 24, 2016

I fixed merge conflicts.


attr_reader :after_commited

def foo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @nashby. Could you change the name of this method to something more descriptive. This will provide insight into why we're including this in the test_helper.rb down the line.

Something like set_after_committed_flag should do.

@nashby nashby force-pushed the after-commit-callback branch from 0986c14 to 0488f44 Compare May 9, 2016 21:26
@nashby
Copy link
Contributor Author

nashby commented May 9, 2016

@michaeldupuisjr thanks for the review! I've updated PR.

comment = Comment.create
comment.destroy

comment.after_committed.must_equal true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spec does not demonstrate that destroying objects fires the after_commit callback. Indeed, it will still pass if line 266 is removed altogether. This is because the #create also runs the after_commit callbacks, so the flag is already set before #destroy is even run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, but I have after_commit with on: :destroy option. It shouldn't be called on create, should it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I overlooked that; you are absolutely correct.

deletes original comment

@alecdotninja
Copy link
Contributor

Great minds think alike! 😉 It seems that I have duplicated this effort in #71.

@michaeldupuisjr
Copy link
Contributor

Sorry @nashby but it looks like this branch may need to be rebased.

I'll get this merged in once tests are green.

@nashby nashby force-pushed the after-commit-callback branch from 0488f44 to ae82efb Compare May 24, 2016 21:43
@nashby
Copy link
Contributor Author

nashby commented May 24, 2016

@michaeldupuisjr no problem. I rebased. Let's wait for specs to be 💚 .

@michaeldupuisjr michaeldupuisjr merged commit 6db3ea2 into DavyJonesLocker:master May 25, 2016
@nashby nashby deleted the after-commit-callback branch May 25, 2016 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants