Sha256: 546fc4a632060c6c24e81db449d7f1e5ee703005d01fe14f03b7fabda6e9c285

Contents?: true

Size: 989 Bytes

Versions: 1

Compression:

Stored size: 989 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Migration" do

  let(:migration) { ActiveRecord::Migration }

  it "should allow to remove more then one column at once" do
    migration.suppress_messages do
      migration.create_table :likes, :id => false, :force => true do |t|
        t.string :remarks
        t.integer :post_id
        t.datetime :created_at
      end
      migration.remove_columns :likes, :post_id, :created_at
      migration.connection.columns(:likes).should have(1).column
      migration.drop_table :likes
    end
  end

  it "should raise an exception if try to remove no column" do
    migration.suppress_messages do
      migration.create_table :likes, :id => false, :force => true do |t|
        t.string :remarks
        t.integer :post_id
        t.datetime :created_at
      end
      expect {
        migration.remove_columns :likes
      }.to raise_error(ArgumentError)
      migration.drop_table :likes
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aspgems-redhillonrails_core-2.0.0.beta4 spec/migration_spec.rb