rr 1.1.0 → 1.1.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +138 -102
  3. data/README.md +27 -23
  4. data/VERSION +1 -1
  5. data/lib/rr/adapters.rb +2 -19
  6. data/lib/rr/autohook.rb +3 -29
  7. data/lib/rr/integrations.rb +44 -2
  8. data/lib/rr/integrations/decorator.rb +40 -0
  9. data/lib/rr/integrations/minitest.rb +2 -0
  10. data/lib/rr/integrations/minitest_4.rb +3 -0
  11. data/lib/rr/integrations/minitest_4_active_support.rb +2 -0
  12. data/lib/rr/integrations/minitest_active_support.rb +2 -0
  13. data/lib/rr/integrations/rspec_1.rb +5 -1
  14. data/lib/rr/integrations/rspec_2.rb +5 -1
  15. data/lib/rr/integrations/test_unit_1.rb +11 -2
  16. data/lib/rr/integrations/test_unit_2.rb +3 -1
  17. data/lib/rr/integrations/test_unit_200.rb +27 -0
  18. data/lib/rr/integrations/test_unit_200_active_support.rb +25 -0
  19. data/lib/rr/integrations/test_unit_2_active_support.rb +6 -3
  20. data/lib/rr/without_autohook.rb +10 -4
  21. data/spec/global_helper.rb +45 -4
  22. data/spec/spec.opts +2 -0
  23. data/spec/suite.rb +23 -7
  24. data/spec/suites/common/adapter_integration_tests.rb +94 -31
  25. data/spec/suites/common/adapter_tests.rb +6 -0
  26. data/spec/suites/common/{rails_integration_test.rb → rails_integration_tests.rb} +40 -58
  27. data/spec/suites/minitest/integration/minitest_test.rb +5 -5
  28. data/spec/suites/minitest/test_helper.rb +5 -1
  29. data/spec/suites/minitest_4/integration/minitest_test.rb +13 -0
  30. data/spec/suites/minitest_4/test_helper.rb +7 -0
  31. data/spec/suites/rspec_1/helper.rb +24 -0
  32. data/spec/suites/rspec_1/integration/rspec_1_spec.rb +20 -18
  33. data/spec/suites/rspec_1/integration/test_unit_1_spec.rb +10 -14
  34. data/spec/suites/rspec_1/integration/test_unit_2_spec.rb +11 -18
  35. data/spec/suites/rspec_1/spec_helper.rb +2 -23
  36. data/spec/suites/{rspec_1/integration/test_unit_1_rails_spec.rb → rspec_1_rails_2/integration/test_unit_1_rails_2_spec.rb} +15 -16
  37. data/spec/suites/rspec_1_rails_2/integration/test_unit_2_rails_2_spec.rb +57 -0
  38. data/spec/suites/rspec_1_rails_2/spec_helper.rb +3 -0
  39. data/spec/suites/rspec_2/helper.rb +27 -0
  40. data/spec/suites/rspec_2/integration/minitest_4_spec.rb +8 -18
  41. data/spec/suites/rspec_2/integration/minitest_spec.rb +8 -10
  42. data/spec/suites/rspec_2/integration/rspec_2_spec.rb +22 -21
  43. data/spec/suites/rspec_2/integration/test_unit_200_spec.rb +57 -0
  44. data/spec/suites/rspec_2/integration/{test_unit_spec.rb → test_unit_2_spec.rb} +9 -11
  45. data/spec/suites/rspec_2/spec_helper.rb +2 -26
  46. data/spec/suites/{rspec_2/integration/minitest_4_rails_spec.rb → rspec_2_rails_3/integration/minitest_4_rails_3_spec.rb} +12 -18
  47. data/spec/suites/{rspec_2/integration/test_unit_rails_spec.rb → rspec_2_rails_3/integration/test_unit_200_rails_3_spec.rb} +16 -18
  48. data/spec/suites/{rspec_1/integration/test_unit_2_rails_spec.rb → rspec_2_rails_3/integration/test_unit_2_rails_3_spec.rb} +19 -28
  49. data/spec/suites/rspec_2_rails_3/spec_helper.rb +3 -0
  50. data/spec/suites/{rspec_2/integration/minitest_rails_spec.rb → rspec_2_rails_4/integration/minitest_4_rails_4_spec.rb} +14 -16
  51. data/spec/suites/rspec_2_rails_4/integration/rspec_2_rails_4_spec.rb +156 -0
  52. data/spec/suites/rspec_2_rails_4/integration/test_unit_200_rails_4_spec.rb +66 -0
  53. data/spec/suites/rspec_2_rails_4/integration/test_unit_2_rails_4_spec.rb +66 -0
  54. data/spec/suites/rspec_2_rails_4/spec_helper.rb +3 -0
  55. data/spec/suites/test_unit_1/integration/test_unit_1_test.rb +4 -0
  56. data/spec/suites/test_unit_1/test_helper.rb +4 -1
  57. data/spec/suites/test_unit_2/integration/test_unit_2_test.rb +4 -0
  58. data/spec/suites/test_unit_2/test_helper.rb +5 -2
  59. data/spec/suites/test_unit_200/integration/test_unit_200_test.rb +10 -0
  60. data/spec/suites/test_unit_200/test_helper.rb +6 -0
  61. data/spec/suites/test_unit_200_rails_3/integration/test_unit_200_rails_3_test.rb +10 -0
  62. data/spec/suites/test_unit_200_rails_3/test_helper.rb +7 -0
  63. data/spec/suites/test_unit_200_rails_4/integration/test_unit_200_rails_4_test.rb +10 -0
  64. data/spec/suites/test_unit_200_rails_4/test_helper.rb +7 -0
  65. data/spec/suites/test_unit_2_rails_2/integration/test_unit_2_rails_2_test.rb +10 -0
  66. data/spec/suites/test_unit_2_rails_2/test_helper.rb +7 -0
  67. data/spec/suites/test_unit_2_rails_3/integration/test_unit_2_rails_3_test.rb +10 -0
  68. data/spec/suites/test_unit_2_rails_3/test_helper.rb +7 -0
  69. data/spec/suites/test_unit_2_rails_4/integration/test_unit_2_rails_4_test.rb +10 -0
  70. data/spec/suites/test_unit_2_rails_4/test_helper.rb +7 -0
  71. metadata +71 -19
  72. data/lib/rr/integrations/none.rb +0 -17
