Skip to content

Commit 5c75226

Browse files
committed
No longer require a rails git clone in some other directory with an env variable. Instead use bundler to do this for us.
1 parent fcfe673 commit 5c75226

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

Gemfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11

22
source :rubygems
33

4-
gemspec :path => ENV['RAILS_SOURCE']
4+
if ENV['RAILS_SOURCE']
5+
gemspec :path => ENV['RAILS_SOURCE']
6+
else
7+
spec = eval(File.read('activerecord-sqlserver-adapter.gemspec'))
8+
ar_version = spec.dependencies.detect{ |d|d.name == 'activerecord' }.requirement.requirements.first.last.version
9+
gem 'rails', :git => "git://github.com/rails/rails.git", :tag => "v#{ar_version}"
10+
end
511

612
if ENV['AREL']
713
gem 'arel', :path => ENV['AREL']
@@ -20,7 +26,7 @@ group :odbc do
2026
end
2127

2228
group :development do
23-
gem 'rake', '>= 0.8.7'
29+
gem 'rake', '0.9.2'
2430
gem 'mocha', '0.9.8'
2531
gem 'shoulda', '2.10.3'
2632
gem 'bench_press'

Rakefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ require 'rake/testtask'
77
def test_libs(mode='dblib')
88
['lib',
99
'test',
10-
"#{ENV['RAILS_SOURCE']}/activerecord/test"]
10+
"#{File.join(Gem.loaded_specs['activerecord'].full_gem_path,'test')}"]
1111
end
1212

1313
def test_files
1414
files = Dir.glob("test/cases/**/*_test_sqlserver.rb").sort
15-
if ENV['ACTIVERECORD_UNITTEST']
16-
ar_cases = Dir.glob("#{ENV['RAILS_SOURCE']}/activerecord/test/cases/**/*_test.rb")
17-
adapter_cases = Dir.glob("#{ENV['RAILS_SOURCE']}/activerecord/test/cases/adapters/**/*_test.rb")
18-
files += (ar_cases-adapter_cases).sort
19-
end
15+
ar_path = Gem.loaded_specs['activerecord'].full_gem_path
16+
ar_cases = Dir.glob("#{ar_path}/test/cases/**/*_test.rb")
17+
adapter_cases = Dir.glob("#{ar_path}/test/cases/adapters/**/*_test.rb")
18+
files += (ar_cases-adapter_cases).sort
2019
files
2120
end
2221

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 if run_ar_tests?
83+
end
8484
end

test/cases/sqlserver_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
SQLSERVER_FIXTURES_ROOT = File.expand_path(File.join(SQLSERVER_TEST_ROOT,'fixtures'))
55
SQLSERVER_MIGRATIONS_ROOT = File.expand_path(File.join(SQLSERVER_TEST_ROOT,'migrations'))
66
SQLSERVER_SCHEMA_ROOT = File.expand_path(File.join(SQLSERVER_TEST_ROOT,'schema'))
7-
ACTIVERECORD_TEST_ROOT = File.expand_path(File.join(ENV['RAILS_SOURCE'],'activerecord','test'))
7+
ACTIVERECORD_TEST_ROOT = File.expand_path(File.join(Gem.loaded_specs['activerecord'].full_gem_path,'test'))
88
ENV['ARCONFIG'] = File.expand_path(File.join(SQLSERVER_TEST_ROOT,'config.yml'))
99

10+
$:.unshift ACTIVERECORD_TEST_ROOT
11+
1012
require 'rubygems'
1113
require 'bundler'
1214
Bundler.setup
@@ -87,15 +89,13 @@ class SQLCounter
8789
module ActiveRecord
8890
class TestCase < ActiveSupport::TestCase
8991
class << self
90-
def run_ar_tests? ; ENV['ACTIVERECORD_UNITTEST'].present? ; end
9192
def connection_mode_dblib? ; ActiveRecord::Base.connection.instance_variable_get(:@connection_options)[:mode] == :dblib ; end
9293
def connection_mode_odbc? ; ActiveRecord::Base.connection.instance_variable_get(:@connection_options)[:mode] == :odbc ; end
9394
def sqlserver_2005? ; ActiveRecord::Base.connection.sqlserver_2005? ; end
9495
def sqlserver_2008? ; ActiveRecord::Base.connection.sqlserver_2008? ; end
9596
def sqlserver_azure? ; ActiveRecord::Base.connection.sqlserver_azure? ; end
9697
def ruby_19? ; RUBY_VERSION >= '1.9' ; end
9798
end
98-
def run_ar_tests? ; self.class.run_ar_tests? ; end
9999
def connection_mode_dblib? ; self.class.connection_mode_dblib? ; end
100100
def connection_mode_odbc? ; self.class.connection_mode_odbc? ; end
101101
def sqlserver_2005? ; self.class.sqlserver_2005? ; end

0 commit comments

Comments
 (0)