My Account Log in

2 options

Effective testing with RSpec 3 : build Ruby apps with confidence / Myron Marston and Ian Dees.

Ebook Central College Complete Available online

View online

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Marston, Myron, author.
Dees, Ian, author.
Series:
Pragmatic programmers.
Pragmatic Programmers
Language:
English
Subjects (All):
Computer software--Development.
Computer software.
Ruby on rails (Electronic resource).
Physical Description:
1 online resource (336 pages) : illustrations.
Edition:
1st edition
Other Title:
Build Ruby apps with confidence
Place of Publication:
Raleigh, North Carolina : The Pragmatic Bookself, 2017.
System Details:
text file
Summary:
"Our tests are broken again!" "Why does the suite take so long to run?" "What value are we getting from these tests anyway?" Solve your testing problems by building and maintaining quality software with RSpec - the popular BDD-flavored Ruby testing framework. This definitive guide from RSpec's lead developer shows you how to use RSpec to drive more maintainable designs, specify and document expected behavior, and prevent regressions during refactoring. Build a project using RSpec to design, describe, and test the behavior of your code. Whether you're new to automated tests or have been using them for years, this book will help you write more effective tests. RSpec has been downloaded more than 100 million times and has inspired countless test frameworks in other languages. Use this influential Ruby testing framework to iteratively develop a project with the confidence that comes from well-tested code. This book guides you through creating a Ruby project with RSpec, and explores the individual components in detail. Start by learning the basics of installing and using RSpec. Then build a real-world JSON API, using RSpec throughout the process to drive a BDD-style outside-in workflow. Apply an effective test strategy to write fast, robust tests that support evolutionary design through refactoring. The rest of the book provides the definitive guide to RSpec's components. Use rspec-core's metadata to slice and dice your spec suite. Dig into rspec-expectations' matchers: compose them in flexible ways, specify expected outcomes with precision, and diagnose problems quickly with the help of good failure messages. Write fast, isolated tests with rspec-mocks' test doubles while pushing your code toward simpler interfaces. The authors, with a combined 20 years of automated testing experience, share testing wisdom that will lead to a fun, productive testing experience. What You Need: To follow along with the book, you'll need Ruby 2.2+. The book will guide you through installing RSpec 3 and setting up a new project to use it.
Contents:
Cover
Table of Contents
Foreword
Acknowledgments
From Myron Marston
From Ian Dees
Introduction
How to Use This Book
Code Snippets
RSpec and Behavior-Driven Development
Who We Are
Who You Are
A Note on Versions
Online Resources
Part I-Getting Started
1. Getting Started With RSpec
Installing RSpec
Your First Spec
Understanding Failure
Sharing Setup (But Not Sandwiches)
Your Turn
2. From Writing Specs to Running Them
Customizing Your Specs' Output
Identifying Slow Examples
Running Just What You Need
Marking Work in Progress
3. The RSpec Way
What Your Specs Are Doing for You
Comparing Costs and Benefits
Different Types of Specs
Guidelines
Part II-Building an App With RSpec 3
4. Starting On the Outside: Acceptance Specs
First Steps
Deciding What to Test First
Checking the Response
Filling In the Response Body
Querying the Data
Saving Your Progress: Pending Specs
5. Testing in Isolation: Unit Specs
From Acceptance Specs to Unit Specs
Filling In the First Spec
Handling Success
Refactoring
Handling Failure
Defining the Ledger
6. Getting Real: Integration Specs
Hooking Up the Database
Testing Ledger Behavior
Testing the Invalid Case
Isolating Your Specs Using Database Transactions
Filling In the Behavior
Querying Expenses
Ensuring the Application Works for Real
Part III-RSpec Core
7. Structuring Code Examples
Getting the Words Right
Sharing Common Logic
Sharing Example Groups
8. Slicing and Dicing Specs with Metadata
Defining Metadata
Reading Metadata
Selecting Which Specs to Run
Sharing Code Conditionally
Changing How Your Specs Run
9. Configuring RSpec
Command-Line Configuration.
Setting Command-Line Defaults
Using a Custom Formatter
RSpec.configure
Part IV-RSpec Expectations
10. Exploring RSpec Expectations
Parts of an Expectation
How Matchers Work
Composing Matchers
Generated Example Descriptions
11. Matchers Included in RSpec Expectations
Primitive Matchers
Higher-Order Matchers
Block Matchers
12. Creating Custom Matchers
Delegating to Existing Matchers Using Helper Methods
Defining Matcher Aliases
Negating Matchers
Using the Matcher DSL
Defining a Matcher Class
Part V-RSpec Mocks
13. Understanding Test Doubles
Types of Test Doubles
Usage Modes: Mocks, Stubs, and Spies
Origins: Pure, Partial, and Verifying Doubles
14. Customizing Test Doubles
Configuring Responses
Setting Constraints
15. Using Test Doubles Effectively
Constructing Your Test Environment
Stubject (Stubbing the Subject)
Using Partial Doubles Effectively
Connecting the Test Subject to Its Environment
The Risks of Mocking Third-Party Code
High-Fidelity Fakes
Faking I/O with StringIO
Wrapping a Third-Party Dependency
A1. RSpec and the Wider Ruby Ecosystem
Bundler
Rake
Using Parts of RSpec With Other Test Frameworks
A2. Using RSpec with Rails
Installation
Using rspec-rails
Spec Types
Spec Types Cheat Sheet
Rails Matchers Cheat Sheet
A3. Matcher Cheat Sheet
Value Matchers
A4. Bibliography
Index
- SYMBOLS -
- DIGITS -
- A -
- B -
- C -
- D -
- E -
- F -
- G -
- H -
- I -
- J -
- K -
- L -
- M -
- N -
- O -
- P -
- Q -
- R -
- S -
- T -
- U -
- V -
- W -
- X -
- Y -.
Notes:
"Version: P1.0 (August 2017)."
Includes bibliographical references and index.
Description based on online resource; title from PDF title page (EBC, viewed March 14, 2018).
ISBN:
9781680503463
1680503464
9781680502770
1680502778
9781680503470
1680503472
9781680501988
1680501984
OCLC:
1008595910

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account