Skip to content

Instantly share code, notes, and snippets.

@amatsuda
Created January 21, 2013 11:30
Show Gist options
  • Select an option

  • Save amatsuda/4585423 to your computer and use it in GitHub Desktop.

Select an option

Save amatsuda/4585423 to your computer and use it in GitHub Desktop.
a failing AR table_name_{prefix,suffix} test
require 'cases/helper'
require 'cases/migration/helper'
require MIGRATIONS_ROOT + '/valid/2_we_need_reminders'
class Reminder < ActiveRecord::Base; end
class FailingMigrationTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false
def setup
super
%w(reminders prefix_reminders_suffix ARprefix_reminders_ARsuffix).each do |table|
Reminder.connection.drop_table(table) rescue nil
end
end
def test_migrator_uses_the_same_prefix_and_suffix_as_the_model_table_name
ActiveRecord::Base.table_name_prefix = 'ARprefix_'
ActiveRecord::Base.table_name_suffix = '_ARsuffix'
Reminder.table_name_prefix = 'prefix_'
Reminder.table_name_suffix = '_suffix'
Reminder.reset_table_name
WeNeedReminders.up
assert Reminder.table_exists?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment