Skip to content

Commit

Permalink
Avoid erroring if _subscribers undefined
Browse files Browse the repository at this point in the history
It's possible for tests to error during setup before setup_subscriptions
has run. In that case we should avoid erroring in teardown to avoid
confusing the source of the issue.
  • Loading branch information
jhawthorn committed May 5, 2020
1 parent 2308945 commit a60b3da
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/rails/controller/testing/template_assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def setup_subscriptions
end

def teardown_subscriptions
return unless defined?(@_subscribers)
@_subscribers.each do |subscriber|
ActiveSupport::Notifications.unsubscribe(subscriber)
end
Expand Down

0 comments on commit a60b3da

Please sign in to comment.