mack-active_record 0.7.1.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -8,93 +8,28 @@ if Mack.env == "test"
|
|
8
8
|
end
|
9
9
|
|
10
10
|
# Wrap it so we don't accidentally alias the run method n times and run out of db connections!
|
11
|
-
unless Mack::Testing.const_defined?("AR_TEST_EXTENSIONS")
|
11
|
+
unless Mack::Testing.const_defined?("AR_TEST_EXTENSIONS")
|
12
12
|
|
13
13
|
module Mack
|
14
14
|
module Testing
|
15
15
|
AR_TEST_EXTENSIONS = 1
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# File.join(File.dirname(__FILE__), "tasks", "db_migration_tasks.rake")])
|
23
|
-
# end
|
24
|
-
# end # Helpers
|
25
|
-
|
26
|
-
module ActiveRecordHelpers
|
27
|
-
def rollback_transaction
|
28
|
-
begin
|
29
|
-
ActiveRecord::Base.transaction do
|
30
|
-
yield if block_given?
|
31
|
-
raise "Rollback!"
|
32
|
-
end
|
33
|
-
rescue => ex
|
34
|
-
# we need to do this so we can throw up actual errors!
|
35
|
-
unless ex.to_s == "Rollback!"
|
36
|
-
raise ex
|
37
|
-
end
|
16
|
+
|
17
|
+
def rollback_transaction
|
18
|
+
begin
|
19
|
+
ActiveRecord::Base.transaction do
|
20
|
+
yield if block_given?
|
21
|
+
raise "Rollback!"
|
38
22
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
module Spec # :nodoc:
|
45
|
-
module Example # :nodoc:
|
46
|
-
module ExampleMethods # :nodoc:
|
47
|
-
include Mack::Testing::ActiveRecordHelpers
|
48
|
-
|
49
|
-
alias_method :ar_spec_execute, :execute
|
50
|
-
|
51
|
-
def before_spec_extension
|
52
|
-
end
|
53
|
-
|
54
|
-
def after_spec_extension
|
55
|
-
end
|
56
|
-
|
57
|
-
def execute(options, instance_variables)
|
58
|
-
before_spec_extension
|
59
|
-
if !app_config.disable_transactional_tests
|
60
|
-
rollback_transaction do
|
61
|
-
@__res = ar_spec_execute(options, instance_variables)
|
62
|
-
end
|
63
|
-
else
|
64
|
-
@__res = ar_spec_execute(options, instance_variables)
|
23
|
+
rescue => ex
|
24
|
+
# we need to do this so we can throw up actual errors!
|
25
|
+
unless ex.to_s == "Rollback!"
|
26
|
+
raise ex
|
65
27
|
end
|
66
|
-
after_spec_extension
|
67
|
-
@__res
|
68
28
|
end
|
29
|
+
end # rollback_transaction
|
69
30
|
|
70
|
-
|
71
|
-
|
72
|
-
end # Spec
|
73
|
-
|
74
|
-
module Test # :nodoc:
|
75
|
-
module Unit # :nodoc:
|
76
|
-
class TestCase # :nodoc:
|
77
|
-
include Mack::Testing::ActiveRecordHelpers
|
78
|
-
|
79
|
-
# Let's alias the run method in the class above us so we can create a new one here
|
80
|
-
# but still reference it.
|
81
|
-
alias_method :ar_test_case_run, :run # :nodoc:
|
82
|
-
|
83
|
-
# We need to wrap the run method so we can do things like
|
84
|
-
# run a cleanup method if it exists
|
85
|
-
def run(result, &progress_block) # :nodoc:
|
86
|
-
if !app_config.disable_transactional_tests
|
87
|
-
rollback_transaction do
|
88
|
-
ar_test_case_run(result, &progress_block)
|
89
|
-
end
|
90
|
-
else
|
91
|
-
ar_test_case_run(result, &progress_block)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
end # TestCase
|
96
|
-
end # Unit
|
97
|
-
end # Test
|
31
|
+
end # Testing
|
32
|
+
end # Mack
|
98
33
|
|
99
34
|
end
|
100
35
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mack-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-06 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.8.0
|
34
34
|
version:
|
35
35
|
description: "mack-active_record was developed by: markbates"
|
36
36
|
email: mark@mackframework.com
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
requirements: []
|
82
82
|
|
83
83
|
rubyforge_project: magrathea
|
84
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.3.0
|
85
85
|
signing_key:
|
86
86
|
specification_version: 2
|
87
87
|
summary: ActiveRecord ORM support for Mack
|