etest-unit 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/etest-unit/version.rb +1 -1
- data/lib/etest-unit.rb +32 -11
- metadata +3 -3
data/lib/etest-unit/version.rb
CHANGED
data/lib/etest-unit.rb
CHANGED
@@ -21,6 +21,38 @@ module EtestUnit
|
|
21
21
|
class TestSuiteCreator < Test::Unit::TestSuiteCreator
|
22
22
|
attr :tests, true
|
23
23
|
|
24
|
+
module ActiveRecordAdditions
|
25
|
+
def set_log_level(level)
|
26
|
+
return unless ActiveRecord::Base.logger
|
27
|
+
|
28
|
+
r = ActiveRecord::Base.logger.level
|
29
|
+
ActiveRecord::Base.logger.level = level
|
30
|
+
r
|
31
|
+
end
|
32
|
+
|
33
|
+
def run_test(test, result)
|
34
|
+
old_log_level = set_log_level(Logger::ERROR)
|
35
|
+
ActiveRecord::Base.transaction do
|
36
|
+
set_log_level(old_log_level)
|
37
|
+
|
38
|
+
super(test, result)
|
39
|
+
|
40
|
+
set_log_level(Logger::ERROR)
|
41
|
+
raise ActiveRecord::Rollback, "Rollback test transaction"
|
42
|
+
end
|
43
|
+
ensure
|
44
|
+
set_log_level(old_log_level)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def create
|
49
|
+
suite = super
|
50
|
+
if defined?(::ActiveRecord)
|
51
|
+
suite.extend ActiveRecordAdditions
|
52
|
+
end
|
53
|
+
suite
|
54
|
+
end
|
55
|
+
|
24
56
|
private
|
25
57
|
|
26
58
|
def collect_test_names
|
@@ -53,17 +85,6 @@ module EtestUnit
|
|
53
85
|
suite.name = @etest.name
|
54
86
|
suite
|
55
87
|
end
|
56
|
-
|
57
|
-
def run_test
|
58
|
-
if defined?(ActiveRecord)
|
59
|
-
ActiveRecord::Base.transaction do
|
60
|
-
super
|
61
|
-
raise ActiveRecord::Rollback, "Rollback test transaction"
|
62
|
-
end
|
63
|
-
else
|
64
|
-
super
|
65
|
-
end
|
66
|
-
end
|
67
88
|
end
|
68
89
|
|
69
90
|
def self.run(etest, *tests)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etest-unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
53
|
version: '0'
|
54
54
|
segments:
|
55
55
|
- 0
|
56
|
-
hash:
|
56
|
+
hash: -2665298691011624838
|
57
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|