etest-unit 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 745dc1a9f7cead3a0e68b343e0d78a3f2b2cbee4
4
+ data.tar.gz: 1063ea79bc5898059e9445d1a2a411f877e18519
5
+ SHA512:
6
+ metadata.gz: 41d0fdde8e558a673d66a9d5baf2b7d94469289fc8c8a38faa1bc856a7cd66b1b7cae780b240deab5259c496f5dce2899ee7022a22ccb52c71e294126957b439
7
+ data.tar.gz: 49ac104c599a0e2e9f5dbb3fe45d2c95ef601e27ac95c2f381c9c900be0fed24e1b32a0a736442e17d0e4467ee871b81e533feca8b6edd38a7dd8464b09cbc93
data/lib/etest-unit.rb CHANGED
@@ -39,20 +39,35 @@ module EtestUnit
39
39
  r
40
40
  end
41
41
 
42
- def run_test(test, result)
42
+ def in_transaction(&block)
43
43
  old_log_level = set_log_level(Logger::ERROR)
44
44
  ActiveRecord::Base.transaction do
45
45
  begin
46
46
  set_log_level(old_log_level)
47
- super(test, result)
47
+ yield
48
48
  ensure
49
49
  set_log_level(Logger::ERROR)
50
50
  raise ActiveRecord::Rollback, "Rollback test transaction"
51
51
  end
52
52
  end
53
+ rescue
54
+ STDERR.puts "Could not run etest in transaction: #{$!}"
53
55
  ensure
54
56
  set_log_level(old_log_level)
55
57
  end
58
+
59
+ def run_test(test, result)
60
+ running_tests_in_transaction = nil
61
+
62
+ in_transaction do
63
+ running_tests_in_transaction = true
64
+ super(test, result)
65
+ end
66
+
67
+ if !running_tests_in_transaction
68
+ super(test, result)
69
+ end
70
+ end
56
71
  end
57
72
 
58
73
  module MochaAdditions
@@ -1,3 +1,3 @@
1
1
  module EtestUnit
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
data/lib/module_ext.rb CHANGED
@@ -21,7 +21,10 @@ module EtestReloader
21
21
 
22
22
  def reload_file(file)
23
23
  begin
24
- load(file) && file
24
+ if load(file)
25
+ STDERR.puts("Loaded #{file}")
26
+ file
27
+ end
25
28
  rescue LoadError
26
29
  nfile = file.gsub(/\/[^\/]+\.rb/, ".rb")
27
30
  nfile != file && reload_file(nfile)
@@ -45,6 +48,7 @@ class Module
45
48
 
46
49
  def reload
47
50
  EtestReloader.reload(name)
51
+ self
48
52
  end
49
53
 
50
54
  #
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etest-unit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
5
- prerelease:
4
+ version: 0.9.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - radiospiel
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-06 00:00:00.000000000 Z
11
+ date: 2013-10-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: test-unit
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: Build your tests alongside your code.
@@ -41,29 +38,25 @@ files:
41
38
  - test/etest_test.rb
42
39
  homepage: http://github.com/radiospiel/etest
43
40
  licenses: []
41
+ metadata: {}
44
42
  post_install_message:
45
43
  rdoc_options: []
46
44
  require_paths:
47
45
  - lib
48
46
  required_ruby_version: !ruby/object:Gem::Requirement
49
- none: false
50
47
  requirements:
51
- - - ! '>='
48
+ - - '>='
52
49
  - !ruby/object:Gem::Version
53
50
  version: '0'
54
- segments:
55
- - 0
56
- hash: 2699735435160365469
57
51
  required_rubygems_version: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ! '>='
53
+ - - '>='
61
54
  - !ruby/object:Gem::Version
62
55
  version: '0'
63
56
  requirements: []
64
57
  rubyforge_project:
65
- rubygems_version: 1.8.23
58
+ rubygems_version: 2.0.3
66
59
  signing_key:
67
- specification_version: 3
60
+ specification_version: 4
68
61
  summary: Build your tests alongside your code.
69
62
  test_files: []