@@ -87,17 +87,19 @@ require 'rr/spy_verification'
87
87
 
88
88
  require 'rr/adapters'
89
89
  require 'rr/integrations'
90
+ require 'rr/integrations/decorator'
90
91
  require 'rr/integrations/rspec/invocation_matcher'
91
92
  require 'rr/integrations/rspec_1'
92
93
  require 'rr/integrations/rspec_2'
93
- require 'rr/integrations/test_unit_1'
94
- require 'rr/integrations/test_unit_2'
95
- require 'rr/integrations/test_unit_2_active_support'
96
94
  require 'rr/integrations/minitest_4'
97
95
  require 'rr/integrations/minitest_4_active_support'
98
96
  require 'rr/integrations/minitest'
99
97
  require 'rr/integrations/minitest_active_support'
100
- require 'rr/integrations/none'
98
+ require 'rr/integrations/test_unit_1'
99
+ require 'rr/integrations/test_unit_200'
100
+ require 'rr/integrations/test_unit_200_active_support'
101
+ require 'rr/integrations/test_unit_2'
102
+ require 'rr/integrations/test_unit_2_active_support'
101
103
 
102
104
  require 'rr/version'
103
105
 
@@ -115,6 +117,10 @@ module RR
115
117
 
116
118
  attr_accessor :debug
117
119
  alias_method :debug?, :debug
120
+
121
+ def ruby_18?
122
+ RUBY_VERSION =~ /^1\.8/
123
+ end
118
124
  end
119
125
  end
120
126
 
@@ -1,12 +1,53 @@
1
-
2
1
  require 'pp'
3
-
4
2
  require 'rubygems'
3
+ require 'appraisal/file'
4
+ require 'bundler'
5
5
 
6
6
  if ENV['COVERAGE']
7
7
  require 'simplecov'
8
8
  SimpleCov.start
9
9
  end
10
10
 
