bmabey-database_cleaner 0.2.0 → 0.2.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.
- data/History.txt +5 -1
- data/VERSION.yml +1 -1
- data/lib/database_cleaner/configuration.rb +0 -41
- data/lib/database_cleaner/truncation_base.rb +30 -29
- metadata +1 -1
data/History.txt
CHANGED
data/VERSION.yml
CHANGED
@@ -91,45 +91,4 @@ module DatabaseCleaner
|
|
91
91
|
|
92
92
|
end
|
93
93
|
|
94
|
-
|
95
|
-
class TruncationBase
|
96
|
-
|
97
|
-
def initialize(options = {})
|
98
|
-
if !options.empty? && !(options.keys - [:only, :except]).empty?
|
99
|
-
raise ArgumentError, "The only valid options are :only and :except. You specified #{options.keys.join(',')}."
|
100
|
-
end
|
101
|
-
if options.has_key?(:only) && options.has_key?(:except)
|
102
|
-
raise ArgumentError, "You may only specify either :only or :either. Doing both doesn't really make sense does it?"
|
103
|
-
end
|
104
|
-
|
105
|
-
@only = options[:only]
|
106
|
-
@tables_to_exclude = (options[:except] || [])
|
107
|
-
if migration_storage = migration_storage_name
|
108
|
-
@tables_to_exclude << migration_storage
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def start
|
113
|
-
# no-op
|
114
|
-
end
|
115
|
-
|
116
|
-
def clean
|
117
|
-
raise NotImplementedError
|
118
|
-
end
|
119
|
-
|
120
|
-
|
121
|
-
private
|
122
|
-
|
123
|
-
def tables_to_truncate
|
124
|
-
raise NotImplementedError
|
125
|
-
end
|
126
|
-
|
127
|
-
# overwrite in subclasses
|
128
|
-
# default implementation given because migration storage need not be present
|
129
|
-
def migration_storage_name
|
130
|
-
nil
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
134
|
-
|
135
94
|
end
|
@@ -1,40 +1,41 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
module DatabaseCleaner
|
2
|
+
class TruncationBase
|
3
|
+
|
4
|
+
def initialize(options = {})
|
5
|
+
if !options.empty? && !(options.keys - [:only, :except]).empty?
|
6
|
+
raise ArgumentError, "The only valid options are :only and :except. You specified #{options.keys.join(',')}."
|
7
|
+
end
|
8
|
+
if options.has_key?(:only) && options.has_key?(:except)
|
9
|
+
raise ArgumentError, "You may only specify either :only or :either. Doing both doesn't really make sense does it?"
|
10
|
+
end
|
11
|
+
|
12
|
+
@only = options[:only]
|
13
|
+
@tables_to_exclude = (options[:except] || [])
|
14
|
+
if migration_storage = migration_storage_name
|
15
|
+
@tables_to_exclude << migration_storage
|
16
|
+
end
|
9
17
|
end
|
10
18
|
|
11
|
-
|
12
|
-
|
13
|
-
if migration_storage = migration_storage_name
|
14
|
-
@tables_to_exclude << migration_storage
|
19
|
+
def start
|
20
|
+
# no-op
|
15
21
|
end
|
16
|
-
end
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
def clean
|
24
|
+
raise NotImplementedError
|
25
|
+
end
|
21
26
|
|
22
|
-
def clean
|
23
|
-
raise NotImplementedError
|
24
|
-
end
|
25
27
|
|
28
|
+
private
|
26
29
|
|
27
|
-
|
30
|
+
def tables_to_truncate
|
31
|
+
raise NotImplementedError
|
32
|
+
end
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
34
|
+
# overwrite in subclasses
|
35
|
+
# default implementation given because migration storage need not be present
|
36
|
+
def migration_storage_name
|
37
|
+
nil
|
38
|
+
end
|
32
39
|
|
33
|
-
# overwrite in subclasses
|
34
|
-
# default implementation given because migration storage need not be present
|
35
|
-
def migration_storage_name
|
36
|
-
nil
|
37
40
|
end
|
38
|
-
|
39
41
|
end
|
40
|
-
|