Skip to content

Commit

Permalink
added 2 methods to avoid mixing-in MustExpectations to a Scope at com…
Browse files Browse the repository at this point in the history
…pile-time. fixes #321
  • Loading branch information
etorreborre committed Jan 21, 2015
1 parent e394dfc commit 06ba00c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Expand Up @@ -21,6 +21,8 @@ trait MustExpectations extends Expectations {
override def check[S >: T](r: MatchResult[S]): MatchResult[S] = checkFailure(r)
override def checkResult(r: Result): Result = checkResultFailure(r)
}

protected def `*** If you see this message this means that you have mixed in the MustExpectations trait instead of the MustThrownExpectations trait ***`: Expectations = ???
}

/**
Expand Down
Expand Up @@ -124,14 +124,16 @@ trait NoThrownExpectations extends Expectations {
/**
* This trait represents any Scope that is used to enclose expectations which might be thrown
*/
trait Scope
trait Scope {
protected def `*** If you see this message this means that you have mixed in the MustExpectations trait instead of the MustThrownExpectations trait ***`: Expectations = ???
}

object Scope {
/** typeclass to transform a Scope to a Result */
/** typeclass instance to transform a Scope to a Result */
implicit def scopeAsResult[S <: Scope]: AsResult[S] = new AsResult[S] {
def asResult(t: =>S): Result = { t; Success() }
}
/** typeclass to transform a Scope to a Result */
/** implicit definition to transform a Scope to a Result */
implicit def scopeToResult(t: =>Scope): Result = AsResult(t)
}

Expand Down

0 comments on commit 06ba00c

Please sign in to comment.