Methods
A
C
S
T
Instance Public methods
america()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 12
def america; end
create_table(name)
# File activerecord/test/cases/migration/command_recorder_test.rb, line 25
def create_table(name); end
setup()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 6
def setup
  @recorder = CommandRecorder.new
end
test_inverse()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 49
def test_inverse
  @recorder.record :create_table, [:system_settings]
  assert_equal 1, @recorder.inverse.length

  @recorder.record :rename_table, [:old, :new]
  assert_equal 2, @recorder.inverse.length
end
test_invert_add_column()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 82
def test_invert_add_column
  @recorder.record :add_column, [:table, :column, :type, {}]
  remove = @recorder.inverse.first
  assert_equal [:remove_column, [:table, :column]], remove
end
test_invert_add_index()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 94
def test_invert_add_index
  @recorder.record :add_index, [:table, [:one, :two], {:options => true}]
  remove = @recorder.inverse.first
  assert_equal [:remove_index, [:table, {:column => [:one, :two]}]], remove
end
test_invert_add_index_with_name()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 100
def test_invert_add_index_with_name
    @recorder.record :add_index, [:table, [:one, :two], {:name => "new_index"}]
    remove = @recorder.inverse.first
    assert_equal [:remove_index, [:table, {:name => "new_index"}]], remove
end
test_invert_add_index_with_no_options()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 106
def test_invert_add_index_with_no_options
  @recorder.record :add_index, [:table, [:one, :two]]
  remove = @recorder.inverse.first
  assert_equal [:remove_index, [:table, {:column => [:one, :two]}]], remove
end
test_invert_add_timestamps()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 118
def test_invert_add_timestamps
  @recorder.record :add_timestamps, [:table]
  remove = @recorder.inverse.first
  assert_equal [:remove_timestamps, [:table]], remove
end
test_invert_create_table()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 64
def test_invert_create_table
  @recorder.record :create_table, [:system_settings]
  drop_table = @recorder.inverse.first
  assert_equal [:drop_table, [:system_settings]], drop_table
end
test_invert_create_table_with_options()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 70
def test_invert_create_table_with_options
  @recorder.record :create_table, [:people_reminders, {:id => false}]
  drop_table = @recorder.inverse.first
  assert_equal [:drop_table, [:people_reminders]], drop_table
end
test_invert_remove_timestamps()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 124
def test_invert_remove_timestamps
  @recorder.record :remove_timestamps, [:table]
  add = @recorder.inverse.first
  assert_equal [:add_timestamps, [:table]], add
end
test_invert_rename_column()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 88
def test_invert_rename_column
  @recorder.record :rename_column, [:table, :old, :new]
  rename = @recorder.inverse.first
  assert_equal [:rename_column, [:table, :new, :old]], rename
end
test_invert_rename_index()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 112
def test_invert_rename_index
  @recorder.record :rename_index, [:table, :old, :new]
  rename = @recorder.inverse.first
  assert_equal [:rename_index, [:table, :new, :old]], rename
end
test_invert_rename_table()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 76
def test_invert_rename_table
  @recorder.record :rename_table, [:old, :new]
  rename = @recorder.inverse.first
  assert_equal [:rename_table, [:new, :old]], rename
end
test_inverted_commands_are_reveresed()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 57
def test_inverted_commands_are_reveresed
  @recorder.record :create_table, [:hello]
  @recorder.record :create_table, [:world]
  tables = @recorder.inverse.map(&:last)
  assert_equal [[:world], [:hello]], tables
end
test_record()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 44
def test_record
  @recorder.record :create_table, [:system_settings]
  assert_equal 1, @recorder.commands.length
end
test_respond_to_delegates()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 10
def test_respond_to_delegates
  recorder = CommandRecorder.new(Class.new {
    def america; end
  }.new)
  assert recorder.respond_to?(:america)
end
test_send_calls_super()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 17
def test_send_calls_super
  assert_raises(NoMethodError) do
    @recorder.send(:non_existing_method, :horses)
  end
end
test_send_delegates_to_record()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 23
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]]], recorder.commands
end
test_unknown_commands_delegate()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 32
def test_unknown_commands_delegate
  recorder = CommandRecorder.new(stub(:foo => 'bar'))
  assert_equal 'bar', recorder.foo
end
test_unknown_commands_raise_exception_if_they_cannot_delegate()
# File activerecord/test/cases/migration/command_recorder_test.rb, line 37
def test_unknown_commands_raise_exception_if_they_cannot_delegate
  @recorder.record :execute, ['some sql']
  assert_raises(ActiveRecord::IrreversibleMigration) do
    @recorder.inverse
  end
end