Skip to content

Instantly share code, notes, and snippets.

@notnoop
Created May 2, 2011 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notnoop/951983 to your computer and use it in GitHub Desktop.
Save notnoop/951983 to your computer and use it in GitHub Desktop.
Sample case to show an infinite recursion in ProtoUser
package code
import org.specs._
import net.liftweb.common._
import net.liftweb.record._
// Please note that program compiles without me providing a save method!
class User extends MegaProtoUser[User] with Record[User] {
def meta = User
def valUnique(errorMsg: => String)(email: String) = Nil
}
object User extends User with MetaMegaProtoUser[User] with MetaRecord[User] {
lazy val user = User.createRecord
def userFromStringId(id: String) : Box[User] = Full(user)
def findUserByUniqueId(id: String) : Box[User] = Full(user)
def findUserByUserName(email: String) : Box[User] = Full(user)
}
object ProtoUserSpec extends Specification {
"ProtoUser save shouldn't cause exception" in {
User.validateUser("1")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment