Search code examples
ruby-on-railsrubyruby-on-rails-3cucumberrspec-rails

How to seed the test database before to run Cucumber features?


I am using Ruby on Rails 3.2.2, cucumber-rails-1.3.0 and rspec-rails-2.8.1. Since I have some "system" data stored in the database, and since I would like to test my application that needs that data in order to properly work, I would like to seed the test database before to run Cucumber features.

How can I make that? What do you advice about?


Solution

  • Rails has a feature called Fixtures which prepopulates the test database before testing. Fixtures uses YAML to seed a table of the same name with data.

    The Ruby on Rails guides have a low down on fixtures that may be beneficial to have a look at.