@@ -373,11 +373,28 @@ class AdapterTestSQLServer < ActiveRecord::TestCase
373
373
assert_match ( /CREATE VIEW sst_customers_view/ , view_info [ "VIEW_DEFINITION" ] )
374
374
end
375
375
376
+ it "allows connection#view_information to work with qualified object names" do
377
+ view_info = connection . send ( :view_information , "[activerecord_unittest].[dbo].[sst_customers_view]" )
378
+ assert_equal ( "sst_customers_view" , view_info [ "TABLE_NAME" ] )
379
+ assert_match ( /CREATE VIEW sst_customers_view/ , view_info [ "VIEW_DEFINITION" ] )
380
+ end
381
+
382
+ it "allows connection#view_information to work across databases when using qualified object names" do
383
+ # College is defined in activerecord_unittest2 database.
384
+ view_info = College . connection . send ( :view_information , "[activerecord_unittest].[dbo].[sst_customers_view]" )
385
+ assert_equal ( "sst_customers_view" , view_info [ "TABLE_NAME" ] )
386
+ assert_match ( /CREATE VIEW sst_customers_view/ , view_info [ "VIEW_DEFINITION" ] )
387
+ end
388
+
376
389
it "allow the connection#view_table_name method to return true table_name for the view" do
377
390
assert_equal "customers" , connection . send ( :view_table_name , "sst_customers_view" )
378
391
assert_equal "topics" , connection . send ( :view_table_name , "topics" ) , "No view here, the same table name should come back."
379
392
end
380
393
394
+ it "allow the connection#view_table_name method to return true table_name for the view for other connections" do
395
+ assert_equal "customers" , College . connection . send ( :view_table_name , "[activerecord_unittest].[dbo].[sst_customers_view]" )
396
+ assert_equal "topics" , College . connection . send ( :view_table_name , "topics" ) , "No view here, the same table name should come back."
397
+ end
381
398
# With same column names
382
399
383
400
it "have matching column objects" do
0 commit comments