Methods
S
T
W
Instance Public methods
setup()
# File activerecord/test/cases/migration/change_table_test.rb, line 7
def setup
  @connection = Minitest::Mock.new
end
test_add_belongs_to_works_like_add_references()
# File activerecord/test/cases/migration/change_table_test.rb, line 33
def test_add_belongs_to_works_like_add_references
  with_change_table do |t|
    @connection.expect :add_reference, nil, [:delete_me, :customer, {}]
    t.belongs_to :customer
  end
end
test_change_changes_column()
# File activerecord/test/cases/migration/change_table_test.rb, line 168
def test_change_changes_column
  with_change_table do |t|
    @connection.expect :change_column, nil, [:delete_me, :bar, :string, {}]
    t.change :bar, :string
  end
end
test_change_changes_column_with_options()
# File activerecord/test/cases/migration/change_table_test.rb, line 175
def test_change_changes_column_with_options
  with_change_table do |t|
    @connection.expect :change_column, nil, [:delete_me, :bar, :string, {:null => true}]
    t.change :bar, :string, :null => true
  end
end
test_change_default_changes_column()
# File activerecord/test/cases/migration/change_table_test.rb, line 182
def test_change_default_changes_column
  with_change_table do |t|
    @connection.expect :change_column_default, nil, [:delete_me, :bar, :string]
    t.change_default :bar, :string
  end
end
test_column_creates_column()
# File activerecord/test/cases/migration/change_table_test.rb, line 119
def test_column_creates_column
  with_change_table do |t|
    @connection.expect :add_column, nil, [:delete_me, :bar, :integer, {}]
    t.column :bar, :integer
  end
end
test_column_creates_column_with_options()
# File activerecord/test/cases/migration/change_table_test.rb, line 126
def test_column_creates_column_with_options
  with_change_table do |t|
    @connection.expect :add_column, nil, [:delete_me, :bar, :integer, {:null => false}]
    t.column :bar, :integer, :null => false
  end
end
test_index_creates_index()
# File activerecord/test/cases/migration/change_table_test.rb, line 133
def test_index_creates_index
  with_change_table do |t|
    @connection.expect :add_index, nil, [:delete_me, :bar, {}]
    t.index :bar
  end
end
test_index_creates_index_with_options()
# File activerecord/test/cases/migration/change_table_test.rb, line 140
def test_index_creates_index_with_options
  with_change_table do |t|
    @connection.expect :add_index, nil, [:delete_me, :bar, {:unique => true}]
    t.index :bar, :unique => true
  end
end
test_index_exists()
# File activerecord/test/cases/migration/change_table_test.rb, line 147
def test_index_exists
  with_change_table do |t|
    @connection.expect :index_exists?, nil, [:delete_me, :bar, {}]
    t.index_exists?(:bar)
  end
end
test_index_exists_with_options()
# File activerecord/test/cases/migration/change_table_test.rb, line 154
def test_index_exists_with_options
  with_change_table do |t|
    @connection.expect :index_exists?, nil, [:delete_me, :bar, {:unique => true}]
    t.index_exists?(:bar, :unique => true)
  end
end
test_integer_creates_integer_column()
# File activerecord/test/cases/migration/change_table_test.rb, line 103
def test_integer_creates_integer_column
  with_change_table do |t|
    @connection.expect :add_column, nil, [:delete_me, :foo, :integer, {}]
    @connection.expect :add_column, nil, [:delete_me, :bar, :integer, {}]
    t.integer :foo, :bar
  end
end
test_references_column_type_adds_id()
# File activerecord/test/cases/migration/change_table_test.rb, line 19
def test_references_column_type_adds_id
  with_change_table do |t|
    @connection.expect :add_reference, nil, [:delete_me, :customer, {}]
    t.references :customer
  end
end
test_references_column_type_with_polymorphic_adds_type()
# File activerecord/test/cases/migration/change_table_test.rb, line 47
def test_references_column_type_with_polymorphic_adds_type
  with_change_table do |t|
    @connection.expect :add_reference, nil, [:delete_me, :taggable, polymorphic: true]
    t.references :taggable, polymorphic: true
  end
end
test_references_column_type_with_polymorphic_and_options_null_is_false_adds_table_flag()
# File activerecord/test/cases/migration/change_table_test.rb, line 61
def test_references_column_type_with_polymorphic_and_options_null_is_false_adds_table_flag
  with_change_table do |t|
    @connection.expect :add_reference, nil, [:delete_me, :taggable, polymorphic: true, null: false]
    t.references :taggable, polymorphic: true, null: false
  end
end
test_references_column_type_with_polymorphic_and_type()
# File activerecord/test/cases/migration/change_table_test.rb, line 75
def test_references_column_type_with_polymorphic_and_type
  with_change_table do |t|
    @connection.expect :add_reference, nil, [:delete_me, :taggable, polymorphic: true, type: :string]
    t.references :taggable, polymorphic: true, type: :string
  end