11
- $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
12
- require 'rr'
11
+ module RR
12
+ module Test
13
+ class Adapter
14
+ attr_reader :name
15
+
16
+ def initialize(name)
17
+ @name = name
18
+ end
19
+
20
+ def appraisal_name
21
+ parts = []
22
+ parts << (RUBY_VERSION =~ /^1\.8/ ? 'ruby_18' : 'ruby_19')
23
+ parts << name
24
+ parts.join('_')
25
+ end
26
+
27
+ def appraisal
28
+ @appraisal ||= Appraisal::File.new.appraisals.find do |appraisal|
29
+ appraisal.name == appraisal_name
30
+ end
31
+ end
32
+ end
33
+
34
+ def self.setup_test_suite(adapter_name)
35
+ puts "Setting up test suite for #{adapter_name}" if ENV['RR_DEBUG']
36
+ unset_bundler_vars
37
+ adapter = Adapter.new(adapter_name)
38
+ ENV['ADAPTER'] = adapter.name.to_s
39
+ puts "Using appraisal: #{adapter.appraisal.name}" if ENV['RR_DEBUG']
40
+ ENV['BUNDLE_GEMFILE'] = adapter.appraisal.gemfile_path
41
+ puts "Using gemfile: #{adapter.appraisal.gemfile_path}" if ENV['RR_DEBUG']
42
+ Bundler.setup(:default)
43
+ $:.unshift File.expand_path('../../lib', __FILE__)
44
+ end
45
+
46
+ def self.unset_bundler_vars
47
+ # Copied from appraisal
48
+ %w(RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE).each do |name|
49
+ ENV[name] = nil
50
+ end
51
+ end
52
+ end
53
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format nested
data/spec/suite.rb CHANGED
@@ -5,9 +5,10 @@ class SpecSuite
5
5
  adapter_name = opts[:adapter] || runner_name
6
6
  path = opts[:path] || runner_name
7
7
  env = opts[:env] || {}
8
+ args = opts[:args] || ""
8
9
  runner_method = "run_#{runner_name}"
9
10
  define_method(runner_method) do
10
- run_command(build_command(program_name, adapter_name, path, suffix, env))
11
+ run_command(build_command(program_name, adapter_name, path, suffix, env, args))
11
12
  end
12
13
  runners << [runner_name, runner_desc]
13
14
  end
@@ -54,19 +55,34 @@ class SpecSuite
54
55
  def_runner :test_unit_1, 'Test::Unit 1', 'ruby', 'test'
55
56
  end
56
57
 
57
- def_runner :test_unit_2, 'Test::Unit 2', 'ruby', 'test'
58
+ if ruby_18?
59
+ def_runner :test_unit_2, 'Test::Unit 2.4.x', 'ruby', 'test'
60
+ def_runner :test_unit_2_rails_2, 'Test::Unit 2.4.x + Rails 2', 'ruby', 'test'
61
+ else
62
+ def_runner :test_unit_200, 'Test::Unit 2.0.0', 'ruby', 'test'
63
+ def_runner :test_unit_200_rails_3, 'Test::Unit 2.0.0 + Rails 3', 'ruby', 'test'
64
+ def_runner :test_unit_2, 'Test::Unit >= 2.5', 'ruby', 'test'
65
+ def_runner :test_unit_2_rails_3, 'Test::Unit >= 2.5 + Rails 3', 'ruby', 'test'
66
+ def_runner :test_unit_2_rails_4, 'Test::Unit >= 2.5 + Rails 4', 'ruby', 'test'
67
+ end
58
68
 
59
69
  unless ruby_18?
60
- def_runner :minitest_4, 'MiniTest 4', 'ruby', 'test', :path => :minitest
61
-
70
+ def_runner :minitest_4, 'MiniTest 4', 'ruby', 'test'
62
71
  def_runner :minitest, 'Minitest', 'ruby', 'test'
63
72
  end
64
73
 
65
74
  if ruby_18?
66
- def_runner :rspec_1, 'RSpec 1', 'spec', 'spec'
75
+ def_runner :rspec_1, 'RSpec 1', 'spec', 'spec',
76
+ :args => '--format progress'
77
+ def_runner :rspec_1_rails_2, 'RSpec 1 + Rails 2', 'spec', 'spec',
78
+ :args => '--format progress'
67
79
  else
68
80
  def_runner :rspec_2, 'RSpec 2', 'rspec', 'spec',
69
81
  :env => {'SPEC_OPTS' => '--format progress'}
82
+ def_runner :rspec_2_rails_3, 'RSpec 2 + Rails 3', 'rspec', 'spec',
83
+ :env => {'SPEC_OPTS' => '--format progress'}
84
+ def_runner :rspec_2_rails_4, 'RSpec 2 + Rails 4', 'rspec', 'spec',
85
+ :env => {'SPEC_OPTS' => '--format progress'}
70
86
  end
71
87
 
