daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest May 17th, 2018 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package hello.snippet
  2.  
  3. import org.specs._
  4. import org.specs.runner.JUnit3
  5. import org.specs.runner.ConsoleRunner
  6. import net.liftweb._
  7. import http._
  8. import net.liftweb.util._
  9. import net.liftweb.common._
  10. import org.specs.matcher._
  11. import org.specs.specification._
  12. import Helpers._
  13. import lib._
  14.  
  15.  
  16. class HelloWorldTestSpecsAsTest extends JUnit3(HelloWorldTestSpecs)
  17. object HelloWorldTestSpecsRunner extends ConsoleRunner(HelloWorldTestSpecs)
  18.  
  19. object HelloWorldTestSpecs extends Specification {
  20.   val session = new LiftSession("", randomString(20), Empty)
  21.   val stableTime = now
  22.  
  23.   override def executeExpectations(ex: Examples, t: =>Any): Any = {
  24.     S.initIfUninitted(session) {
  25.       DependencyFactory.time.doWith(stableTime) {
  26.         super.executeExpectations(ex, t)
  27.       }
  28.     }
  29.   }
  30.  
  31.   "HelloWorld Snippet" should {
  32.     "Put the time in the node" in {
  33.       val hello = new HelloWorld
  34.       Thread.sleep(1000) // make sure the time changes
  35.  
  36.       val str = hello.howdy(<span>Hello at <b:time/></span>).toString
  37.  
  38.       str.indexOf(stableTime.toString) must be >= 0
  39.       str.indexOf("Hello at") must be >= 0
  40.     }
  41.   }
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top