Sha256: e4bcb1dd747166a5daca3eccdbb7f74d13089b86abc9cfc8b6776c15fd37fc24
Contents?: true
Size: 1.28 KB
Versions: 23
Compression:
Stored size: 1.28 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe ActsAsArchive::Migration do before(:each) do establish_test_db Article.create_archive_table end describe 'method_missing_with_archive' do it 'should migrate both tables up' do migrate_up (@new_article_columns - @old_article_columns).should == [ 'permalink' ] (@new_archive_columns - @old_archive_columns).should == [ 'permalink' ] end it 'should migrate both tables down' do migrate_up @old_article_columns = @new_article_columns @old_archive_columns = @new_archive_columns ActiveRecord::Migrator.migrate("#{SPEC}/db/migrate", 0) @new_article_columns = columns("articles") @new_archive_columns = columns("archived_articles") (@old_article_columns - @new_article_columns).should == [ 'permalink' ] (@old_archive_columns - @new_archive_columns).should == [ 'permalink' ] end it "should not touch the archive's deleted_at column" do connection.add_column(:articles, :deleted_at, :datetime) Article.reset_column_information migrate_up("migrate_2") (@old_article_columns - @new_article_columns).should == [ 'deleted_at' ] (@old_archive_columns - @new_archive_columns).should == [] end end end
Version data entries
23 entries across 23 versions & 7 rubygems