aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/test/cases/base_test.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index 5016dcea43..4306738670 100644
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -1021,17 +1021,20 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_clear_cash_when_setting_table_name
- k = Class.new(Joke)
- k.table_name = "cold_jokes"
- before_columns = k.columns
- before_seq = k.sequence_name
+ original_table_name = Joke.table_name
- k.table_name = "funny_jokes"
- after_columns = k.columns
- after_seq = k.sequence_name
+ Joke.table_name = "funny_jokes"
+ before_columns = Joke.columns
+ before_seq = Joke.sequence_name
+
+ Joke.table_name = "cold_jokes"
+ after_columns = Joke.columns
+ after_seq = Joke.sequence_name
assert_not_equal before_columns, after_columns
assert_not_equal before_seq, after_seq unless before_seq.nil? && after_seq.nil?
+ ensure
+ Joke.table_name = original_table_name
end
def test_dont_clear_sequence_name_when_setting_explicitly