Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9312841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:43:53+00:00 2026-06-19T01:43:53+00:00

I saw this cool method for only using Database cleaners :truncation for capybara test

  • 0

I saw this cool method for only using Database cleaners :truncation for capybara test using :js => true

In spec_helper.rb:

config.before(:each) do
  DatabaseCleaner.strategy = if example.metadata[:js]
    :truncation
  else
    :transaction
  end
  DatabaseCleaner.start
end

config.after(:each) do
  DatabaseCleaner.clean
end 

The problem is that any feature test done with capybara seems to need the cleaning strategy to be :truncation.

All the other specs, however, are fine with :transaction, which is significantly faster.

Is there a way of specifying strategy for only capybara feature tests? SOmething like:

DataCleaner.strategy( :truncation ) if :type => :feature
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T01:43:54+00:00Added an answer on June 19, 2026 at 1:43 am

    this should do it, let me know

    config.after(:all, :type => :feature) do
      DatabaseCleaner.clean_with :truncation
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just saw this cool feature of JQuery which is JQuery Portlet http://jqueryui.com/demos/sortable/portlets.html I
I saw this C# using statement in a code example: using StringFormat=System.Drawing.StringFormat; What's that
Saw this line in a class method and my first reaction was to ridicule
I just saw this and think it's cool. console.log(Starting...); $(#my_element) .fadeIn() .delay(3000) .fadeOut(); console.log(Finishing...);
I saw this text while reading wikipedia( http://en.wikipedia.org/wiki/K-means%2B%2B ) The authors tested their method
I saw this used in a WWDC video but only very briefly. They didn't
I just saw this page : http://www.gdconf.com/expo/exhibitorlist.html It has a cool drop down details
I implemented this form submission method that uses xmlhttpreqeust. I saw the new html5
I saw this as an example on MDN and didn't understand why this was
I saw this question and it motivated me to look again (without success) at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.