Skip to content

Commit 50a49e5

Browse files
committed
Much of the AAAA test file was not needed. The core are AAA file was already doing this. Moved schema specific file from possibly conflicting AAA test file to AAAA too.
1 parent e0ab45d commit 50a49e5

File tree

3 files changed

+5
-40
lines changed

3 files changed

+5
-40
lines changed

test/cases/aaa_create_tables_test_sqlserver.rb

Lines changed: 0 additions & 10 deletions
This file was deleted.

test/cases/aaaa_create_tables_test_sqlserver.rb

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,10 @@
22
require 'cases/sqlserver_helper'
33

44
class AAAACreateTablesTestSqlserver < ActiveRecord::TestCase
5-
self.use_transactional_fixtures = false
65

7-
def setup
8-
@ar_path = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', 'rails/activerecord/test/schema'))
9-
@base_path = "#{File.dirname(__FILE__)}/../fixtures/db_definitions"
10-
end
11-
12-
def __test_sqlserver_load_test_schema
13-
execute_sql_file("#{@base_path}/sqlserver.drop.sql", ActiveRecord::Base.connection)
14-
execute_sql_file("#{@base_path}/sqlserver.sql", ActiveRecord::Base.connection)
15-
execute_sql_file("#{@base_path}/sqlserver2.drop.sql", Course.connection)
16-
execute_sql_file("#{@base_path}/sqlserver2.sql", Course.connection)
6+
def test_load_sqlserver_specific_schema
7+
eval(File.read(File.expand_path(File.join(File.dirname(__FILE__), '..', 'schema', 'sqlserver_specific_schema.rb'))))
178
assert true
189
end
19-
20-
def test_activerecord_load_test_schema
21-
eval(File.read("#{@ar_path}/schema.rb"))
22-
eval(File.read("#{@ar_path}/schema2.rb"))
23-
assert_equal ["courses"], Course.connection.tables, "Make sure schema2.rb creates table in Course.connection to arunit2."
24-
end
25-
26-
private
2710

28-
def execute_sql_file(path, connection)
29-
File.read(path).split(';').each_with_index do |sql, i|
30-
begin
31-
connection.execute("\n\n-- statement ##{i}\n#{sql}\n") unless sql.blank?
32-
rescue ActiveRecord::StatementInvalid
33-
#$stderr.puts "warning: #{$!}"
34-
end
35-
end
36-
end
3711
end

test/schema/sqlserver_specific_schema.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ActiveRecord::Schema.define do
2+
23
create_table :table_with_real_columns, :force => true do |t|
34
t.column :real_number, :real
45
end
@@ -15,7 +16,6 @@
1516
# char1 char(1) default 'Y',
1617
# char2 character varying(50) default 'a varchar field',
1718
# char3 text default 'a text field',
18-
1919
t.column :positive_integer, :integer, :default => 1
2020
t.column :negative_integer, :integer, :default => -1
2121
t.column :decimal_number, :decimal, :precision => 3, :scale => 2, :default => 2.78
@@ -28,4 +28,5 @@
2828
t.column :string_with_pretend_null_three, :string, :default => 'NULL'
2929
t.column :string_with_pretend_null_four, :string, :default => '(NULL)'
3030
end
31-
end
31+
32+
end

0 commit comments

Comments
 (0)