     it "the returned promise should fail with #{msg}", ->
       ended = false
       runs ->
-        promise.call(this)
+        (promise?.call(this) or @promise or @subject)
         .then =>
           block.apply(this, arguments)
           ended = true

    it 'the returned promise should be fulfilled', ->
      ended = false
      runs ->
        promise.call(this)
        .then ->
          expect(true).toBeTruthy()
          ended = true


      @actual? and @actual.then?

    toBeSamePromise: (promise) ->
      notText = if @isNot then " not" else ""
      @message = ->
        "Expected #{@actual}#{notText} to be #{promise}"

      @actual is promise


global.promise = (promise) ->
  should = (msg, block) ->
    it "the returned promise should #{msg}", ->
      ended = false
      runs ->
        (promise?.call(this) or @promise or @subject)
        .then =>
          block.apply(this, arguments)
          ended = true
