OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Speed up RSpec boot time by 30%
Christophe Bliard176821f287e0
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rbdeleted file mode 100644index 0c08beeec00..00000000000--- a/spec/support/database_cleaner.rb+++ /dev/null@@ -1,12 +0,0 @@-RSpec.configure do |config|- # Since Rails 5.1., we can force the application server and capybara to share the same connection,- # which results in database_cleaner no longer being necessary.- # This will only work with a server that works in single mode (e.g., Puma)- # Using it we can ensure we run with a clean database (which use_transactional_fixtures does not ensure).- # c.f., spec/support/database_cleaner- config.use_transactional_fixtures = true-- config.before(:suite) do- DatabaseCleaner.clean_with(:truncation)- end-enddiff --git a/spec/support/transactional_tests.rb b/spec/support/transactional_tests.rbnew file mode 100644index 00000000000..be21c10e652--- /dev/null+++ b/spec/support/transactional_tests.rb@@ -0,0 +1,9 @@+RSpec.configure do |config|+ # Rails 5.1+ safely shares the database connection between the app and test+ # threads. So RSpec thread and Puma thread share the same db connection,+ # meaning running tests in transaction is ok as the transaction will be+ # visible for both.++ # Run every test method within a transaction+ config.use_transactional_fixtures = true+end