Sha256: 54917e49d0668a7e8b29daa3737d397e7003bb8a641855d470d5d07819fe502c

Contents?: true

Size: 1.19 KB

Versions: 44

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require "cases/helper_sqlserver"
require "migrations/create_clients_and_change_column_null"

class ChangeColumnNullTestSqlServer < ActiveRecord::TestCase
  before do
    @old_verbose = ActiveRecord::Migration.verbose
    ActiveRecord::Migration.verbose = false
    CreateClientsAndChangeColumnNull.new.up
  end

  after do
    CreateClientsAndChangeColumnNull.new.down
    ActiveRecord::Migration.verbose = @old_verbose
  end

  def find_column(table, name)
    table.find { |column| column.name == name }
  end

  let(:clients_table) { connection.columns("clients") }
  let(:name_column) { find_column(clients_table, "name") }
  let(:code_column) { find_column(clients_table, "code") }
  let(:value_column) { find_column(clients_table, "value") }

  describe "#change_column_null" do
    it "does not change the column limit" do
      _(name_column.limit).must_equal 15
    end

    it "does not change the column default" do
      _(code_column.default).must_equal "n/a"
    end

    it "does not change the column precision" do
      _(value_column.precision).must_equal 32
    end

    it "does not change the column scale" do
      _(value_column.scale).must_equal 8
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-6.0.2 test/cases/change_column_null_test_sqlserver.rb
activerecord-sqlserver-adapter-6.0.1 test/cases/change_column_null_test_sqlserver.rb
activerecord-sqlserver-adapter-6.0.0 test/cases/change_column_null_test_sqlserver.rb
activerecord-sqlserver-adapter-6.0.0.rc2 test/cases/change_column_null_test_sqlserver.rb