Methods
- A
- C
- S
- T
-
- test_inverse_of_raise_exception_on_unknown_commands,
- test_invert_add_belongs_to_alias,
- test_invert_add_column,
- test_invert_add_foreign_key,
- test_invert_add_foreign_key_with_column,
- test_invert_add_foreign_key_with_column_and_name,
- test_invert_add_index,
- test_invert_add_index_with_name,
- test_invert_add_index_with_no_options,
- test_invert_add_reference,
- test_invert_add_timestamps,
- test_invert_change_column,
- test_invert_change_column_default,
- test_invert_change_column_null,
- test_invert_change_table,
- test_invert_create_join_table,
- test_invert_create_join_table_with_table_name,
- test_invert_create_table,
- test_invert_create_table_with_options_and_block,
- test_invert_disable_extension,
- test_invert_drop_join_table,
- test_invert_drop_table,
- test_invert_drop_table_without_a_block_nor_option,
- test_invert_enable_extension,
- test_invert_remove_belongs_to_alias,
- test_invert_remove_column,
- test_invert_remove_column_without_type,
- test_invert_remove_index,
- test_invert_remove_index_with_name,
- test_invert_remove_index_with_no_column,
- test_invert_remove_index_with_no_special_options,
- test_invert_remove_reference,
- test_invert_remove_reference_with_index_and_foreign_key,
- test_invert_remove_timestamps,
- test_invert_rename_column,
- test_invert_rename_index,
- test_invert_rename_table,
- test_inverted_commands_are_reversed,
- test_irreversible_commands_raise_exception,
- test_record,
- test_remove_foreign_key_is_irreversible,
- test_respond_to_delegates,
- test_revert_order,
- test_send_calls_super,
- test_send_delegates_to_record,
- test_unknown_commands_delegate
Instance Public methods
america()
Link
create_table(name)
Link
setup()
Link
test_inverse_of_raise_exception_on_unknown_commands()
Link
test_invert_add_belongs_to_alias()
Link
test_invert_add_column()
Link
test_invert_add_foreign_key()
Link
test_invert_add_foreign_key_with_column()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 284 def test_invert_add_foreign_key_with_column enable = @recorder.inverse_of :add_foreign_key, [:dogs, :people, column: "owner_id"] assert_equal [:remove_foreign_key, [:dogs, column: "owner_id"]], enable end
test_invert_add_foreign_key_with_column_and_name()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 289 def test_invert_add_foreign_key_with_column_and_name enable = @recorder.inverse_of :add_foreign_key, [:dogs, :people, column: "owner_id", name: "fk"] assert_equal [:remove_foreign_key, [:dogs, name: "fk"]], enable end
test_invert_add_index()
Link
test_invert_add_index_with_name()
Link
test_invert_add_index_with_no_options()
Link
test_invert_add_reference()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 244 def test_invert_add_reference remove = @recorder.inverse_of :add_reference, [:table, :taggable, { polymorphic: true }] assert_equal [:remove_reference, [:table, :taggable, { polymorphic: true }], nil], remove end
test_invert_add_timestamps()
Link
test_invert_change_column()
Link
test_invert_change_column_default()
Link
test_invert_change_column_null()
Link
test_invert_change_table()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 87 def test_invert_change_table @recorder.revert do @recorder.change_table :fruits do |t| t.string :name t.rename :kind, :cultivar end end assert_equal [ [:rename_column, [:fruits, :cultivar, :kind]], [:remove_column, [:fruits, :name, :string, {}], nil], ], @recorder.commands assert_raises(ActiveRecord::IrreversibleMigration) do @recorder.revert do @recorder.change_table :fruits do |t| t.remove :kind end end end end
test_invert_create_join_table()
Link
test_invert_create_join_table_with_table_name()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 139 def test_invert_create_join_table_with_table_name drop_join_table = @recorder.inverse_of :create_join_table, [:musics, :artists, table_name: :catalog] assert_equal [:drop_join_table, [:musics, :artists, table_name: :catalog], nil], drop_join_table end
test_invert_create_table()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 108 def test_invert_create_table @recorder.revert do @recorder.record :create_table, [:system_settings] end drop_table = @recorder.commands.first assert_equal [:drop_table, [:system_settings], nil], drop_table end
test_invert_create_table_with_options_and_block()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 116 def test_invert_create_table_with_options_and_block block = Proc.new{} drop_table = @recorder.inverse_of :create_table, [:people_reminders, id: false], &block assert_equal [:drop_table, [:people_reminders, id: false], block], drop_table end
test_invert_disable_extension()
Link
test_invert_drop_join_table()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 144 def test_invert_drop_join_table block = Proc.new{} create_join_table = @recorder.inverse_of :drop_join_table, [:musics, :artists, table_name: :catalog], &block assert_equal [:create_join_table, [:musics, :artists, table_name: :catalog], block], create_join_table end
test_invert_drop_table()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 122 def test_invert_drop_table block = Proc.new{} create_table = @recorder.inverse_of :drop_table, [:people_reminders, id: false], &block assert_equal [:create_table, [:people_reminders, id: false], block], create_table end
test_invert_drop_table_without_a_block_nor_option()
Link
test_invert_enable_extension()
Link
test_invert_remove_belongs_to_alias()
Link
test_invert_remove_column()
Link
test_invert_remove_column_without_type()
Link
test_invert_remove_index()
Link
test_invert_remove_index_with_name()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 213 def test_invert_remove_index_with_name add = @recorder.inverse_of :remove_index, [:table, {column: [:one, :two], name: "new_index"}] assert_equal [:add_index, [:table, [:one, :two], name: "new_index"]], add end
test_invert_remove_index_with_no_column()
Link
test_invert_remove_index_with_no_special_options()
Link
test_invert_remove_reference()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 254 def test_invert_remove_reference add = @recorder.inverse_of :remove_reference, [:table, :taggable, { polymorphic: true }] assert_equal [:add_reference, [:table, :taggable, { polymorphic: true }], nil], add end
test_invert_remove_reference_with_index_and_foreign_key()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 259 def test_invert_remove_reference_with_index_and_foreign_key add = @recorder.inverse_of :remove_reference, [:table, :taggable, { index: true, foreign_key: true }] assert_equal [:add_reference, [:table, :taggable, { index: true, foreign_key: true }], nil], add end
test_invert_remove_timestamps()
Link
test_invert_rename_column()
Link
test_invert_rename_index()
Link
test_invert_rename_table()
Link
test_inverted_commands_are_reversed()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 55 def test_inverted_commands_are_reversed @recorder.revert do @recorder.record :create_table, [:hello] @recorder.record :create_table, [:world] end tables = @recorder.commands.map{|_cmd, args, _block| args} assert_equal [[:world], [:hello]], tables end
test_irreversible_commands_raise_exception()
Link
test_record()
Link
test_remove_foreign_key_is_irreversible()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 294 def test_remove_foreign_key_is_irreversible assert_raises ActiveRecord::IrreversibleMigration do @recorder.inverse_of :remove_foreign_key, [:dogs, column: "owner_id"] end assert_raises ActiveRecord::IrreversibleMigration do @recorder.inverse_of :remove_foreign_key, [:dogs, name: "fk"] end end
test_respond_to_delegates()
Link
test_revert_order()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 64 def test_revert_order block = Proc.new{|t| t.string :name } @recorder.instance_eval do create_table("apples", &block) revert do create_table("bananas", &block) revert do create_table("clementines", &block) create_table("dates") end create_table("elderberries") end revert do create_table("figs", &block) create_table("grapes") end end assert_equal [[:create_table, ["apples"], block], [:drop_table, ["elderberries"], nil], [:create_table, ["clementines"], block], [:create_table, ["dates"], nil], [:drop_table, ["bananas"], block], [:drop_table, ["grapes"], nil], [:drop_table, ["figs"], block]], @recorder.commands end
test_send_calls_super()
Link
test_send_delegates_to_record()
Link
# File activerecord/test/cases/migration/command_recorder_test.rb, line 24 def test_send_delegates_to_record recorder = CommandRecorder.new(Class.new { def create_table(name); end }.new) assert recorder.respond_to?(:create_table), 'respond_to? create_table' recorder.send(:create_table, :horses) assert_equal [[:create_table, [:horses], nil]], recorder.commands end