Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails rspec destroy data after each test

config.before(:suite) do
  DatabaseCleaner.strategy = :transaction
  DatabaseCleaner.clean_with(:truncation)
end

config.before(:each) do
  DatabaseCleaner.start
end

config.after(:each) do
  DatabaseCleaner.clean
end
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #rails #rspec #destroy #data #test
ADD COMMENT
Topic
Name
4+6 =