What Is Rspec In Ruby
It makes writing tests simpler more expressive and easier to maintain.
What is rspec in ruby. Rspec is a computer domain specific language dsl particular application domain testing tool written in programming language ruby to test ruby code. The testing ruby applications with rspec screencast introduces the core rspec libraries through the development of a small cli card game. Rspec is a behaviour driven development tool for ruby programmers. What is and why rspec.
Rspec is written in ruby. What this means is that tests written in rspec focus on the behavior of an application being tested. That s what the r stands for. Model testing with rspec the advanced topics will be covered in rspec ii.
Rspec was created for behavior driven development bdd which means it s a focus on behaviors of application for testing. Rspec is composed of multiple libraries which are designed to work together or can be used independently with other testing tools like cucumber or minitest. Install rspec in ruby application echo gem rspec. Even though it has a very rich and powerful dsl domain specific language at its core it is a simple tool which you can start using rather quickly.
We also consider rspec as a tool for ruby. In addition to covering the technical aspects of using rspec it also covers best practices for using them so you get the most out of your test suite. The spec runner providing a rich command line program flexible and customizable reporting and an api to organize your code examples. But it uses a domain specific language or dsl for short.
Different types of tests what kinds of things to test. Rspec helps you do the tdd part of that equation focusing on the documentation and design aspects of tdd. Installing and running rspec rspec vocabulary subject. It is the most frequently used testing library for ruby in production applications.
Rspec is a testing tool for ruby created for behavior driven development bdd. Bdd is an approach to software development that combines test driven development domain driven design and acceptance test driven planning. Rails testing related tools testing frameworks dsl s for writing tests rspec most popular cucumber test unit currently comes with rails. The parts of rspec are.
Rspec is a unit test case framework for ruby language. That s a fancy way of saying that rspec has its own way of doing things that we have to talk to rspec in its own language not just in ruby. Rspec is different than traditional xunit frameworks like junit because rspec is a behavior driven development tool.