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

Version Path
winton-acts_as_archive-0.1.3 spec/acts_as_archive/migration_spec.rb
brianjlandau-acts_as_archive-0.2.8 spec/acts_as_archive/migration_spec.rb
brianjlandau-acts_as_archive-0.2.7 spec/acts_as_archive/migration_spec.rb
brianjlandau-acts_as_archive-0.2.6 spec/acts_as_archive/migration_spec.rb
micahwedemeyer-acts_as_archive-0.3.0 spec/acts_as_archive/migration_spec.rb
sideshowbandana-acts_as_archive-0.2.7 spec/acts_as_archive/migration_spec.rb
sideshowbandana-acts_as_archive-0.2.6 spec/acts_as_archive/migration_spec.rb
foolabs-acts_as_archive-0.2.12 spec/acts_as_archive/migration_spec.rb
gravis-acts_as_archive-0.2.11 spec/acts_as_archive/migration_spec.rb
gravis-acts_as_archive-0.2.10 spec/acts_as_archive/migration_spec.rb
gravis-acts_as_archive-0.2.7 spec/acts_as_archive/migration_spec.rb
gravis-acts_as_archive-0.2.9 spec/acts_as_archive/migration_spec.rb
gravis-acts_as_archive-0.2.8 spec/acts_as_archive/migration_spec.rb
gravis-acts_as_archive-0.2.6 spec/acts_as_archive/migration_spec.rb
acts_as_archive-0.2.5 spec/acts_as_archive/migration_spec.rb
acts_as_archive-0.2.4 spec/acts_as_archive/migration_spec.rb
acts_as_archive-0.2.3 spec/acts_as_archive/migration_spec.rb
acts_as_archive-0.2.2 spec/acts_as_archive/migration_spec.rb
acts_as_archive-0.2.1 spec/acts_as_archive/migration_spec.rb
acts_as_archive-0.2.0 spec/acts_as_archive/migration_spec.rb