aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_decorators_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Replace drop sql statement to drop_table methodYasuo Honda2014-09-111-1/+1
| | | | to drop sequences at the same time each tables dropped for Oracle
* Remove 'if exists' from drop table statement then use `table_exists?`Yasuo Honda2014-09-031-1/+1
| | | | | Since 'drop table if exists' statement does not always work with some databases such as Oracle.
* Revert "Merge pull request #16254 from ↵Yves Senn2014-08-291-0/+1
| | | | | | | | | | | | | zuhao/refactor_activerecord_attribute_decorators_test" This reverts commit 16fe19831548f108c113094d106663497fc190d5, reversing changes made to 4c81c8ce533896be28bdc0b055ff30bb9dee1316. The call to `Model.reset_column_information` was to express the intent of the test. `reset_column_information` itself can trigger SQL queries because it checks for a tables existance. Let's move it outside of the block. /cc @sgrif
* Remove redundant that already happened in teardown.Zuhao Wan2014-07-221-1/+0
|
* Don't type cast the default on the columnSean Griffin2014-06-171-11/+1
| | | | | | | If we want to have type decorators mess with the attribute, but not the column, we need to stop type casting on the column. Where possible, we changed the tests to test the value of `column_defaults`, which is public API. `Column#default` is not.
* Promote time zone aware attributes to a first class type decoratorSean Griffin2014-06-161-0/+21
| | | | | | | | | | | | | This refactoring revealed the need for another form of decoration, which takes a proc to select which it applies to (There's a *lot* of cases where this form can be used). To avoid duplication, we can re-implement the old decoration in terms of the proc-based decoration. The reason we're `instance_exec`ing the matcher is for cases such as time zone aware attributes, where a decorator is defined in a parent class, and a method called in the matcher is overridden by a child class. The matcher will close over the parent, and evaluate in its context, which is not the behavior we want.
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-091-2/+2
| | | | | | | | In some cases there is a difference between the two, we should always be doing one or the other. For convenience, `type_cast` is still a private method on type, so new types that do not need different behavior don't need to implement two methods, but it has been moved to private so it cannot be used accidentally.
* Make `_before_type_cast` actually be before type castSean Griffin2014-06-091-0/+2
| | | | | | | | | | | | | - The following is now true for all types, all the time - `model.attribute_before_type_cast == given_value` - `model.attribute == model.save_and_reload.attribute` - `model.attribute == model.dup.attribute` - `model.attribute == YAML.load(YAML.dump(model)).attribute` - Removes the remaining types implementing `type_cast_for_write` - Simplifies the implementation of time zone aware attributes - Brings tz aware attributes closer to being implemented as an attribute decorator - Adds additional point of control for custom types
* fix test cases after #15558 merge to master.Kuldeep Aggarwal2014-06-071-3/+3
|
* Don't query the database schema when calling `serialize`Sean Griffin2014-06-071-0/+112
We need to decorate the types lazily. This is extracted to a separate API, as there are other refactorings that will be able to make use of it, and to allow unit testing the finer points more granularly.