Skip to content

Commit fcfe673

Browse files
committed
Simplify testing. Make AR tests not run by default.
1 parent 90c240c commit fcfe673

File tree

4 files changed

+5
-15
lines changed

4 files changed

+5
-15
lines changed

Gemfile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ group :tinytds do
1111
if ENV['TINYTDS_SOURCE']
1212
gem 'tiny_tds', :path => ENV['TINYTDS_SOURCE']
1313
else
14-
gem 'tiny_tds'
14+
gem 'tiny_tds', '>= 0.4.5'
1515
end
1616
end
1717

@@ -24,12 +24,5 @@ group :development do
2424
gem 'mocha', '0.9.8'
2525
gem 'shoulda', '2.10.3'
2626
gem 'bench_press'
27-
platforms :mri_18 do
28-
gem 'ruby-prof', '0.9.1'
29-
gem 'ruby-debug', '0.10.3'
30-
end
31-
platforms :mri_19 do
32-
gem 'ruby-debug19', '0.11.6'
33-
end
3427
end
3528

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ end
1212

1313
def test_files
1414
files = Dir.glob("test/cases/**/*_test_sqlserver.rb").sort
15-
unless ENV['ACTIVERECORD_UNITTEST_SKIP']
15+
if ENV['ACTIVERECORD_UNITTEST']
1616
ar_cases = Dir.glob("#{ENV['RAILS_SOURCE']}/activerecord/test/cases/**/*_test.rb")
1717
adapter_cases = Dir.glob("#{ENV['RAILS_SOURCE']}/activerecord/test/cases/adapters/**/*_test.rb")
1818
files += (ar_cases-adapter_cases).sort

test/cases/migration_test_sqlserver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ def test_coerced_string_creates_string_column
8080
@connection.expects(:add_column).with(:delete_me, :bar, 'nvarchar(255)', {})
8181
t.string :foo, :bar
8282
end
83-
end
83+
end if run_ar_tests?
8484
end

test/cases/sqlserver_helper.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
Bundler.setup
1313
require 'shoulda'
1414
require 'mocha'
15-
begin ; require 'ruby-debug' ; rescue LoadError ; end
16-
[ File.expand_path(File.join(File.dirname(__FILE__),'..','..','test')),
17-
File.expand_path(File.join(File.dirname(__FILE__),'..','..','test','connections','native_sqlserver_odbc')),
18-
File.expand_path(File.join(ENV['RAILS_SOURCE'],'activerecord','test'))
19-
].each{ |lib| $:.unshift(lib) unless $:.include?(lib) } if ENV['TM_DIRECTORY']
2015
require 'cases/helper'
2116
require 'models/topic'
2217
require 'active_record/version'
@@ -92,13 +87,15 @@ class SQLCounter
9287
module ActiveRecord
9388
class TestCase < ActiveSupport::TestCase
9489
class << self
90+
def run_ar_tests? ; ENV['ACTIVERECORD_UNITTEST'].present? ; end
9591
def connection_mode_dblib? ; ActiveRecord::Base.connection.instance_variable_get(:@connection_options)[:mode] == :dblib ; end
9692
def connection_mode_odbc? ; ActiveRecord::Base.connection.instance_variable_get(:@connection_options)[:mode] == :odbc ; end
9793
def sqlserver_2005? ; ActiveRecord::Base.connection.sqlserver_2005? ; end
9894
def sqlserver_2008? ; ActiveRecord::Base.connection.sqlserver_2008? ; end
9995
def sqlserver_azure? ; ActiveRecord::Base.connection.sqlserver_azure? ; end
10096
def ruby_19? ; RUBY_VERSION >= '1.9' ; end
10197
end
98+
def run_ar_tests? ; self.class.run_ar_tests? ; end
10299
def connection_mode_dblib? ; self.class.connection_mode_dblib? ; end
103100
def connection_mode_odbc? ; self.class.connection_mode_odbc? ; end
104101
def sqlserver_2005? ; self.class.sqlserver_2005? ; end

0 commit comments

Comments
 (0)