Sha256: 0d0b8a52a429f0c865d18cf23637a1cdda0f7970b6559bd61b2c6b8499cd8153

Contents?: true

Size: 1.26 KB

Versions: 27

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require "cases/helper_sqlserver"

class SQLServerTriggerTest < ActiveRecord::TestCase
  after { exclude_output_inserted_table_names.clear }

  let(:exclude_output_inserted_table_names) do
    ActiveRecord::ConnectionAdapters::SQLServerAdapter.exclude_output_inserted_table_names
  end

  it "can insert into a table with output inserted - with a true setting for table name" do
    exclude_output_inserted_table_names["sst_table_with_trigger"] = true
    assert SSTestTriggerHistory.all.empty?
    obj = SSTestTrigger.create! event_name: "test trigger"
    _(["Fixnum", "Integer"]).must_include obj.id.class.name
    _(obj.event_name).must_equal "test trigger"
    _(obj.id).must_be :present?
    _(obj.id.to_s).must_equal SSTestTriggerHistory.first.id_source
  end

  it "can insert into a table with output inserted - with a uniqueidentifier value" do
    exclude_output_inserted_table_names["sst_table_with_uuid_trigger"] = "uniqueidentifier"
    assert SSTestTriggerHistory.all.empty?
    obj = SSTestTriggerUuid.create! event_name: "test uuid trigger"
    _(obj.id.class.name).must_equal "String"
    _(obj.event_name).must_equal "test uuid trigger"
    _(obj.id).must_be :present?
    _(obj.id.to_s).must_equal SSTestTriggerHistory.first.id_source
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
activerecord-sqlserver-adapter-7.0.7 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.2 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.1 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.0 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.6 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.0.rc2 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.0.rc1 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.5.1 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.1.0.beta1 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.5.0 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.4.0 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.3.0 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-6.0.3 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.2.0 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-6.1.3.0 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.1.0 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.0.0 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-7.0.0.0.rc1 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-6.1.2.1 test/cases/trigger_test_sqlserver.rb
activerecord-sqlserver-adapter-6.1.2.0 test/cases/trigger_test_sqlserver.rb