Sentry-ruby: New features in 2.7.0 break my tests

Created on 11 Oct 2017  路  11Comments  路  Source: getsentry/sentry-ruby

The functionality in controller_transaction.rb seems to blow up my tests with the following error:

ArticlesController GET #show returns http success
     Failure/Error: get :show, params: { id: article.uuid }

     LocalJumpError:
       no block given (yield)
     # /Users/chase/.rvm/gems/ruby-2.3.3/gems/sentry-raven-2.7.0/lib/raven/integrations/rails/controller_transaction.rb:8:in `block (2 levels) in included'
     # /Users/chase/.rvm/gems/ruby-2.3.3/gems/devise-4.3.0/lib/devise/test/controller_helpers.rb:33:in `block in process'
     # /Users/chase/.rvm/gems/ruby-2.3.3/gems/devise-4.3.0/lib/devise/test/controller_helpers.rb:100:in `catch'
     # /Users/chase/.rvm/gems/ruby-2.3.3/gems/devise-4.3.0/lib/devise/test/controller_helpers.rb:100:in `_catch_warden'
     # /Users/chase/.rvm/gems/ruby-2.3.3/gems/devise-4.3.0/lib/devise/test/controller_helpers.rb:33:in `process'
     # ./spec/controllers/articles_controller_spec.rb:45:in `block (3 levels) in <top (required)>'
     # ./spec/rails_helper.rb:49:in `block (2 levels) in <top (required)>'

2.6.3 works just fine. @nateberkopec it looks like someone else mentioned this in the comments on PR #743, so I thought I'd open an issue.

bug

Most helpful comment

Fixed in 2.7.1.

All 11 comments

Ah crap I forgot this didn't work correctly, I'll push a fix tomorrow.

Awesome! Thanks Nate.

This breaks for me on a normal production GET request.
The update should probably be yanked?

That is strange that build has passed all 1760 test examples at CI and fails on simple run within controller. Shouldn't this default use-case been covered with test?

If it's helpful to have a link to an open-source project with failing specs, there's one here.

Looks like tests are failing on 60% of the PRs Dependabot created for this update this morning, so I'll comment in on all of those and let people know you've got a fix incoming.

Given all the feedback here, yanking 2.7.0.

This change worked for my project:

diff --git a/lib/raven/integrations/rails/controller_transaction.rb b/lib/raven/integrations/rails/controller_transaction.rb
index da12a46..23506ba 100644
--- a/lib/raven/integrations/rails/controller_transaction.rb
+++ b/lib/raven/integrations/rails/controller_transaction.rb
@@ -2,12 +2,10 @@ module Raven
   class Rails
     module ControllerTransaction
       def self.included(base)
-        base.class_eval do
-          around_action do |controller|
-            Raven.context.transaction.push "#{controller.class}##{controller.action_name}"
-            yield
-            Raven.context.transaction.pop
-          end
+        base.around_action do |controller, block|
+          Raven.context.transaction.push "#{controller.class}##{controller.action_name}"
+          block.call
+          Raven.context.transaction.pop
         end
       end
     end

I haven't find a way to reproduce it in a test case though :/

I'm 99.8% sure I got this, but can someone confirm that their applications test's pass on https://github.com/getsentry/raven-ruby/pull/774?

Sure thing - checking now.

Fixed in 2.7.1.

Thanks Nate!

Was this page helpful?
0 / 5 - 0 ratings