Cross Reference: database_cleaner.rb
xref
: /
ontohub
/
config
/
database_cleaner.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
database_cleaner.rb revision e200ddd4b78a4915a072095be2a2e6cac65ed333
1516
N/A
require
'database_cleaner'
50
N/A
50
N/A
module
DatabaseCleanerConfig
50
N/A
CLEAN_MODE
= :
transaction
50
N/A
INITIAL_CLEAN_MODE
= :
truncation
50
N/A
INITIAL_CLEAN_OPTIONS
= {
except
: %w
(
ontology_file_extensions
proof_statuses
)
}
50
N/A
50
N/A
if
defined
?
(
RSpec
)
&&
RSpec.respond
_to
?
(:
configure
)
50
N/A
RSpec.configure
do
|
config
|
50
N/A
config.use
_instantiated_fixtures
=
false
50
N/A
config.use
_transactional_fixtures
=
false
50
N/A
50
N/A
config.before
(:
suite
)
do
50
N/A
DatabaseCleaner.strategy
=
INITIAL_CLEAN_MODE
,
INITIAL_CLEAN_OPTIONS
50
N/A
DatabaseCleaner.clean
50
N/A
DatabaseCleaner.strategy
=
CLEAN_MODE
50
N/A
end
50
N/A
50
N/A
config.before
(:
each
)
do
50
N/A
DatabaseCleaner.start
50
N/A
end
50
N/A
2026
N/A
config.after
(:
each
)
do
2627
N/A
DatabaseCleaner.clean
2026
N/A
50
N/A
# Remove repositories and other data created in a test
2627
N/A
%w
(
data
test
)
.
each
do
|d|
202
N/A
dir
=
Rails.root.join
(
'tmp'
, d)
50
N/A
dir.rmtree
if
dir.exist
?
1431
N/A
end
1431
N/A
end
1431
N/A
end
1755
N/A
end
1352
N/A
1618
N/A
if
defined
?
ActiveSupport
::
TestCase
72
N/A
# Set strategy and clean once at load time
1431
N/A
DatabaseCleaner.strategy
=
INITIAL_CLEAN_MODE
,
INITIAL_CLEAN_OPTIONS
50
N/A
DatabaseCleaner.clean
2470
N/A
DatabaseCleaner.strategy
=
CLEAN_MODE
1618
N/A
50
N/A
class
ActiveSupport
::
TestCase
50
N/A
50
N/A
class_attribute
:
use_transactional_fixtures
66
N/A
class_attribute
:
use_instantiated_fixtures
135
N/A
66
N/A
self.use
_transactional_fixtures
=
false
66
N/A
self.use
_instantiated_fixtures
=
false
50
N/A
2205
N/A
setup
do
2627
N/A
DatabaseCleaner.start
2627
N/A
end
2627
N/A
2627
N/A
teardown
do
2627
N/A
DatabaseCleaner.clean
2627
N/A
end
2627
N/A
2627
N/A
end
2627
N/A
end
2627
N/A
end
2627
N/A