From e8acbedb52a8e20c4ad127d3bb028af2b51ba289 Mon Sep 17 00:00:00 2001 From: Sarah Aladetan Date: Mon, 9 Dec 2019 12:39:35 -0800 Subject: [PATCH] update migration generator test to rely on config table name should we do this though? i can see an argument where we actually keep the test as is because the default `table_name` is still `key_values` and we're trying to maintain original usage expectations with this PR --- .../github/store/active_record_generator_test.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/generators/github/store/active_record_generator_test.rb b/test/generators/github/store/active_record_generator_test.rb index 4de6209..cd72630 100644 --- a/test/generators/github/store/active_record_generator_test.rb +++ b/test/generators/github/store/active_record_generator_test.rb @@ -17,24 +17,25 @@ class GithubDSActiveRecordGeneratorTest < Rails::Generators::TestCase else "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end + table_name = "key_values" assert_migration "db/migrate/create_key_values_table.rb", <<-EOM class CreateKeyValuesTable < ActiveRecord::Migration#{migration_version} def self.up - create_table :key_values do |t| + create_table :#{table_name} do |t| t.string :key, :null => false t.binary :value, :null => false t.datetime :expires_at, :null => true t.timestamps :null => false end - add_index :key_values, :key, :unique => true - add_index :key_values, :expires_at + add_index :#{table_name}, :key, :unique => true + add_index :#{table_name}, :expires_at - change_column :key_values, :id, "bigint(20) NOT NULL AUTO_INCREMENT" + change_column :#{table_name}, :id, "bigint(20) NOT NULL AUTO_INCREMENT" end def self.down - drop_table :key_values + drop_table :#{table_name} end end EOM