-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
rspec run_callbacks(:commit) for create action is not working ? #2395
Comments
This looks like something you're running against Rails, if so this is the wrong repo to raise this issue against but it looks like you have transactional fixtures turned on (so you'd never receive an on commit as it's never committed). Regardless you've not provided anything like enough information to reproduce this, vanilla RSpec (of which rspec-core is apart of) has no idea about callback execution. |
Hi @cis-sourabh how did you solve this? I am also facing the same issue. |
Which version of Rails are you using? |
And which version of RSpec? |
I am using Rails 4.2.8.
… On 08-Oct-2020, at 4:27 PM, Phil Pirozhkov ***@***.***> wrote:
Which version of Rails are you using?
Typically, you should use https://github.com/grosser/test_after_commit <https://github.com/grosser/test_after_commit> for Rails 4, and the same is baked in Rails 5+ rails/rails#18458 <rails/rails#18458>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#2395 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AOZYRQWTCVWKVPOXUCLMBXDSJWLKDANCNFSM4SIS75LA>.
|
RSpec 3.9
… On 08-Oct-2020, at 4:30 PM, Phil Pirozhkov ***@***.***> wrote:
And which version of RSpec?
I can't remember if we have should_receive, is this coming from Mocha?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#2395 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AOZYRQUCL64QQZMRNZ7V2RLSJWLTDANCNFSM4SIS75LA>.
|
I'd say give |
Yes, it worked with them gem. Thanks for your time!!
…On Thu, Oct 8, 2020, 4:36 PM Phil Pirozhkov ***@***.***> wrote:
I'd say give test_after_commit a shot.
Provide a snippet of the model/spec.
Anyway, this question is more suitable for StackOverflow, not our bug
tracker.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2395 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOZYRQX4F2UIW7MJYQY6ZULSJWMKTANCNFSM4SIS75LA>
.
|
I am writing a test case for
after_commit
callback:When I am executing test case without putting condition
:on => :create
, it works. But when try to run with condition:on => :create
thenafter_commit
callback is not executing, it skipped.Here below is the testcase which is not working
The text was updated successfully, but these errors were encountered: