org.scalatest.verb

class BehaveWord

[source: org/scalatest/verb/BehaveWord.scala]

final class BehaveWord
extends AnyRef
Class that supports shared test registration via instances referenced from the behave field of Specs, FlatSpecs, and WordSpecs as well as instance of their sister traits, FixtureSpec, FixtureFlatSpec, and FixtureWordSpec.

This class, via the behave field, enables syntax such as the following in Specs, FlatSpecs, FixtureSpecs, and FixtureFlatSpecs:

 it should behave like nonFullStack(stackWithOneItem)
           ^
 

It also enables syntax such as the following syntax in WordSpecs and FixtureWordSpecs:

 behave like nonEmptyStack(lastValuePushed)
 ^
 

For more information and examples of the use of behave, see the Shared tests section in the main documentation for trait Spec, FlatSpec, or WordSpec.

Method Summary
def like (unit : Unit) : Unit
Supports the registration of shared tests.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
def like(unit : Unit) : Unit
Supports the registration of shared tests.

This method enables syntax such as the following in Specs, FlatSpecs, FixtureSpecs, and FixtureFlatSpecs:

   it should behave like nonFullStack(stackWithOneItem)
                    ^
   

It also enables syntax such as the following syntax in WordSpecs and FixtureWordSpecs:

   behave like nonEmptyStack(lastValuePushed)
   ^
   

This method just provides syntax sugar intended to make the intent of the code clearer. Because the parameter passed to it is type Unit, the expression will be evaluated before being passed, which is sufficient to register the shared tests. For more information and examples of the use of behave, see the Shared tests section in the main documentation for trait Spec, FlatSpec, or WordSpec.



Copyright (C) 2001-2009 Artima, Inc. All rights reserved.