Skip to content
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

Exception matchers should work for failed futures with await #269

Closed
wants to merge 1 commit into from

Conversation

ceedubs
Copy link

@ceedubs ceedubs commented Jun 5, 2014

This commit just adds a failing test.

I was having trouble figuring out what would actually need to happen to make this work, but I figured a failing test might at least be helpful.

@asflierl
Copy link
Contributor

Ooo, I just ran into the same issue. Here's my example (scala 2.10.4, Specs2 2.3.12-scalaz-7.1.0-M6):

class MeepSpec extends Specification with NoTimeConversions { def is = s2"""
  The road runner should meep twice. $e1
  … for realz.                       $e2
"""

  import scala.concurrent._, duration._

  def e1 = Await.result(Roadrunner.meep, 1 second) should throwA[RuntimeException]
  def e2 = Roadrunner.meep should throwA[RuntimeException].await

  object Roadrunner {
    def meep = Future[String](sys error "meep meep")
  }
}

I'd expect e2 to work just like e1.

My rough guess is that the cause is in line 45 in FutureMatchers.scala. I think the map on the value of the Expectable only applies the matcher to the success case and ignores the failure path of the future.

@etorreborre
Copy link
Owner

Andreas, I realize that you have a version of specs2 for scalaz-7.1.0-M6 and the current SNAPSHOT won't work for you. When do you need the fix?

@asflierl
Copy link
Contributor

Thanks for the quick fix, Eric! It's not urgent for us, we can work with manually awaiting things for now, it's only 1 or 2 lines of code change because everything is hidden away in custom matchers. So take your time, we'll be fine. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants