Skip to Main Content
Rails 5 Test Prescriptions
book

Rails 5 Test Prescriptions

by Noel Rappin
February 2018
Intermediate to advanced content levelIntermediate to advanced
406 pages
9h 52m
English
Pragmatic Bookshelf
Content preview from Rails 5 Test Prescriptions

Adding Some Math

Moving on. Next, you need to be able to calculate how much of a project is remaining and the rate of completion, and then put them together to determine a projected end date.

The next test is for the project to be able to calculate how much work is remaining.

I like to take a moment before I write a test to think about what the test needs. The typical test structure has three parts:

  • Given: What data does the test need? This test needs a project, at least one complete task, and at least one incomplete task.

  • When: What action is taking place? I’m calculating the remaining work.

  • Then: What behavior do I need to specify? The work-calculation result.

I also like to think about what could make the happy-path test fail; that’s more ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Rails 4 Test Prescriptions

Rails 4 Test Prescriptions

Noel Rappin
Agile Web Development with Rails 5.1

Agile Web Development with Rails 5.1

Sam Ruby, David B. Copeland, Dave Thomas
Rspec Essentials

Rspec Essentials

Mani Tadayon

Publisher Resources

ISBN: 9781680505566Errata Page