LanguagesRuby / RailsApply Behavior Driven Development to Ruby on Rails with Rspec

Apply Behavior Driven Development to Ruby on Rails with Rspec

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Applying the Behavior Driven Development (BDD) methodology with a Ruby-based BDD framework allows you to write system requirements in a Ruby format first and then write Ruby code for the particular features of those requirements. Because the Ruby format is similar to plain English, business analysts and the people gathering the requirements can participate in the development process.


A few different Ruby-based BDD frameworks are available. RSpec, Cucumber, and Shoulda are the most popular. Find out how RSpec works by using the use case of an employee information manager.


BDD mandates that you write tests for each step of the process, which leads to cleaner code. The BDD process begins with the development team creating a scenario, for which they describe each feature. The initial scenario inevitably fails. The team subsequently defines each step (iterative test) and writes the application code for each feature. They also refactor the code when the scenario passes each step.





Read the full story at Web Developer’s Virtual Library:


Apply Behavior Driven Development to Ruby on Rails with Rspec

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories