cirandas.net

ref: master

spec/spec_helper.rb


 1
 2
 3
 4
 5
 6
 7
 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
require_relative '../config/environment'
require 'rspec/rails'

require_relative 'support/factories'
require_relative 'concerns/metadata_scopes_spec'

require 'database_cleaner'

RSpec.configure do |config|

  config.fixture_path = 'spec/fixtures'
  config.include Noosfero::Factory

# This cleaning method is important when you have annomalous data created on
# the database but it consumes a lot of time.
#
#   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