Module: SupportModule

Included in:
Specfac::CLI
Defined in:
lib/specfac/modules/support_module.rb

Class Method Summary collapse

Class Method Details

.database_cleanerObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/specfac/modules/support_module.rb', line 8

def self.database_cleaner

  "# RSpec.configure do |config|
  #
  #   config.before(:suite) do
  #     DatabaseCleaner.clean_with(:truncation)
  #   end
  #
  #   config.before(:each) do
  #     DatabaseCleaner.strategy = :transaction
  #   end
  #
  #   config.before(:each, :js => true) do
  #     DatabaseCleaner.strategy = :truncation
  #   end
  #
  #   config.before(:each) do
  #     DatabaseCleaner.start
  #   end
  #
  #   config.after(:each) do
  #     DatabaseCleaner.clean
  #   end
  #
  # end
  #
  RSpec.configure do |config|
    config.use_transactional_fixtures = false
    config.before(:suite) { DatabaseCleaner.clean_with(:truncation) }
    config.before(:each) { DatabaseCleaner.strategy = :transaction }
    config.before(:each, :js => true) { DatabaseCleaner.strategy = :truncation }
    config.before(:each) { DatabaseCleaner.start }
    config.after(:each) { DatabaseCleaner.clean }
  end"
end

.factory_botObject



2
3
4
5
6
# File 'lib/specfac/modules/support_module.rb', line 2

def self.factory_bot
  "RSpec.configure do |config|
    config.include FactoryBot::Syntax::Methods
  end"
end