72
88
  private
@@ -78,11 +94,11 @@ class SpecSuite
78
94
  session
79
95
  end
80
96
 
81
- def build_command(program_name, adapter_name, path, suffix, env)
97
+ def build_command(program_name, adapter_name, path, suffix, env, args)
82
98
  env = env.merge('ADAPTER' => adapter_name)
83
99
  env.each {|k,v| ENV[k.to_s] = v.to_s }
84
100
  file_list = build_file_list(path, suffix)
85
- ['bundle', 'exec', program_name, *file_list]
101
+ ['ruby'] + file_list + [args]
86
102
  end
87
103
 
88
104
  def build_file_list(adapter_name, suffix)
@@ -1,68 +1,103 @@
1
1
  require 'rubygems'
2
2
  require 'session'
3
3
  require 'tempfile'
4
+ require 'appraisal'
4
5
 
5
6
  module AdapterIntegrationTests
7
+ ROOT_DIR = File.expand_path('../../../..', __FILE__)
8
+ LIB_DIR = File.join(ROOT_DIR, 'lib')
9
+ TEMP_DIR = '/tmp/rr_integration_tests'
10
+
11
+ def create_link(filename)
12
+ FileUtils.ln_s(File.join(ROOT_DIR, filename), File.join(TEMP_DIR, filename))
13
+ end
14
+
6
15
  def debug?
7
16
  RR.debug?
8
17
  end
9
18
 
19
+ def ruby_18?
20
+ RUBY_VERSION =~ /^1\.8/
21
+ end
22
+
10
23
  def run_fixture_tests(content)
11
- output = nil
12
- f = Tempfile.new('rr_test_fixture')
24
+ fixture_path = File.join(TEMP_DIR, 'rr_test_fixture_spec.rb')
25
+ FileUtils.rm_f(fixture_path)
26
+ f = File.open(fixture_path, 'w')
13
27
  puts content if debug?
14
28
  f.write(content)
15
29
  f.close
16
30
  bash = Session::Bash.new
17
- cmd = "ruby -I #{lib_path} #{f.path} 2>&1"
18
- puts cmd if debug?
19
- stdout, stderr = bash.execute(cmd)
20
- success = !!(bash.exit_status == 0 || stdout =~ /Finished/)
31
+ # Bundler will set RUBYOPT to "-I <path to bundler> -r bundler/setup".
32
+ # This is unfortunate as it causes Bundler to be loaded before we
33
+ # load Bundler in RR::Test.setup_test_suite, thereby rendering our
34
+ # second Bundler.setup a no-op.
35
+ command = "env RUBYOPT='' ruby -I #{LIB_DIR} #{f.path} 2>&1"
36
+ puts command if debug?
37
+ stdout, _ = bash.execute(command)
38
+ exit_status = bash.exit_status
39
+ success = !!(exit_status == 0 || stdout =~ /Finished/)
21
40
  if debug? or !success
22
41
  puts stdout
23
- puts stderr
24
42
  end
25
43
  success.should be_true
26
44
  stdout
27
45
  ensure
28
- f.unlink
29
- end
30
-
31
- def lib_path
32
- File.expand_path('../../../../lib', __FILE__)
46
+ FileUtils.rm_f(fixture_path) if fixture_path
33
47
  end
34
48
 
35
49
  def test_helper_path
36
- File.expand_path('../../../global_helper', __FILE__)
37
- end
38
-
39
- def ruby_18?
40
- RUBY_VERSION =~ /^1\.8/
50
+ File.join(ROOT_DIR, 'spec/global_helper.rb')
41
51
  end
42
52
 
43
- def bootstrap(opts={})
53
+ def full_bootstrap(opts={})
44
54
  str = ""
45
- if respond_to?(:adapter_name)
46
- str << "ENV['ADAPTER'] = '#{adapter_name}'\n"
47
- end
48
- str << <<-EOT
49
- require 'rubygems'
50
- require 'bundler'
51
- Bundler.setup(:default)
52
- EOT
53
- str << "require 'rr'\n" if opts[:include_rr_before]
54
55
  str << <<-EOT
55
- require '#{test_framework_path}'
56
- #{additional_bootstrap}
56
+ require 'fileutils'
57
+ temp_dir = '#{TEMP_DIR}'
58
+ Dir.chdir(temp_dir)
59
+ require '#{test_helper_path}'
60
+ RR::Test.setup_test_suite('#{adapter_name}')
57
61
  EOT
