Skip to content

Commit 6ce7a13

Browse files
committed
Added test
1 parent b0f64ef commit 6ce7a13

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

test/cases/adapter_test_sqlserver.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,23 @@ def test_doesnt_error_when_a_select_query_is_called_while_preventing_writes
550550

551551
describe 'table is in non-dbo schema' do
552552
it "records can be created successfully" do
553-
Alien.create!(name: 'Trisolarans')
553+
assert_difference("Alien.count", 1) do
554+
Alien.create!(name: 'Trisolarans')
555+
end
554556
end
555557

556558
it 'records can be inserted using SQL' do
557-
Alien.connection.exec_insert("insert into [test].[aliens] (id, name) VALUES(1, 'Trisolarans'), (2, 'Xenomorph')")
559+
assert_difference("Alien.count", 2) do
560+
Alien.connection.exec_insert("insert into [test].[aliens] (id, name) VALUES(1, 'Trisolarans'), (2, 'Xenomorph')")
561+
end
562+
end
563+
end
564+
565+
describe 'table names contains spaces' do
566+
it 'records can be created successfully' do
567+
assert_difference("TableWithSpaces.count", 1) do
568+
TableWithSpaces.create!(name: 'Bob')
569+
end
558570
end
559571
end
560572

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
class TableWithSpaces < ActiveRecord::Base
4+
self.table_name = "A Table With Spaces"
5+
end

test/schema/sqlserver_specific_schema.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@
151151
SELECT GETUTCDATE() utcdate
152152
SQL
153153

154+
create_table 'A Table With Spaces', force: true do |t|
155+
t.string :name
156+
end
157+
154158
# Constraints
155159

156160
create_table(:sst_has_fks, force: true) do |t|

0 commit comments

Comments
 (0)