Sha256: 11446b5880bfd6b3c0ae9e3e0971572721ec421dcbbfdc41c2e674e6c8846e13

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class UpdateableViewsInheritanceMigrationTest < ActiveSupport::TestCase
  # We use transactional fixtures - migration from the setup is rolled back by Rails on teardown
  def setup
    @connection = ActiveRecord::Base.connection
  end

  def test_create_child_default
    ActiveRecord::Migrator.up(File.dirname(__FILE__) + '/fixtures/migrations/', 2)
    assert_equal %w(coal_consumption id max_speed name type water_consumption),
                 @connection.columns(:steam_locomotives).map{ |c| c.name }.sort
  end

  def test_create_child_explicit_table
    ActiveRecord::Migrator.up(File.dirname(__FILE__) + '/fixtures/migrations/', 3)
    assert_equal %w(electricity_consumption id max_speed name type),
                 @connection.columns(:electric_locomotives).map{ |c| c.name }.sort
  end
  
  def test_drop_child
    ActiveRecord::Migrator.up(File.dirname(__FILE__) + '/fixtures/migrations/', 3)
    ActiveRecord::Migrator.down(File.dirname(__FILE__) + '/fixtures/migrations/', 2)
    assert_equal %w(steam_locomotives), @connection.views.sort
    assert_equal %w(locomotives
                    schema_migrations
                    steam_locomotives_data
                    updateable_views_inheritance), @connection.tables.sort
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
updateable_views_inheritance-1.4.3 test/migration_test.rb
updateable_views_inheritance-1.4.2 test/migration_test.rb
updateable_views_inheritance-1.4.1 test/migration_test.rb
updateable_views_inheritance-1.4.0 test/migration_test.rb
updateable_views_inheritance-1.3.0 test/migration_test.rb
updateable_views_inheritance-1.2.2 test/migration_test.rb
updateable_views_inheritance-1.2.1 test/migration_test.rb
updateable_views_inheritance-1.2.0 test/migration_test.rb
updateable_views_inheritance-1.1.2 test/migration_test.rb