58
- str << "require 'rr'\n" unless opts[:include_rr_before]
62
+ str << opts[:before_require_rr] if opts[:before_require_rr]
63
+ str << require_rr if opts[:include_rr_before_test_framework]
64
+ str << require_test_framework(opts)
65
+ str << require_rr unless opts[:include_rr_before_test_framework]
59
66
  str
60
67
  end
61
68
 
62
- def additional_bootstrap
69
+ def require_rr
70
+ "require 'rr'\n"
71
+ end
72
+
73
+ def before_require_test_framework
74
+ ""
75
+ end
76
+
77
+ def require_test_framework(opts={})
78
+ parts = [
79
+ before_require_test_framework,
80
+ opts[:before_require_test_framework] || "",
81
+ ]
82
+ paths = test_framework_path
83
+ paths = [paths] unless paths.is_a?(Array)
84
+ paths.each do |path|
85
+ parts << "require '#{path}'"
86
+ end
87
+ parts << after_require_test_framework
88
+ parts.join("\n")
89
+ end
90
+
91
+ def after_require_test_framework
63
92
  ""
64
93
  end
65
94
 
95
+ def with_bootstrap(*args)
96
+ opts = args.last.is_a?(Hash) ? args.pop : {}
97
+ str = args.first || ""
98
+ [full_bootstrap(opts), str].join("\n")
99
+ end
100
+
66
101
  def all_tests_should_pass(output)
67
102
  if output =~ /(\d+) failure/
68
103
  $1.should be == '0'
@@ -74,6 +109,18 @@ module AdapterIntegrationTests
74
109
 
75
110
  def self.included(base)
76
111
  base.class_eval do
112
+ before :all do
113
+ FileUtils.rm_rf(TEMP_DIR)
114
+ FileUtils.mkdir(TEMP_DIR)
115
+ create_link('Gemfile')
116
+ create_link('Appraisals')
117
+ create_link('gemfiles')
118
+ end
119
+
120
+ after :all do
121
+ FileUtils.rm_rf(TEMP_DIR)
122
+ end
123
+
77
124
  specify "when RR raises an error it raises a failure not an exception" do
78
125
  output = run_fixture_tests(error_test)
79
126
  output.should match /1 failure/
@@ -92,6 +139,22 @@ module AdapterIntegrationTests
92
139
  all_tests_should_pass(output)
93
140
  end
94
141
  end
142
+
143
+ # issue #29
144
+ specify "loading Cucumber doesn't mess up RR's autohook mechanism" do
145
+ FileUtils.mkdir(File.join(TEMP_DIR, 'features'))
146
+ loading_cucumber_test = <<-EOT
147
+ require 'fileutils'
148
+ temp_dir = '#{TEMP_DIR}'
149
+ Dir.chdir(temp_dir)
150
+ require '#{test_helper_path}'
151
+ RR::Test.setup_test_suite('#{adapter_name}')
152
+ # This is what gets loaded within the `cucumber` executable
153
+ require 'cucumber/rspec/disable_option_parser'
154
+ require 'rr'
155
+ EOT
156
+ run_fixture_tests(loading_cucumber_test)
157
+ end
95
158
  end
96
159
  end
97
160
  end
@@ -1,4 +1,10 @@
1
+ require 'set'
2
+
1
3
  module AdapterTests
4
+ def test_the_correct_adapters_are_loaded
5
+ assert_equal Set.new(applicable_adapter_names), Set.new(RR.loaded_adapter_names)
6
+ end
7
+
2
8
  def test_using_a_mock
3
9
  subject = Object.new
4
10
  mock(subject).foobar(1, 2) { :baz }
@@ -1,12 +1,13 @@
1
1
  $is_java = (RUBY_PLATFORM == 'java')
2
2
  if $is_java
3
+ require 'active_record'
3
4
  require 'arjdbc'
4
5
  require 'arjdbc/sqlite3'
5
6
  else
6
7
  require 'sqlite3'
7
8
  end
8
9
 
9
- module IntegrationWithRails
10
+ module RailsIntegrationTests
10
11
  def sqlite_adapter
11
12
  $is_java ? 'jdbcsqlite3' : 'sqlite3'
12
13
  end
@@ -19,10 +20,8 @@ module IntegrationWithRails
19
20
  ruby_18? ? 'test_help' : 'rails/test_help'
20
21
  end
21
22
 
