public function test_to_json_methods_method_same_as_attribute() { $book = Book::find(1); $json = $book->to_json(array('methods' => 'name')); $decoded = (array) json_decode($json); $this->assert_true(array_key_exists('name', array_flip(array_keys($decoded)))); $this->assert_true(ActiveRecord\Inflector::is_lower($decoded['name'])); }