Sha256: 6d88b4e99e2d8508c71d8b880036fa3fcd0feae7088441f8034fcbe40acbe65d

Contents?: true

Size: 648 Bytes

Versions: 11

Compression:

Stored size: 648 Bytes

Contents

UNHANDLED_REJECTIONS = []
# In Firefox promise events are disabled by default.
# We need to enable them in about:config.
window.REJECTION_EVENTS_SUPPORTED = ("onunhandledrejection" in window)

beforeAll ->
  window.addEventListener 'unhandledrejection', (event) ->
    UNHANDLED_REJECTIONS.push(event)

beforeEach ->
  UNHANDLED_REJECTIONS = []

  jasmine.addMatchers
    toHaveUnhandledRejections: (util, customEqualityTesters) ->
      compare: (actual) ->
        # It doesn't really matter what's in actual.
        # A good way to call this is e.g. `expect(window).not.toHaveUnhandledRejections()
        pass: UNHANDLED_REJECTIONS.length > 0

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-1.0.1 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-1.0.0 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.62.1 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.62.0 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.61.1 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.61.0 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.60.3 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.60.2 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.60.1 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.60.0 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee