org.specs2.form

Prop

Related Docs: object Prop | package form

case class Prop[T, S](label: String = "", actual: Property[T] = Property[T](), expected: Property[S] = Property[S](), constraint: (T, S) ⇒ Result = Prop.checkProp, decorator: Decorator = Decorator().bkGreyLabel) extends Executable with DecoratedProperty[Prop[T, S]] with Product with Serializable

The Prop class is a named property which holds:

This property can be executed and can be inserted in a Form.

A Prop is meant to be declared as "bound" to an actual value:

val customerName = Prop("Customer name", person.name)

[the actual value is not evaluated until the Prop is executed]

Then it can be associated an expected value with the apply method (usually in a Form declaration):

customerName("Bill")

The actual and the expected values can have different types and the constraint which is applied to them can be anything returning a result.

However the Prop companion object provides a method to create a Property with a constraint using a beEqualTo matcher:

Prop("Name", "Eric")("Eric") must_== Success("'Eric' is equal to 'Eric'")

Linear Supertypes
Serializable, Serializable, Product, Equals, DecoratedProperty[Prop[T, S]], DecoratedLabel[Prop[T, S]], Executable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Prop
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. DecoratedProperty
  7. DecoratedLabel
  8. Executable
  9. AnyRef
  10. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Prop(label: String = "", actual: Property[T] = Property[T](), expected: Property[S] = Property[S](), constraint: (T, S) ⇒ Result = Prop.checkProp, decorator: Decorator = Decorator().bkGreyLabel)

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. val actual: Property[T]

  5. lazy val actualValue: Product with Serializable with Either[Result, T]

    returns

    the actual value as either Right(value) or Left(result)

  6. def apply(e: ⇒ S): Prop[T, S]

    The apply method sets the expected value and returns the Prop

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. val constraint: (T, S) ⇒ Result

  10. def decorateLabel(ns: Any): Any

    do the decoration

    do the decoration

    Definition Classes
    DecoratedLabel
  11. def decorateLabelWith(f: (Any) ⇒ Any): Prop[T, S]

    set a new Decorator for the label

    set a new Decorator for the label

    Definition Classes
    DecoratedLabel
  12. def decorateValue(ns: Any): Any

    do the decoration

    do the decoration

    Definition Classes
    DecoratedProperty
  13. def decorateValueWith(f: (Any) ⇒ Any): Prop[T, S]

    set a new Decorator for the value

    set a new Decorator for the value

    Definition Classes
    DecoratedProperty
  14. def decorateWith(f: (Any) ⇒ Any): Prop[T, S]

    set a new Decorator

    set a new Decorator

    Definition Classes
    DecoratedProperty
  15. val decorator: Decorator

    Definition Classes
    PropDecoratedLabel
  16. def decoratorIs(d: Decorator): Prop[T, S]

    set a new Decorator

    set a new Decorator

    Definition Classes
    PropDecoratedLabel
  17. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. def equals(other: Any): Boolean

    Definition Classes
    Prop → Equals → AnyRef → Any
  19. def execute: Result

    execute the constraint set on this property, with the expected value

    execute the constraint set on this property, with the expected value

    returns

    a Result

    Definition Classes
    PropExecutable
  20. val expected: Property[S]

  21. lazy val expectedValue: Product with Serializable with Either[Result, S]

    returns

    the expected value as an option

  22. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  24. def hashCode(): Int

    Definition Classes
    Prop → AnyRef → Any
  25. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  26. val label: String

  27. def labelStyles: String

    return the label styles

    return the label styles

    Definition Classes
    DecoratedLabel
  28. def map(f: (Result) ⇒ Result): Executable

    modify the result to return

    modify the result to return

    Definition Classes
    Executable
  29. def matchWith(c: (T, S) ⇒ Result): Prop[T, S]

    set a specific constraint on the property

  30. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  33. def resultIs(r: ⇒ Result): Prop[T, S]

    set a specific result on the property

  34. def styleLabelWith(s: (String, String)): Prop[T, S]

    set a new style for the label

    set a new style for the label

    Definition Classes
    DecoratedLabel
  35. def styleValueWith(s: (String, String)): Prop[T, S]

    set a new style for the value

    set a new style for the value

    Definition Classes
    DecoratedProperty
  36. def styleWith(s: (String, String)): Prop[T, S]

    set a new style

    set a new style

    Definition Classes
    DecoratedProperty
  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  38. def toString(): String

    Display the property:

    Display the property:

    label: "this" (actual: "that")

    Definition Classes
    Prop → AnyRef → Any
  39. def valueStyles: String

    Definition Classes
    DecoratedProperty
  40. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from DecoratedProperty[Prop[T, S]]

Inherited from DecoratedLabel[Prop[T, S]]

Inherited from Executable

Inherited from AnyRef

Inherited from Any

Ungrouped