-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from agourlay/0.9.1
0.9.1
- Loading branch information
Showing
43 changed files
with
1,023 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
src/main/scala/com/github/agourlay/cornichon/dsl/Assertions.scala
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
src/main/scala/com/github/agourlay/cornichon/dsl/BlockScopedResource.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.github.agourlay.cornichon.dsl | ||
|
||
import com.github.agourlay.cornichon.core.Session | ||
|
||
import scala.concurrent.Future | ||
|
||
trait BlockScopedResource { | ||
|
||
val sessionTarget: String | ||
|
||
val openingTitle: String | ||
val closingTitle: String | ||
|
||
def startResource(): Future[Unit] | ||
|
||
def stopResource(): Future[Unit] | ||
|
||
def resourceResults(): Session | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/scala/com/github/agourlay/cornichon/dsl/CollectionAssertionSyntax.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.github.agourlay.cornichon.dsl | ||
|
||
import com.github.agourlay.cornichon.steps.regular.AssertStep | ||
|
||
trait CollectionAssertionSyntax[A, B] { | ||
def is(expected: A*): AssertStep[Iterable[B]] | ||
def hasSize(expected: Int): AssertStep[Int] | ||
def inOrder: CollectionAssertionSyntax[A, B] | ||
def contain(elements: A*): AssertStep[Boolean] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/main/scala/com/github/agourlay/cornichon/dsl/DslErrors.scala
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
src/main/scala/com/github/agourlay/cornichon/dsl/SessionAssertion.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.github.agourlay.cornichon.dsl | ||
|
||
import com.github.agourlay.cornichon.core.SessionKey | ||
import com.github.agourlay.cornichon.steps.regular.{ AssertStep, CustomMessageAssertion, GenericAssertion } | ||
import com.github.agourlay.cornichon.dsl.SessionAssertionErrors._ | ||
import com.github.agourlay.cornichon.json.JsonAssertions.JsonAssertion | ||
import com.github.agourlay.cornichon.resolver.Resolver | ||
import com.github.agourlay.cornichon.util.ShowInstances._ | ||
|
||
case class SessionAssertion( | ||
private val resolver: Resolver, | ||
private val key: String, | ||
private val indice: Option[Int] = None | ||
) { | ||
|
||
def atIndex(indice: Int) = copy(indice = Some(indice)) | ||
|
||
def is(expected: String) = AssertStep( | ||
title = s"session key '$key' is '$expected'", | ||
action = s ⇒ GenericAssertion(expected, s.get(key, indice)) | ||
) | ||
|
||
def isEqualToSessionValue(other: String, indice: Option[Int] = None) = AssertStep( | ||
title = s"content of session key '$key' is equal to the content of key '$other'", | ||
action = s ⇒ GenericAssertion(s.get(key), s.get(other)) | ||
) | ||
|
||
def isPresent = AssertStep[Boolean]( | ||
title = s"session contains key '$key'", | ||
action = s ⇒ { | ||
val predicate = s.getOpt(key, indice).isDefined | ||
CustomMessageAssertion(true, predicate, keyIsAbsentError(key, s.prettyPrint)) | ||
} | ||
) | ||
|
||
def isAbsent = AssertStep( | ||
title = s"session does not contain key '$key'", | ||
action = s ⇒ CustomMessageAssertion(None, s.getOpt(key, indice), keyIsPresentError(key)) | ||
) | ||
|
||
def asJson = JsonAssertion(resolver, SessionKey(key)) | ||
|
||
} |
Oops, something went wrong.