, , , ,

If you are using Cucumber with Rails 3 or Rails 4, you might face this issue.

You would have obviously followed the Cucumber guide to set up cucumber with Rails 4.

Problem faced

When you run cucumber it throws error “No known ORM was detected!  Is ActiveRecord, DataMapper, MongoMapper, Mongoid, or CouchPotato loaded? (DatabaseCleaner::NoORMDetected)”.

What causes this problem

When you follow cucumber guide, it ask you to add this snippet in Gemfile





And when you execute command to generate cucumber, it creates env.rb inside features/support folder




Entries in gemfile and env.rb file for database doesn’t allow you to run your cucumber tests and always throw error for not finding the database, snippet of env.rb is shown below


How to resolve

If you are not using any database in your application and using Rails 3.x or 4.x with latest version of cucumber, you will have to do following things.

  • Commented out the lines shown above in env.rb
  • Uninstall database cleaner by running command “gem uninstall database_cleaner
  • Also remove database cleaner from your gemfile, so that next time you do bundle install, this problem will not haunt you.
  • Some of the group forums also suggest to mark “DatabaseCleaner.strategy = :none, but it didn’t work in my case as “none” is not a valid input for strategy, it only accept “transaction” and “truncation”; So I would rather comment it out or delete those lines.

Hope this helps, my motivation behind documenting it is unable to find straight forward solution anywhere.