Added RSpec support file to initialize database into clean state before running suite.
This commit is contained in:
parent
50162cc250
commit
e006684c83
4 changed files with 15 additions and 1 deletions
4
Gemfile
4
Gemfile
|
@ -173,6 +173,10 @@ group :development, :test do
|
||||||
# record and replay TCP/HTTP transactions
|
# record and replay TCP/HTTP transactions
|
||||||
gem 'tcr'
|
gem 'tcr'
|
||||||
gem 'vcr'
|
gem 'vcr'
|
||||||
|
|
||||||
|
# database cleanup when transactions are not possible
|
||||||
|
# and DB initialization before running RSpec suite
|
||||||
|
gem 'database_cleaner'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Want to extend Zammad with additional gems?
|
# Want to extend Zammad with additional gems?
|
||||||
|
|
|
@ -113,6 +113,7 @@ GEM
|
||||||
crass (1.0.4)
|
crass (1.0.4)
|
||||||
daemons (1.2.5)
|
daemons (1.2.5)
|
||||||
dalli (2.7.6)
|
dalli (2.7.6)
|
||||||
|
database_cleaner (1.7.0)
|
||||||
debug_inspector (0.0.3)
|
debug_inspector (0.0.3)
|
||||||
delayed_job (4.1.3)
|
delayed_job (4.1.3)
|
||||||
activesupport (>= 3.0, < 5.2)
|
activesupport (>= 3.0, < 5.2)
|
||||||
|
@ -511,6 +512,7 @@ DEPENDENCIES
|
||||||
coveralls
|
coveralls
|
||||||
daemons
|
daemons
|
||||||
dalli
|
dalli
|
||||||
|
database_cleaner
|
||||||
delayed_job_active_record
|
delayed_job_active_record
|
||||||
diffy
|
diffy
|
||||||
doorkeeper
|
doorkeeper
|
||||||
|
|
|
@ -2694,7 +2694,7 @@ Setting.create_if_not_exists(
|
||||||
area: 'Models::Base',
|
area: 'Models::Base',
|
||||||
description: 'Defines the searchable models.',
|
description: 'Defines the searchable models.',
|
||||||
options: {},
|
options: {},
|
||||||
state: [],
|
state: Models.searchable.map(&:to_s),
|
||||||
preferences: {
|
preferences: {
|
||||||
authentication: true,
|
authentication: true,
|
||||||
},
|
},
|
||||||
|
|
8
spec/support/reset_system_before_suite.rb
Normal file
8
spec/support/reset_system_before_suite.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.before(:suite) do
|
||||||
|
DatabaseCleaner.clean_with(:truncation)
|
||||||
|
Rails.application.load_seed
|
||||||
|
Cache.clear
|
||||||
|
Setting.reload
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue