cucumber - DatabaseCleaner strategy transaction is not working -
in env.rb
before databasecleaner.strategy = :transaction end
also created hook in shared_steps.rb
before('@database_cleaner_before') databasecleaner.start end after('@database_cleaner_after') databasecleaner.clean end
in feature file
@database_cleaner_after @database_cleaner_before scenario: can sign new valid "email" , "username" when come in new valid "email" , come in new "username" , come in "password" , click on "sign up" button should see message word "signed up" , "successfully"
i using gem:
capybara 2.0.2 cucumber 1.2.1 database_cleaner 0.9.1 selenium-webdriver 2.30.0 cucumber-rails 1.3.0 rails 3.1.0
in database.rb
require 'active_record' class activerecord::base mattr_accessor :shared_connection @@shared_connection = nil def self.connection @@shared_connection || retrieve_connection end end activerecord::base.shared_connection = activerecord::base.connection
databasecleaner.strategy = :trancation working fine (delete record database) databasecleaner.strategy = :transaction not rolling database record why?. missing somethings?
cucumber capybara database-cleaner
No comments:
Post a Comment