small medium large xlarge

Errata for The RSpec Book

 

The latest version of the book is P2.1, released about 4 years ago. If you've bought a PDF of the book and would like to upgrade it to this version (for free), visit your home page.

By default this page displays the errata for the latest version of the book. If you have a previous version, select it here:

If you've found a new error, please submit it.

  • Typo
  • Tech. error
  • Suggestion
  • Maybe next edition
  • Not a problem
  • Reported in: P2.0 (08-Nov-11)
#47920
PDF page: 0

After location 62 on Kindle, there are some doubled hyphens, which are probably meant to be en-dashes: "Test--Driven". --Ilmari Vacklin

  • Reported in: P2.1 (03-Dec-13)
#53274
PDF page: 1
The "should" expectation syntax (e.g. "[].should be_empty") has been deprecated since RSpec 2.11. Hopefully you'll be updating the code samples to ...more...
  • Reported in: P2.1 (07-Nov-14)
#77786
PDF page: 3
Broken link in footnote 1 - the current link is at http(colon slash slash)blog(dotdaveastels(dot)com(dot)s3-website-us-west-2(dot)amazonaws(dot)com/20...more...
  • Reported in: P2.1 (09-Jan-16)
#79585
Paper page: 12
The ling greeting.should == "Hello RSpec!" is now depreciated for RSpec 3.0 due to the use of should. If you are using RSpec 3.0 then you can use the...more...
  • Reported in: P2.1 (10-Nov-15)
#79136
Paper page: 14
syntax Should has been deprecated replace with Expect Section 2.3 Hello Cucumber hello/3/features/greeter_says_hello.feature Scenario: ...........more...
  • Reported in: P2.1 (17-Jan-13)
#50476
PDF page: 14

Last then line missing closing $/--Brian maltzan

  • Reported in: P2.1 (06-Oct-12)
#49930
PDF page: 16

The code sample hello/5/features/step_definitions/greeter_steps.rb appears to be missing a blank line before "Given...".--Wayne Conrad

  • Reported in: P1.0 (11-Apr-11)
#46852
PDF page: 31

checking

  • Reported in: P2.1 (09-Nov-13)
#53129
PDF page: 41
"Cucumber will load features/support/env.rb, which now requires lib/code-breaker.rb, which" lib/code-breaker.rb should be lib/codebreaker.rb (i.e. ...more...
  • Reported in: P2.1 (05-Dec-13)
#53283
PDF page: 42
There is some confusion about using the "puts" method on the Output object, which makes it feel like an IO object, and because it is later replaced w/...more...
  • Reported in: P2.0 (25-Aug-11)
#47436
Paper page: 42
The code example is shown as Then /^I should see "([^"]*)"$/ do ... but in the following paragraph, the regex is shown as ([^\"]*) - note adde...more...
  • Reported in: P2.0 (17-Jan-15)
#78052
Paper page: 43
Completion of code on page 43 when running cucumber get "undefined method" error for messages. code snippet class Output def messages @m...more...
  • Reported in: P2.0 (17-Jan-15)
#78053
Paper page: 43
Found correct to the previous error on forum. The following code causes a clash with RSpec's BuiltIn::Output def output @output ||= Output.ne...more...
  • Reported in: P2.0 (06-Nov-11)
#47907
PDF page: 47
The "original narrative" shown with the scenario in the lower half of this page is different from the original narrative as it appeared on the previou...more...
  • Reported in: P2.1 (31-Jul-13)
#52282
PDF page: 59

"subimt a guess" should read "submit a guess" in the third line of the first paragraph on page 59 of the PDF.--Daniel

  • Reported in: P1.0 (28-Apr-11)
#46976
PDF page: 59
A hypen is included in the epub version of the book in the case where the hypen indicated a end of line wrap in the PDF version. The hypen does not o...more...
  • Reported in: P2.0 (16-May-12)
#49331
PDF page: 60
The code in step definition Then /^I should see "([^"]*)"$/ do |message| output.messages.should include(message) end is using should metho...more...
  • Reported in: P2.0 (16-May-12)
#49332
PDF page: 60
The need for including RSpec appeared only when I used Guard for automating running Cucumber acceptance tests. When running Cucumber manually it all w...more...
  • Reported in: P2.1 (20-Jan-13)
#50499
PDF page: 61
Section 5.1, first paragraph: "game_spec.rb). See Shouldn't We Avoid a One-to-One Mapping?, on page 46 for" should be "game_spec.rb). See...more...
  • Reported in: P2.0 (16-Jul-12)
#49530
PDF page: 61
[Using ruby 1.9.3-p194] After modifying the line game = Codebreaker::Game.new(output) and running Cucumber the book indicates that the test wil...more...
  • Reported in: P1.0 (03-Aug-11)
#47338
PDF page: 73
I suggest that the definition of the let() method to be updated/verified. let(<name>) { <block> } i'm beginning to have a suspicion that the "...more...
  • Reported in: P2.1 (03-Dec-13)
#53272
PDF page: 74
Paper page: 59

Section 6.1, first paragraph: "subimt" should be "submit".--Richard Murnane

  • Reported in: P2.1 (22-Jan-13)
#50507
PDF page: 74
Chapter 6, introduction, first paragraph feature we’re going to tackle is to subimt a guess and get feedback from the "to subimt a" -> "to sub...more...
  • Reported in: P2.1 (10-Jun-13)
#51957
PDF page: 74

The third sentence contains 'subimt', should be 'submit'--Robert Newbould

  • Reported in: P2.0 (26-May-11)
#47110
Paper page: 75
"Run the specs, and they should all pass." in 2nd para, line 1 To make this a true statement, number_match? need to be in codebreaker/game.rb, whic...more...
  • Reported in: P2.0 (25-Aug-12)
#49741
PDF page: 77

This is a dummy. Throw me away.

  • Reported in: P2.0 (17-Jul-12)
#49532
PDF page: 78
[Ruby 1.9.3p194; Cucumber 1.2.1; RSpec 2.11.0] Running cucumber on codebreaker_submits_guess.feature, shows 5 passing scenarios, not 14 scenarios. ...more...
  • Reported in: P2.0 (21-Apr-12)
#49169
PDF page: 80
Earlier in the book "before(:each)" was introduced and the lines were changed to use @output.should_receive. Now in this section the code is back to ...more...
  • Reported in: B13.0 (19-Mar-13)
#51093
PDF page: 80
Paper page: 92
undefined method `[]' for nil:NilClass (NoMethodError) ./lib/codebreaker/game.rb:30:in `exact_match?' ./lib/codebreaker/game.rb:17:in `...more...
  • Reported in: P2.0 (17-Jul-12)
#49533
PDF page: 81
The book states that running the codebreaker_starts_game will fail because of the missing argument... however, it does not fail since a default is pro...more...
  • Reported in: P2.0 (01-Mar-12)
#48857
Paper page: 88

missing change mark before:

def initialize(secret, guess)--Carlos Silva

  • Reported in: P2.0 (05-Jul-12)
#49495
PDF page: 91
I am using ruby --version ruby 1.9.3p194 (2012-04-20) [x86_64-linux] rspec --version 2.10.1 cucumber --version 1.2.1 The example code fails ...more...
  • Reported in: P2.0 (07-Oct-11)
#47720
PDF page: 92
"Ru n t h e s pe c s , an d t h e y s h o u ld all pas s . Ru n t h e s c e n ario s , an d y o u s h o u ld s e e t h at t we lv e ar e pas s in g ,...more...
  • Reported in: P2.0 (28-Feb-12)
#48835
PDF page: 94
Chapter 7.3 is all about “Refactor to Express Intent”. A minor improvement could be made to the refactored `number_match?` method to better convey the...more...
  • Reported in: P2.0 (03-Mar-12)
#48874
Paper page: 100
I think that the marker_spec.rb code presented in this page leads to think that there is only one context at this point in the "describe Marker do … e...more...
  • Reported in: P2.0 (09-Sep-11)
