The RSpec Book

Behaviour-Driven Development with RSpec, Cucumber, and Friends

  • 5.0 (1 rating) ·
  • 2 Want to read
  • 2 Have read
Locate

My Reading Lists:

Create a new list

Check-In

×Close
Add an optional check-in date. Check-in dates are used to track yearly reading goals.
Today

  • 5.0 (1 rating) ·
  • 2 Want to read
  • 2 Have read

Buy this book

Last edited by MARC Bot
September 16, 2024 | History

The RSpec Book

Behaviour-Driven Development with RSpec, Cucumber, and Friends

  • 5.0 (1 rating) ·
  • 2 Want to read
  • 2 Have read

Provides information on developing Rails 3 applications using RSpec and Cucumber.

Publish Date
Pages
420

Buy this book

Book Details


Table of Contents

Part 1. Getting Started with RSpec and Cucumber
Page 23
1. Introduction
Page 24
1.1. Test-Driven Development: Where It All Started
Page 24
1.2. Behaviour-Driven Development: The Next Step
Page 26
1.3. RSpec
Page 27
1.4. Cucumber
Page 28
1.5. TheBDDCycle
Page 30
2. Hello
Page 32
2.1. Installation
Page 32
2.2 HelloRSpec ....................... 33 2.3 HelloCucumber..................... 35.
3 Describing Features 39 3.1 IntroducingCodebreaker................ 40 3.2 PlanningtheFirstRelease ............... 40 3.3 PlanningtheFirstIteration .............. 46 3.4 WhatWe’veLearned................... 54
CONTENTS 8
4 Automating Features with Cucumber 55
4.1 Steps and Step Definitions . 4.2 Step Definition Methods .. 4.3 TestDouble ....... .. 4.4 What We’ve Learned . . . ..
5 Describing Code with RSpec
.............. 57 .............. 58 .............. 62 .............. 64
65
5.1 Getting Started with RSpec 5.2 Red:StartwithaFailingCodeExample....... 68 5.3 Green:GettheExampletoPass. . . . . . . . . . . . 70 5.4 Refactor.......................... 74 5.5 WhatWe’veLearned................... 78
6 Adding New Features 79 6.1 ScenarioOutlinesinCucumber . . . . . . . . . . . . 79 6.2 RespondingtoChange ................. 82 6.3 WhatWe’veLearned................... 85
7 Specifying an Algorithm 86 7.1 BeginwiththeSimplestExample . . . . . . . . . . . 86 7.2 RefactortoRemoveDuplication . . . . . . . . . . . . 90 7.3 RefactortoExpressIntent ............... 91 7.4 WhatWe’veLearned................... 96
8 Refactoring with Confidence 98 8.1 SniffingOutCodeSmells................ 98 8.2 OneStepataTime ................... 100 8.3 UpdatingSpecsAfterRefactoring . . . . . . . . . . . 109 8.4 Exploratory Testing . . . . . . ............. 113 8.5 WhatWe’veLearned. . . . . . ............. 114
9 Feeding Back What We’ve Learned
116
9.1 UseCucumberforCollaboration . . . . . . . . . . . 116 9.2 Experimenting with a New Implementation . . . . . 120 9.3 WhatWe’veLearned................... 124
.............. 65
CLICK HERE to purchase this book now.
CONTENTS 9
II 10
11
III 12
13
Behaviour-Driven Development 126
The Case for BDD 127 10.1 HowTraditionalProjectsFail............. 127 10.2 WhyTraditionalProjectsFail............. 128 10.3 RedefiningtheProblem................. 132 10.4 TheCostofGoingAgile................. 135 10.5 WhatWe’veLearned................... 138
Writing Software That Matters 140 11.1 ADescriptionofBDD.................. 140 11.2 ThePrinciplesofBDD ................. 140 11.3 TheProjectInception .................. 141 11.4 TheCycleofDelivery .................. 143 11.5 What’sinaStory?.................... 147 11.6 WhatWe’veLearned................... 150
RSpec 151
Code Examples 152 12.1 DescribeIt!........................ 153 12.2 PendingExamples.................... 157 12.3 Hooks:Before,After,andAround . . . . . . . . . . . 160 12.4 HelperMethods ..................... 164 12.5 SharedExamples .................... 166 12.6 NestedExampleGroups ................ 168 12.7 WhatWe’veLearned................... 171
RSpec::Expectations 172 13.1 should,should_not,andmatchers.......... 173 13.2 Built-inMatchers .................... 174 13.3 PredicateMatchers ................... 182 13.4 BeTrueintheEyesofRuby.............. 183 13.5 HaveWhateverYouLike ................ 184 13.6 OperatorExpressions.................. 188 13.7 GeneratedDescriptions................. 189 13.8 Subjectivity........................ 190 13.9 WhatWe’veLearned................... 192
CLICK HERE to purchase this book now.
CONTENTS 10
14 RSpec::Mocks 193 14.1 TestDoubles....................... 194 14.2 MethodStubs ...................... 195 14.3 MessageExpectations ................. 197 14.4 Test-SpecificExtensions ................ 199 14.5 MoreonMethodStubs ................. 203 14.6 MoreonMessageExpectations . . . . . . . . . . . . 205 14.7 When to Use Test Doubles and Test-Specific Exten-
sions ........................... 215 14.8 RisksandTrade-Offs.................. 220 14.9 Choosing Other Test Double Frameworks . . . . . . 222 14.10 WhatWe’veLearned................... 224
15 Tools and Integration 226 15.1 TherspecCommand .................. 226 15.2 TextMate ......................... 231 15.3 Autotest.......................... 232 15.4 Rake............................ 232 15.5 RCov ........................... 234 15.6 WhatWe’veLearned................... 235
16 Extending RSpec 236 16.1 Metadata ......................... 236 16.2 Configuration ...................... 237 16.3 Filtering.......................... 237 16.4 ExtensionModules ................... 240 16.5 GlobalHooks....................... 241 16.6 MockFramework .................... 241 16.7 CustomMatchers .................... 242 16.8 Macros .......................... 246 16.9 CustomFormatters................... 249 16.10 WhatWe’veLearned................... 252
IV Cucumber 253
17 Intro to Cucumber 254 17.1 From20,000Feet .................... 255 17.2 Features ......................... 255 17.3 CustomerAcceptanceTests .............. 259 17.4 Gherkin.......................... 259 17.5 Scenarios......................... 261
CLICK HERE to purchase this book now.
CONTENTS 11
17.6 Steps ........................... 262 17.7 ThecucumberCommand ............... 263 17.8 Given/When/Then ................... 264 17.9 Declarative and Imperative Scenario Styles . . . . . 265
17.10 Organizing Features 17.11 Tags.......... 17.12 What We’ve Learned .
18 Cucumber Detail
.................. 266 .................. 267 .................. 269
271
18.1 StepDefinitions ..................... 271 18.2 World ........................... 273 18.3 Calling Steps Within Step Definitions . . . . . . . . 274 18.4 Hooks........................... 275 18.5 Background ....................... 277 18.6 MultilineText ...................... 278 18.7 TablesinSteps ..................... 279 18.8 ScenarioOutlines.................... 280 18.9 Configuration ...................... 282 18.10 WhatWe’veLearned................... 282
V Behaviour-Driven Rails 284
19 BDD in Rails 285 19.1 Outside-InRailsDevelopment............. 286 19.2 SettingUpaRails3Project .............. 288 19.3 SettingUpaRails2Project .............. 291 19.4 WhatWe’veLearned................... 291
20 Cucumber with Rails 292 20.1 StepDefinitionStyles.................. 292 20.2 DirectModelAccess................... 294 20.3 WhatWe’veLearned................... 299
21 Simulating the Browser with Webrat 300 21.1 Writing Simulated Browser Step Definitions . . . . . 301 21.2 NavigatingtoPages ................... 306 21.3 ManipulatingForms .................. 310 21.4 Specifying Outcomes with View Matchers . . . . . . 315 21.5 BuildingontheBasics ................. 318 21.6 WhatWe’veLearned................... 321
CLICK HERE to purchase this book now.
CONTENTS 12
22 Automating the Browser with Webrat and Selenium 322 22.1 GettingStarted ..................... 323 22.2 Writing Step Definitions for Selenium . . . . . . . . 326 22.3 DebuggingSeleniumIssues .............. 330 22.4 WhatWe’veLearned................... 332
23 Rails Views 333 23.1 WritingViewSpecs ................... 333 23.2 MockingModels ..................... 336 23.3 SpecifyingHelpers.................... 343 23.4 WhenShouldIWriteViewSpecs?. . . . . . . . . . . 345 23.5 WhatWe’veLearned................... 345
24 Rails Controllers 347 24.1 ControllerSpecs..................... 347 24.2 Context-SpecificExamples............... 354 24.3 Specifying ApplicationController . . . . . . . . . . . 363 24.4 WhatWe’veLearned................... 365
25 Rails Models 367 25.1 WritingModelSpecs .................. 367 25.2 SpecifyingBusinessRules............... 375 25.3 Exercise.......................... 384 25.4 UsefulTidbits ...................... 385 25.5 WhatWe’veLearned................... 388
A RubySpec 390 A.1 TheProject........................ 391 A.2 Syntax .......................... 391 A.3 Guards .......................... 393 A.4 Extensibility ....................... 394 A.5 MSpec........................... 396 A.6 Tags............................ 396 A.7 Community........................ 397
B RSpec’s Built-in Expectations 399 C Bibliography 403

Classifications

Library of Congress
TK5105.8885.R83 C44 2010, QA76.76.D47

ID Numbers

Open Library
OL24602313M
Internet Archive
rspecbookbehavio00chel_797
ISBN 13
9781934356371
LCCN
2011281911
OCLC/WorldCat
551430947

Community Reviews (0)

Feedback?
No community reviews have been submitted for this work.

Lists

This work does not appear on any lists.

History

Download catalog record: RDF / JSON / OPDS | Wikipedia citation
September 16, 2024 Edited by MARC Bot import existing book
January 14, 2023 Edited by ImportBot import existing book
October 9, 2020 Edited by ImportBot import existing book
September 25, 2020 Edited by MARC Bot import existing book
February 9, 2011 Created by Andrew Havens Added new book.