These are chat archives for etorreborre/specs2

27th
Sep 2015
tony kerz
@tony-kerz
Sep 27 2015 16:54
thanks @etorreborre, that worked and i upvoted your response on stack-overflow :+1:
tony kerz
@tony-kerz
Sep 27 2015 17:01
on another note, what would be the idiomatic way to specify that something should be true in specs2? i currently have something like the following but it is using junit assertTrue and then returns specs2 ok which seems strange:
    "be true" in {
      assertTrue(someInstance.someMethodThatReturnsBoolean())
      ok
    }
wait, i think i found it, would it be?
    "be true" in {
      someInstance.someMethodThatReturnsBoolean() must beTrue
    }
tony kerz
@tony-kerz
Sep 27 2015 21:39
@etorreborre can you spot why i'm not seeing any output from the before routine..?:
import org.specs2.specification.BeforeEach
import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.mock.Mockito

class ScratchSpec extends SpecificationWithJUnit 
with Mockito 
with BeforeEach
{
  def before = System.out.println("before...!!!")
  "scratch" should {
    "be true" in {
      (!false == true) must beTrue
    }
  }
}
tony kerz
@tony-kerz
Sep 27 2015 23:10
this seems to work, would this be the recommended syntax?:
import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.specification.Before
import org.specs2.mock.Mockito

class ScratchSpec extends SpecificationWithJUnit
with Mockito 
{
  object context extends Before {
    def before = System.out.println("before...!!!")
  }

  "scratch" should {
    "be true" in context {
      (!false == true) must beTrue
    }
  }
}