Testing Ruby with RSpec: The Complete Guide [Video]
- FREE Subscription Read for free
- $185.99 Video Buy
- $12.99 Video + Subscription Buy
-
What do you get with a Packt Subscription?
- Instant access to this title and 7,500+ eBooks & Videos
- Constantly updated with 100+ new titles each month
- Breadth and depth in over 1,000+ technologies
-
Free ChapterIntroduction
- Welcome to RSpec
- Unit Tests versus End-to-End (E2E) Tests
- Installing RSpec
- Starting a Project with rspec --init
- Test-Driven Development
- The Describe Method
- The it Method
- The Expect and Eq Methods
- Reading Failures
- Making the Specs Pass
- Multiple Examples in Example Group
- Fixing Failing Specs Again
- Reducing Duplication - Before Hooks and Instance Variables
- Reducing Duplication: Helper Methods
- Problems with Mutation
- Reducing Duplication: The let Method
- Custom Error Messages
- The context Method and Nested Describes
- Before and After Hooks
- Nested Logic: Hooks
- Nested Logic: Overwriting Let Variables
-
Subjects, Shared Examples, and Shared Context
-
Built-In Matchers
- The not_to Method
- Equality Matchers I (eq and eql)
- Equality Matchers II (equal and be)
- Comparison Matchers
- Predicate Matchers
- all Matcher
- be Matcher (Truthy, Falsy and Nil Values)
- change Matcher
- contain_exactly Matcher
- start_with and end_with Matchers
- have_attributes Matcher
- include Matcher
- raise_error Matcher
- respond_to Matcher
- satisfy Matcher
- not_to Method
- Compound Expectations
-
Mocks
-
Conclusion
This course offers a comprehensive overview of the RSpec testing library for the Ruby programming library. RSpec is the most popular Ruby Gem of all time, with over 300 million downloads to date. If you are new to the topic, testing is the practice of writing code that confirms that other code works as expected. Tests control regressions, which are changes to the code that breaks the program.
The benefits of testing extend beyond the codebase. Adopting a test-driven approach will also make you a better developer. Tests force you to think critically about a program and its features: classes, objects, methods, and more.
This course begins with the essentials and proceeds to more complex topics, including installation, project initialization, Test-Driven Development (TDD), let variables, before and after hooks, subjects, shared examples, shared context, built-in matches, mocks and doubles, instance doubles, and class doubles.
At the completion of this course, you will have acquired hands-on Ruby testing experience with this awesome RSpec library.
All Resources for this course are available at https://github.com/packtpublishing/testing-ruby-with-rspec-the-complete-guide
- Publication date:
- August 2019
- Publisher
- Packt
- Duration
- 7 hours 30 minutes
- ISBN
- 9781839219474