Sha256: b6dec7ba814b2f2ba1facf6d278ef17ee45b28f483ce3d627de78d5cfad084e4

Contents?: true

Size: 901 Bytes

Versions: 8

Compression:

Stored size: 901 Bytes

Contents

require 'abstract_unit'

class ActiveSchemaTest < Test::Unit::TestCase
  def setup
    ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do
      alias_method :real_execute, :execute
      def execute(sql, name = nil) return sql end
    end    
  end
  
  def teardown
    ActiveRecord::ConnectionAdapters::MysqlAdapter.send(:alias_method, :execute, :real_execute)
  end

  def test_drop_table
    assert_equal "DROP TABLE people", drop_table(:people)
  end
  
  def test_add_column
    assert_equal "ALTER TABLE people ADD `last_name` varchar(255)", add_column(:people, :last_name, :string)
  end
  
  def test_add_column_with_limit
    assert_equal "ALTER TABLE people ADD `key` varchar(32)", add_column(:people, :key, :string, :limit => 32)
  end
  
  private
    def method_missing(method_symbol, *arguments)
      ActiveRecord::Base.connection.send(method_symbol, *arguments)
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/activerecord/test/active_schema_test_mysql.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/activerecord/test/active_schema_test_mysql.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/activerecord/test/active_schema_test_mysql.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/activerecord/test/active_schema_test_mysql.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/activerecord/test/active_schema_test_mysql.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/activerecord/test/active_schema_test_mysql.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/activerecord/test/active_schema_test_mysql.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/activerecord/test/active_schema_test_mysql.rb