diff options
author | Jeffrey Guenther <guenther.jeffrey@gmail.com> | 2017-12-14 19:03:28 -0800 |
---|---|---|
committer | Jeffrey Guenther <guenther.jeffrey@gmail.com> | 2017-12-14 19:03:28 -0800 |
commit | 1c5358e4729ce48b0e597d0b39d22f3b1c42f6fc (patch) | |
tree | ea060a71e57ec1e6366a33f7e40be14ea2f0d64b /activerecord/test/cases/base_test.rb | |
parent | ab2a95db8088b7607017671b82e396bcd9e80332 (diff) | |
parent | cc0d272c8c37c197a7e68633e5f082eccb2e3737 (diff) | |
download | rails-1c5358e4729ce48b0e597d0b39d22f3b1c42f6fc.tar.gz rails-1c5358e4729ce48b0e597d0b39d22f3b1c42f6fc.tar.bz2 rails-1c5358e4729ce48b0e597d0b39d22f3b1c42f6fc.zip |
Merge branch 'master' into activestorage-guide
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 3497f6aae4..7fc4a396e4 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -629,7 +629,7 @@ class BasicsTest < ActiveRecord::TestCase end def test_readonly_attributes - assert_equal Set.new([ "title" , "comments_count" ]), ReadonlyTitlePost.readonly_attributes + assert_equal Set.new([ "title", "comments_count" ]), ReadonlyTitlePost.readonly_attributes post = ReadonlyTitlePost.create(title: "cannot change this", body: "changeable") post.reload @@ -1495,4 +1495,24 @@ class BasicsTest < ActiveRecord::TestCase # regular column assert query.include?("name") end + + test "column names are quoted when using #from clause and model has ignored columns" do + refute_empty Developer.ignored_columns + query = Developer.from("`developers`").to_sql + quoted_id = Developer.connection.quote_table_name("id") + + assert_match(/SELECT #{quoted_id}.* FROM `developers`/, query) + end + + test "protected environments by default is an array with production" do + assert_equal ["production"], ActiveRecord::Base.protected_environments + end + + def test_protected_environments_are_stored_as_an_array_of_string + previous_protected_environments = ActiveRecord::Base.protected_environments + ActiveRecord::Base.protected_environments = [:staging, "production"] + assert_equal ["staging", "production"], ActiveRecord::Base.protected_environments + ensure + ActiveRecord::Base.protected_environments = previous_protected_environments + end end |