mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 15:22:56 +00:00
Adding test for formatter
I have added database cleaner as for formatter spec it was trying to use inbuild transactional fixture flag, which was failing as it couldn't find any transaction to rollback. Hence switched to using database_cleaner gem for using truncation as strategy
This commit is contained in:
@@ -5,6 +5,7 @@ require File.expand_path('../dummy/config/environment', __FILE__)
|
||||
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
||||
require 'spec_helper'
|
||||
require 'rspec/rails'
|
||||
require 'database_cleaner'
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||
@@ -33,7 +34,7 @@ RSpec.configure do |config|
|
||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||
# examples within a transaction, remove the following line or assign false
|
||||
# instead of true.
|
||||
config.use_transactional_fixtures = true
|
||||
config.use_transactional_fixtures = false
|
||||
|
||||
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||
# based on their file location, for example enabling you to call `get` and
|
||||
@@ -49,4 +50,15 @@ RSpec.configure do |config|
|
||||
# The different available types are documented in the features, such as in
|
||||
# https://relishapp.com/rspec/rspec-rails/docs
|
||||
config.infer_spec_type_from_file_location!
|
||||
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
DatabaseCleaner.clean_with(:truncation)
|
||||
end
|
||||
|
||||
config.around(:each) do |example|
|
||||
DatabaseCleaner.cleaning do
|
||||
example.run
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user