22
- def bootstrap_active_record
23
- <<-EOT
24
- #{bootstrap}
25
-
23
+ def with_active_record_bootstrap(str)
24
+ with_bootstrap str, :before_require_test_framework => <<-EOT
26
25
  require 'active_record'
27
26
 
28
27
  # This is necessary to turn on transactional tests, for some reason
@@ -33,55 +32,58 @@ module IntegrationWithRails
33
32
  ActiveRecord::Base.establish_connection(config)
34
33
 
35
34
  require '#{rails_test_helper}'
35
+
36
+ ActiveRecord::Base.logger = Logger.new(File.open('/tmp/tests.log', 'a+'))
37
+ class Person < ActiveRecord::Base; end
36
38
  EOT
37
39
  end
38
40
 
39
- def self.included(base)
40
- base.class_eval do
41
- specify "the database is properly rolled back after an RR error" do
42
- require 'active_record'
43
- FileUtils.rm_f(sqlite_db_file_path)
44
- ActiveRecord::Base.establish_connection(
45
- :adapter => sqlite_adapter,
46
- :database => sqlite_db_file_path
47
- )
48
- unless debug?
49
- old_stdout = $stdout
50
- $stdout = File.open('/dev/null', 'w')
41
+ def database_properly_rolled_back_test
42
+ with_active_record_bootstrap <<-EOT
43
+ class FooTest < ActiveRecord::TestCase
44
+ def test_one
45
+ Person.create!(:name => 'Joe Blow')
46
+ object = Object.new
47
+ mock(object).foo
51
48
  end
52
- ActiveRecord::Migration.create_table :people do |t|
53
- t.string :name
49
+ end
50
+ EOT
51
+ end
52
+
53
+ def activerecord_teardown_still_works_test
54
+ with_active_record_bootstrap <<-EOT
55
+ class FooTest < ActiveRecord::TestCase
56
+ teardown do
57
+ raise 'hell'
54
58
  end
55
- unless debug?
56
- $stdout = old_stdout
59
+
60
+ def test_one
61
+ # whatever
57
62
  end
63
+ end
64
+ EOT
65
+ end
66
+
67
+ def self.included(base)
68
+ base.class_eval do
69
+ specify "the database is properly rolled back after an RR error" do
70
+ setup_database
58
71
 
59
72
  count = ActiveRecord::Base.connection.select_value('SELECT COUNT(*) from people')
60
73
  count.to_i.should be == 0
61
74
 
62
- run_fixture_tests <<-EOT
63
- #{bootstrap_active_record}
64
-
65
- ActiveRecord::Base.logger = Logger.new(File.open('/tmp/tests.log', 'a+'))
66
-
67
- class Person < ActiveRecord::Base; end
68
-
69
- require "#{test_helper_path}"
70
-
71
- class FooTest < ActiveRecord::TestCase
72
- def test_one
73
- Person.create!(:name => 'Joe Blow')
74
- object = Object.new
75
- mock(object).foo
76
- end
77
- end
78
- EOT
75
+ run_fixture_tests(database_properly_rolled_back_test)
79
76
 
80
77
  count = ActiveRecord::Base.connection.select_value('SELECT COUNT(*) from people')
81
78
  count.to_i.should be == 0
82
79
  end
83
80
 
84
81
  specify "throwing an error in teardown doesn't mess things up" do
82
+ setup_database
83
+ run_fixture_tests(activerecord_teardown_still_works_test)
84
+ end
85
+
86
+ def setup_database
85
87
  require 'active_record'
86
88
  FileUtils.rm_f(sqlite_db_file_path)
87
89
  ActiveRecord::Base.establish_connection(
@@ -98,26 +100,6 @@ module IntegrationWithRails
98
100
  unless debug?
99
101
  $stdout = old_stdout
100
102
  end
101
-
102
- output = run_fixture_tests <<-EOT
103
- #{bootstrap_active_record}
104
-
105
- ActiveRecord::Base.logger = Logger.new(File.open('/tmp/tests.log', 'a+'))
106
-
107
- class Person < ActiveRecord::Base; end
108
-
109
- require "#{test_helper_path}"
110
-
111
- class FooTest < ActiveRecord::TestCase
112
- teardown do
113
- raise 'hell'
114
- end
115
-
116
- def test_one
117
- # whatever
118
- end
119
- end
120
- EOT
121
103
  end
122
104
  end
123
105
  end