minitest-hooks 1.4.2 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cab2b3cd7d0bc63cc18436e87e08ff392e9facfc
4
- data.tar.gz: 82eed894ed6beab837d83fd94a64ab3c36e1acb4
2
+ SHA256:
3
+ metadata.gz: a525a80546faf2287ec0c0b8f5423a93bf76195381aec4bb37ab04ea6a533a71
4
+ data.tar.gz: 8e6c6bd1f68db59ad2a6c885f6aba06b38f0302c8ecda20981381fd9e6683550
5
5
  SHA512:
6
- metadata.gz: fa12984df59acb3da5d4d038f2d5aa83b758724a5f7a2d258f6f82ddc5d23d7afc739eaaa9b09bdd72befa7f040f693a398ced29b3086e6ef9278118753975bb
7
- data.tar.gz: b2e8f5f4bdf2e1283711cb2b947da5ea5526eaf7e00bd2ec0912011764203c16f7ba376011df4898a4bb8108599b6e416b447859838af44d7adf229f89d152ee
6
+ metadata.gz: c6ba36dfb0477f1a7a15579b791ee73c6a5f3bf56157a115f7eaa14c40763e5244e2eb3e6f774fbfdc0cdbc6a7f31a8595bd95a59042889e974acb45c3210c9e
7
+ data.tar.gz: e56c3ed65969f299e59030a590a207a56519180843221a55635c6db58fd8dd5f9b0d339af7cfecfcfee10ec1272b2353349d89048df06f25f99680b49cbeaf87
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ === 1.5.1 (2023-07-27)
2
+
3
+ * Do not include specs or Rakefile in the gem (jeremyevans)
4
+
5
+ * Fix use with minitest 5.19+ by using Minitest instead of MiniTest as the constant (jeremyevans)
6
+
7
+ === 1.5.0 (2018-05-21)
8
+
9
+ * Fix use with minitest 5.11+ by using Minitest::Result in such cases (GUI) (#15)
10
+
1
11
  === 1.4.2 (2017-09-12)
2
12
 
3
13
  * Don't modify test instance name if before_all/after_all cause an error (jeremyevans) (#14)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015,2017 Jeremy Evans
1
+ Copyright (c) 2015-2023 Jeremy Evans
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to
data/README.rdoc CHANGED
@@ -29,7 +29,7 @@ First, you need to require the library.
29
29
 
30
30
  You can set the default for some specs to be <tt>Minitest::HooksSpec</tt>:
31
31
 
32
- MiniTest::Spec.register_spec_type(/something/, Minitest::HooksSpec)
32
+ Minitest::Spec.register_spec_type(/something/, Minitest::HooksSpec)
33
33
 
34
34
  Alternatively, you can include <tt>Minitest::Hooks</tt> in a specific spec class:
35
35
 
@@ -1,3 +1,3 @@
1
1
  require 'minitest/hooks'
2
2
 
3
- MiniTest::Spec.register_spec_type(//, Minitest::HooksSpec)
3
+ Minitest::Spec.register_spec_type(//, Minitest::HooksSpec)
@@ -64,40 +64,39 @@ module Minitest::Hooks::ClassMethods
64
64
  def with_info_handler(reporter, &block)
65
65
  @instance = new(NEW)
66
66
  @instance.time = 0
67
- description = respond_to?(:desc) ? desc : name
68
- @instance.name = "#{description}#around_all"
67
+ @instance.name = "around_all"
69
68
 
70
69
  begin
71
70
  @instance.around_all do
72
71
  begin
73
72
  @instance.capture_exceptions do
74
- @instance.name = "#{description}#before_all"
73
+ @instance.name = "before_all"
75
74
  @instance.before_all
76
75
  end
77
76
 
78
77
  if @instance.failure
79
78
  failed = true
80
- reporter.record @instance
79
+ _record_minitest_hooks_error(reporter, @instance)
81
80
  else
82
81
  super(reporter, &block)
83
82
  end
84
83
  ensure
85
84
  @instance.capture_exceptions do
86
- @instance.name = "#{description}#after_all" unless failed
85
+ @instance.name = "after_all" unless failed
87
86
  @instance.after_all
88
87
  end
89
88
  if @instance.failure && !failed
90
89
  failed = true
91
- reporter.record @instance
90
+ _record_minitest_hooks_error(reporter, @instance)
92
91
  end
93
- @instance.name = "#{description}#around_all" unless failed
92
+ @instance.name = "around_all" unless failed
94
93
  end
95
94
  end
96
95
  rescue => e
97
96
  @instance.capture_exceptions do
98
97
  raise e
99
98
  end
100
- reporter.record @instance
99
+ _record_minitest_hooks_error(reporter, @instance)
101
100
  end
102
101
  end
103
102
 
@@ -132,4 +131,19 @@ module Minitest::Hooks::ClassMethods
132
131
  super
133
132
  end
134
133
  end
134
+
135
+ private
136
+
137
+ def _record_minitest_hooks_error(reporter, instance)
138
+ # In Minitest 5.11+, use Minitest::Result for wrapping the object to send
139
+ # to the reporter.
140
+ if(defined?(Minitest::Result))
141
+ result = Minitest::Result.from(instance)
142
+ # :nocov:
143
+ else
144
+ result = instance
145
+ # :nocov:
146
+ end
147
+ reporter.record result
148
+ end
135
149
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-12 00:00:00.000000000 Z
11
+ date: 2023-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '5'
20
- type: :development
19
+ version: '5.3'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">"
25
25
  - !ruby/object:Gem::Version
26
- version: '5'
26
+ version: '5.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sequel
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-global_expectations
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: |
70
84
  minitest-hooks adds around and before_all/after_all/around_all hooks for Minitest.
71
85
  This allows you do things like run each suite of specs inside a database transaction,
@@ -82,23 +96,14 @@ files:
82
96
  - CHANGELOG
83
97
  - MIT-LICENSE
84
98
  - README.rdoc
85
- - Rakefile
86
99
  - lib/minitest/hooks.rb
87
100
  - lib/minitest/hooks/default.rb
88
101
  - lib/minitest/hooks/test.rb
89
- - spec/all.rb
90
- - spec/errors/example.rb
91
- - spec/helper.rb
92
- - spec/minitest_hooks_all_name_spec.rb
93
- - spec/minitest_hooks_direct_spec.rb
94
- - spec/minitest_hooks_errors_spec.rb
95
- - spec/minitest_hooks_spec.rb
96
- - spec/minitest_hooks_test.rb
97
102
  homepage: http://github.com/jeremyevans/minitest-hooks
98
103
  licenses:
99
104
  - MIT
100
105
  metadata: {}
101
- post_install_message:
106
+ post_install_message:
102
107
  rdoc_options:
103
108
  - "--quiet"
104
109
  - "--line-numbers"
@@ -120,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
125
  - !ruby/object:Gem::Version
121
126
  version: '0'
122
127
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.6.13
125
- signing_key:
128
+ rubygems_version: 3.4.10
129
+ signing_key:
126
130
  specification_version: 4
127
131
  summary: Around and before_all/after_all/around_all hooks for Minitest
128
132
  test_files: []
data/Rakefile DELETED
@@ -1,45 +0,0 @@
1
- require "rake"
2
- require "rake/clean"
3
-
4
- CLEAN.include ["minitest-hooks-*.gem", "rdoc", "coverage"]
5
-
6
- desc "Build minitest-hooks gem"
7
- task :package=>[:clean] do |p|
8
- sh %{#{FileUtils::RUBY} -S gem build minitest-hooks.gemspec}
9
- end
10
-
11
- ### Specs
12
-
13
- desc "Run specs"
14
- task :spec do
15
- sh %{#{FileUtils::RUBY} spec/all.rb}
16
- end
17
-
18
- task :default=>:spec
19
-
20
- ### RDoc
21
-
22
- RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'minitest-hooks: around and before_all/after_all/around_all hooks for Minitest']
23
-
24
- begin
25
- gem 'hanna-nouveau'
26
- RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
27
- rescue Gem::LoadError
28
- end
29
-
30
- rdoc_task_class = begin
31
- require "rdoc/task"
32
- RDoc::Task
33
- rescue LoadError
34
- require "rake/rdoctask"
35
- Rake::RDocTask
36
- end
37
-
38
- RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
39
-
40
- rdoc_task_class.new do |rdoc|
41
- rdoc.rdoc_dir = "rdoc"
42
- rdoc.options += RDOC_OPTS
43
- rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb"
44
- end
45
-
data/spec/all.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'rbconfig'
2
- ENV['RUBY'] ||= ENV["RUBY"] || File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]).sub(/.*\s.*/m, '"\&"')
3
- ENV['RUBYLIB'] = "lib:#{ENV['RUBYLIB']}"
4
- Dir['./spec/*_spec.rb'].each{|f| require f}
@@ -1,42 +0,0 @@
1
- require './spec/helper'
2
- require 'minitest/hooks/default'
3
-
4
- error = ENV['MINITEST_HOOKS_ERRORS']
5
-
6
- describe 'Minitest::Hooks error handling' do
7
- before(:all) do
8
- raise if error == 'before-all'
9
- end
10
- before do
11
- raise if error == 'before'
12
- end
13
- after do
14
- raise if error == 'after'
15
- end
16
- after(:all) do
17
- raise if error == 'after-all'
18
- end
19
- around do |&block|
20
- raise if error == 'around-before'
21
- super(&block)
22
- raise if error == 'around-after'
23
- end
24
- around(:all) do |&block|
25
- raise if error == 'around-all-before'
26
- super(&block)
27
- case error
28
- when 'before-all'
29
- name.must_equal 'Minitest::Hooks error handling#before_all'
30
- when 'after-all'
31
- name.must_equal 'Minitest::Hooks error handling#after_all'
32
- else
33
- name.must_equal 'Minitest::Hooks error handling#around_all'
34
- end
35
- raise if error == 'around-all-after'
36
- end
37
-
38
- 3.times do |i|
39
- it "should work try #{i}" do
40
- end
41
- end
42
- end
data/spec/helper.rb DELETED
@@ -1,6 +0,0 @@
1
- $:.unshift(File.join(File.dirname(File.expand_path(__FILE__)), "../lib/"))
2
- require 'rubygems'
3
- require 'sequel'
4
- gem 'minitest'
5
- require 'minitest/autorun'
6
- DATABASE_URL = ENV['DATABASE_URL'] || (defined?(JRUBY_VERSION) ? 'jdbc:sqlite::memory:' : 'sqlite:/')
@@ -1,42 +0,0 @@
1
- require './spec/helper'
2
- require 'minitest/hooks/default'
3
-
4
- describe 'Minitest::Hooks error handling' do
5
- before(:all) do
6
- name.must_equal 'Minitest::Hooks error handling#before_all'
7
- end
8
- after(:all) do
9
- name.must_equal 'Minitest::Hooks error handling#after_all'
10
- end
11
- around(:all) do |&block|
12
- name.must_equal 'Minitest::Hooks error handling#around_all'
13
- super(&block)
14
- name.must_equal 'Minitest::Hooks error handling#around_all'
15
- end
16
-
17
- 3.times do |i|
18
- it "should work try #{i}" do
19
- end
20
- end
21
- end
22
-
23
- class MinitestHooksNameTest < Minitest::Test
24
- include Minitest::Hooks
25
-
26
- def before_all
27
- assert_equal 'MinitestHooksNameTest#before_all', name
28
- end
29
- def after_all
30
- assert_equal 'MinitestHooksNameTest#after_all', name
31
- end
32
- def around_all
33
- assert_equal 'MinitestHooksNameTest#around_all', name
34
- super
35
- assert_equal 'MinitestHooksNameTest#around_all', name
36
- end
37
-
38
- 3.times do |i|
39
- define_method "test_should_work_try_#{i}" do
40
- end
41
- end
42
- end
@@ -1,113 +0,0 @@
1
- require './spec/helper'
2
- require 'minitest/hooks'
3
-
4
- NDB = Sequel.connect(DATABASE_URL)
5
-
6
- MiniTest::Spec.register_spec_type(/no_default/, Minitest::Spec)
7
-
8
- describe 'Minitest::Hooks with transactions/savepoints no_default' do
9
- include Minitest::Hooks
10
-
11
- before(:all) do
12
- @ds_ba = @ds_aa
13
- @ds_ba.count.must_equal 1 + @i
14
- end
15
- before do
16
- @ds_be = @ds_ae
17
- @ds_be.count.must_equal 2 + @i * 2
18
- end
19
- after do
20
- @ds_be.count.must_equal 2 + @i * 2
21
- end
22
- after(:all) do
23
- @ds_ba.count.must_equal 1 + @i
24
- end
25
- around do |&block|
26
- @ds_aa.count.must_equal 1 + @i
27
- NDB.transaction(:rollback=>:always, :savepoint=>true, :auto_savepoint=>true) do
28
- @ds_ae = @ds_aa
29
- @ds_ae.insert(1)
30
- super(&block)
31
- end
32
- @ds_aa.count.must_equal 1 + @i
33
- end
34
- around(:all) do |&block|
35
- @i ||= 0
36
- NDB.transaction(:rollback=>:always) do
37
- NDB.create_table(:a){Integer :a}
38
- @ds_aa = NDB[:a]
39
- @ds_aa.count.must_equal 0
40
- @ds_aa.insert(1)
41
- super(&block)
42
- end
43
- NDB.table_exists?(:a).must_equal false
44
- end
45
-
46
- 3.times do |i|
47
- it "should work try #{i}" do
48
- @ds_aa.count.must_equal 2
49
- @ds_ae.count.must_equal 2
50
- @ds_ba.count.must_equal 2
51
- @ds_be.count.must_equal 2
52
- end
53
- end
54
-
55
- describe "in nested describe" do
56
- before(:all) do
57
- @ds_ba3 = @ds_ba
58
- @ds_ba2 = @ds_aa2
59
- @ds_ba2.count.must_equal 2
60
- end
61
- before do
62
- @ds_be3 = @ds_be
63
- @ds_be2 = @ds_ae2
64
- @ds_be2.count.must_equal 4
65
- end
66
- after do
67
- @ds_be2.count.must_equal 4
68
- end
69
- after(:all) do
70
- @ds_ba2.count.must_equal 2
71
- end
72
- around do |&block|
73
- @ds_aa.count.must_equal 2
74
- super() do
75
- @ds_aa.count.must_equal 3
76
- @ds_ae3 = @ds_ae
77
- @ds_ae2 = @ds_aa2
78
- @ds_ae2.insert(1)
79
- block.call
80
- @ds_aa.count.must_equal 4
81
- end
82
- @ds_aa.count.must_equal 2
83
- end
84
- around(:all) do |&block|
85
- @i ||= 1
86
- super() do
87
- @ds_aa.count.must_equal 1
88
- @ds_aa2 = @ds_aa
89
- @ds_aa2.insert(1)
90
- block.call
91
- @ds_aa.count.must_equal 2
92
- end
93
- NDB.table_exists?(:a).must_equal false
94
- end
95
-
96
- 3.times do |i|
97
- it "should work try #{i}" do
98
- @ds_aa.count.must_equal 4
99
- @ds_ae.count.must_equal 4
100
- @ds_ba.count.must_equal 4
101
- @ds_be.count.must_equal 4
102
- @ds_aa2.count.must_equal 4
103
- @ds_ae2.count.must_equal 4
104
- @ds_ba2.count.must_equal 4
105
- @ds_be2.count.must_equal 4
106
- @ds_ae3.count.must_equal 4
107
- @ds_ba3.count.must_equal 4
108
- @ds_be3.count.must_equal 4
109
- end
110
- end
111
- end
112
- end
113
-
@@ -1,27 +0,0 @@
1
- require './spec/helper'
2
- require 'minitest/hooks/default'
3
- require 'open3'
4
-
5
- RUBY = ENV['RUBY'] || 'ruby'
6
-
7
- describe 'Minitest::Hooks error handling' do
8
- def self.run_test(desc, runs, errors)
9
- it "should handle errors in #{desc}" do
10
- ENV['MINITEST_HOOKS_ERRORS'] = desc
11
- Open3.popen3(RUBY, "spec/errors/example.rb", "-v") do |_, o, e, w|
12
- o.read.must_match /#{runs} runs, 0 assertions, 0 failures, #{errors} errors, 0 skips/
13
- e.read.must_equal ''
14
- w.value.exitstatus.wont_equal 0 if w
15
- end
16
- end
17
- end
18
-
19
- run_test "before-all", 1, 1
20
- run_test "before", 3, 3
21
- run_test "after", 3, 3
22
- run_test "after-all", 4, 1
23
- run_test "around-before", 1, 1
24
- run_test "around-after", 1, 1
25
- run_test "around-all-before", 1, 1
26
- run_test "around-all-after", 4, 1
27
- end
@@ -1,108 +0,0 @@
1
- require './spec/helper'
2
- require 'minitest/hooks/default'
3
-
4
- DB = Sequel.connect(DATABASE_URL)
5
-
6
- describe 'Minitest::Hooks with transactions/savepoints' do
7
- before(:all) do
8
- @ds_ba = @ds_aa
9
- @ds_ba.count.must_equal 1 + @i
10
- end
11
- before do
12
- @ds_be = @ds_ae
13
- @ds_be.count.must_equal 2 + @i * 2
14
- end
15
- after do
16
- @ds_be.count.must_equal 2 + @i * 2
17
- end
18
- after(:all) do
19
- @ds_ba.count.must_equal 1 + @i
20
- end
21
- around do |&block|
22
- @ds_aa.count.must_equal 1 + @i
23
- DB.transaction(:rollback=>:always, :savepoint=>true, :auto_savepoint=>true) do
24
- @ds_ae = @ds_aa
25
- @ds_ae.insert(1)
26
- super(&block)
27
- end
28
- @ds_aa.count.must_equal 1 + @i
29
- end
30
- around(:all) do |&block|
31
- @i ||= 0
32
- DB.transaction(:rollback=>:always) do
33
- DB.create_table(:a){Integer :a}
34
- @ds_aa = DB[:a]
35
- @ds_aa.count.must_equal 0
36
- @ds_aa.insert(1)
37
- super(&block)
38
- end
39
- DB.table_exists?(:a).must_equal false
40
- end
41
-
42
- 3.times do |i|
43
- it "should work try #{i}" do
44
- @ds_aa.count.must_equal 2
45
- @ds_ae.count.must_equal 2
46
- @ds_ba.count.must_equal 2
47
- @ds_be.count.must_equal 2
48
- end
49
- end
50
-
51
- describe "in nested describe" do
52
- before(:all) do
53
- @ds_ba3 = @ds_ba
54
- @ds_ba2 = @ds_aa2
55
- @ds_ba2.count.must_equal 2
56
- end
57
- before do
58
- @ds_be3 = @ds_be
59
- @ds_be2 = @ds_ae2
60
- @ds_be2.count.must_equal 4
61
- end
62
- after do
63
- @ds_be2.count.must_equal 4
64
- end
65
- after(:all) do
66
- @ds_ba2.count.must_equal 2
67
- end
68
- around do |&block|
69
- @ds_aa.count.must_equal 2
70
- super() do
71
- @ds_aa.count.must_equal 3
72
- @ds_ae3 = @ds_ae
73
- @ds_ae2 = @ds_aa2
74
- @ds_ae2.insert(1)
75
- block.call
76
- @ds_aa.count.must_equal 4
77
- end
78
- @ds_aa.count.must_equal 2
79
- end
80
- around(:all) do |&block|
81
- @i ||= 1
82
- super() do
83
- @ds_aa.count.must_equal 1
84
- @ds_aa2 = @ds_aa
85
- @ds_aa2.insert(1)
86
- block.call
87
- @ds_aa.count.must_equal 2
88
- end
89
- DB.table_exists?(:a).must_equal false
90
- end
91
-
92
- 3.times do |i|
93
- it "should work try #{i}" do
94
- @ds_aa.count.must_equal 4
95
- @ds_ae.count.must_equal 4
96
- @ds_ba.count.must_equal 4
97
- @ds_be.count.must_equal 4
98
- @ds_aa2.count.must_equal 4
99
- @ds_ae2.count.must_equal 4
100
- @ds_ba2.count.must_equal 4
101
- @ds_be2.count.must_equal 4
102
- @ds_ae3.count.must_equal 4
103
- @ds_ba3.count.must_equal 4
104
- @ds_be3.count.must_equal 4
105
- end
106
- end
107
- end
108
- end
@@ -1,120 +0,0 @@
1
- require './spec/helper'
2
- require 'minitest/hooks/test'
3
-
4
- class MyTest < Minitest::Test
5
- include Minitest::Hooks
6
- end
7
-
8
- class TestMinitestHooks < MyTest
9
- DB = Sequel.connect(DATABASE_URL)
10
-
11
- def before_all
12
- super
13
- @ds_ba = @ds_aa
14
- assert_equal @ds_ba.count, 1 + @i
15
- end
16
- def setup
17
- super
18
- @ds_be = @ds_ae
19
- assert_equal @ds_be.count, 2 + @i * 2
20
- end
21
- def teardown
22
- assert_equal @ds_be.count, 2 + @i * 2
23
- super
24
- end
25
- def after_all
26
- assert_equal @ds_ba.count, 1 + @i
27
- super
28
- end
29
- def around
30
- assert_equal @ds_aa.count, 1 + @i
31
- DB.transaction(:rollback=>:always, :savepoint=>true, :auto_savepoint=>true) do
32
- @ds_ae = @ds_aa
33
- @ds_ae.insert(1)
34
- super
35
- end
36
- assert_equal @ds_aa.count, 1 + @i
37
- end
38
- def around_all
39
- @i ||= 0
40
- DB.transaction(:rollback=>:always) do
41
- DB.create_table(:a){Integer :a}
42
- @ds_aa = DB[:a]
43
- assert_equal @ds_aa.count, 0
44
- @ds_aa.insert(1)
45
- super
46
- end
47
- assert_equal DB.table_exists?(:a), false
48
- end
49
-
50
- 3.times do |i|
51
- define_method(:"test_should_work_#{i}") do
52
- assert_equal @ds_aa.count, 2
53
- assert_equal @ds_ae.count, 2
54
- assert_equal @ds_ba.count, 2
55
- assert_equal @ds_be.count, 2
56
- end
57
- end
58
-
59
- class TestMinitestHooks2 < self
60
- def before_all
61
- super
62
- @ds_ba3 = @ds_ba
63
- @ds_ba2 = @ds_aa2
64
- assert_equal @ds_ba2.count, 2
65
- end
66
- def setup
67
- super
68
- @ds_be3 = @ds_be
69
- @ds_be2 = @ds_ae2
70
- assert_equal @ds_be2.count, 4
71
- end
72
- def teardown
73
- assert_equal @ds_be2.count, 4
74
- super
75
- end
76
- def after_all
77
- assert_equal @ds_ba2.count, 2
78
- super
79
- end
80
- def around
81
- assert_equal @ds_aa.count, 2
82
- super do
83
- assert_equal @ds_aa.count, 3
84
- @ds_ae3 = @ds_ae
85
- @ds_ae2 = @ds_aa2
86
- @ds_ae2.insert(1)
87
- yield
88
- assert_equal @ds_aa.count, 4
89
- end
90
- assert_equal @ds_aa.count, 2
91
- end
92
- def around_all
93
- @i ||= 1
94
- super do
95
- assert_equal @ds_aa.count, 1
96
- @ds_aa2 = @ds_aa
97
- @ds_aa2.insert(1)
98
- yield
99
- assert_equal @ds_aa.count, 2
100
- end
101
- assert_equal DB.table_exists?(:a), false
102
- end
103
-
104
- 3.times do |i|
105
- define_method(:"test_should_work_#{i}") do
106
- assert_equal @ds_aa.count, 4
107
- assert_equal @ds_ae.count, 4
108
- assert_equal @ds_ba.count, 4
109
- assert_equal @ds_be.count, 4
110
- assert_equal @ds_aa2.count, 4
111
- assert_equal @ds_ae2.count, 4
112
- assert_equal @ds_ba2.count, 4
113
- assert_equal @ds_be2.count, 4
114
- assert_equal @ds_ae3.count, 4
115
- assert_equal @ds_ba3.count, 4
116
- assert_equal @ds_be3.count, 4
117
- end
118
- end
119
- end
120
- end