etest-unit 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module EtestUnit
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
data/lib/etest-unit.rb CHANGED
@@ -35,18 +35,8 @@ module EtestUnit
35
35
  ActiveRecord::Base.transaction do
36
36
  begin
37
37
  set_log_level(old_log_level)
38
-
39
- if defined?(Mocha)
40
- mocha_setup
41
- end
42
-
43
38
  super(test, result)
44
39
  ensure
45
- if defined?(Mocha)
46
- mocha_verify
47
- mocha_teardown
48
- end
49
-
50
40
  set_log_level(Logger::ERROR)
51
41
  raise ActiveRecord::Rollback, "Rollback test transaction"
52
42
  end
@@ -55,12 +45,21 @@ module EtestUnit
55
45
  set_log_level(old_log_level)
56
46
  end
57
47
  end
58
-
48
+
49
+ module MochaAdditions
50
+ def run_test(test, result)
51
+ test.mocha_setup
52
+ super(test, result)
53
+ ensure
54
+ test.mocha_verify
55
+ test.mocha_teardown
56
+ end
57
+ end
58
+
59
59
  def create
60
60
  suite = super
61
- if defined?(::ActiveRecord)
62
- suite.extend ActiveRecordAdditions
63
- end
61
+ suite.extend ActiveRecordAdditions if defined?(::ActiveRecord)
62
+ suite.extend MochaAdditions if defined?(::Mocha)
64
63
  suite
65
64
  end
66
65
 
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.2
4
+ version: 0.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  segments:
55
55
  - 0
56
- hash: 1929617669401661542
56
+ hash: 4133727308211617544
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 1.8.25
65
+ rubygems_version: 1.8.23
66
66
  signing_key:
67
67
  specification_version: 3
68
68
  summary: Build your tests alongside your code.