Capybara with :js => true causes test to fail

后端 未结 3 1145
北荒
北荒 2020-11-28 04:06

I\'m new to Capybara and testing on Rails in general, so please forgive me if this is a simple answer.

I\'ve got this test

it \"should be able to edi         


        
3条回答
  •  一生所求
    2020-11-28 04:14

    A variation of brutuscat's answer that fixed our feature specs (which all use Capybara):

    config.before(:suite) do
      DatabaseCleaner.clean_with(:truncation)
    end
    
    config.before(:each) do
      # set the default
      DatabaseCleaner.strategy = :transaction
    end
    
    config.before(:each, type: :feature) do
      DatabaseCleaner.strategy = :truncation
    end
    
    config.before(:each) do
      DatabaseCleaner.start
    end
    
    config.append_after(:each) do
      DatabaseCleaner.clean
    end
    

提交回复
热议问题