end
test_remove_belongs_to_works_like_remove_references()
# File activerecord/test/cases/migration/change_table_test.rb, line 40
def test_remove_belongs_to_works_like_remove_references
  with_change_table do |t|
    @connection.expect :remove_reference, nil, [:delete_me, :customer, {}]
    t.remove_belongs_to :customer
  end
end
test_remove_drops_multiple_columns()
# File activerecord/test/cases/migration/change_table_test.rb, line 196
def test_remove_drops_multiple_columns
  with_change_table do |t|
    @connection.expect :remove_columns, nil, [:delete_me, :bar, :baz]
    t.remove :bar, :baz
  end
end
test_remove_drops_single_column()
# File activerecord/test/cases/migration/change_table_test.rb, line 189
def test_remove_drops_single_column
  with_change_table do |t|
    @connection.expect :remove_columns, nil, [:delete_me, :bar]
    t.remove :bar
  end
end
test_remove_index_removes_index_with_options()
# File activerecord/test/cases/migration/change_table_test.rb, line 203
def test_remove_index_removes_index_with_options
  with_change_table do |t|
    @connection.expect :remove_index, nil, [:delete_me, {:unique => true}]
    t.remove_index :unique => true
  end
end
test_remove_references_column_type_removes_id()
# File activerecord/test/cases/migration/change_table_test.rb, line 26
def test_remove_references_column_type_removes_id
  with_change_table do |t|
    @connection.expect :remove_reference, nil, [:delete_me, :customer, {}]
    t.remove_references :customer
  end
end
test_remove_references_column_type_with_polymorphic_and_options_null_is_false_removes_table_flag()
# File activerecord/test/cases/migration/change_table_test.rb, line 68
def test_remove_references_column_type_with_polymorphic_and_options_null_is_false_removes_table_flag
  with_change_table do |t|
    @connection.expect :remove_reference, nil, [:delete_me, :taggable, polymorphic: true, null: false]
    t.remove_references :taggable, polymorphic: true, null: false
  end
end
test_remove_references_column_type_with_polymorphic_and_type()
# File activerecord/test/cases/migration/change_table_test.rb, line 82
def test_remove_references_column_type_with_polymorphic_and_type
  with_change_table do |t|
    @connection.expect :remove_reference, nil, [:delete_me, :taggable, polymorphic: true, type: :string]
    t.remove_references :taggable, polymorphic: true, type: :string
  end
end
test_remove_references_column_type_with_polymorphic_removes_type()
# File activerecord/test/cases/migration/change_table_test.rb, line 54
def test_remove_references_column_type_with_polymorphic_removes_type
  with_change_table do |t|
    @connection.expect :remove_reference, nil, [:delete_me, :taggable, polymorphic: true]
    t.remove_references :taggable, polymorphic: true
  end
end
test_remove_timestamps_creates_updated_at_and_created_at()
# File activerecord/test/cases/migration/change_table_test.rb, line 96
def test_remove_timestamps_creates_updated_at_and_created_at
  with_change_table do |t|
    @connection.expect :remove_timestamps, nil, [:delete_me, { null: true }]
    t.remove_timestamps({ null: true })
  end
end
test_rename_index_renames_index()
# File activerecord/test/cases/migration/change_table_test.rb, line 161
def test_rename_index_renames_index
  with_change_table do |t|
    @connection.expect :rename_index, nil, [:delete_me, :bar, :baz]
    t.rename_index :bar, :baz
  end
end
test_rename_renames_column()
# File activerecord/test/cases/migration/change_table_test.rb, line 210
def test_rename_renames_column
  with_change_table do |t|
    @connection.expect :rename_column, nil, [:delete_me, :bar, :baz]
    t.rename :bar, :baz
  end
end
test_string_creates_string_column()
# File activerecord/test/cases/migration/change_table_test.rb, line 111
def test_string_creates_string_column
  with_change_table do |t|
    @connection.expect :add_column, nil, [:delete_me, :foo, :string, {}]
    @connection.expect :add_column, nil, [:delete_me, :bar, :string, {}]
    t.string :foo, :bar
  end
end
test_table_name_set()
# File activerecord/test/cases/migration/change_table_test.rb, line 217
def test_table_name_set
  with_change_table do |t|
    assert_equal :delete_me, t.name
  end
end
test_timestamps_creates_updated_at_and_created_at()
# File activerecord/test/cases/migration/change_table_test.rb, line 89
def test_timestamps_creates_updated_at_and_created_at
  with_change_table do |t|
    @connection.expect :add_timestamps, nil, [:delete_me, null: true]
    t.timestamps null: true
  end
end
with_change_table()
# File activerecord/test/cases/migration/change_table_test.rb, line 15
def with_change_table
  yield ConnectionAdapters::Table.new(:delete_me, @connection)
end