aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/defaults_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove legacy mysql adapterAbdelkader Boudih2015-12-171-10/+3
|
* Closes rails/rails#18864: Renaming transactional fixtures to transactional testsBrandon Weiss2015-03-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | I’m renaming all instances of `use_transcational_fixtures` to `use_transactional_tests` and “transactional fixtures” to “transactional tests”. I’m deprecating `use_transactional_fixtures=`. So anyone who is explicitly setting this will get a warning telling them to use `use_transactional_tests=` instead. I’m maintaining backwards compatibility—both forms will work. `use_transactional_tests` will check to see if `use_transactional_fixtures` is set and use that, otherwise it will use itself. But because `use_transactional_tests` is a class attribute (created with `class_attribute`) this requires a little bit of hoop jumping. The writer method that `class_attribute` generates defines a new reader method that return the value being set. Which means we can’t set the default of `true` using `use_transactional_tests=` as was done previously because that won’t take into account anyone using `use_transactional_fixtures`. Instead I defined the reader method manually and it checks `use_transactional_fixtures`. If it was set then it should be used, otherwise it should return the default, which is `true`. If someone uses `use_transactional_tests=` then it will overwrite the backwards-compatible method with whatever they set.
* tests, use `drop_table if_exists: true` in our test suite.Yves Senn2015-01-201-1/+1
|
* pg tests, get rid of global schema `schema_1`.Yves Senn2014-12-021-45/+0
|
* tests, favor public API over inspecting columns where possible.Yves Senn2014-12-011-16/+19
| | | | | This is a follow up to https://github.com/rails/rails/commit/07786c5e75a7b0afdf318063510af6b475e3e04c and https://github.com/rails/rails/commit/cd2596f55e88fe659592612a793c4f4aa723c9be
* tests, run numeric default tests for every adapter.Yves Senn2014-12-011-15/+33
|
* tests, use public API to verify default parsing. #17863, #17856Yves Senn2014-12-011-1/+2
|
* Fix value extracted from negative integers for PostgreSQL.Guo Xiang Tan2014-12-011-0/+4
| | | | Fixes: https://github.com/rails/rails/issues/17856.
* Don't type cast the default on the columnSean Griffin2014-06-171-1/+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.
* Collapse PG default extractoin of most types to single regexSean Griffin2014-06-041-0/+5
| | | | | | | For any type that is represented as a string and then type cast, we do not need separate regular expressions for the various types. No function will match this regex. User defined types *should* match this, so that the type object can decide what to do with the value.
* Remove dead test code for unsupported adaptersSean Griffin2014-05-171-1/+1
|
* Use teardown helper method.Guo Xiang Tan2014-03-141-1/+1
| | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* Handle single quotes in PostgreSQL default column valuesDylan Markow2013-06-191-0/+25
| | | | | | | | | | PostgreSQL escapes single quotes by using an additional single quote. When Rails queries the column information, PostgreSQL returns the default values with the escaped single quotes. #extract_value_from_default now converts these to one single quote each. Fixes #10881.
* Standardize the use of current_adapter?Rafael Mendonça França2013-01-011-1/+1
|
* Remove ActiveRecord::ModelJon Leighton2012-10-261-4/+4
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
* The default value of a text/blob in mysql strict mode should be nilJon Leighton2012-10-191-17/+55
| | | | | | | | | In non-strict mode it is '', but if someone is in strict mode then we should honour the strict semantics. Also, this removes the need for a completely horrible hack in dirty.rb. Closes #7780
* #7914 get default value when type uses schema nameArturo Pie2012-10-131-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | PostgreSQL adapter properly parses default values when using multiple schemas and domains. When using domains across schemas, PostgresSQL prefixes the type of the default value with the name of the schema where that type (or domain) is. For example, this query: ``` SELECT a.attname, d.adsrc FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = "defaults"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; ``` could return something like "'<default_value>'::pg_catalog.text" or "(''<default_value>'::pg_catalog.text)::text" for the text columns with defaults. I modified the regexp used to parse this value so that it ignores anything between ':: and \b(?:character varying|bpchar|text), and it allows to have optional parens like in the above second example.
* removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-061-1/+1
| | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-021-1/+0
|
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-131-1/+1
| | | | | | After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now. It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
* Change Object#either? to Object#among? -- thanks to @jamesarosen for the ↵David Heinemeier Hansson2011-04-121-1/+1
| | | | suggestion!
* Using Object#in? and Object#either? in various placesPrem Sichanugrist2011-04-111-1/+2
| | | | There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-3/+3
| | | | 's/[ \t]*$//' -i {} \;)
* update tests for mysql2 supportBrian Lopez2010-08-021-1/+1
|
* edit pass: the names of Rails components have a space, ie, "Active Record", ↵Xavier Noria2010-06-141-1/+1
| | | | not "ActiveRecord"
* Use better assertion methods for testingNeeraj Singh2010-05-191-2/+2
| | | | | | [#4645 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* cleaning up a bunch of parse time warnings in AR [#4186 state:resolved]Aaron Patterson2010-03-151-2/+2
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Merge commit 'origin/master' into savepointsHongli Lai (Phusion)2008-12-031-6/+1
|\ | | | | | | | | | | Conflicts: activerecord/lib/active_record/fixtures.rb activerecord/test/cases/defaults_test.rb
| * Remove SQL Server cases from tests for latest adapter work to pass rails ↵Ken Collins2008-11-191-1/+1
| | | | | | | | | | | | expected behavior. Signed-off-by: Michael Koziarski <michael@koziarski.com>
* | Fix the final MySQL unit test failure that's related to savepoint support.Hongli Lai (Phusion)2008-11-031-28/+39
| |
* | Fix what looks like a Mysql bug with transactions, savepoints, and create table.Jonathan Viney2008-11-031-21/+26
|/
* Deal with MySQL's quirky handling of defaults and blob/text columnsFrederick Cheung2008-09-141-0/+31
| | | | | | [#1043 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Include mysql older than 5.1.23 in the 5.1 series in the list of those that ↵Tarmo Tänav2008-08-261-1/+1
| | | | | | can't handle NULL defaults Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix default nil tests for MySQL 5.0.51 [#192 state:resolved]Ryan Bates2008-05-311-1/+1
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* PostgreSQL: support server versions 7.4 through 8.0 and the ruby-pg driver. ↵Jeremy Kemper2008-02-221-1/+3
| | | | | | Closes #11127 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8922 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/railsJeremy Kemper2008-01-211-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix pathsJeremy Kemper2008-01-181-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Move tests to casesJeremy Kemper2008-01-181-0/+67
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de