Created
September 16, 2009 09:04
-
-
Save teigen/187942 to your computer and use it in GitHub Desktop.
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
package cuke4duke | |
/* | |
static typing to the rescue :-) | |
scala version of http://wiki.github.com/aslakhellesoy/cucumber/step-argument-transforms | |
note that this version doesn't need the 'user' hint | |
since we can provide the same hint using types in the stepdefinition | |
*/ | |
class ConvertTest extends ScalaDsl { | |
/* user stuff */ | |
class User(name: String) { | |
def friends_with(user: User): Boolean = true | |
} | |
object User { | |
def find_by_username(name: String): Option[User] = null | |
} | |
var user: User = _ | |
/* the conversion, called Transformed in the ruby verison */ | |
convert[User](name => User.find_by_username(name)) | |
Then("""^(\w+) should be friends with (\w+)$""") { (user: User, friend: User) => | |
assert(user.friends_with(friend)) | |
} | |
/* | |
# feature file | |
Scenario: friend'ing | |
Given ... | |
When ... | |
Then larrytheliquid should be friends with dastels | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment