Class/Object

org.specs2.form

Prop

Related Docs: object Prop | package form

Permalink

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
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)

    Permalink

Value Members

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

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

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

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

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

    Permalink

    returns

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

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

    Permalink

    The apply method sets the expected value and returns the Prop

  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

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

    Permalink
  10. def decorateLabel(ns: Any): Any

    Permalink

    do the decoration

    do the decoration

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

    Permalink

    set a new Decorator for the label

    set a new Decorator for the label

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

    Permalink

    do the decoration

    do the decoration

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

    Permalink

    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]

    Permalink

    set a new Decorator

    set a new Decorator

    Definition Classes
    DecoratedProperty
  15. val decorator: Decorator

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

    Permalink

    set a new Decorator

    set a new Decorator

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

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

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

    Permalink

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

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

    Definition Classes
    Prop → Executable
  20. val expected: Property[S]

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

    Permalink

    returns

    the expected value as an option

  22. def finalize(): Unit

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

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

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

    Permalink
    Definition Classes
    Any
  26. val label: String

    Permalink
  27. def labelStyles: String

    Permalink

    return the label styles

    return the label styles

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

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

    Permalink

    set a specific constraint between the actual and expected value

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

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

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

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

    Permalink

    set a specific result on the property

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

    Permalink

    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]

    Permalink

    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]

    Permalink

    set a new style

    set a new style

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

    Permalink
    Definition Classes
    AnyRef
  38. def toString(): String

    Permalink

    Display the property:

    Display the property:

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

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

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

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

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

    Permalink
    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