diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-13 11:51:10 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-13 11:51:10 -0700 |
commit | d53b5f073924e8b397ec86f7ad092aa0b5ed3fe4 (patch) | |
tree | 78d2f76516e22944e2c41e318a0d54d5ad639289 /activerecord/test | |
parent | b97ff316ec6d3fa962dc804d5aeb83aa81b2d847 (diff) | |
parent | 37ca5b09662797928a4f74878595a4e577c5aedd (diff) | |
download | rails-d53b5f073924e8b397ec86f7ad092aa0b5ed3fe4.tar.gz rails-d53b5f073924e8b397ec86f7ad092aa0b5ed3fe4.tar.bz2 rails-d53b5f073924e8b397ec86f7ad092aa0b5ed3fe4.zip |
Merge branch 'master' into normalizecb
* master: (61 commits)
add tests for reset_calbacks
Fixing build broken by this change
Extract variable out of loop
Updated comment to Rails 4
Fixes NoMethodError: `alias_method_chain` when requiring just active_support/core_ext
better error message when app name is not passed in `rails new`
Code cleanup for ActionDispatch::Flash#call
Fix typo: require -> requires
Add CHANGELOG entry for #10576
Merge pull request #10556 from Empact/deprecate-schema-statements-distinct
Some editorial changes on the documentation.
respond_to -> respond to in a message from AM::Lint
specify that dom_(id|class) are deprecated in controllers, views are fine
copy edits [ci skip]
Fix class and method name typos
Replace multi_json with json
ruby -> Ruby
Adding documentation to the automatic inverse_of finder.
Improve CHANGELOG entry [ci kip]
Call assume_migrated_upto_version on connection
...
Conflicts:
activesupport/lib/active_support/callbacks.rb
Diffstat (limited to 'activerecord/test')
6 files changed, 48 insertions, 15 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index ff7eb86969..fb88ab7c09 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -226,8 +226,10 @@ module ActiveRecord end def test_distinct_zero_orders - assert_equal "DISTINCT posts.id", - @connection.distinct("posts.id", []) + assert_deprecated do + assert_equal "DISTINCT posts.id", + @connection.distinct("posts.id", []) + end end def test_columns_for_distinct_zero_orders @@ -236,8 +238,10 @@ module ActiveRecord end def test_distinct_one_order - assert_equal "DISTINCT posts.id, posts.created_at AS alias_0", - @connection.distinct("posts.id", ["posts.created_at desc"]) + assert_deprecated do + assert_equal "DISTINCT posts.id, posts.created_at AS alias_0", + @connection.distinct("posts.id", ["posts.created_at desc"]) + end end def test_columns_for_distinct_one_order @@ -246,8 +250,10 @@ module ActiveRecord end def test_distinct_few_orders - assert_equal "DISTINCT posts.id, posts.created_at AS alias_0, posts.position AS alias_1", - @connection.distinct("posts.id", ["posts.created_at desc", "posts.position asc"]) + assert_deprecated do + assert_equal "DISTINCT posts.id, posts.created_at AS alias_0, posts.position AS alias_1", + @connection.distinct("posts.id", ["posts.created_at desc", "posts.position asc"]) + end end def test_columns_for_distinct_few_orders @@ -256,8 +262,10 @@ module ActiveRecord end def test_distinct_blank_not_nil_orders - assert_equal "DISTINCT posts.id, posts.created_at AS alias_0", - @connection.distinct("posts.id", ["posts.created_at desc", "", " "]) + assert_deprecated do + assert_equal "DISTINCT posts.id, posts.created_at AS alias_0", + @connection.distinct("posts.id", ["posts.created_at desc", "", " "]) + end end def test_columns_for_distinct_blank_not_nil_orders @@ -270,8 +278,10 @@ module ActiveRecord def order.to_sql "posts.created_at desc" end - assert_equal "DISTINCT posts.id, posts.created_at AS alias_0", - @connection.distinct("posts.id", [order]) + assert_deprecated do + assert_equal "DISTINCT posts.id, posts.created_at AS alias_0", + @connection.distinct("posts.id", [order]) + end end def test_columns_for_distinct_with_arel_order @@ -284,8 +294,10 @@ module ActiveRecord end def test_distinct_with_nulls - assert_equal "DISTINCT posts.title, posts.updater_id AS alias_0", @connection.distinct("posts.title", ["posts.updater_id desc nulls first"]) - assert_equal "DISTINCT posts.title, posts.updater_id AS alias_0", @connection.distinct("posts.title", ["posts.updater_id desc nulls last"]) + assert_deprecated do + assert_equal "DISTINCT posts.title, posts.updater_id AS alias_0", @connection.distinct("posts.title", ["posts.updater_id desc nulls first"]) + assert_equal "DISTINCT posts.title, posts.updater_id AS alias_0", @connection.distinct("posts.title", ["posts.updater_id desc nulls last"]) + end end def test_columns_for_distinct_with_nulls diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb index 244e0b7179..500df52cd8 100644 --- a/activerecord/test/cases/ar_schema_test.rb +++ b/activerecord/test/cases/ar_schema_test.rb @@ -12,6 +12,8 @@ if ActiveRecord::Base.connection.supports_migrations? def teardown @connection.drop_table :fruits rescue nil + @connection.drop_table :nep_fruits rescue nil + @connection.drop_table :nep_schema_migrations rescue nil ActiveRecord::SchemaMigration.delete_all rescue nil end @@ -30,6 +32,24 @@ if ActiveRecord::Base.connection.supports_migrations? assert_equal 7, ActiveRecord::Migrator::current_version end + def test_schema_define_w_table_name_prefix + table_name = ActiveRecord::SchemaMigration.table_name + ActiveRecord::Base.table_name_prefix = "nep_" + ActiveRecord::SchemaMigration.table_name = "nep_#{table_name}" + ActiveRecord::Schema.define(:version => 7) do + create_table :fruits do |t| + t.column :color, :string + t.column :fruit_size, :string # NOTE: "size" is reserved in Oracle + t.column :texture, :string + t.column :flavor, :string + end + end + assert_equal 7, ActiveRecord::Migrator::current_version + ensure + ActiveRecord::Base.table_name_prefix = "" + ActiveRecord::SchemaMigration.table_name = table_name + end + def test_schema_raises_an_error_for_invalid_column_type assert_raise NoMethodError do ActiveRecord::Schema.define(:version => 8) do diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index d9c032392d..a181c513ae 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -130,6 +130,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase assert_equal '10', keyboard.id_before_type_cast assert_equal nil, keyboard.read_attribute_before_type_cast('id') assert_equal '10', keyboard.read_attribute_before_type_cast('key_number') + assert_equal '10', keyboard.read_attribute_before_type_cast(:key_number) end # Syck calls respond_to? before actually calling initialize diff --git a/activerecord/test/cases/migration/change_schema_test.rb b/activerecord/test/cases/migration/change_schema_test.rb index cad759bba9..54fff8a0f5 100644 --- a/activerecord/test/cases/migration/change_schema_test.rb +++ b/activerecord/test/cases/migration/change_schema_test.rb @@ -235,7 +235,7 @@ module ActiveRecord end end - def test_keeping_default_and_notnull_constaint_on_change + def test_keeping_default_and_notnull_constraints_on_change connection.create_table :testings do |t| t.column :title, :string end diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index db3bb56f1f..c4a72ed3bc 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -18,7 +18,7 @@ require 'models/pet' require 'models/toy' require 'rexml/document' -class PersistencesTest < ActiveRecord::TestCase +class PersistenceTest < ActiveRecord::TestCase fixtures :topics, :companies, :developers, :projects, :computers, :accounts, :minimalistics, 'warehouse-things', :authors, :categorizations, :categories, :posts, :minivans, :pets, :toys # Oracle UPDATE does not support ORDER BY diff --git a/activerecord/test/cases/primary_keys_test.rb b/activerecord/test/cases/primary_keys_test.rb index 8e5379cb1f..aa125c70c5 100644 --- a/activerecord/test/cases/primary_keys_test.rb +++ b/activerecord/test/cases/primary_keys_test.rb @@ -205,7 +205,7 @@ if current_adapter?(:MysqlAdapter, :Mysql2Adapter) class PrimaryKeyWithAnsiQuotesTest < ActiveRecord::TestCase self.use_transactional_fixtures = false - def test_primaery_key_method_with_ansi_quotes + def test_primary_key_method_with_ansi_quotes con = ActiveRecord::Base.connection con.execute("SET SESSION sql_mode='ANSI_QUOTES'") assert_equal "id", con.primary_key("topics") |