Sha256: 498c20f0bc5d9b00698127940fec34a393b5352bc1b9e3d0b3ad798bc60c1401

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

require_relative '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

5 entries across 5 versions & 1 rubygems

Version Path
updateable_views_inheritance-1.4.8 test/migration_test.rb
updateable_views_inheritance-1.4.7 test/migration_test.rb
updateable_views_inheritance-1.4.6 test/migration_test.rb
updateable_views_inheritance-1.4.5 test/migration_test.rb
updateable_views_inheritance-1.4.4 test/migration_test.rb