-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Replacing lambda with proc getting argument error because of it. #21244
Conversation
I can't reproduce the error locally. Can you show the full example for the test method? (I assume you're using |
Here is the full example def test_send_mail
stub_any_instance(Mail::SMTP, instance: Mail::SMTP.new({})) do |instance|
assert_called(instance, :deliver!) do
with_translation 'de', email_subject: '[Anmeldung] Willkommen' do
ActiveSupport::Deprecation.silence do
get '/test/send_mail'
end
assert_equal "Mail sent - Subject: [Anmeldung] Willkommen", @response.body
end
end
end
end |
@kaspth One more example of this test "ActionMailer should be told when Mail gets delivered" do
assert_called(DeliveryMailer, :deliver_mail) do
DeliveryMailer.welcome.deliver_now
end
end Mocha version of this example was test "ActionMailer should be told when Mail gets delivered" do
DeliveryMailer.expects(:deliver_mail).once
DeliveryMailer.welcome.deliver_now
end I can post more examples if you want to see |
@ronakjangir47 can we have a test-case for this? this would be very helpful in the future if someone tries to changed it back to use lambda |
210cb87
to
e49c2cd
Compare
@kaspth @guilleiguaran Added test-case. This problem was only with those methods who needs arguments. |
Didn't understand why that change would fix anything. I verified it locally with:
|
Don't know why Travis didn't put the build here (even after closing/reopening). But: https://travis-ci.org/rails/rails/builds/75992035 |
Replacing lambda with proc getting argument error because of it.
Thanks @kaspth |
assert_called
gives error while calling with block for exampleBefore Change
After Change
\cc @kaspth