#47526
PDF page: 102
It's being picky, but following the mantra that readability is paramount, isn't this rather cryptic? count + (number_match?(guess, index) ? 1 : 0) ...more...
  • Reported in: P2.0 (01-Apr-12)
#49046
Paper page: 103
@guess is a string being passed to Marker, map is not a method available to the String class, so use each_char instead, or convert the String to Array...more...
  • Reported in: P2.0 (22-Jan-14)
#76324
PDF page: 117
marker = Marker.new('1234','1155') marker.number_match_count.should == 0 should be marker = Marker.new('1234','1155') marker.number_match_count....more...
  • Reported in: P2.0 (07-Apr-12)
#49079
PDF page: 118
You do realize that this new implementation could have been achieved by just reversing the order of the checking like this: @secret.include?(@guess[i...more...
  • Reported in: P2.1 (12-Feb-14)
#76401
PDF page: 139

The third paragraph starts with

so you can refactor

which is suspended in mid-air.

--Bernard Kaiflin

  • Reported in: P2.1 (05-Jun-13)
#51836
PDF page: 143

I try to implement all the suggestion you guys have provide but none of one work--Amrit Deep Dhungana

  • Reported in: P2.1 (25-Oct-12)
#50022
PDF page: 145
In the middle of the page it says: "Assuming that Thing’s initialize() method does this and set_status() does as well, you can write the previous lik...more...
  • Reported in: P2.1 (12-Feb-14)
#76402
PDF page: 145
In Ruby 1.8.7, the block passed to "yield Thing.new" is executed twice, and the block passed to given_thing_with is not executed. In Ruby 2.0.0 : bl...more...
  • Reported in: P2.1 (03-Dec-13)
#53273
PDF page: 149
Paper page: 139
Third paragraph starts with a sentence fragment: "----> so you can refactor <---- There are a couple of.... etc" (arrows added for emphasis) -...more...
  • Reported in: P1.0 (20-May-12)
#49360
Paper page: 150

`yield Thing.new do; end` binds the block to `yield` instead of `Thing.new`. Need to use `yield Thing.new { ... }` instead.--David Chelimsky

  • Reported in: P2.1 (13-Feb-14)
#76404
PDF page: 165
In section "Owned Collections", paragraph 5, line 2 : players_on(). When it receives a message, it doesn’t understand (like players_on()), ---->...more...
  • Reported in: P1.0 (08-Jun-11)
#47171
Paper page: 169
Third paragraph: Currently Reads: "...anything that begins with have_ to a predicate on the target object beginning with has_" have_ and has_ sho...more...
  • Reported in: P2.1 (08-Dec-12)
#50335
PDF page: 179

Book has test-specific subclasspattern

(with no space between subclass and pattern)
--Perry Smith

  • Reported in: P2.1 (14-Feb-14)
#76407
PDF page: 182
Executing the example "describe WidgetsController". $ gem install rails … Successfully installed rails-4.0.2 I have added four missing do's an...more...
  • Reported in: P2.1 (13-Feb-14)
#76405
PDF page: 183
In section Stub Chain, second paragraph : Article.recent.published.authored_by(params[:author_id]) ----> shouldn't it be article ? Also 3rd l...more...
  • Reported in: P2.1 (14-Feb-14)
#76408
PDF page: 188
Section Custom Argument Matchers. I had difficulties to make an example with calculator.should_receive(:add).with(greater_than_3) working. Du...more...
  • Reported in: P1.0 (07-May-13)
#51471
Paper page: 201
In the first paragraph on the page, the book implies that it is the stub that causes any subsequent calls to log() to be ignored: <quote> In the s...more...
  • Reported in: P2.0 (09-Feb-12)
#48688
PDF page: 203

"Article.stub_chain" should be "article.stub_chain"

  • Reported in: P2.1 (08-Dec-12)
#50338
PDF page: 210
2nd one of these. In the pdf it has: create an autotestdirectory autotest is in italics and directory is normal but there is no space between t...more...
  • Reported in: P2.1 (08-Dec-12)
#50339
PDF page: 210
2nd one of these. In the pdf it has: create an autotestdirectory autotest is in italics and directory is normal but there is no space between t...more...
  • Reported in: P2.1 (15-Feb-14)
#76411
PDF page: 215
Section 16.1 Metadata ----> it would be nice to have a green bar with the path of the example : code/extending_rspec/metadata.rb before the e...more...
  • Reported in: P2.1 (08-Dec-12)
#50340
PDF page: 215
Suggestion to Pragmatic: it would be nice if I could add and edit previous "erratas". Now to the errata. This is the third one. This isn't a big ...more...
  • Reported in: P1.0 (18-Jun-11)
#47193
Paper page: 221
The code presented to add a rspec:rcov rake task is no longer needed as it is added rails rspec gems. This should at least be mentioned for those usin...more...
  • Reported in: P1.0 (04-Oct-11)
#47685
Paper page: 225

To run the example it says to type "rspec group_example.rb" but given the filename shown above this should be "rpsec focused_group.rb"--Nigel Lowry

  • Reported in: P2.0 (17-Jul-12)
#49537
Paper page: 232
Under the "Matcher Protocol" subsubsection of subsection 16.7, under the "matches?" list item, the second sentence contains a typo: "Return true for a...more...
  • Reported in: P2.0 (01-Jun-12)
#49397
PDF page: 232
"spec_opts takes an array of strings" (first sentence right under the "About Code Coverage" sidebar) but the (non-deprecated) option's name is actuall...more...
  • Reported in: P2.1 (08-Nov-12)
#50153
PDF page: 237

"pending_count)" missing a parentheses, should be "pending_count()".

I'm really enjoying this book so far. Thanks!--Alex Plescan

  • Reported in: P2.0 (01-Jun-12)
#49399
PDF page: 238

network.rb
require 'ping'
ping has been deprecated after ruby 1.8.7
The book needs to show another way of doing ping for ruby 1.9.x--Jim Oser

  • Reported in: P1.0 (02-Dec-10)
#45871
PDF page: 251
On the Kindle 3, the word "fiancé" in the "Cucumber Seeds" box is rendered as "fiancée". The PDF page # given above is actually the location number.-...more...
  • Reported in: P2.0 (21-May-12)
#49361
PDF page: 253

In the footnote, the URL to the Cucumber wiki is wrong. Cucumber has moved to another Github repository.--Ulrich Sossou

  • Reported in: P2.1 (16-Feb-14)
#76414
PDF page: 258

Bottom of the page, the link in footnote 2

h__p://wiki.github.com/aslakhellesoy/cucumber/rdoc

gives an error 404.

--Bernard Kaiflin

  • Reported in: P2.0 (11-Jan-12)
#48498
PDF page: 270
s/pending/undefined/ "Several things changed when we added the step definition. First, the scenario and step are no longer pending, but passing." ...more...
  • Reported in: P1.0 (02-Dec-10)
#45872
PDF page: 273
In the Kindle edition, chapter 1 has footnotes 2,3 and 4 not no footnote 1. 2, 3 and 4 correspond to 1, 2, and 3 of the PDF edition. PDF page # given ...more...
  • Reported in: P2.0 (15-Dec-11)
#48291
PDF page: 274
At the beginning of the last sentence of the fifth paragraph (immediately before the "Tagged Hooks" subsection): "When we do,…" is somewhat confusing....more...
  • Reported in: P2.0 (31-Jul-12)
#49603
PDF page: 278

The url in the footnote does not work. This form doesn't let me input urls to this box so I can't give you the correct one.
--Joseph Shraibman

  • Reported in: P2.0 (02-Apr-12)
#49049
PDF page: 287
In 19.2 "Setting up a Rails 3 Project", running 'bundle install' gives the following error: % rails generate rspec:install WARNING: Cucumber-rails...more...
  • Reported in: P2.0 (21-Jul-11)
#47300
PDF page: 288
Cucumber on rails 3 requires database_cleaner to be added explicitly to the gemfile. Following the steps here gives an error that database_cleaner is ...more...
  • Reported in: P1.0 (05-Jul-12)
#49498
Paper page: 296
Content of simulated_browser\05\app\models\genre.rb I downloaded from the website should be: class Genre < ActiveRecord::Base attr_accessible :n...more...
  • Reported in: P1.0 (23-Aug-11)
#47433
PDF page: 326

“The Webrat’s default timeout” should probably drop the “the”, agree?

  • Reported in: P2.1 (06-Nov-12)
#50135
PDF page: 338
The book says "The assigns() method returns a hash representing instance variables that were assigned to the view by the controller. Run rake spec:con...more...
  • Reported in: P2.1 (06-Nov-12)
#50136
PDF page: 340
the book text indicates that there is a change on the line: context "when the message fails to save" do it "assigns @message" do ➤ message.stub(:...more...
  • Reported in: P2.0 (11-Jul-11)
#47257
Paper page: 347
Example rails_controllers/messages/13/spec/controllers/messages_controller_spec.rb is missing the line Message.stub(:new).and_return(message). This w...more...
  • Reported in: P2.0 (11-Jul-11)
#47258
Paper page: 348
In the example rails_controllers/messages/15/spec/controllers/messages_controller_spec.rb the before block needs job.stub(:save).and_return(true) ...more...
  • Reported in: P2.0 (03-Feb-12)
#48650
PDF page: 353
In this section, the messages_controller is altered so that it stores a notice in flash when the message is successfully saved. In the examples, the #...more...
  • Reported in: P1.0 (31-Mar-12)
#49044
Paper page: 353

First paragraph reads:

"The most obvious bit is the duplication in the past two examples"

"past" should be "last"--Nigel Lowry

Stuff To Be Considered in the Next Edition

  • Reported in: P1.0 (16-Dec-10)
#46030
PDF page: 1
# Quick Thoughts on "The RSpec Book" My rating: 10/10. Heavens gift book! Really. That said, I have a few thoughts... ## On brute-forcing I...more...
  • Reported in: B16.0 (24-Nov-10)
#45749
PDF page: 22
In section 1.2, end of the second paragraph: the word "is" should be removed from "...but even then, they generally mean is that it's stored somewhere...more...
  • Reported in: P1.0 (05-Dec-10)
#45897
PDF page: 34
The phrase "go ahead and <x>" is used too much throughout the book. It would improve the writing to remove that part and just state the "<x>". For exa...more...
  • Reported in: P1.0 (03-Dec-10)
#45883
PDF page: 43
So, now we have our release plan with 3 stories. It’s time to start breaking it down into iterations. Yet only 2 stories are worked out and page 52...more...
  • Reported in: B16.0 (24-Nov-10)
#45737
PDF page: 59
Under section 4.3 Test Double: "A fake object that pretends to be real object..." should be "A fake object that pretends to be a real object...".--Joh...more...
  • Reported in: P1.0 (03-Dec-10)
#45887
PDF page: 67
Throughout the PDF, output is colored as though it were code. On page 67, in "prompts for the first guess" the "for" is highlighted as a keyword; in "...more...
  • Reported in: P1.0 (23-Dec-10)
#46098
Paper page: 73
The path cb/325/... threw me for a minute, after seeing a steady progression of 27,28,30,32. I guess you meant 32.5. In the next edition, I would make...more...
  • Reported in: P1.0 (10-Mar-11)
#46559
Paper page: 85
Recommend Enumerable#count, not enumerable#inject. The #count method does exactly what's required here. Using #inject makes the code harder to read to...more...
  • Reported in: B16.0 (27-Nov-10)
#45787
PDF page: 106
"Create a marker.rb file in lib/codebreaker/, open the Codebreaker module, and copy the Marker into that file." This is unclear to me. I think it mean...more...
  • Reported in: P1.0 (14-Mar-11)
#46580
PDF page: 120
In Ruby 1.9.2 there isn't a String#map method any more. but in this example you could use String#each_char instead. Perhaps you could mention it in a ...more...
  • Reported in: P1.0 (01-Dec-10)
#45852
PDF page: 130

The claim that exponential cost increase in later bug fixes comes from civil engineering would be nice to have footnoted with a source--Greg Cox

  • Reported in: P1.0 (01-Feb-11)
#46338
PDF page: 152
Your code snippet formatter has decided that the text following => is ruby code and highlighted "require" and "and" inappropriately in the second line...more...
  • Reported in: B16.0 (14-Nov-10)
#45599
PDF page: 167

There's a missing space after the comma: "It /is/ DRY,/and/ it's so complicated."--Adam Spiers

  • Reported in: B16.0 (14-Nov-10)
#45598
PDF page: 170

I think "nontechnical" should be hyphenated: "non-technical"--Adam Spiers

  • Reported in: B16.0 (25-Nov-10)
#45754
PDF page: 176

Ruby on RailsRuby on Rails extends ...--Rich Morin

  • Reported in: P1.0 (03-Apr-11)
#46738
Paper page: 181

In "/... for Aslak/", the word for should not be printed like a keyword.

This occurs on pages 181, 184 and 200(4).--Andreas Kemkes

  • Reported in: B16.0 (28-Nov-10)
#45797
PDF page: 183

There should be no comma in "When it receives a message, it does not understand" on line 2.

  • Reported in: B16.0 (28-Nov-10)
#45799
PDF page: 193
"All of the other patterns we’ll talk about and you’ll read about elsewhere are usually variations of method stubs and method expectations..." Does...more...
  • Reported in: B16.0 (26-Nov-10)
#45770
PDF page: 200
"The first example specifies that the WidgetsController finds the widget, so we set an expectation that the Widget class should receive the find() met...more...
  • Reported in: P1.0 (19-Dec-10)
#46054
PDF page: 230
The autotest command appears to be part of the ZenTest gem, which is not listed on page 18. While autotest appears to have been its own gem for a whi...more...
  • Reported in: B16.0 (28-Nov-10)
#45801
PDF page: 232
RSpec::Core::RakeTask.new do |t| t.rspec_opts = ["--color"] end spec_opts takes an array of strings,... Should "spec_opts" be "r...more...
  • Reported in: B16.0 (29-Nov-10)
#45806
PDF page: 238
Under the Exclusion heading, "...we tend to try to disable them so we can run rest of the suite..." should be "we tend to try to disable them so we ca...more...
  • Reported in: P1.0 (03-Apr-11)
#46742
Paper page: 280

In ":require", the word require should not be printed like a keyword.--Andreas Kemkes

  • Reported in: P1.0 (30-Dec-10)
#46151
PDF page: 287
The autotest/discover.rb would not be any more generated since this commit f47e87b39a6f2bc24b71d701c8b509fd6e32acb1 in the rspec-rails repository.--Da...more...
  • Reported in: B16.0 (29-Nov-10)
#45809
PDF page: 300
"We’re going to focus on Cucumber with Webrat and Selenium, so we’re going to skip over some of the low-level details that we use RSpec for in practic...more...
  • Reported in: P1.0 (03-Apr-11)
#46743
Paper page: 313

In "/... logged in as .../", the word in should not be printed like a keyword.--Andreas Kemkes

  • Reported in: P1.0 (05-Dec-10)
#45907
PDF page: 338
The messages example in the rails_view chapter works with rails 3.0.0 but does not work when running on rails 3.0.3. The refactoring of new.html.erb_s...more...
  • Reported in: P1.0 (25-Jan-11)
#46310
PDF page: 344
"Use Webrat’s have_xpath( ) and have_selector( ) matchers for view specs." I believe this is misplaced and should be moved to the summary of Chapter 2...more...
  • Reported in: B16.0 (29-Nov-10)
#45807
PDF page: 367
The database migration on this page specifies "recipient_id": "script/rails generate model message title:string text:text recipient_id:integer" ...more...