private function assert_validity($value, $boolean, $msg = null)
 {
     $book = new BookNumericality();
     $book->numeric_test = $value;
     if ($boolean == 'valid') {
         $this->assert_true($book->save());
         $this->assert_false($book->errors->is_invalid('numeric_test'));
     } else {
         $this->assert_false($book->save());
         $this->assert_true($book->errors->is_invalid('numeric_test'));
         if (!is_null($msg)) {
             $this->assert_same($msg, $book->errors->on('numeric_test'));
         }
     }
 }
 public function test_custom_message()
 {
     BookNumericality::$validates_numericality_of = array(array('numeric_test', 'message' => 'Hello'));
     $book = new BookNumericality(array('numeric_test' => 'NaN'));
     $book->is_valid();
     $this->assert_equals(array('Numeric test Hello'), $book->errors->full_messages());
 }
 public function testCustomMessage()
 {
     BookNumericality::$validatesNumericalityOf = array(array('numeric_test', 'message' => 'Hello'));
     $book = new BookNumericality(array('numeric_test' => 'NaN'));
     $book->isValid();
     $this->assertEquals(array('Numeric test Hello'), $book->errors->fullMessages());
 }