Sha256: 45186c29372d32063bfdabe2e6a36c47bb8cfccc1fb5735bb6e40205687e432c
Contents?: true
Size: 1.27 KB
Versions: 4
Compression:
Stored size: 1.27 KB
Contents
require 'cases/helper_sqlserver' class SQLServerUuidTest < ActiveRecord::TestCase let(:acceptable_uuid) { ActiveRecord::ConnectionAdapters::SQLServer::Type::Uuid::ACCEPTABLE_UUID } it 'has a uuid primary key' do SSTestUuid.columns_hash['id'].type.must_equal :uuid assert SSTestUuid.primary_key end it 'can create with a new pk' do obj = SSTestUuid.create! obj.id.must_be :present? obj.id.must_match acceptable_uuid end it 'can create other uuid column on reload' do obj = SSTestUuid.create! obj.reload obj.other_uuid.must_match acceptable_uuid end it 'can find uuid pk via connection' do connection.primary_key(SSTestUuid.table_name).must_equal 'id' end it 'changing column default' do table_name = SSTestUuid.table_name connection.add_column table_name, :thingy, :uuid, null: false, default: "NEWSEQUENTIALID()" SSTestUuid.reset_column_information column = SSTestUuid.columns_hash['thingy'] column.default_function.must_equal "newsequentialid()" # Now to a different function. connection.change_column table_name, :thingy, :uuid, null: false, default: "NEWID()" SSTestUuid.reset_column_information column = SSTestUuid.columns_hash['thingy'] column.default_function.must_equal "newid()" end end
Version data entries
4 entries across 4 versions & 1 rubygems