File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33require "cases/helper_sqlserver"
4- require "models/topic"
5- require "models/task"
6- require "models/post"
7- require "models/subscriber"
8- require "models/minimalistic"
9- require "models/college"
4+ require "models/dog"
5+ require "models/other_dog"
106
117class TempTestSQLServer < ActiveRecord ::TestCase
128 # it "assert true" do
139 # assert true
1410 # end
1511
1612 it "insert from one schema to another using raw SQL" do
17- arunit_connection = Topic . lease_connection
18- arunit2_connection = College . lease_connection
13+ arunit_connection = Dog . lease_connection
14+ arunit2_connection = OtherDog . lease_connection
1915
2016 arunit_database = arunit_connection . pool . db_config . database
2117 arunit2_database = arunit2_connection . pool . db_config . database
@@ -24,8 +20,16 @@ class TempTestSQLServer < ActiveRecord::TestCase
2420 INSERT INTO #{ arunit2_database } .dbo.dogs(id) SELECT id FROM #{ arunit_database } .dbo.dogs
2521 SQL
2622
27- assert_nothing_raised do
28- arunit_connection . execute ( sql )
23+ assert Dog . count , 1
24+ assert OtherDog . count , 0
25+
26+ arunit_connection . transaction do
27+ assert_nothing_raised do
28+ arunit_connection . execute ( sql )
29+ end
2930 end
31+
32+ assert Dog . count , 1
33+ assert OtherDog . count , 1
3034 end
3135end
You can’t perform that action at this time.
0 commit comments