By Developers, For Developers

Historical errata for The RSpec Book

PDF PgPaper PgTypeDescriptionFixed onComments
13TYPO

Asklak’s name is not displaying properly

— Aslak HellesÃÿy set out

2009-02-23
13TYPO

More UTF errors

— his fiancÃl’e,

2009-02-23
13TYPO

In the third alinea the last name of Aslak is not correct. It now sais HellesÃÿy.

2009-02-23
130SUGGEST

When describing which gems you need to unpack into the rails project you say:

> gem unpack cucumber
> gem unpack rspec
> gem unpack rspec-rails
> gem unpack webrat

However on the line above you have

> sudo gem install cucumber rspec-rails webrat

I know that it’s obvious but you might want to add rspec by itself into that list so that people who aren’t paying attention will try to unpack a gem that they don’t have installed. Therefore it would become

> sudo gem install cucumber rspec rspec-rails webrat

If they were following the book that won’t happen since we install it earlier, but it might for people jumping around.

Thanks

Kent

2009-06-21rspec is a dependency of rspec-rails, so you don't need to include it explicitly on the command line
13TYPO

in the sidebar Aslak’s last name prints as Helles[capital A bar][lowercase y umlaut]y. And later fiance has a typographic error as well. I’m on os x leopard, all updates.

In the spring of 2008, Aslak HellesÃÿy set out to rewrite RSpec’s Story Runner with a real grammar defined with Nathan Sobo’s Treetop library. Aslak dubbed it Cucumber at the suggestion of
his fiancÃl’e, Patricia Carrier, thinking it would be a short-lived
working title until it was merged back into RSpec. Little did either
of them know that Cucumber would develop a life of its own.

2009-02-23
16SUGGEST

Could use a more complete description of how you set up the tutorial project and why in that manner.
Or a link to docs that outline why it is a good idea to do it that way & describe what all the component files are for.

2009-05-29
64TYPO

before used instead of after in the following snippet:

set aside
the global state in an instance variable in before(:each) and then restore
it in after(:each), like this:
before(:each) do
original_global_value = $some_global_value $some_global_value = temporary_value end before(:each) do $some_global_value = original_global_value
end

2009-02-23
114SUGGEST

this is a quibble, but the -colour option in the following snippet makes it seem like a command line arg with the dash as opposed to an option for —format

you can also add the –colour option to see passing examples
in green and failing examples in red.

2009-02-23
46TYPO

Misspeeling. :)

And viola!

2009-02-23
67TYPO

missing a t on consistent:

A good guideline to follow is to keep things consisent

2009-02-23
67ERROR

Helper module included doesn’t match name of the module

Spec::Runner.configure do |config|
config.include(UserExampleHelperMethods)
end

module is actually UserExampleHelpers

2009-02-23
68TYPO

We declare a shared example grouip

2009-02-23
70TYPO

A couple of words got duped here

etc, etc declared in the in the
outer group are available in the inner group.

2009-02-23
70TYPO

another before/after mixup - step 5:

1. outer before
2. inner before
3. example
4. inner after
5. outer before

2009-02-23
12TYPO

In the Cucumber example, the word “for” has been syntax highlighted, which I presume is not needed. Of course, I’m just learning Cucumber so I could be completely wrong…

2009-03-25
14SUGGEST

My head still spins after looking at the BDD cycle diagram. Perhaps turning it into a flowchart-y diagram makes it easier.

2009-02-04We added flowchart so you both the dizzying nested cycles and the clarifying flow chart.
18SUGGEST

Before describing which files are responsible for what, a short introduction to installing the gems would be nice. Perhaps in an appendix or sidebar, but definately before page 18.

2009-05-29
22OK

More syntax highlighting in the plain text scenarios.

2010-07-18
29SUGGEST

I got sidetracked by the fact that cucumber was run in the examples with -n. IMHO it doesn’t add much value at first, so perhaps run the examples without -n, and introduce that specific command line flag later on in the book?

2009-07-04This is tricky because even though the flag adds complexity to the command, it also reduces the noise in the output. I think I'm going to leave this as/is. \n \nFYI - it's changed to "-s"
88TYPO

Missing the word ‘in’

‘But what about when the state we’re interested is …’ should be ‘But what about when the state we’re interested in is …’

2009-03-25
129TYPO

‘the’ Should be ‘that’ in the sidebar.

BDD is about writing software that< matters

2009-03-25
10TYPO

The word “that” is repeated twice in “stores a Registration in a Registry’s registrations collection, and that that collection…”

2009-02-23
12TYPO

In the example: “on line” should be changed to on-line or online.

2009-02-23
19ERROR

It looks like the root needs a bin directory to match example batch file on page 28.
project_root would then have top level directories bin, features, lib and spec.

2009-03-25
39TYPO

The missing include( ) method is an RSpec expectation matcher method,
so we need to require the rspec exectations library

Should say “[…]rspec exPectations library”

2009-03-25
46ERROR

It talks about the bin made in the last chapter, but with in the end that bin should be:

#!/usr/bin/env ruby -w
$LOAD_PATH.push File.join(File.dirname(FILE), “/../lib”)
require ‘mastermind’

game = Mastermind::Game.new(STDOUT)
game.start

2010-01-17
15TYPO

2nd to last paragraph:
“you can go to to learn more of the detail and philosophy behind each feature”
(duplicate ‘to’)

2009-02-23
15TYPO

Last paragraph: “its time” should be “it’s time”

2009-03-25
18SUGGEST

3rd paragraph: I’m wondering about the “parallel structure below lib/mastermind and spec/mastermind”. That sounds like the kind of 1:1 relationship between units of code and tests that the first chapter talked about getting away from.

2009-03-25
19SUGGEST

In figure 2.2, I am wondering why the lib/mastermind and spec /mastermind directories are not shown, and why step_definitions/mastermind.rb isn’t shown.

I’m also wondering why the top three directories appear to be in bold while the rest do not. It’s hard to tell if this is an artifact of the rendering or a meaningful part of the picture, though.

2009-03-25
20SUGGEST

The first paragraph that starts on page 20 says “stories” three times, and then switches to the word “scenarios”. It’s hard to tell if these terms are meant to be interchangeable here, or, if not, what the relationship between them is.

2009-05-29The description of Stories In, Features Out has changed and been moved to the Writing Software that Matters chapter.
23TYPO

Top:
“and enter that snippet to it.”

How about:
“and add that snippet to it.”
or
“and enter that snippet into it.”

2009-03-25
25SUGGEST

3rd paragraph:
“It is common to write the code you wish we had doing TDD.”

This sounds a little odd after using “the code you wish YOU had” a couple times just before this.

2009-03-30The rest of the paragraph reads "we", so I changed it to "It is common to write the code we wish we had doing TDD" - I agree "It is common to write the code YOU wish WE had doing TDD" was confusing, but I think this reads OK now. \n \nThanks
26SUGGEST

I’m not sure if this is an error or not.

End of 1st paragraph of page 26:

“This is RSpec’s way of setting expectations about equality.”

I thought we were dealing with Cucumber in this chapter? The outer of the two cycles? Should this say RSpec or Cucumber? If ‘RSpec’ is correct, some explanation might help.

2009-03-30
29SUGGEST

On the matter of -n, I got curious enough to look it up. There didn’t seem to be anything in the documentation wiki yet, but going to the source in Github I got my answer: long form “—no-source”, “Don’t print the file and line of the step definition with the steps.”

A brief mention of this might be enough to tie up that loose end for the reader.

2009-03-30
29TYPO

First paragraph:
“Now we see file and line numbers”

How about:
“Now we see file names and line numbers”

2009-03-25
29TYPO

Start of section 2.5:
“At this point we’ve made our way through to the first step in the concentric cycles”

This doesn’t seem quite right. How about eliminating “to”:
“At this point we’ve made our way through the first step in the concentric cycles”

From the diagram, it actually looks like we’ve finished step two and are now about to work on step three.

2009-03-25
29TYPO

Start of section 2.5:
“the concentric cycles described at the beginning of this chapter”

The concentric cycles are introduced in the previous chapter (1), not the current one (2).

2009-03-25
115SUGGEST

a few of the examples use the option colour yet there is a section on -color, it might make sense to standardize on one and/or mention the two are synonymous

2009-06-17
119ERROR

9 No mutants survived. Cool!
Line 2 indicates that heckle found four opportunities to mutate the code
in the #start method. Line 9 tells us that at least one code example
failed after modifying the code in each of those four ways.

— Not in this example

2009-03-25
39TYPO

In the final para on the page, “Now one of the two Thens are passing” should read “Now one of the two Thens is passing” (number agreement).

2009-03-25
42TYPO

Second para on page: “… and is supported by RSpec’s mock framework with a the as_null_object() method:” should read “… and is supported by RSpec’s mock framework with the as_null_object() method:”

2009-03-25
126TYPO

Section 15.1, “Traditional Rails Development” - second para, penultimate sentence: “… revisit what you’ve already built or make due.” should read “… revisit what you’ve already built or make do.”

2009-03-25
27ERROR

Much better! Go ahead and copy that code into bin/mastermind.bat if
you’re on Windows. Otherwise, use bin/mastermind (and don’t forget to
chmod 755 bin/mastermind so you’ll be able to execute it later).

There was no “bin/mastermind” in the game original drawing on p 19

2009-03-25
55SUGGEST

Section 8.1, para after the code example - instead of
“We use the describe() to define…”

How about either:

“We use the describe() method to define…”

Or:

“We use describe() to define…”

The first fits better, given that the following para talks about “The it() method…”

2009-03-25
69TYPO

In section “Sharing Examples in a Module”, first sentence has “share_examples_for()”. Should be “shared_examples_for()”

2009-06-17The API is actually share_examples_for. shared_examples_for (with a 'd') does work because it is an alias for backwards compatibility.
10TYPO

Under “Emergent Design” subtitle, at the end of the second paragraph, a period (.) is missing.

…are responsible for testing pratices

2009-02-23
75TYPO

Penultimate sentence on page: “This can to help reduce…” should read “This can help reduce…”

2009-03-25
79TYPO

Last sentence in para after first code example: “RSpec let’s you express…” should be “RSpec lets you express…”

2009-03-25
82SUGGEST

Last sentence on page: “Now you could, of course, express this like this:” seems stilted.

How about, slightly more verbose, but I think a little more fluent, “Now you could, of course, express the same thing like this:”

2009-03-30
84TYPO

Last text on page: “… a second argument that is either String message…” should be “… a second argument that is either a String message…”

2009-03-25
89TYPO

Last sentence on page: “RSpec let’s us use…” should read “RSpec lets us use…”

2009-03-25
118TYPO

Section 12.3, final para: “… it’s code examples in …” should read “… its code examples in …”

2009-03-25
129TYPO

Last sentence of last complete para on page: “… have them validate its working …” should read “… have them validate it’s working …”

2009-03-25
2626OK

I’m with you till about page 26 then you start getting into making Ruby bin files and a few other things, and i get lost.

2009-05-29This is a bit too general. Please feel free to make specific suggestions if you have any.
33TYPO

Last paragraph:
“the Game needs a to handle the messenger argument to the initialize method.”

How about:
“the Game needs to handle the messenger argument to the initialize method.”

2009-03-25
39TYPO

Last paragraph:
“half way” looks odd as two words. Should it say “halfway”?

2009-03-25
1TYPO

One thing, I’m sure will be in the final version, but just wanted to confirm, normally these types of titles, have started out with some initial conditions of the software. For example, written with version X.Y.Z, assumes the following are installed, and may also include pointers for the installations. It seems like that could create problems down the road if people se variations in how things behave because their setup is different.

2010-01-15
43TYPO

3rd paragraph of section 3.3:
“we prefer to refactor in the green than in the red.”

Should “than” be replaced with “rather than”?

2009-03-25
44TYPO

Minor style issue: in the top code example, the first two examples are not separated by a blank line. Everywhere else, they are.

2009-03-25
46TYPO

2nd paragraph:
“It just builds, gradually on what we’ve already developed.”

The comma looks funny there.

2009-03-25
46TYPO

3rd paragraph:
“Go ahead and fire up a shell and run the script and you see the following output:”

How about changing “you” to “you’ll”

2009-03-25
54OK

You interchangeably use Test Driven Development (TDD) and BDD was that intentional I thought they were different although this is also new to me. It may just need to be clearer that you are describing two different aspects of testing.

2009-12-22This is thoroughly explained now in later versions of the beta.
142TYPO

In “Joe asks…”: “[…] introduce you to the other styles of step defintions […]” should be “[…] definitions […]”

2009-03-25
64TYPO

In the example on page 64, you have before(:each) twice when the 2nd one should be after(:each).

2009-03-25
69TYPO

“In addition to share_examples_for” should be “In addition to shared_examples_for”.

2009-06-17The API is actually share_examples_for. shared_examples_for (with a 'd') does work because it is an alias for backwards compatibility.
86TYPO

:working_to_hard should be :working_too_hard

2009-03-25
20SUGGEST

The authors use two different formats to write up features:

The “in order to” format on page 12 that places the business reason first.

Feature: pay bill on line
In order to reduce the time I spend paying bills
As a bank customer with a checking account
I want to pay my bills on line

And the Mike Cohn’s “so that” format on Page 20 that places the business value last:

Feature: code-breaker starts game
As a code-breaker
I want to start a game
So that I can break the code

While the authors do mention that the narrative is free format, they fail to mention that they used different structured formats in their examples, which could cause some confusion.

To avoid possible confusion after the prior code on page 20 you could say:

“Note the narrative structure in this example and the one on page 12 are different. We could have just as easily written the feature as:

Feature: code-breaker starts game
In order to break the code
As a code-breaker
I want to start a game”

Also while the features narrative is supposedly free format, some tools used with the test tools are dependent on the format. Maybe the authors mention that later.

2010-01-17
18SUGGEST

The project structure discussed on page 18 and shown graphically in Figure 2.2 on page 19 is confusing. Where does this structure come from? Is the reader supposed to set it up from scratch? Is there some sort of command or tool the read is supposed to run like Rails scaffolding? (I created them manually – was there an alternative?)

Which mastermind.rb file is which? What’s in each? Why are the file names identical?

Where is the reader supposed to put the codebreaker_starts_game.feature file? Should it have an .rb extension? (It wasn’t too hard to figure out this last one by trial and error, but some advice would have been nice.)

2009-05-29
27OK

There is further project structure confusion on page 27. Unlike Unix, Windows itself does not commonly have a bin directory, although Ruby does have a bin directory. Perhaps the authors are assuming that the student created the mastermind directory under the Ruby directory? Is so, suggesting it, because the project tree diagram in figure 2.2 doesn’t imply a bin anywhere. Also while Unix uses forward slashes at the command line, Windows uses back slashes, so the correct Windows format might be:

C:\\ruby\\bin\\mastermind.bat

assuming that is what the authors intended.

2010-02-03
27ERROR

The file contents

#!/usr/bin/env ruby -w
$LOAD_PATH.push File.join(File.dirname(FILE), “/../lib” )
require ‘mastermind’
game = Mastermind::Game.new(STDOUT)
game.start

Does not work on Windows as a BAT file, so copying the above into mastermind.bat makes no sense. The authors need a Windows specific BAT file or some additional instructions that are missing.

Running the above as a BAT file gives the following results:
C:\\RubyPrograms\\TheRSpecBook\\mastermind>mastermind

C:\\RubyPrograms\\TheRSpecBook\\mastermind>#!/usr/bin/env ruby -w
‘#!’ is not recognized as an internal or external command,
operable program or batch file.

C:\\RubyPrograms\\TheRSpecBook\\mastermind>$LOAD_PATH.push File.join(File.dirname(FILE), "/../lib
‘$LOAD_PATH.push’ is not recognized as an internal or external command,
operable program or batch file.

C:\\RubyPrograms\\TheRSpecBook\\mastermind>require ‘mastermind’
‘require’ is not recognized as an internal or external command,
operable program or batch file.

C:\\RubyPrograms\\TheRSpecBook\\mastermind>game = Mastermind::Game.new(STDOUT)
‘game’ is not recognized as an internal or external command,
operable program or batch file.

C:\\RubyPrograms\\TheRSpecBook\\mastermind>game.start
‘game.start’ is not recognized as an internal or external command,
operable program or batch file.

2009-03-25
28SUGGEST

OK, I was wrong, the mastermind.bat does work, but only when run from Cucumber and not as a standard BAT file. So it isn’t really a Windows script in the normal sense, it is a Ruby script that Cucumber finds and runs. If the reader has used Ruby for scripting, maybe this is obvious, but for a reader to uses Ruby primarily from within Rails it is less obvious.

The trick to get it to work is to place the mastermind.bat file at the top of the mastermind directory tree, the same place that the reader is using to run Cucumber.

Anyway, I think this could use a little clarification.

2009-03-25
119ERROR

Heckle 1.4.1 was released in 2007, not 2006.

2009-03-25
63OK

In the code example, how about adding (:capacity => 10) to the calls to Stack.new (as you do on pages 71 and 72) to show that you’re using a stack with a capacity of 10.

2009-12-06
64TYPO

Top of page:
“in general, we want to have each example run in complete isolation from the other.”

How about “others” instead of “other”

2009-03-25
69TYPO

Start of 1st paragraph:

The quoted phrases “should taste really good” and “should be available by the slice,” have ending quotation marks that face the wrong direction (so they look like opening quotation marks).

Also, the comma inside “should be available by the slice,” looks wrong - in the first line, for instance, “Any Pizza” has a comma after it that lies outside the closing quotation mark.

2009-03-25
71SUGGEST

I’m not fluent in RSpec terminology yet, but this sentence in the first paragraph reads a little confusing:

“For example, let’s say you want to express a given in the outer group, an event, or when in the inner group, and the expected outcome in the examples them selves.”

It might be mostly a matter of the commas seeming to carry equal weight in the sentence, so it’s hard to tell where one list item in the sentence ends and the next begins.

2009-03-30Changed to "let's say you want to express a given in the outer group, an event (or when) in the inner group, and the expected outcome in the examples themselves."
127TYPO

top of page:

“Building from the models out to the views means writing code based on
assumptions of what ### ‘you’ ### think you’ll need”

2009-03-25
143TYPO

“showtime_time.strftime(”%l:%M%p" ).strip.downcase" should have an upper “i” instead of a lower “L” as argument to strftime => “showtime_time.strftime(”%I:%M%p“).strip.downcase”

2009-03-25
145TYPO

Again (see p.143): “showtime_time.min.zero? ? ”%l%p" : “%l:%M%p”" should have upper “i” instead of lower “L” => “showtime_time.min.zero? ? ”%L%p" : “%L:%M%p”"

2009-03-25
142SUGGEST

Maybe it is easier to keep focused on cucumber if the required commands for creating the movie model and migrating the database are given:

- ruby script/generate model movie showtime_date:date showtime_time:time

- rake db:migrate
- rake db:test:prepare

2009-06-21
143TYPO

Sorry for the entries #37641 and #37642 about strftime with option “%l”. I learned in the meantime that it’s used to get single digits - exactly what we want here :-).
Nevertheless it doesn’t work for me - I just get no digits back (“:15pm” instead of “2:15pm”) and I couldn’t find this option in the ruby or rails documentation, so I thought it’s a typo…

2009-03-25
9-15SUGGEST

It seemed to me that chapter 1 could use a bit more discussion of the differences between RSpec and Cucumber… specifically regarding the differing strengths and why it is worth taking the time to learn and use two different tools. I only began to feel like I had a handle on it after reading the more detailed sections.

2009-05-29
143SUGGEST

At least for me the option %l for strftime doesn’t work on windows (no problems with it on my linux machine). A very simple workaround is to convert the time to a datestring first:

showtime_time.to_datetime.strftime(“%l:%M%p”).strip.downcase

If it was not only me who encounters this problem it would be helpful to add a footnote on that.

So you can remove/ignore my previous entries #37641, #37642 and #37645 (I promise this is my last one on this topic :-)

2009-06-21
64OK

maybe on : describe Stack, “when almost full (with one element less than capacity)”
(1..stack.capacity - 1).each { |n| stack.push n }

and : describe Stack, “when full”
(1..stack.capacity).each { |n| stack.push n }

2009-06-17I wouldn't do that because I'd have to violate encapsulation by exposing capacity.
76TYPO

End of 1st paragraph of section 9.1:
“An Expression Matcher is an object that does exactly what it’s name tells you: it matches an expression.”

Two things:

1. “it’s” should be “its”

2. How about “implies” or “says” instead of “tells you”

2009-03-25
77TYPO

2nd to last paragraph on page:
“RSpec’s built in matchers.”

“built in” looks wrong, since the next section name and the first sentence in that next section use the hyphenated “built-in”.

2009-03-25
77TYPO

Last paragraph: “to access them” sounds redundant here.

2009-03-25
82TYPO

Top line:
“key_value_pairs_methods()” should be “key_value_pairs() methods”

(methods being part of the surrounding text rather than formatted as code)

2009-03-25
86ERROR

This construction shows up three times on this page:

lambda {
team.working_too_hard.should throw_symbol(:working_to_hard)
}

I’m expecting it to look more like this:

lambda {
team.working_too_hard
}.should throw_symbol(:working_too_hard)

Am I off base here?

2009-03-25
87SUGGEST

Right above “How They Work” heading:

This will pass as long as user.in_role?(“admin”).

How about:

This will pass as long as user.in_role?(“admin”) returns true.

2009-03-30
87SUGGEST

Last paragraph before section 9.4:
“Well, we wouldn’t want to have to say anything quite so ridiculous, and so RSpec includes a means of assigning your own Explicit Predicate Matchers.”

How about changing “and so” to just “so”

2009-03-30
95TYPO

2nd to last paragraph:
“using in implicit subject” should be “using an implicit subject”

2009-03-25
96SUGGEST

The list on this page goes in roughly the order the topics were discussed, except the last two. Explicit came before implicit.

2009-03-30
96TYPO

Last paragraph:
“mean time” looks odd (I’m used to “meantime”) but I’m not sure what the rules say

2009-03-25
98SUGGEST

2nd paragraph:
“straight forward” -> “straightforward”

2009-03-30
99TYPO

In code sample for person_test.rb (bottom):

require ’ test/unit’

(extra space before ‘test’)

2009-03-25
100TYPO

Last paragraph:
“transforming” -> “transforming”

2009-03-25
103TYPO

2nd paragraph of section 11.2:
“as shown on line in the code that follows”

How about:
“as shown on line 6 in the code that follows”

2009-03-25
103TYPO

In the code sample on line 6:

describe(‘A Person’) # <label id=“code.lone_describe”

I don’t understand what the “<label” comment is doing. It looks kinda like a malformed xml tag…

2009-03-25
104TYPO

2nd paragraph:
“We can take this a step further and just use the describe() to generate RSpec’s counterpart to a TestCase”

How about:
“We can take this a step further and just use the describe() call to generate RSpec’s counterpart to a TestCase”

2009-03-25
104TYPO

Last sentence:
“If you run rake spec you should see the same output generated when we added describe() to the TestCase.”

How about:
“If you run rake spec you should see the same output generated AS when we added describe() to the TestCase.”

2009-03-25
105TYPO

2nd paragraph:
“replace the the tests” (duplicate ‘the’)

2009-03-25
106TYPO

Middle of page:
“So the next step is to simply replace the setup() and teardown() with before() and after():”

How about removing ‘the’:
“So the next step is to simply replace setup() and teardown() with before() and after():”

2009-03-25
108TYPO

3rd paragraph:
“converstion” -> “conversion”

2009-03-25
143ERROR

When running Cucumber to test after adding the model I get a complaint that the movies table does not exist:

cucumber features/showtime_descriptions.feature:7
Feature: Showtime Descriptions # features/showtime_descriptions.feature

So that I can find movies that fit my schedule
As a movie goer
I want to see accurate and concise showtimes
Scenario: Show minutes for times not ending with 00 # features/showtime_descriptions.feature:7
Given a movie # features/step_definitions/showtime_steps.rb:1
Could not find table ‘movies’ (ActiveRecord::StatementInvalid)

I am running Rails 2.2.2 and Cucumber 0.1.16.

2009-06-21
113TYPO

Sidebar, 1st paragraph:
“It scanned Java source code with JUnit tests in them”

How about:
“It scanned Java source files with JUnit tests in them”
or
“It scanned Java source code with JUnit tests”

2009-03-25
114TYPO

Wondering how/whether this “—format colour” option is related to the “-color” option on the next page.

Also, why does the spelling seem to alternate between ‘color’ and ‘colour’? Are they interchangeable?

2009-03-25
116TYPO

The example at the top of this page, and the section heading on the previous page (115) show “-color” with one dash. The next example shows “—colour” with two dashes (and a different spelling). Farther down, an example shows it as “—color”

Are the one-dash versions and two-dash versions interchangeable? Are the spellings interchangeable? If so, it would be helpful to say that.

2009-03-25
117TYPO

3rd paragraph:
“if you prefer to stick with rspec releases, the TextMate repository is a simple and clean option”

how about:
“if you prefer to stick with rspec releases, the official TextMate repository is a simple and clean option”

(to distinguish the official repository (as it is called in the preceding paragraph) from the development (github) one.

2009-03-25
118TYPO

4th paragraph:
> ending with “_test.rb” rather than starting with “test.”

How about:
> ending with “_test.rb” rather than starting with “test_”.

2009-03-25
119TYPO

3rd paragraph:
“Line 9 tells us that at least one code example failed”

Doesn’t look like it from the above example. It looks like it tells us that they all failed (“No mutants survived”).

2009-03-25
129TYPO

Last complete paragraph has three occurrences of “move onto”. Should that be “move on to”?

2009-03-25
131TYPO

Top of page (sentence starts on previous page):
“you don’t have to worry about installing every single gem required—it’s included with the app.”

How about:
“you don’t have to worry about installing every single gem required—THEY’RE included with the app.”

2009-03-25
131TYPO

In the “Using Rails config.gem” section, I’m confused by the part (3rd paragraph) that says, “you’ll need to setup your test environment to load the gems.”

I thought the first paragraph of this sections said that by using this method you’ll have the gem loaded in all environments. So is it loaded in all environments or just the test environment? And, why can’t it be done for just the test environment?

2009-03-25
133TYPO

4th paragraph:
“confidence to refactor your code and evolve the application code”

2nd ‘code’ sounds redundant

2009-03-25
136TYPO

End of 4th paragraph: “specify it’s behavior” should be “specify its behavior”

2009-03-25
136TYPO

Last paragraph: “it’s support for piggy-backing” should be “its support for piggy-backing”

2009-03-25
137TYPO

3rd paragraph: “added valued” should be “added value”

2009-03-25
141TYPO

2nd-to-last paragraph:
“created in the Given() and available to all subsequent steps”

How about:
“created in Given() and available to all subsequent steps”
or
“created in the Given() method and available to all subsequent steps”

2009-03-25
141SUGGEST

End of page:

Since the last paragraph introduces the —scenario option, how about showing the command using that option in the example that follows

2009-06-21
141TYPO

Footnote 3:
“The —scenario was introduced in cucumber-0.1.9”

How about:
“The —scenario option was introduced in cucumber-0.1.9”
or
“—scenario was introduced in cucumber-0.1.9”

2009-03-25
119SUGGEST

… and heckle 1.4.2 was released in 2009. My erratum is moot!

2009-03-30
129TYPO

s/software the matters/software that matters/

2009-03-25
38TYPO

I think the line “Assuming that your monitor has more colors than this book, you can also add the –colour option…” should instead use a double hyphen…“—colour”

2009-03-25
81TYPO

In the Arrays and Hashes paragraph on pg81, the first and second example looks to me to be incorrect. Should the two arrays in the second example be different or am I misunderstanding the intention?

[1,2,3].should [1,2,3] [1,2,3].should_not [1,2,3]
{’this’ => ‘hash’ }.should {'this' => 'hash' } {'this' => 'hash' }.should_not {’that’ => ‘hash’ }

Thanks, Iain Watt.

2009-03-25
88SUGGEST

It seems the code example is aliasing the object predicate ‘can_drive_at_night?’ with :drive_at_night so just say that. As it is now the point you’re trying to make is not very clear.

2009-05-29Explicit predicate matchers have been deprecated so the material in question has been removed.
64ERROR

The very last example on the page shows storing a value in the before and resetting it in the after. However the code shows two “before” functions - the second should be after.

Ie.

before(:each) do
original_global_value = $some_global_value $some_global_value = temporary_value end before(:each) do $some_global_value = original_global_value
end

should be

before(:each) do
original_global_value = $some_global_value $some_global_value = temporary_value end after(:each) do $some_global_value = original_global_value
end

2009-03-25
11SUGGEST

There’s an existing example written:

movie_list.empty?.should be_true

A more idiomatic way of representing this would be:

movie_list.should be_empty

2009-02-23
56OK

I don’t like the example because it makes more sense to the implementors of rspec than to its users. A better example might be:

it “should result in 3.325 < val < 3.335” do
val = 10.0 / 3.0
val.should be_close(3.33, 0.005)
end

2009-05-28This is actually the example taken directly from rspec's codebase.
32SUGGEST

Your first version of the spec file is:

require File.join(File.dirname(FILE), “/../spec_helper”)

module Mastermind
describe Game do
end
end

It’s good practice to include a stub for a test you know you’re going to need by making the example:

require File.join(File.dirname(FILE), “/../spec_helper”)

module Mastermind
describe Game do
it “should send a welcome message”
end
end

2009-03-30We cover that later - there is only so much information we can cover at one time, ay?
89TYPO

The line:

expected #has_key?(:id) to return true, got false

doesn’t format correctly (the syntax highlighter is confused)

2009-03-25
112TYPO

The formatting of the output is using the wrong syntax highlighter (it shouldn’t treat the ‘#’ as a comment.

2009-03-25
134SUGGEST

You should drop ‘RAILS_ROOT/’ from the directories - it’s what’s going to be naturally assumed by the reader and it’s inconsistent with other directory references.

2009-06-17
138OK

Minor formatting problem - the first line of showtime_descriptions.feature is orphaned from the rest.

2009-06-17Formatting issues like this will be dealt with when we typeset the book for print.
38SUGGEST

To be more consistent, replace (line #8)
“ruby spec/mastermind/game_spec.rb —format specdoc”
with
“spec —format specdoc spec/mastermind/game_spec.rb”

By doing so, you can also remove the “require ‘rubygems’” from your code.

2009-03-25
23SUGGEST

The text reads “Steps are defined by calling any of three methods provided by
Cucumber: Given( ), When( ), or Then( )”. You mentioned And and But as similar to Then but continuing. Are they the defined the same as Then()? I am sure I’ll figure this out later, but so far this leaves me asking.

2009-11-23
68TYPO

Text says " example grouip with theshared_examples_for“. Spelling error with ”group".

2009-03-25
70ERROR

On the numbered list, showing the order the blocks run, item five should be outer after, not outer before

2009-03-25
81ERROR

“[1,2,3].should_not [1,2,3]" this test will actually fail. I would assume you meant something like "[1,2,3].should_not [3,2,1]”.

2009-03-25
82OK

What’s with the underscores in the number for the commission example? 250_000 and 7_500??

2009-05-29That's standard Ruby - try it.
31SUGGEST

The text shown for the cucumber features/scenarios is using ruby syntax highlighting. So words like “for” and “break” in plain-text phrases like “So that I can break the code” are highlighted when they shouldn’t be.

I suggest using a different syntax highlighting.

2009-03-30
57TYPO

“only moments a way” should be “only moments away”

2009-03-25
54TYPO

In first paragraph at top of page, command for running the newly created codebreaker_submits_guess feature shows the file name as “codebreaker_submits_guess.rb” instead of “codebreaker_submits_guess.feature”.

2009-03-25
50TYPO

In the feature narrative, it says:
“For each additional peg in the guess that matches the color but not the position of a color in the guess, a white peg is added to the mark.”

This should say:
“For each additional peg in the guess that matches the color but not the position of a color in the SECRET CODE, a white peg is added to the mark.”

This same error is repeated on page 53, when this same narrative is shown again.

2009-03-25
52TYPO

3rd paragraph of ‘FIT’ sidebar:
I think ‘repetative’ should be ‘repetitive’

2009-03-25
53TYPO

In 2nd paragraph of feature narrative, same error as on pg 50 (‘guess’ in last sentence should be ‘secred code’)

2009-03-25
54TYPO

4th paragraph:
“modify if as follows” (if -> it)

2009-03-25
55TYPO

3rd paragraph has three errors (that I noticed):

actaully -> actually
becasue -> because

“complex enough where this brute force approach…”
how about:
“complex enough THAT this brute force approach…”

2009-03-25
59TYPO

3rd paragraph, 1st line:
How about ‘RSpec’ instead of ‘rspec’ (as you have it in other places in the book)

2009-03-25
106TYPO

In lambda examples, :working_to_hard should be :working_too_hard

2009-03-25
60TYPO

Start of section 4.3:
“we’ll build a code example around first one that is failing”

How about:
“well build a code example around THE first one that is failing”

2009-03-25
61TYPO

2nd paragraph:
“the example on line .”

Should this be “the example on line 10.”?

2009-03-25
62TYPO

2nd paragraph:
“But there there are two sides to every story.” (duplicate ‘there’)

2009-03-25
64TYPO

2nd paragraph:
“its a good idea”

How about:
“it’s a good idea”

2009-03-25
64TYPO

2nd paragraph:
“we’ve not only got all the examples to pass”

How about:
“we’ve not only gotten all the examples to pass”

2009-03-25
66TYPO

2nd to last paragraph:
“Windows users use same script”

How about:
“Windows users use THE same script”

2009-03-25
68TYPO

alogrithm -> algorithm

2009-03-25
68TYPO

naive -> naïve

2009-05-29both are in the dictionary and I think the publisher wants us to limit our overseas excursions to "behaviour"
126TYPO

“either revisit what you’ve already built or make due.” s.b. “either revisit what you’ve already built or make do.”

2009-03-25
63ERROR

In game.rb:

the expression
@code = code
is missing in the start-method.

2009-03-25
9TYPO

[sudo] gem install aslakhellesoy-cucumber —version “>= 1.1.99.21”
does not work
it should be
[sudo] gem install aslakhellesoy-cucumber —version “>= 0.1.99.21”

2009-03-25
188TYPO

The first example should read:

current_url.should =~ /vacation-photos/

2009-03-25
196TYPO

The first line should read:

Let’s break down the spec:

(breakdown is not a verb)

2009-03-25
184TYPO

“with a couple reusable” should read “with a couple of reusable”

2009-03-25
40TYPO

Should the below code work?

ruby spec/mastermind/game_spec.rb —format specdoc

It returns, no output for me.

spec spec/mastermind/game_spec.rb —format specdoc
does work for me.

great book, so, far.

thanks

2009-03-25
25SUGGEST

Need to describe the file naming conventions between the .feature file and the step definition files.

2009-06-17
54TYPO

cucumber —require features features/codebreaker_submits_guess.rb

Shouldnt’t that filename be codebreaker_submits_guess.feature ?

2009-03-25
168TYPO

End of 2nd paragraph:
“our applications provides” should be “our application provides”

2009-03-25
169TYPO

Last paragraph:
“it’s own” should be “its own”

2009-03-25
174TYPO

2nd paragraph: “it’s genres” should be “its genres”

2009-03-25
174ERROR

Looks like the example at the end of this page is failing when it shouldn’t be

2009-06-21
176TYPO

3rd paragraph:
“takes a little bit of a time” should be “takes a little bit of time”

2009-03-25
176TYPO

4th paragraph:
“test between the tags” should be “text between the tags”

2009-03-25
177TYPO

Looks like the last code sample should say “click_link” instead of “clicks_link”

2009-03-25
181TYPO

2nd to last paragraph:
Should “it stores a ActionController::TestUploadedFile” say ‘an’ instead of ‘a’?

2009-03-25
182TYPO

Top: “text/plainMIME” should be “text/plain MIME”

2009-03-25
183TYPO

2nd paragraph:
“Webrat provides the submit_form()”

How about:
“Webrat provides submit_form()”
or
“Webrat provides the submit_form() method”

2009-03-25
183TYPO

2nd to last paragraph:
“include” should be “including”

2009-03-25
184TYPO

Last paragraph:
Out of place line break after “pseudo-class,”

2009-05-29
185TYPO

3rd example regex:
“I the Messages tab should be active”

How about:
“The Messages tab should be active”

2009-03-25
186TYPO

4th paragraph:
should “a interesting rule” say “an interesting rule”?

2009-03-25
187TYPO

3rd paragraph:
“which include accessors”

How about:
“including accessors”

2009-03-25
187TYPO

3rd paragraph:
“accessors for their value state”

How about:
“accessors for its value state”

2009-03-25
188TYPO

3rd paragraph:
“RESTAPI” should be “REST API”

2009-03-25
23TYPO

“cd to the mastermind directory” where? So far the book does not suggest downloading the code or creating a directory.

2009-06-09
20TYPO

“Figure 2.2, on the next page shows” — you need a comma after “page”, or no comma before “on”.

2009-03-25
20TYPO

“By convention, we’ll build” doesn’t make sense. By convention, people build… so we will too. Or: Following convention, we’ll build…

2009-03-25
24OK

It’s not clear what file the steps should be typed in.

2009-05-29There's no instruction on page 24 to type it anywhere. Turn the page, however, and it's right there in the 1st paragraph.
29TYPO

Add “a” before “*nix user”

2009-03-25
30SUGGEST

Doing split(/n/) only works because the first message includes “\
”. If it were other way around (“Enter name: ” first, and then “Welcome!\
”, or whatever), then splitting on \
would not isolate the two messages. Assuming I’m right about this, it seems very fragile.

2009-09-15The implementation ends up using puts, so I think it works fine. Agreed that this might be fragile if we went in a different implementation direction, but all that would happen is that we'd get an unexpected failure and make the appropriate change. \n \nThanks for the tip though :)
9TYPO

cucumber installation version is wrong

Given:
[sudo] gem install aslakhellesoy-cucumber —version “>= 1.1.99.21”

Should be: 0.1.99.21 otherwise gem is not found

2009-03-25
45SUGGEST

“Fowler talks about changing the behavior of systems…” This sentence is kind of red herring. He really talks about not changing it, and in any case, there’s no need to recap this. You’ve already summarized what refactoring is, so you can just go and ahead and do it.

2009-03-30Changed to "changing the designs of systems ..."
45SUGGEST

Make up your mind about how to spell behavio(u)r. I know the Prag enterprise has a foot in both camps, but still :-)

2009-03-30
52TYPO

“criteria” in the “FIT” sidebar should be “criterion” (or “is” should be “are”).

2009-03-25
44TYPO

absolute line #12 reads

with a the as_null_object( ) method:

perhaps should read

with an as_null_object( ) method:

2009-03-25
64ERROR

“At this point all of the examples pass: ”

I could be mistaken, but I don’t think there was ever an iteration where game#start actually saved the parameter “code” into code. My tests didn't pass, i read backwards, and didn't see any code that set code.

2009-03-25
156TYPO

“it’s support for piggy-backing” should be “its support for piggy-backing”

2009-03-25
172SUGGEST

Clarify a bit why the Webrat version is less coupled with the code. It still embeds form element names. It really doesn’t seem that the use of movies_path is the sole remaining implementation detail left.

2010-01-16
158TYPO

The code example at the bottom of the page should not have a page break after the first line, especially since it masks the required indentation of the next line.

2009-05-29These sorts of formatting issues will be addressed when we go to typesetting after the beta process is over.
198ERROR

TRUNC at end of line instead of: do |form|

(in code block on bottom half of page)

2009-04-05
193TYPO

3rd paragraph of “A Big Misconception”:
“they’d completely make changing some of the views painful”

How about:
“they’d make completely changing some of the views painful”

2009-03-25
194TYPO

First line:
‘things which lead that “Ah-ha!” moment’

How about:
‘things which lead TO that “Ah-ha!” moment’

2009-03-25
196TYPO

4th paragraph:
“stub out text() method on the stub message”

How about:
“stub out THE text() method on the stub message”

2009-03-25
197TYPO

3rd paragraph: duplicate ‘to’

2009-03-25
198TYPO

Last line:
“should a render a form to create a message”

How about:
“should render a form to create a message”

2009-03-25
201TYPO

Paragraph after 2nd code sample:
“Mock models that act as_null_object”

We didn’t use a token “as_null_object” (or any variation on “acts as”) in the code. We just had “:null_object => true”

2009-04-05#as_null_object is now introduced earlier in the book in the second MasterMind chapter
204TYPO

First line:
“and we’re going to add a sidebar component”

How about:
“and NOW we’re going to add a sidebar component”

2009-03-25
205TYPO

6th paragraph:
“let’s move it out into it’s own partial”

How about:
“let’s move it out into its own partial”

2009-03-25
205TYPO

7th paragraph:
“rely on an local variable”

How about:
“rely on a local variable”

2009-03-25
208TYPO

I don’t understand why the responses here (and again on the next page) would contain the string “rendered form partial”

2009-04-05This will be fixed in beta 4 with other code truncation fixes. Thanks
208ERROR

2nd paragraph:
“If you run new.html.erb_spec.rb now, you’ll see four failing examples”

Why would they be failing now? We just refactored the form to a partial. Shouldn’t they still be passing, because the form is still rendered when the view is rendered?

2009-06-21
208TYPO

2nd to last paragraph:
“this one spec and the form, itself.”

How about:
“this one spec and the form itself.”

2009-03-25
209TYPO

2nd paragraph: duplicate “in”

2009-03-25
213TYPO

4th bullet point:
shouldn’t “lib/path/to/view.html.erb” be something like “app/path/to/view.html.erb” instead?

2009-03-25
147SUGGEST

“choose between the lesser of three evils” should be “choose among three evils” or “choose the least of three evils”.

2009-06-21
139ERROR

9 No mutants survived. Cool!

Line 9 tells us that at least one code example failed — no failures

2009-03-25
149TYPO

sidebar:
software the matters s/b software that matters

2009-03-25
222ERROR

In Duck Typing subsection,
Passes if… and Passes unless …:
“m.respond_to?(m)” -> “actual.respond_to?(m)”

2009-05-29
13OK

In 1.3 RSpec first code example mixed up “describe” and “context”.
My understanding is describe/context are for backword compatibility.
(see also. changelogs on 0.9.1)

They are still first class spec’ing vocabularies? Did I miss someting?

2009-05-190.9 was well over a year ago :) Over time, common use has moved towards using "describe" for the subject of the example group and "context" for the specific context for the examples.
114SUGGEST

“This example uses the specify( ) method instead of it( ) because specify
is more readable when there is no docstring. ” <- I have a question. My understanding is context/specify is for backword compatibility now(s.a. 0.9.1 changes).
Is it a first class spec’ing DSL still now?

2009-03-30Yes, first class members - disregard the 0.9.1 changes, which are well over a year old.
76SUGGEST

Using ActiveSupport’s test class, you can write:

test “a > b” do

etc.

2009-03-30As of rails-2.2, yes. I added a footnote to that effect.
76OK

By far the most disconcerting magical object is whatever “should” returns. It would be good to explain that. What is the return value of should, and how is that object engineered?

2009-12-06
222SUGGEST

I’d urge you not to perpetuate the idea that duck typing is about calling respond_to? It really, really isn’t, and that interpretation of it has haunted it for years.

2009-05-29
15TYPO

Cucumber Seeds: JBehave libary => library

2009-03-25
54TYPO

cucumber —require features feature/codebreaker_submits_guess.rb should be .feature

2009-03-25
17TYPO

Was page 15 in B1.0:
“its time” should be “it’s time”

2009-03-25
106TYPO

team.working_too_hard.should throw_symbol(:working_to_hard)

Should the symbol be :working_too_hard (two oh’s)? Occurs twice on this page.

2009-03-25
146146TYPO

Next-to-last sentence in 2nd paragraph of section 15.1 should read “… revisit what you’ve already built or make do” (not “make due”).

2009-03-25
153TYPO

Second paragraph under section 16.1 begins, “Like a good set of IntegrationTests…”. Need to de-wikify that.

2009-03-25
163ERROR

Creating the model, movie.rb, without creating the migration as well might confuse new-to-rails readers. A gentle suggestion to the reader to script/generate the model, edit the migration, run db:migrate and db:test:clone (or at least a gentle reminder the first time) might help.

2009-06-21
170OK

[Cut from the last para of 170 to the middle of 172]

Reasoning: Skip the example of “what Rails provides out of the box.” You’re trying to make the case for webrat, so lead with that. It’s a bit jarring to read 2 pages of “what I don’t want to use.”

2009-12-06We feel that it provides useful context.
35TYPO

On the last paragraph is a word missing:

.. second, the Game needs a [???] to handle the messenger argument ..

2009-03-25
68OK

One comma too much be before the closing and
… other than the prescribed r, g, y, c, b[,] and w?

2009-05-29The comma there is optional, and without it has a tendency to make the last two items fell like a unit "b and w" instead of the last 2 options "b, and 2".
149TYPO

BDD is about writing software the matters

2009-03-25
24TYPO

Ruby keywords are highlighted in this cucumber output (the next page, 25, has similar output without this problem)

2009-03-25
24TYPO

Cucumber output shows snippets without anything in the bodies of the methods. In my output each has ‘pending’ in the body. Also, they are described in the output as “undefined steps”, not “steps pending”. I am using cucumber version 0.1.99.21

2009-03-25
25TYPO

2nd line: “enter that snippet to it”
How about: “enter that snippet into it”

2009-03-25
30SUGGEST

The feature file in the sample code has #START and #END comments, which also show up in cucumber’s output

2009-03-30
31TYPO

“Now we see file and line numbers”
How about “Now we see file NAMES and line numbers”

2009-03-25
31ERROR

“Now we see file [names] and line numbers for the feature and scenario”

I only see this for the scenario when I run cucumber — not the feature.

2009-03-30
34ERROR

Wondering what the “require ‘rubygems’” line is doing here. It wasn’t in the example folder at 01/01, it’s not mentioned in the surrounding text, and my spec seems to run just fine without it.

2009-03-30
45TYPO

Middle of page:
“but we prefer to refactor in the green than in the red”

How about:
“but we prefer to refactor in the green rather than in the red”

2009-03-25
66SUGGEST

Omit: “You know, the ones who know about CTRL-C, but don’t know about cat.” Keep it collegial.

2009-05-29Collegial != dry. It's a joke.
61SUGGEST

Leads into “experiencing that gnawing feeling” with haste as a lot of readers are still puzzling over “should_receive()” before “guess()”. The paragraph about “the first three lines in the example” could be made softer and clearer. It’s the first significant break point. It should be softer and clearer.

2009-05-29
157TYPO

Last paragraph of 16.2:
“Then we’ll explore using Webrat for both the Simulated Browser and Automated Browser styles in Chapter 17, Simulating the Browser with Webrat”

The ‘automated’ part appears slated for the (as yet unwritten) chapter 18, not 17

2009-06-21
123TYPO

Missing line number:
“[…]as shown on line in the code that follows”
Maybe a typo here:
describe(‘A Person’) # <label id=“code.lone_describe”

2009-03-25
40ERROR

Running Ruby 1.9.1

The following error is returned when sending puts() to the mock messenger:

jon@bunt:~/Code/mastermind(master)$ spec -c spec/mastermind/game_spec.rb
F

1)
NoMethodError in ‘Mastermind::Game starting up should send a welcome message’
private method `puts’ called for messenger
/home/jon/Code/mastermind/lib/mastermind/game.rb:8:in `start’
/home/jon/Code/mastermind/spec/mastermind/game_spec.rb:10:in `block (3 levels) in

Finished in 0.021702199 seconds

1 example, 1 failure

2009-03-30Marking this fixed per #38275
40ERROR

Disregard my previous tech error. It was due to passing a string rather than the mock.

2009-03-30
170ERROR

Top: “The step passes because the Genre model and table already exist.”

(because we said they do, just now?)

2009-06-21
169TYPO

The step definition file we’re writing is called “genre_steps.rb” in the example at the bottom of this page. But on pages (at least including 170 and 172) it is called “movie_steps.rb”

2009-06-21
147SUGGEST

Building from the models out to the views means writing code based on
>> assumptions of what <<>> think you’ll need <<.
of what <> think …
Being a smart ass I would further say that
that what you think you’ll need IS an assumption. So maybe it would be better to say:
“… based on assumptions.” or " … based on what you think you’ll need."

2009-04-05
56SUGGEST

The first paragraph in “Finding the Way Home” is a vague mess.

Please be more specific when refering to the “destination”, the “example” or “this refactoring”.

2009-05-29
56SUGGEST

The first paragraph in “Finding the Way Home” is vague because the reader is never explicitly told to add the code argument to the “should prompt for first guess” example. This isn’t an issue for people downloading the code examples, but can be for those whom choose to type the examples.

2009-05-29
189SUGGEST

For the save_and_open_page description you should probably say that the .html is saved to RAILS_ROOT/tmp/ and is only opened automatically on OS X.

2009-06-21
175ERROR

Assuming there is an automatically running script that produces the sample outputs in the book, the one on 174-175 fails because rake db:migrate hasn’t been run on the ‘03’ project in the ‘simulated browser’ section of the code samples.

2009-06-21
146SUGGEST

It would be nice to know who talks here: “I once worked on an application …”
(Like here: beta2.0p193: “by Zach Dennis”)

2009-04-05
200ERROR

TRUNC at the end of the line instead of
:value => “the title”
(in code example “should render a text field for the message title”)

2009-04-05
204ERROR

First paragraph of “Semantics vs Syntax” -> “The spec also references elements with the IDs recent_messages and message,[…]” -> recent_messages and message are classes, not IDs.

2009-04-05
11TYPO

…To put this into perpsective, perhaps a brief exploration… In third paragraph.

2009-03-25
56SUGGEST

I agree with suggestion #38294. I am typing the examples as opposed to downloading the code samples, and I don’t know what the “destination” you refer to is. Which example don’t I need to copy?

2009-05-29
70SUGGEST

If you’re reading the book sequentially and you’re not familiar with BDD terminology, it’s difficult to understand the relationships between features, scenarios, examples, and step definitions when working your way through Part 1. Could there be a chapter beforehand that explains these things in detail?

I’m not only new to RSpec and Cucumber, but also to BDD in general. A framework-agnostic explanation of BDD and its terminology, would go much further in helping me understand what RSpec and Cucumber are doing.

2009-12-22
35ERROR

This page states “Running features/codebreaker_starts_game.feature gives us a different error now:”

The error that is actually received is “undefined method `start’ for # (NoMethodError)”

not
“wrong number of arguments (1 for 0) (ArgumentError)”

2009-07-04Justin - are you sure you had everything hooked up per the instructions? That output is generated by running the code.
54TYPO

the command “cucumber —require features features/codebreaker_submits_guess.rb” should instead be “cucumber —require features features/codebreaker_submits_guess.feature”

2009-03-30
54TYPO

When I try to run the codebreaker_submits_guess.feature

using this command:
cucumber —require features features/codebreaker_submits_guess.rb

I get the following output:
/Users/jp/.gem/ruby/1.8/gems/cucumber-0.1.16/bin/../lib/cucumber/treetop_parser/feature_parser.rb:27:in `parse_feature’: features/codebreaker_submits_guess.feature:20:5: Parse error, expected one of “\\r”, “\
”, “#”, “GivenScenario”, “Given”, “When”, “Then”, “And”, “But”, “Scenario Outline”, “Scenario”, “More Examples”. After “”. Found: “|” (Cucumber::TreetopParser::Feature::SyntaxError)

I copied the code for the codebreaker_sumbits_guess.feature directly from the code provided in the PDF.

2009-03-30
44ERROR

The Null Object Pattern was mentioned and given the GOF book reference. The GOF book does not mention this pattern directly (I can’t find it). But other books that I have like Refactoring by Fowler or Refactoring to Patterns by Kerievsky does.

2009-03-30Great catch! It's actually from Pattern Languages of Program Design 3, by Robert C. Martin and Dirk Riehle and Frank Buschmann. \n \nFixed. \n \nThanks!
52TYPO

s/repetative/repetitive/

2009-03-30
1515TYPO

At the end of the first paragraph inside the “Cucumber Seeds” outset, “library” is misspelled as “libary”.

2009-03-29
181182ERROR

Rails.root.join(“spec”, “fixtures”, “vacation.jpg”)

cause problem w/ Rails 2.3.
Since Rails2.3, Rails.root returns Pathname and TestUploadedFile can’t handle path as Pathname correctly.

So, use File.expand_path(“vacation.jpg”, “#{Rails.root}/spec/fixtures”) or other method returns String or fix Rails( #2264 on rails.lighthouseapp.com)

2009-05-29
22OK

“Although the narrative is free-form, we generally follow a variation of the Connextra format described in the (as yet) unwritten sec.narrative.”

Describing, or defining what the Connextra format is might be helpful to some readers. While familiar with user stories, using this term to describe the format was new to me. A little Googling solved that, but I’m still not clear on what sec.narrative refers to.

2009-05-29It's already written, just not in a chapter that we've published in beta yet. Coming soon ....
53ERROR

“Scenarios: all colors correct …” The current version of cucumber does not support this syntax, I had to replace Scenarios with Examples and remove the “all colors correct” part to get it to work.

2009-03-30
173SUGGEST

“… To get this step passing we’ll need a MoviesController” …

It would help you describe the step to take to create this controller.

2009-06-21
0SUGGEST

Before trying the samples, I did a clean rails install. This installed 2.3 . And some of the samples (don’t exactly remember) don’t work with 2.3 (possibly due to the in progress of the git versions of cucumber, and rspec). Maybe it is best to specify the rails version when creating the rails project.

2009-06-22
181SUGGEST

In the description of attach_file, there is all of a sudden the mention of “Photo”. I took me a while to figure out how it relates to the form field. An example form would be nice here.

2010-07-21
163TYPO

./script/cucumber features/showtime_descriptions.feature:7 Doesn’t work, most probably because I use Postgres and didn’t migrate to the db!? Is the migration of the movie model missing?

2009-06-21
96TYPO

In the phrase, “and self is the result object.”, “result” should be styled like code.

2009-03-30
28OK

The big gray block divides up the code example. This makes it difficult to read the code.

2009-05-29Typesetting issues like this will be addressed before we go to print.
198ERROR

“The example will still be failing, but you should see another familiar error message: MissingTemplate. Go ahead and implement the new.html.erb template.”

But we just added the template file at the end of the last page (198). Since I have that template already, but it’s blank, the error I’m seeing now is:

1)
ArgumentError in ‘messages/new.html.erb should render a form to create a message’
wrong number of arguments (2 for 1)
./spec/views/messages/new.html.erb_spec.rb:11:in `have_selector’
./spec/views/messages/new.html.erb_spec.rb:11:
script/spec:4:

Finished in 0.082394 seconds

1 example, 1 failure

2009-04-05This issue was with webrat/nokogiri IIRC, and it is fixed as of rspec 1.2.2, rspec-rails 1.2.2, nokogiri 1.2.3, and webrat 0.4.3.
198ERROR

This line from the code example is causing a failure for me:

response.should have_selector(“form[method=post]”, :action => messages_path) do |form|

1)
ArgumentError in ‘messages/new.html.erb should render a form to create a message’
wrong number of arguments (2 for 1)
./spec/views/messages/new.html.erb_spec.rb:11:in `have_selector’
./spec/views/messages/new.html.erb_spec.rb:11:
script/spec:4:

Finished in 0.088844 seconds

1 example, 1 failure

When I remove the second argument, it passes (after making the other fixes mentioned this in the section) but still warnes about using a deprecated feature:

response.should have_selector(“form[method=post]” +
“[action=‘#{messages_path}’]”) do |form|
form.should have_selector(“input[type=submit]”)
end

Nokogiri::CSS::Parser.parse is deprecated, call Nokogiri::CSS.parse()
.

Finished in 0.087327 seconds

1 example, 0 failures

2009-04-05This was an issue with webrat which was resolved in 0.4.2.
200TYPO

The new “should render a text field for the message title” example passes when it should fail. I’m guessing this change to Nokogiri probably has something to do with that:

(http)github.com/tenderlove/nokogiri/commit/13db61b3a028bf64ea94f957b4fc05bd0ecb9337

2009-04-05This is not an issue with webrat 0.4.3 and nokogiri 1.2.3.
207ERROR

In the “” example I had to turn a line into this to get it to pass:

response.should have_selector(“form[method=post]” +
“[action=‘#{messages_path(@message.id)}’]”)

(among other things, message_path became messages_path)

2009-04-05The truncated code examples have been fixed in the views chapter. It should now display the full line of what is to be typed in.
208ERROR

“Now that we’re done refactoring, we can go back into spec-driving mode and add an example to edit.html.erb_spec.rb that expects the edit template to render the form partial”

This seems to imply that this file already exists at this point, but I’m pretty sure it doesn’t.

2009-04-05
208ERROR

“Run that spec, watch it fail, and update edit.html.erb to render the partial”

I don’t think edit.html.erb exists yet either…

2009-04-05
210TYPO

“With the shared example working let’s remove the original examples which ensured the for m partial was being endered. The new.html.erb_spec.rb should look like:”

but we already removed these back on page 208:

“If you run new.html.erb_spec.rb now, you’ll see four failing examples. These are the four that got copied over to _form.html.erb_spec.rb. Because those same examples are passing in the _form spec, we can safely remove them from the new spec.”

(and I think there were only three, not four)

2009-06-21The typo here is "examples" instead of "example." There is still one example remaining that specifies that the new template is rendering the partial. That's the one that should be removed. Typo fixed.
212SUGGEST

In the ViewMatches example, it isn’t apparent until the very end that we’re supposed to be doing any following along in the views_example application:

“First, let’s add a line to require every ruby file in the spec/spec_helpers/ directory. This goes before the Spec::Runner.configure block:”

By this point we’re a couple sentences from the end of the chapter.

2009-04-05
195TYPO

‘script/spec’ requires spec/autorun with latest rspec 1.2, use ‘rake spec’ instead

2009-04-05This is fixed in the latest stable release of rspec and rspec-rails (1.2.2) script/spec should work fine.
162TYPO

In Joe Asks: “…provided by the spec-rails library”: change “spec-rails” to “rspec-rails”

2009-05-29
163TYPO

Change “Cucumbers’s” to “Cucumber’s” in the first paragraph of Completing the Feature.

2009-05-29
99TYPO

In “The cost of going Agile”, “..project delivery We’ve managed..” should not have a capital W.

2009-03-30
102TYPO

“..to understand what that means first. so we work with the core..”

Needs capital S in “so”, or a comma.

2009-03-30
106TYPO

“..in response to being interacted with . This is useful for..”

Extra space.

2009-03-30
113TYPO

“Part of the rational for using mocks..” should be rationale, minus the extra space.

2009-03-30
160TYPO

Duplicated code snippets; it looks like the second one is complete, but the first is partial.

2009-04-12Doug - the first is the code in the feature file, the second is the shell output. They look mostly the same, but the shell output adds step definition snippets.
54ERROR

after adding the codebreaker_submits_guess.feature feature were told to run the command:

cucumber —require features features/codebreaker_submits_guess.rb

but the file is .feature not .rb so the command should be:

cucumber —require features features/codebreaker_submits_guess.feature

2009-03-30
24ERROR

Download link doesn’t exist.

2009-03-30
24ERROR

There is a discussion of running the RSpec examples and having all (4 at that point) pass, but with the code that is viewable in the book, they will not pass. The linked code shows @code = code inside lib/mastermind/game.rb#start

2009-04-12
178ERROR

The book states that webrat’s fill_in supports referencing form fields by id=, name= and

2009-06-21That was a typo in the book - it's not id= and name=, but just id and name. Works with webrat-0.4.4 and rails-2.3.2.
316ERROR

Under Floating Point Comparisons
“actual < (expected + delta) or > (expected - delta)”
the “or” should be “and actual”

2009-05-29
169OK

“within the contest of a single object” s/contest/context/
and
“specify ordering off expectations” s/off/of/
and
“for multiple object in” s/object/objects/

2009-05-29That chapter was released by mistake, and removed from subsequent releases.
24ERROR

Broken link to code download

2009-03-30
19SUGGEST

You kind of jump right into things, without first suggesting that the reader does ‘rails mastermind’ ‘script/generate cucumber’ etc., maybe consider slowing it down in the beginning.

2009-05-29The mastermind example is not a rails example, nor does it use any generated files. But I added Hello RSpec and Hello Cucumber examples (coming in the next beta), so that should help.
27OK

This story feels kind of out of place, I mean, it’s right in the middle of a code example. Perhaps move it so it’s not interfering with anything.

2009-05-29Typesetting issues like this will be addressed before we go to print.
59TYPO

shouldn’t the lower game.rb example be expecting arguments?

e.g. start(code)

2009-03-30
31TYPO

The link of the code to bin/mastermind is broken. And is it suppose to be mastermind.rb?

2009-03-30It's bin/mastermind. Should be fixed now
32OK

I don’t understand why we don’t want to use STDOUT or what it is. I started feeling a little lost on page 32. I’m not making the connection of what STDOUT has to do with cucumber.

2009-12-06The book assumes a basic working knowledge of Ruby.
39SUGGEST

A bit of clarification needed on mock(“messenger”). I’m not sure if the object mocks a object of the class messenger or creates a mock object and gives it a class name of messenger or something else. I’m new so maybe my question is dumb but it’s unclear to me.

2009-03-30
0SUGGEST

I think it’s a better idea to use a curly energy-saver bulb instead of an incandescent bulb on the cover, if possible :)

2010-01-15
81SUGGEST

This sentence in the last paragraph could use some love:
“The reason we can move this quickly that the green bar tells us that we’re safe after every change we make.”

2009-03-30
82TYPO

In the mm/43 code example:

@messenger.puts temp.sort.join

should that line actually be(?):

@messenger.puts temp.compact.sort.join

2009-11-23
95TYPO

First line of “A brief history of Agile”:

projcets

2009-03-30
97OK

Link in the footnote isn’t active.

2009-06-09Neil - I don't see a link on page 97 of Beta 3.0 - what link are you talking about?
217TYPO

In the epub book on iPhone, it displays as “Peanut butter & jelly” instead of "Peanut butter & jelly. So, it reads as

to ensure “Peanut butter & jelly” is on the page, you’d type just that in the string, not “Peanut butter & jelly”.

2009-05-29
228ERROR

I’m getting this error when run:
$ rake gems:unpack:dependencies RAILS_ENV=test

> no such file to load — nokogiri/native

2009-09-15
229TYPO

“spec/spec_helper.rb: This file is used load…”

should be

“spec/spec_helper.rb: This file is used to load…”

2009-06-21
196TYPO

When I run the feature on page 196, I get the error below. The problem is that there is no table for movies. Did you want me to scaffold a model and rake the migration? I’m trying to following along step by step and it misses this.

  1. ERROR:

$ cucumber features/showtime_descriptions.feature:7
Feature: Showtime Descriptions

So that I can find movies that fit my schedule
As a movie goer
I want to see accurate and concise showtimes

Scenario: Show minutes for times not ending with 00 # features/showtime_descriptions.feature:7
Given a movie # features/step_definitions/showtime_steps.rb:1
Could not find table ‘movies’ (ActiveRecord::StatementInvalid)
features/showtime_descriptions.feature:9:in `Given a movie’
When I set the showtime to 2007-10-10 at 2:15pm # features/step_definitions/showtime_steps.rb:5
Then the showtime description should be “October 10, 2007 (2:15pm)” # features/step_definitions/showtime_steps.rb:10

1 scenario
1 failed step
2 skipped steps

2009-06-21
23SUGGEST

The link provided to the code-breaker script is “Forbidden”.

2009-03-30
32OK

“There is no application code yet, so we’re getting a NameError on Mastermind. Take a look at the backtrace.” What is a backtrace?

2009-05-28A backtrace is an array of strings representing the lines of code that were executed leading up to an error. This is basic Ruby, which readers of this book are expected to have, so we won't be explaining it in the book. I'd recommend you read the Pickaxe book (http://pragprog.com/titles/ruby/programming-ruby) first
0SUGGEST

Wondering how the page numbers in this errata submission form should be handled when using formats like epub and mobi

2009-05-29Please email this question to support@pragprog.com.
0TYPO

It’s hard to follow the provided code examples, in the sequence of numbered folders.

How about a git repo for each of the main projects that book takes the reader through. Each step could have its own commit, and the reader could view it on github or clone it to their local machine and use tools like gitx to view it or play with it.

2010-07-18I'm going to try to make this happen with the final release, but I can't make any promises at this point.
75TYPO

“This isn’t a very complex a problem compared to many …”
should be
“This isn’t a very complex problem compared to many …”

2009-03-30
58TYPO

I think the last code snippet:
Download mm/27/lib/mastermind/game.rb
def start
messenger.puts "Welcome to Mastermind!" messenger.puts “Enter guess:”
end

should have been:
def start(code)

2009-03-30
132TYPO

I found a couple of things in Chapter 10 tha kinda jumped off the screen at me.

132: The examples shown don’t match the text—Hash with 17 key/value pairs… hash.keys.length.should == 42.

Next paragraph, they do match:
hash.should.have(17).key_value_pairs.

Maybe I’m just being grumpy, but it bothered me as I read it.

2009-06-17
136TYPO

136: In the paragraph

Since there are plenty of other examples that specify specifics about the error messages raised by message expectation failures, this example only cares that a MockExpectationError is raised.

“specify specifics” seems awkward.

2009-03-30
29TYPO

The code links are broken. Example:

mm/04/features/step_definitions/mastermind.rb

Kind regards,

Ralf Waldvogel

2009-03-30
77SUGGEST

Bottom of page:

The nested contexts produce a confusing description: “with duplicates in the guess that match a peg in the code by color and position”

Duplicate pegs in the guess can match a peg in the code by color, but by position?

2010-01-15
78TYPO

Sidebar, 3rd paragraph:
“launched into an theoretical algorithm problem-solving session.”

How about:
“launched into a theoretical algorithm problem-solving session.”

2009-03-30
80TYPO

Last paragraph:
“The reason we can move this quickly that”

How about:
“The reason we can move this quickly is that”

2009-03-30
83TYPO

Near bottom:
“we’ve used to the Cucumber scenarios”

How about:
“we’ve used the Cucumber scenarios”

2009-03-30
95TYPO

Near top:
I think “irreverance” should be “irreverence”

2009-03-30
99TYPO

Last paragraph:
“behavour” should be “behaviour” (or “behavior”, not sure if the american/british thing matters much)

2009-03-30
100TYPO

In the “Continual regression testing” subsection:
“depending on the kinds of feature we are implementing”

How about “kind of feature” or “kinds of features” here

2009-03-30
26ERROR

First:
Running ruby 1.9.1 (2008-12-01 revision 20438) [i686-linux] and current rspec and cucumber I get only
Given /^I am not yet playing$/ do
pending
end

When /^I start a new game$/ do
pending
end

Then /^the game should say “([^\\”]*)"$/ do |arg1|
pending
end

The lines
Then /^the game should say “Welcome to Mastermind!”$/ do
pending
end
left.

2009-06-17You're using a more recent version of cucumber than the one we wrote that material against. Discrepancies in the output will all be resolved before we go to print, but if we try to keep up with all those changes with every beta we'll never get the book done.
45OK

Does the name of the as_null_object( ) method come from the internal implementation? Or does it describe the external behavior? I would expect something like: ignore_additional_parts().

2009-05-29as_null_object() references the null object pattern, so that's the right name.
221ERROR

To set up HTTP headers in Webrat, the text suggests the following:

Given /^I’m browsing the site using Safari$/ do
header “User-Agent” , “Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us)”
end

On its own, this is not enough; you must also explicitly call headers in your request, e.g.:

get ‘/’, nil, headers

Then, all is well.

Cheers,
- Brad Heintz
brad.heintz@gmail.com

2010-07-21
29TYPO

In @game.start game is a local variable, so game.start will be correct.

2009-05-28
25SUGGEST

Footnote about installation of packages should be moved to a ‘Preparing your ruby environment". I agree with other comments all this should be concentrated in one place. Ideally a ’rspec-book’ gem that always delivers the versions that related to the book no matter how the base gems evolve. Ideally this gem can be installed/uninstalled at will - without hosing your system as some dependency update/upgrade breaks your ‘dearest-project’.

2009-06-09We added a Hello chapter (for beta 6) that has a section on installation and Hello RSpec and Hello Cucumber examples (i.e. Hello world).
23ERROR

Box: /subject-file with CTL+SHIFT+DOWN/feature-file with CTL+SHIFT+DOWN/

subject-file is a new notion.

2009-05-29
23ERROR

End of sentence beneath box:
“Stories In, Features Out.”

This seems ambiguous to me. Did you mean “Stories went ‘out’, Features came ‘in’.”
Or did you mean something else by in/out?

2009-05-29he description of Stories In, Features Out has changed and been moved to the Writing Software that Matters chapter.
25SUGGEST

Top of the page, code:

Then the game should say “Welcome to Mastermind!”
And the game should say “Enter guess:”

I think this could be more useful:

Then the game should emit “Welcome to Mastermind!”
And the game should prompt “Enter guess:”

The benefit is you save about 2 pages+ of convolutions trying to handle a shared step. This revealed nothing to me about Cucumber. In fact this shows the benefit of using Cucumber: It makes flaws patently obvious; 1) This game doesn’t ‘say’ anything (some do of course). 2) The two lines are fundamentally different.

On the last point, would people be comfortable bundling a programs splash screen with a GUI dialog requesting user interaction? Or in the audible case, bundling as shared behavior/features the startup music with audible prompts requesting input?

I was hoping this ‘straw man’ would reveal some Cucumber gold but at the end of a couple of pages….

2009-09-15Convention these days is "then I should see", which is what I changed both of these to.
22OK

You have given a directory tree for the RSpec tutorial.

It is <> clear where this goes. The “project root directory” is mentioned. But NOT the “Rails project root”.

Example: I am using NetBeans 6.5. It will create a standard Rails project with all the associated Rails directories.

I created a Rails MasterMind project.

Do these new directories go in the Rails Project root? E.g.,
MasterMind/bin/mastermind
MasterMind/features/step_definitions
Mastermind/features/support
MasterMind/features/support/env.rb
MasterMind/lib/mastermind
MasterMind/lib/mastermind.rb
MasterMind/spec/mastermind
MasterMind/spec/mastermind.rb
MasterMind/spec/spec_helper.rb

Or do these directories go in their own << NON-RAILS >> project root directory where << NONE >> of the normally Rails’ associated directories are:

Controllers,
Helpers,
Models,
View,
Configuration,
Database Migrations,
Libs,
Logs,
Public,
Rspec (I have installed the Rails gem ‘rspec’),
Unit Tests,
Functional Tests,
Test Fixtures,
Integration Tests,
Scripts
Documentation,
test/performance,
Vendor

go?

Can this Rspec/Cucumber system be installed in NetBeans? Or is this a recipe for complexity? Disaster? Not relevant to this book?

Struggling with all the concepts and yearning for the best way to may Rails Really Sing!!

Using NetBean 6.5 with Rails 2.3, Rspec and Cucumber gems installed. OS = Windoze Vizta.

Thanks,

Ken

2009-05-29Why does everybody think this is a rails project? This is not a rails project. We'll add a better explanation of this. \n \nAs for NetBeans, IDE details beyond those supported directly by RSpec (i.e. TextMate) is outside the scope of this book.
22OK

Make it clear if this directory tree is << everything >> in the tree or is it a sub-tree in the RAILS project root directory with all those other RAILS dir’s.

Maybe set it up completely separately from RAILS? (I suspect this will defeat the coding/compliance cycle)

(See prior message for context.)

Ken

2009-05-29See comment for #38684.
25SUGGEST

You may wish to describe how this works in the common IDEs.

NetBeans has great Project directory tree with the RAILS dir’s. Also a complete Files Tree showing ALL dir’s and files.

I used e-textmate before. It also has good layouts. But is not as good a integrating gems, plugins and tools.

Eclipse (Aptana) is similar.

How about some details on how the IDEs handle Rspec/Cucumber.

In NetBeans 6.l5 there already are a Unit Testing, RSpec set of directories and files.

Do we keep using the RSpec NB tools? How to incorporate Cucumber into the NB gui?

Thanks,

Ken Wagner

2009-05-29We're not including any material on IDEs in this edition of the book.
58TYPO

Running the examples should result in two failures not one. The example “should prompt for the first guess” should also be in error since the code is not passed to the start method in this example yet. The first time we see the code passed to the start method of this example is mm/27/spec/mastermind/game_spec.rb.

2009-05-29
19SUGGEST

Have you thought about the issue of whether you’ll get flak from Pressman Toy for using the trademark Mastermind? Looks like the issue got raised in discussions about gnome-mastermind, too, but never went anywhere.

2009-06-17We had not, but now that you bring it up, we have :) We'll be changing the name in the next beta (beta 7).
26ERROR

" In Cucumber, you get notification of a pending step, which you can think of as an undefined step. "

actually, it seems (from both Cucumber 0.2.2 output and the book’s output) that you get notification of an undefined step, which you can certainly think of as an undefined step…

2009-05-28
26ERROR

“and Cucumber gave us this snippet to get that started:”

Actually, the snippet Cucumber gave us had “pending” in it; reading this, you might think you could just cut and paste the snippet from Cucumber, but you can’t.

2009-06-09
29TYPO

"Here we store the return value of game.start": actually, it's game.start, not game.start.

2009-05-28
29TYPO

@message is hyphenated. Not sure if there’s a rule about hyphenating code, but it feels wrong…

2009-05-29Typesetting issues like this will be addressed before we go to print.
72SUGGEST

Immediately before Sec 4.5 you say it is not a good time to do exploratory testing. Then you go ahead and do it, concluding on p73 with a suggesting that exploratory testing was beneficial… “An interactive session with working software is worth a thousand meetings.”
Yours Confused

2009-06-09"Here's a hint: it's not" is in reference to whether the algorithm is complete. I've removed that statement, however, to avoid confusion.
25ERROR

Looks like Cucumber 0.2.2 is smart enough to know that “Then the game should say ‘.*’” will cover both of the last two steps! (neat.)

2009-06-17
131SUGGEST

RAILS_ENV=test rake gems
should be something like this
For Windows:
set RAILS_EV=test
For Linux and MacOS
export RAILS_ENV=test

rake gems
rake gems:install
rake gems:unpack:dependencies

2009-06-21
56SUGGEST

The first paragraph of “Responding to Change” could be more explicit - perhaps add something like:

Our new Cucumber step-matcher needs Game.start() to accept an argument: the secret code. But our RSpec example assumes that start() doesn’t take any arguments. We don’t want to change two things at once, but we can’t fix one without breaking the other… can we?

2009-05-29Thanks Jay - slightly re-worded, but your addition is now part of the book. Cheers!
92TYPO

“…and multiple failed attempts at decyphering the instructions in the release notes.”

The preferred spelling is “decipher”.

2009-05-29
59SUGGEST

At this point, the RSpec stories pass fine but the Cucumber feature “code-breaker starts game” fails because it does not pass a code to Mastermind::Game::start. Is this intentional?

2009-12-22
61SUGGEST

As Jesse posits above, I’m confused as to why “should_receive()” comes before the second “guess()”. Although, I just reread the paragraph about that code and it makes sense now, I missed it the first time. Maybe it could be made clearer? I can imagine why a mock object needs to know about the expectation before the call, but I also think it would help if this paragraph was expanded just a litte.

2009-05-29
188SUGGEST

Isn’t a full page for a screenshot of the rails project tree a bit generous? Couldn’t be represented as a diagram, and to keep it consistent with the tree shown for the Mastermind game at the beginning of the book?

2010-07-21
196SUGGEST

Perhaps remind the reader that they still need to create and run in the migration for the movies table to support the Movie class.

2009-06-21
88OK

Is chapter 6 really necessary? Up until now it’s been a great tutorial/technical work on BDD using RSpec and friends and now it turns into a fluffy management book. If anything, this might make a good introductory chapter but I’d rather see more time given to BDD! The audience (developers) reading this book would already be sold on agile, otherwise they wouldn’t even be investigating BDD or TDD!

2009-05-29Absolutely necessary, as it sets up the next chapter which wasn't published until beta 4.
21ERROR

For example, in this chapter we’ll describe the behaviour of Game in spec/mastermind/game_spec.rb and we’ll put its
class definition in lib/mastermind/game.rb.

This sentence is in Chapter 2. States this will happen in Chapter 2.

Error: Doesn’t happen until Chapter 3.

2009-05-28
32OK

Running “cucumber features” yields summary lines of:
1 scenario
1 failed step
1 skipped step
2 undefined steps

The book says it should be:

1 scenario
1 failed step
2 skipped steps
1 passed step

“1 passed step” vs "2 undefined steps.

Here is total STDOUT from “cucumber features”

Feature: code-breaker starts game
As a code-breaker
I want to start a game
So that I can break the code

Scenario: start game # features/codebreaker_starts_game.feature:6
Given I am not yet playing # features/step_definitions/mastermind.rb:5
uninitialized constant Mastermind (NameError)
./features/step_definitions/mastermind.rb:6:in `/^I am not yet playing$/’
features/codebreaker_starts_game.feature:7:in `Given I am not yet playing’
When I start a new game # features/step_definitions/mastermind.rb:9
Then the game should say “Welcome to Mastermind!” # features/codebreaker_starts_game.feature:9
And the game should say “Enter guess:” # features/codebreaker_starts_game.feature:10

1 scenario
1 failed step
1 skipped step
2 undefined steps

You can implement step definitions for missing steps with these snippets:

Then /^the game should say “([^\\”]*)"$/ do |arg1|
pending
end

2009-05-29We're going to do our best to have all of this up to date before we go to print, but Cucumber is changing VERY fast right now and some of the output may not be correctly reflected in the book. Our priority is going to be on the code you write, rather than the output.
17SUGGEST

Wording on the flow chart is awkward. “Repeat #2 - #7 until Scenario is passing” perhaps should mention “and the code is as simple and expressive as it can be” or something similar. “Repeat #1 - #7 when Scenario is all passing” perhaps should say “for each scenario in the current story” or something like that.

2009-05-29Agreed it was awkward, but I went in a different direction as for changes. The refactor steps already imply "and the code is as simple and expressive as it can be" and the "current story" context really suggests a 3rd cycle at a higher level.
25OK

Cucumber does not check the correspondence of the
“Given /^I am not yet playing$/ do
end”

sequences in “features/codebreaker_starts_game.feature”

and

“features/step_definitions/mastermind.rb”

so that if one file has “../^I am not yet playing$/..”
and the other has “../^I am not playing$/..”

the result of cucumber remains

“1 scenario
4 undefined steps”

after adding the mistyped entry in “features/mastermind.rb”

Would it not be better if cucumber flagged the mis-correspondence? Or flag the “Given …” in the mastermind.rb file as either an orphan (not found in the “.feature” file) or not matching the “step_definition” file.

I found this oddity while experimenting with the “Given” entries.

in the

2009-05-28Please make cucumber feature requests in the cucumber tracker: https://rspec.lighthouseapp.com/projects/16211
27ERROR

my output to the first step added (page 26) indicates 1 pending step and not 1 passed step as the PDF book says on page 27

2009-06-09
1OK

have a way for us to indicate what our environment is at this stage as we are submitting a suggestion/error… and save it so that we do not have to update but can update it if it changes.

2009-05-29Please email this suggestion to support@pragprog.com.
270TYPO

first full paragraph, change “hard understand” to “hard to understand”

2009-05-29
251SUGGEST

the last sentence on pdf p.251 mentions a familiar error and instructs reader to create new.html.erb. On the next page, it instructs the reader to add a route, then goes into a more detailed version of creating the new.html.erb MissingTemplate error. Methinks the first reference should be removed.

2009-06-21
182TYPO

Last sentence of the page: " We’ll go over the the
protocol in a bit,[…]" -> double “the”

2009-05-29
184ERROR

In the second paragraph, you mentioned an error message, but what follows is the code for defining a custom matcher with custom failure messages (which is introduced in the next paragraph).

"In the event of a failure using should_not( ), the generated message would read like this:

Spec::Matchers.define :report_to do |boss|
match do |employee|
employee.reports_to?(boss)
end
[…]
end"

2009-05-29
186TYPO

First sentence of chapter 15.4: “Custom matchers can help us to build up domain-specific DSLs for
specifying our code,[…]” -> you should remove “domain-specific”, domain-specific domain-specific language sounds not very well.

2009-05-29
271ERROR

“The spec should now be at 2 examples, 0 failures, 1 pending.” -> not if you are using Rails 2.3.2, it will fail with the following error message: “Missing template messages/create.erb in view path app/views”

2009-06-22
287TYPO

You pasted the wrong code example on the bottom of the page (the same as on page 288 -> “rails_controllers/messages/14/spec/controllers/application_controller5_spec.rb”).

2009-06-22
131ERROR

I note that the rspec-1.2.2 docs recommend using “failure_message_for_should” rather than “failure_message”, and “failure_message_for_should_not” rather than “negative_failure_message” … see preamble for module Spec::Matchers

2009-06-09
140TYPO

Procs referring to method working_too_hard? need a question mark at the end to match the actual name of the method. Currently written as lambda{team.working_too_hard} but should be lambda{team.working_too_hard?}

2009-06-17
85TYPO

“Instead of getting bbbw, we get bbw.”

Shouldn’t this be “Instead of getting bbb, we get bbw”? The pending example which was just unpendinged expects ‘bbb’. Unless I’ve made a mistake?

2009-12-22
279TYPO

In the second sentence of 23.2, there ist a duplicated “to”.
“… and help us to to remove duplication …”

2009-05-30Ironic, that.
287ERROR

There seem to be some missing steps in getting to green with the ApplicationController spec. The code from the tgz download shows that the ApplicationController needs to ‘rescue_from AccessDenied, :with=>:access_denied’ and define an access_denied method on ApplicationController in order for the “redirect to 401.html” example to pass. This step does not appear in the body of the book. As given in the book, the example continues to fail with an uncaught AccessDenied exception.

2009-06-22
58OK

Not sure if a note about this is worth including in the book, but while doing the Mastermind demo I twice made the same mistake: I accidentally left off the ‘w’ in the w[] constructions in the specs. This resulted in confusing errors, since[r g y c] == ‘r g y c’.

2009-05-29I don't think we can really try account for everybody's typos. We've got enough of a challenge dealing with our own ;)
139ERROR

This doesn’t really matter since the point is just to demonstrate the throw_symbol matcher, but doesn’t the first implementation of working_too_hard? already short circuit? The method returns as soon as it finds anyone who worked for more than 50 hours. How is this a “perfect case for using throw/catch”?

2009-12-23
237TYPO

Looks like there’s an extra paragraph break at the bottom of the page between “:nth-child pseudo-class,” and “giving it lots of flexibility.”

2009-06-22Formatting problems like this will be addressed when we're ready to go to print.
215ERROR

When following along with the steps in this chapter, creating the movie.rb file as listed on this page doesn’t immediately make the Cucumber scenario pass, as shown on the next page. The reason for this is that there isn’t a movies table in the database yet. Cucumber reports the following:


Feature: Showtime Descriptions
So that I can find movies that fit my schedule
As a moviegoer
I want to see accurate and concise showtimes

Scenario: Show minutes for times not ending in 00
Given a movie
Could not find table ‘movies’ (ActiveRecord::StatementInvalid)
features/showtime_descriptions.feature:7:in `Given a movie’
When I set the showtime to 2007-10-10 at 2:15pm
Then the showtime description should be “October 10, 2007 (2:15pm)”

1 scenario
1 failed step
2 skipped steps
—-

In order to get this working, there needs to be another step to create and run a database migration that will make the movies table and give it showtime_date and showtime_time columns. Running the model generator (script/generate model Movie showtime_date:date showtime_time:time) would suffice for creating the migration, and as an added bonus, also creates an empty movie.rb file for the model definition. Run the migration (rake db:migrate), clone the production database to the test database (rake db:test:clone), fill in the details in movie.rb, and then Cucumber reports a passing scenario.

Of course, adding all this migration and database stuff detracts from the simplicity of the example. The credo as I’ve understood it so far in the book is to implement as little as possible to get a scenario to pass, and generating and running a migration seems like a larger chunk of work than I’m used to seeing in the code found earlier in the book. Then again, Rails has more complicated dependencies than a bare-bones Ruby app, so it might be necessary here to bite off a larger chunk.

2009-06-21
288ERROR

Code example 5 for application controller failing with:
AccessDenied in ‘ApplicationController handling AccessDenied exceptions should redirect to the /401.html (access denied) page’
AccessDenied

Sorry if this is something I’ve done — I’ve tried to see if it’s my fault & not spotted it.

2009-06-22
227ERROR

The code listing for ‘simulated_browser/03/out/01.all_passing’ isn’t a passing scenario at all. It has a failing step with the following error:

Could not find table ‘genres’ (ActiveRecord::StatementInvalid)

2009-06-21
254ERROR

For the 3rd example you neglected to mention that you have to update the form to include <%= f.test_area :text %>. Of course running the spec told be it was missing, but you should be consistent.

2009-06-21
66SUGGEST

It would be nice if the book would be Ruby 1.9 safe. the code in the guess method is the first instance I’ve seen which isn’t. It iterates over the guess string with each_with_index, but in 1.9 Strings are no longer enumerable.

So something like guess.split(“”).each_with_index … might be in order.

2009-06-09Ignoring, per Rick's request in #39009
73ERROR

First ignore my earlier erratum #39008 I’d lost track of what was being passed to guess.

Than said, in order to getht app to work, I had to change it to:

#!/usr/bin/env ruby
$LOAD_PATH.push File.join(File.dirname(FILE), “/../lib” )
require ‘mastermind’
game = Mastermind::Game.new(STDOUT)
game.start(%w[r g y c])
while guess = gets.chomp
game.guess guess.split(“”)
end

without the chomp the newline is part of the guess

without the “” argument to split, with a guess of “cyyg” it passes
[“cyyg”] NOT the expected [“c”, “y”, “y”, “g”]

2010-01-15
301ERROR

In the list of of built-in expectations, the definition of be_close is incorrect.

actual < (expected + delta) or > (expected - delta)

The OR should be an AND.

actual.be_close(3, 0.5)

actual < 3.5 OR actual > 2.5 passes for any numeric value.

what you really want is: 2.5 < a < 3.5

2009-06-09
203OK

I’m not sure why the ‘Bundling in vendor/plugins’ section splits the two vendor/gem sections. I would consider merging the ‘Bundling in vendor/gems’ section with the ‘Using Rails config.gem’ section and introducing the

[sudo] rake gems:unpack:dependencies RAILS_ENV=test

command earlier - as it is a powerful and elegant way to manage and freeze an applications gems.

2009-06-21We see them as two separate approaches.
203ERROR

Unpacking webrat (and nokogiri) breaks cucumber.

“Because webrat (and nokogiri) are native gems, that is, they are built locally on your machine based on its architecture, we won’t unpack those.”

2009-06-21
123OK

share_examples_for should be shared_examples_for (also on p.122)

2009-05-29Actually, shared_examples_for is an alias for share_examples_for, which is the preferred method.
68ERROR

The spec output in the middle of the page only appears that way if using —format nested, which has not been described.

2009-06-22
111ERROR

—nested should be —format nested (at least in rspec 1.2.2)

2009-05-29
137ERROR

The example at the top of the page (beginning with “agent.commission.should == 0”) is actually testing more than the prior example (which ends “should change{agent.commission}.by(7_500)”) because it is testing the starting value of 0, where the rspec example is only testing the difference between the starting and ending values.

Yet the text claims the two examples “express the same thing”.

2009-06-21
142ERROR

field.players.collect — shouldn’t that be .select?

2009-06-17
142ERROR

142 says that “home_team.should have(9).players_on(field)” will call home_team.players_on(field). (At least, that’s how I read it.) But back on p.136 it says players_on_the_field() and key_value_pairs() are sugar and not even evaluated. How are these different? Why isn’t team.players_on_the_field called?

2009-12-23
186ERROR

class ReportTo is missing its ‘end’

2009-05-29It's actually there, but it landed on the top of the next page. \n \nThese sorts of formatting issues will be addressed in typesetting.
186SUGGEST

Is does_not_match? (if implemented) called instead of matches? for should_not? Or in addition to matches?, somehow? The text isn’t clear.

2009-05-29
235SUGGEST

set_hidden_field() could be used to simulate hack attempts, to make sure the app is resistant to such attacks.

2010-01-16
236SUGGEST

reload — if, after a form submission, the response is a redirect, will webrat really resubmit the form? Because I don’t think that is normal browser behavior. It will simply reload the target of the redirect.

2010-01-16
237SUGGEST

Is contain() sophisticated enough to distinguish between content that will be displayed vs html comments, tag attributes, javascripts, and the like? Seems like, generally, matching invisible content is not what is desired here.

2009-06-21Yes, it is. Have you tried it?
215ERROR

I’m on windows XP sp3, rails -v 2.3.2, cucumber 0.3.1, rspec(-rails) 1.2.5 and after I make the DB and run the tests I stiil get this error
Scenario: Show minutes for times not ending with 00 # features/showtime_descriptions.feature:7
Given a movie # features/step_definitions/showtime_steps.rb:1
When I set the showtime to 2007-10-10 at 2:15pm # features/step_definitions/showtime_steps.rb:5
Then the showtime description should be “October 10, 2007 (2:15pm)” # features/step_definitions/showtime_steps.rb:10
expected: “October 10, 2007 (2:15pm)”,
got: “October 10, 2007 (:15pm)” (using ==)
Diff:
@@ –1,2 +1,2 @@
-October 10, 2007 (2:15pm)
+October 10, 2007 (:15pm)
(Spec::Expectations::ExpectationNotMetError)
./features/step_definitions/showtime_steps.rb:11:in `/^the showtime description should be “October 10, 2007 \\(2:15pm\\)”$/’
features/showtime_descriptions.feature:11:in `Then the showtime description should be “October 10, 2007 (2:15pm)”’

What I found out is
showtime_time.strftime(“%l:%M%p”).strip.downcase
doesn’t work on my machine for some reason. If I change it to
showtime_time.strftime(“%I:%M%p”).strip.downcase
and add leading zeros (0) to the Scenarios it will pass.

2009-06-21
280TYPO

login_require() -> login_required() (last paragraph)

2009-05-30
288TYPO

The description of adding after(:each) to reload routes appears after the code listing that already shows that code.

2009-06-22
298SUGGEST

Is it really necessary to repeat every matcher for the “should_not” version? I think it just clutters up the chapter.

2010-07-21
186OK

The macros section says how to write macros, but doesn’t discuss using existing macros. Is it suggested to install shoulda? rspec_on_rails_on_crack? Will there be examples in the final book?

2009-06-21There are examples of each right on that page :) That aside, shoulda macros don't plug into rspec as of yet - though the matchers do.
270SUGGEST

The book says “Go ahead and create that class in app/controllers/messages_controller.rb”. Contrary to other cases in the book, just create a empty class does not work, it leads to failed examples with the message “Controller specs need to know what controller is being specified”.

Instead of “Go ahead and create that class in app/controllers/messages_controller.rb” it should invite to create a real controller class.

2009-06-22
251OK

it “should render a form to create a message” do
render “messages/new.html.erb”
response.should have_selector(“form[method=post]” , :action => messages_path) do
|form|
form.should have_selector(“input[type=submit]” )
end
end
——
This don’t work. After some checking, (in webrat specs) I discovered this:

describe “specifying nested elements” do
it “should be able to loop over all the matched elements” do
@body.should have_selector(“div”) do |node|
node.first.name.should == “div”
end
end
Here, they take the node as yielded to the block, and add .first.
I don’t know where this bug belongs, perhaps way down in ‘nokogiri’
But I have to but a .first or .to_s to get it to run.

2009-06-21I just ran that example and it passed. I'm using rails-2.3.2, rspec-1.2.6, rspec-rails-1.2.6 and webrat-0.4.4.
86SUGGEST

There are still other scenarios that do not pass. If you add these to your Scenarios, you will see the problem.

Scenarios: dups in code and guess
| r r g g | g g r r | wwww |
| r r g y | g g r r | www |
| g r r g | r g g r | wwww |

You may want to note that there are additional failing scenarios (at least refer back to the “Exploratory Testing” section). Perhaps suggest it as an exercise for the user to find additional failing cases and fix them in the same manner prescribed.

2009-05-29
86SUGGEST

Ignore previous posting - the suggestions are addressed in the book. Reading more carefully would be helpful.

2009-05-29
30ERROR

Text says: “Here we store the return value of game.start in a variable named message in the When step definition.”
Text should say: “Here we store the return value of game.start in a variable named @message in the When step definition.”

(Loosing the @ from game.start.)

2009-05-28
35TYPO

The text says: “Open up a shell and cd to the mastermind directory and run the game_spec.rb file with the spec command, like this: spec spec/mastermind/game_spec.rb”

This is ambiguous, if “cd to the mastermind directory” means “cd to /spec/mastermind/” then that part should be dropped from the code following the spec command.

2009-09-15
36SUGGEST

This page needs to explain each of the steps it takes. Why each file is requiring the other. Why each file is located where it is. The purpose of each file. The syntax of each line.

2009-06-09
37TYPO

The text says “the Game needs to handle the messenger argument to the initialize method”. In this phrase, “handle” should be “hand”.

2009-07-04
24OK

At the bottom of the page, I tried to copy the Feature:… and following three lines that spanned the page boundary but it ended up copying the footer and header as well. Might consider keeping the code together on one page?

2009-05-29This sort of thing will be handled during copy-editing before we go to print.
286ERROR

The error given by the spec at this point, using rails 2.3.2, is not consistent with the text. The actual error reported is: ‘No action responded to index. Actions:’

2009-06-22
182TYPO

Duplicate word “the” in “We’ll go over the the
protocol in a bit”

2009-05-29
26TYPO

“To run the feature and see the result, cd to the mastermind directory in a command shell and run cucumber features -n.”

I ran this in my own project.

cucumber features -n
produces an error

cucumber -n features
produces a summary

cucumber features
produces output similar to your text

ganesh:~ zim$ gem list

* LOCAL GEMS*

actionmailer (2.2.2, 2.2.0, 2.1.2, 2.1.1)
actionpack (2.2.2, 2.2.0, 2.1.2, 2.1.1)
activerecord (2.2.2, 2.2.0, 2.1.2, 2.1.1)
activeresource (2.2.2, 2.2.0, 2.1.2, 2.1.1)
activesupport (2.2.2, 2.2.0, 2.1.2, 2.1.1)
aptana_cloud (1.0.6)
archive-tar-minitar (0.5.2)
builder (2.1.2)
capistrano (2.5.5, 2.5.0, 2.4.3)
cgi_multipart_eof_fix (2.5.0)
cheat (1.2.1)
cucumber (0.3.4)
daemons (1.0.10)
diff-lcs (1.1.2)
ec2onrails (0.9.9.1, 0.9.9)
fastthread (1.0.1)
gem_plugin (0.2.3)
highline (1.5.0, 1.4.0)
linecache (0.43)
mongrel (1.1.5)
mysql (2.7)
net-scp (1.0.2, 1.0.1)
net-sftp (2.0.2, 2.0.1)
net-ssh (2.0.11, 2.0.4)
net-ssh-gateway (1.0.1, 1.0.0)
optiflag (0.6.5)
polyglot (0.2.5)
rails (2.2.2, 2.1.2)
rake (0.8.4, 0.8.3)
rcov (0.8.1.2.0)
rest-client (0.9)
rmagick (2.9.1)
rspec (1.1.12, 1.1.11)
rspec-rails (1.1.12, 1.1.11)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.5, 0.4.3)
ruby-nxt (0.8.1)
ruby-serialport (0.7.0)
rubygems-update (1.3.3, 1.3.1)
rubyzip (0.9.1)
sources (0.0.1)
term-ansicolor (1.0.3)
termios (0.9.4)
treetop (1.2.5)
ganesh:~ zim$ ruby -v
ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.8.1]
ganesh:~ zim$

2009-06-09Looks like -n got changed to mean something else. Use -s instead for now, and we'll get that updated in the book.
232TYPO

Shouldn’t the code samples at the top of the page be “fill_in …” instead of “fills_in …”

2009-06-21
31OK

I think the example you use at the start of the book is two complex form a business case point of view i can’t relate to it and im a massive fan of cucumber.

2009-05-19While I appreciate it may seem complex, this is the classic challenge of worked examples like this. Make it too simple and readers don't believe they can apply the concepts to "the real world." Make it too complex, and we loose the less experienced readers. \n \nBased on other similar feedback, I am going to be adding some material to explain the domain a bit more and take some more time figuring out the features to use for the first iteration. Hopefully that will clear things up for you.
128OK

The stubs in the example for the WidgetsController are reversed. it “finds the widget” stubs update_attributes msg, and it “updates the widget’s attributes” stubs the find msg.

2009-05-19The stubs are correct. Those are there because they have to be for the examples to run. The things that are attached to the examples are the message expectations (should_receive), and they align correctly with the example names.
241ERROR

There is no Cucumber “—scenario” option (V 0.3.6) as mentioned on second last line and in footnote 3.

To run a single scenario just specifiy the line number of it - as on page 242.

2009-06-21
107TYPO

“enough is” Line 3

The text has a space but none appear due to the emphasis of “enough”

2009-05-29
315ERROR

The code for testing the application controller is not working. I get this error:

1)
AccessDenied in ‘ApplicationController handling AccessDenied exceptions should redirect to the /401.html (access denied) page’
AccessDenied

2009-06-22
125TYPO

Statment.new should be Statement.new
Same on p. 126

2009-05-29
242TYPO

You have the user download (or type in) a model file, but don’t show the script/generate to generate the empty model file, migration file and test files. Since Movie is derived from ActiveRecord::Base, the tests fail because the table cannot be found. It would be good to generate the new model with “script/generate rspec_model Movie” or even “script/generate rspec_model Movie showtime_date:date showtime_time:time” followed by “rake db:migrate” and “rake db:test:clone”.

2009-06-21
16SUGGEST

In the “Joe Asks…” dialogue, you’re already supposing the reader knows what you mean by red/green. Maybe a couple of paragraphs and some screenshots to let the readers see what the process looks like

2009-05-29
39SUGGEST

regarding #38350, I was having the same problem (getting undefined error vs. wrong number of arguments error). I went back through the book and the problem was that back on page 33, I didn’t actually copy the code for the mastermind script. I think I was a little thrown off by the line just before the code snippet “If we did that, the mastermind script might look like this instead:”. I think the word ‘might’ made me assume that this wasn’t the actual code and was just an example. I probably wouldn’t have posted this but it looks like at least one other person made the same mistake, so hopefully he sees this.

2009-05-29
34ERROR

The book suggests to use

Then /^the game should say “(.*)” $/ do |message|
@messenger.string.split(“\
” ).should include(message)
end

for the step definition for the last two acceptance criteria in the start game scenario. When I run cucumber features though it says that the definitions for those two criteria are undefined.

What I had to do to get this working was to use cucumber’s suggested implementation, and insert the body of the book’s definition into it. So it ended up looking like this:

Then /^the game should say “([^\\”]*)“$/ do |message|
@messenger.string.split(”\
" ).should include(message)
end

This seems to work. For some reason cucumber isn’t matching the regex provided in the book. I am using the 0.3.9 gem.

2009-06-17
82SUGGEST

You say that we should not be refactoring in the red, and you provide a method (pending) to make this possible. But we are still in the red on the cucumber scenario. Is this something that should be addressed here?

2009-09-15I made a more specific reference to RSpec code examples passing.
0OK

It might be worth mentioning somewhere not to “require ‘model_name’” (or any other rails classes) in your rails spec’s as this can cause classes to be loaded multiple times when more than 1 spec is run.
I only mention it because I had the require statement at the top (working of off the original non-rails mastermind examples) and this gave me a bunch of problems with callbacks firing multiple times (because the class would end up being required automatically beforehand and then again for the spec itself). I know this is a general pieces of rails knowledge but it might be worth making it explicit to people just starting with rails so they don’t run into bizarre issues running their specs.

2009-05-29There's really no way for us to cover all of these sorts of gotchas.
54TYPO

“For each peg in the guess that matches color”

…should read…

“For each peg in the guess that matches the color”

2009-05-29
33OK

Remember some of us try BDD early in our journey to Railsdom as we figure “if we’re gonna learn Rails, we might as well learn best practice”.

For this reason, p33 needs to explain:

  1. The function of the $LOAD_PATH line
  2. Why bin/mastermind is the appropriate location for this code
  3. Why “new(STDOUT)” tells the game object it can hand output to STDOUT (it’s not clear from the only Rails API documentation)
2009-06-09The project at the beginning of the book is not a Rails project.
25OK

Following up on suggestion #37454, I think the directory structure and require statements are pretty mysterious and inscrutable from p. 25 forward. To some degree this hinges on how much you want to assume on the part of your readers, which is probably going to be explained in the not-yet-written preface. I realize that you’re not writing a textbook for rank beginners, but I do think you want to consider how much Ruby experience you’re assuming.

I’m envisioning including this book/material in my Software Design and Development course that I’ll be teaching in the Spring, and for students transitioning from a Java-based Data Structures to a (potentially) Ruby-based Software Design and Development course, this sort of “magic directory structure” material is going to make my life more difficult.

Consider, for example, p. 37-38 (PDF). In less than a page, we insert a whole bunch of require statements without any real sense of what we’re doing or why. In some cases, those requires are the only thing in the files, which seems super magical; why in the world does that accomplish anything? Sure, we can play along and type in the code and run it, but if we’re not pretty experienced with Ruby, it’s mostly voodoo rather than knowledge. (It’s like a “cool hack” with no comment or test code. It may “work”, but it doesn’t add much value to the project.)

I understand that this is “How real Ruby is written”, but I’m concerned that this will really put off interested people that approach this with a sincere desire to better understand BDD, Ruby, RSpec, and Cucumber, but find themselves bogged down in smoke and strange incantations.

2009-06-17I appreciate where you're coming from, but this is not intended to be an Intro to Ruby book. There is quite a bit more material that we'd have to cover if we were to start down that path. \n \nI did, however, add some explanation about the directory structure. Hopefully that will help.
44ERROR

with rspec 1.2.6 and cucumber 0.3.9 freshly installed, I don’t get the ‘undefined method ’include’’ problem - it appears that this is handled automatically.

2009-06-17
29ERROR

my version of cucumber emits the snippet suggestion:

Then /^the test_runner should say “([^\\”]*)"$/ do |arg1|
pending
end

rather than the snippet suggestions

Then /^the game should say “Welcome to Mastermind!”$/ do
pending
end

Then /^the game should say “Enter guess:”$/ do
pending
end

perhaps this is intended to teach the refactoring process on a granular level, and was nice when I read through on my first pass. When I went back to go though and play with the examples, this became confusing, because my features and specs were failing (and passing) at different times, with different messages that the ones listed in the book.

2009-06-17
29ERROR

my version of cucumber (0.3.9) emits the snippet suggestion:

Then /^the test_runner should say “([^\\”]*)"$/ do |arg1|
pending
end

rather than the snippet suggestions

Then /^the game should say “Welcome to Mastermind!”$/ do
pending
end

Then /^the game should say “Enter guess:”$/ do
pending
end

perhaps this is intended to teach the refactoring process on a granular level, and was nice when I read through on my first pass. When I went back to go though and play with the examples, this became confusing, because my features and specs were failing (and passing) at different times, with different messages that the ones listed in the book.

2009-06-17
41TYPO

As you’ll see a bit later in this chapter (the word “in” is missing)

2009-06-17
28ERROR

Running the command “cucumber features -n” results in a missing argument error. Running “cucumber features” does seem to work.

2009-06-09
33OK

I found the discussion of the two different approaches to the design of the mastermind script distracting. I was concentrating on learning how Cucumber scripts are defined and then I got sidetracked into evaluating how the first version of the mastermind script violated the Single Responsibility Principle. Now because of design decision to pass STDOUT to Game.new() this affects the step definitions. At this point I haven’t even fully grasped the architecture of the mastermind program and how Cucumber interacts with it. It seems to me that any program that is to be tested with Cucumber must be designed as a API and a thin script which calls that API. Then the step definitions can call the API as well. This isn’t explained at the beginning of ch.2 so all that follows confuses me since I’m new to this testing game.

2009-12-06
33SUGGEST

From the page:
" When /^I start a new game$/ do
game = Mastermind::Game.new
messages = game.start end Then /^the game should say "(.*)"$/ do |message| messages.should include(message)
end

That could work, but let’s take a step back for a second. How are we going to invoke this?"

There are two things being discussed here: 1) the emerging design of the application code and the step definition. It seems you are asking how we are going to invoke the step definition but that doesn’t make sense.

2009-09-15
46SUGGEST

You should explicitly specify that spec be used to run the examples specified on the page. I mistakenly tried cucumber and was confused that my results didn’t match those of the book.

2009-06-17Compromise - I specified that you should run the RSpec code examples - that should make it clear enough at that point.
284SUGGEST

Need to add a line like this in the before block:

assigns[:recent_messages] = []

2009-06-22We do just a few paragraphs later.
38TYPO

The first line of env.rb in B5.0 has an incorrect number of ../ in it. It reads “$: << File.join(File.dirname(FILE), ”/../../lib“)” but should read “$: << File.join(File.dirname(FILE), ”/../lib“)” to execute `cucumber features` succesfully.

2009-09-15I think you have the env.rb in the wrong directory. It belongs in PROJECT_ROOT/features/support/env.rb, which would require two "/.."'s to get back up to the project root.
79TYPO

Prior to Chapter 5, we had been using the code ‘r g y c’ as the secret code. In Chapter 5, it’s all of the sudden ‘r y g c’. Is that intentional?

2009-12-23
86SUGGEST

“We just compact the array before sorting…” Might be helpful to add a few words, “We just compact the array before sorting and joining, which removes all nil’s from the array.” so those unfamiliar with compact know what it’s doing. Then again documentation is your friend.

2009-06-17
93SUGGEST

“Planning phase: how many people, how long for…” Consider, “how many people, for how long,…” instead of “how long for”.

2009-06-17
34ERROR

Perhaps this is a config error my end. But I’m new to Cucumber so I’m not sure.
If I execute
cucumber features -n
I get
missing argument: -n (OptionParser::MissingArgument)
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.3.11/lib/cucumber/cli/configuration.rb:40:in `parse!’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.3.11/lib/cucumber/cli/main.rb:84:in `configuration’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.3.11/lib/cucumber/cli/main.rb:36:in `execute!’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.3.11/lib/cucumber/cli/main.rb:25:in `execute’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-0.3.11/bin/cucumber:9:in `<top (required)>’
/usr/local/bin/cucumber:19:in `load’
/usr/local/bin/cucumber:19:in `

But
cucumber features
runs fine

2009-06-17
72SUGGEST

The text says:

“The messenger( ) and game( ) methods use a common Ruby idiom of initializing an instance variable if it does not exist, and returning the value of that variable like a standard accessor.”

The text should explain why the messenger( ) and game( ) methods execute within each step definition even though there’s no code inside each definition to call them.

Also the test should explain what idiom you’re referring to in particular.

2009-07-04
74SUGGEST

The text says:

“We moved the before(each) block to line 5, inside the outer -most describe( ) block. This makes it available to all of the nested groups, and therefore every example in this file.”

This includes making it available to nested groups that didn’t previously use them, like “should send a welcome message” and “should prompt for the first guess”.

The should explain whether:

(1) The block is available to nested groups like “should send…” etc after refactoring, but “should send…” don’t use them, and if so why
(2) The block is used by nested groups like “should send…” etc after refactoring, but this change in “should send…” doesn’t matter, and if so why
(3) The block is not in fact available to nested groups like “should send…” etc after refactoring, and if so why

2009-12-06
24TYPO

It says:

“On line 4, we assign the value of returned by”.

It should say:

“On line 4, we assign the value returned by”

2009-06-17
59TYPO

The text says:

“so require it file from lib/mastermind.rb”

It should say:

“so require the file from lib/mastermind.rb”

2009-06-17
372TYPO

customer should be custom in “You can extract duplication and common patter ns in your model specs into customer macros…”

2009-06-17
24SUGGEST

In first para at top of page. The font and layout for ‘gem install cucumber’ and ‘cucumber —help’ don’t follow your data-entry convention.

2009-06-17
25SUGGEST

Between hello/1/spec/greeter_spec.rb and hello/2/spec/greeter_spec.rb the name of the variable holding the string has changed without explanation from greeting to message.

2009-06-17
26SUGGEST

Section 2.3, first para. “Inside the hello directly, ”
Should that be ‘directory’?

2009-06-17
50TYPO

Pull-out box, ‘Downloadable Files’

“..rather than just see it’s ultimate output”

Apostrophe not needed - this is a possesive, not a contraction. Should be “see its ultimate output”

2009-06-17
154TYPO

In “code example” paragraph:

… reminds us that the writing them is a design and documentation practice …

I think you mean … the writing of them is a design …

2009-06-17
274ERROR

On pages 274-275 there is output listed from running “./script/cucumber features/browse_movies.feature” which indicates a failing step, but the text immediately after this on page 275 claims that the scenario is passing.

2009-06-21
45TYPO

…it let’s us express… should read …it lets us express…

2009-06-22
85TYPO

…This code is certainlly naive,… should read …This code is certainly naive,…

2009-09-15
236OK

In the code example that starts on PDF page 235 there is a definition of a should_assign method:

def should_assign(hash)
variable_name = hash.keys.first
model, method = hash[variable_name]
model_access_method = [model, method].join(‘.’ )

it “should assign @#{variable_name} => #{model_access_method}” do
expected = “the value returned by #{model_access_method}”
model.should_receive(method).and_return(expected)
do_request
assigns[variable_name].should == expected
end
end

Notice the definition of the local variable “expected”. At the bottom you specify that you expect assigns[variable_name] to be equal to the local variable “expected” which has been assigned a string just saying:

“the value returned by #{model_access_method}”

That means, if you use the should_assign macro like this:

get :index do
should_assign :projects => [Project, :all]
end

it will expect assigns[:projects] to be equal to “the value returned by Project.all”

I believe this is one of the “weirdnesses” that is mentioned in the beta warning in the beginning of the book. :)

2009-11-23That actually works. The text is supplied by the mock, and is there to provide a useful failure message.
35TYPO

“If the code-breaker indicates no, the
system and shuts down.” (Note the extraneous “and”.)

Should this be: “If the code-breaker indicates no, the
system shuts down.”?

2009-07-04
39TYPO

“an interation planning meeting” -> iteration?

2009-07-04
40TYPO

“Let’s go ahead and store this feature in file.” -> “in a file”?

(All my previous submissions referenced the wrong page, sorry. I just realized the page #s are at top and not bottom)

2009-07-04
270SUGGEST

The words “The step passes because the Genre model and table already exist” are misleading.

“Create the Genre model and table already exist so the step will pass” would be more accurate.

Instructions for creating the Genre model and table, even if in an appendix, wouldn’t go amiss.

2010-01-17
1SUGGEST

I think the hello example is a fantastic example but speaking as someone who has onboarded a number of teams to BDD via nbehave i still think your book is to fast paced and complex and i think you need some real simple web examples. I like the book i love cucumber but i just think your book is aimed to high and the learnign curve it introduces is to steep.

2009-07-04Thanks for your comments, Neil, but at this late stage, I don't think we can really do much about this. No matter where we target this, there will be some for whom this is too simple and some for whom this is too complex.
29SUGGEST

the-rspec-book_b7_0.pdf >> top of p29 says:
3 steps (1 failed, 2 skipped)

No explanation provided why 2 skipped. Does it stop upon first fail?

2009-07-04
98SUGGEST

“corresponding likelihood” over “companion likelihood”

2009-07-04
100SUGGEST

“challenging edge cases” over “sinister edge cases”

2009-07-04
100TYPO

“don’t mark against the same peg more than once in the code. Moreover,” over “don’t mark against the same peg in the code twice. And to make things even more complex,”

2009-07-04I prefer this one as/is.
100SUGGEST

“don’t mark against the same peg more than once in the code. Moreover,” over “don’t mark against the same peg in the code twice. And to make things even more complex,”

2009-07-04Duplicate of 39650
105SUGGEST

“We’re now interacting with the desired internal structure” over “We’re now interacting with the structure we want internally”

2009-07-04Again - personal preference, but I'm leaving this one as/is.
107SUGGEST

“before reading the next paragraph…” over “before reading the next paragraph.\\\
\\\
No. Seriously.” —at this point the reader is probably committed.

2009-07-04
108SUGGEST

omit (repetitive) “Before we move on though, were there any other defects in the marking algorithm that you found in your own exploratory testing? If so, add some new scenarios to reflect them. If they fail, drive out the changes on your own, trying to stay in the green as much as possible.”

2009-07-04How is this repetitive? We only cover a couple of scenarios in the chapter and the reader may have discovered others that we didn't cover. This text invites the reader to step away and explore.
112OK

omit (juvenile) “(It’s nice to do this from time to time anyway—it helps
their self-esteem.)” —we already know we have a heightened sense for cheap irony

2010-07-18
121SUGGEST

“Whether this is due to real understanding and value of Agile principles, or simply a marketing ruse, only time will tell.” over “Whether this is due to them understanding and valuing the underlying principles of Agile or simply a marketing ruse to dress up the same old tired processes is left as an exercise for the reader.”

2010-07-18The book hasn't been through copy-edit yet. Wording issues like this will be addressed when we get there.
124TYPO

behaviour (from behavour) in Changing Existing Code

2009-07-04
128TYPO

“your application [and it] has any potentially tricky integration points”

2009-07-04Not sure about this one - doesn't make sense with the preceding "or your"
145TYPO

“significant impact [on] the way that we drive out code”

2009-07-04
158TYPO

use singular ‘return’ in “method can take an arbitrary number of arguments and a block, and returns a subclass”

2009-07-04
176SUGGEST

“A little bit cryptic, yes?” over “A little bit cryptic, no?”

2009-07-04I think this is a bit cultural. In my experience, "no" is commonly used in this context.
177SUGGEST

‘What we want to say is that “the result should equal five,” which is how we say it in English.’ over ‘What we want to say is that “the result should equal five.” Here’s how we say it in English: \\\
\\\
the result should equal 5’

2009-07-04
183SUGGEST

“due to inconsequential formatting changes” is more readable than “due to some inconsequential changes to formatting,” no?

2009-07-04Now you're making me laugh. In 39678, you suggested that ", yes?" would be preferable over ", no?" and now you say ", no?" here. \n \nAnyhow - fixed.
189SUGGEST

“While that does express our intention” over “While that does express what we’re trying to express”

2009-07-04
41TYPO

The second sentence of the last paragraph on the page begins, “The seems…”. I believe the authors probably intended, “This seems…”.

2009-07-04
51ERROR

When I run “cucumber features -s” at this point in the tutorial, both feature files are run, so I get much more output than the text describes (both “Feature: code-breaker starts game” and “Feature: code-breaker submits guess”).

2009-07-04
56ERROR

“cucumber features -s” should be “cucumber features/codebreaker_starts_game.feature -s” to get the output described on this page.

2009-07-04
82TYPO

The start method in the callout should have a code parameter.

2009-07-04I see two instances of start() at the top of the page, both if which have the code argument. Are you sure you're talking about page 82 in beta 7? If not, please add a new erratum. Thanks.
91TYPO

The When /^I start a new game$/ do step got broken when the start method of Codebreaker::Game got a parameter, but it was never fixed in the tutorial and magically shows up on this page as already fixed!

2009-12-06
203SUGGEST

“When something goes wrong it must be corrected” over “If something goes wrong it’s gotta get fixed”

2009-07-04
213SUGGEST

“Please pay momentously” over “Please pay imminently”

2009-07-04Leaving as/is
234TYPO

repetative ceremony

2009-07-04
319TYPO

The second code listing, after ‘so go ahead and create that class in app/controllers/messages_controller.rb: [Download rails_controllers/messages/015/spec/controllers/messages_controller_spec.rb]’ at the end of the page shows the spec instead of controller code.

2009-10-04
148TYPO

The text doesn’t match the code example: “We stub the save method…”, but the update_attributes method was stubbed.

2009-07-04
251SUGGEST

Please clarify as to `set RAILS_ENV=test` and `export RAILS_ENV=test`. I don’t understand how they are useful, or why I should specify these lines in config/environments/test.rb. Actually it now seems like it’s intended for the command line. Follows fast upon the config settings. Maybe another sentence or two should help.

2009-12-23
260SUGGEST

“They are also unlikely to catch bugs that a good set of model specs might have missed.\\\
\\\
It’s not half bad, though.” over “They are also unlikely to catch bugs that a good set of model specs wouldn’t have already caught.\\\
\\\
It’s not all bad, however.” Unclear.

2009-09-15
262TYPO

In the code listing for cucumber_rails/01/features/showtime_descriptions.feature, it says

So that I can find movies that fit my schedule
As a movie goer

Shouldn’t those lines be swapped?

2009-07-04Nope. There are different narrative styles for cucumber features - this will be made clear in the cucumber chapter in the final book.
248TYPO

In Figure 20.1, the RSpec loop back notation says “Repeat #3 - #5 for discovered, models, etc. until step is passing”

This doesn’t really make sense - perhaps it should say “Repeat #3 - #5 for discovered controllers, controller actions, models, etc. until step is passing”

This will then match more closely to the last bullet point on page 247.

2009-07-04
250TYPO

Broken link in footnote to Github resource.

2009-09-15
300DEFER

rspec-rails ActiveRecord::Error mocking

For outside-in view specs it would be useful to see how to mock ActiveRecord errors, for example I want to implement

it “should render an error message if errors are present”

as part of my view spec, which I am amending after finding in a feature that I had no validation error messages showing up on the page to tell the user what they did wrong.

Some general advice on mocking these complex objects (where you could just stub the action you know your view uses, error_messages_for() in this case, but that would be fragile if, for example, the view were changed to use error_message_for several times instead).

2010-07-21
300SUGGEST

At the end of the page, you specify to “create the new.html.erb template” - however, you don’t indicate that any code needs to be added to that file (i.e. <% form_for …%>) before running the test again.

For the “show.html.erb” sample (starting on page 297), you create an empty file, run the test, see it fail, and then fix that error.

A user following along might think the same approach is being followed for this example. However, if you don’t add the code to new.html.erb, you won’t get the same errors shown in the book. (Specifically, you won’t get the “undefined method ‘spec_mocks_mock_path’…” error.)

2009-10-04
141TYPO

Is “Internets” in the diagram meant to be serious or humorous?

2009-09-15
187SUGGEST

I know it’s only an example, but I’m not sure if I’m following your working_too_hard? example.

Doesn’t the first version of the method finish running once any person has been working more than 50 hours in any week, and therefore not need short-circuiting? (It may be worth mentioning that using .any? would be more idiomatic ruby, unless .each is unavailable)

2009-12-23
131TYPO

Second sentence of section 11.3 should begin “Ask a stakeholder how…” instead of “As a stakeholder how…”

2009-09-15"As" is correct - I added a comma after "story" to clarify the intent.
107TYPO

bbbw should be bbb

2009-12-22
82TYPO

The definition of the start method should have the code parameter. I believe this is what Ed Ruder was taking about.

the line:
def start

should be changed to:
def start(code)

2009-12-06
82TYPO

Just under “A Small Change Goes a Long Way” we are instructed to run the feature again with:
cucumber -r features features/codebreaker_submits_guess.feature

I get “no such file to load” error using the cucumber -r option here, but it runs fine with -s or no option.

I am not sure if this is a typo, or if I am doing something else wrong. I did at least find it odd that the book begins using the -r option with no explanation of why we are doing so.

2009-09-15Not sure why you were getting a no such file error, but we don't need the -r any longer so it's pulled from the examples.
284ERROR

“set_hidden_field ”user_id“, :to => @bob.id” is correct

2009-07-17
180TYPO

In the box on Matchers is the following text:

Given Dan’s penchant for “Getting The words Right”,…

words has been written in lowercase, while the rest of the phrase is in Title Case.

2009-07-17
249TYPO

In the sidebar, second paragraph

“or other forms of visual aide”

should be “or other forms of visual aid”
or at least “or other visual aides”

Visual aid is the standard spelling. An aide is a person, so to say “forms of aide” is incorrect.

2009-07-17
330TYPO

we gets -> we get

2009-07-17
354SUGGEST

The last sentence in the page 354 “Not changing the controller…” is confusing to me and seems contradictory.

2009-10-22
284TYPO

First full paragraph, missing space between text/plain and MIME

Given text:
text/plainMIME
should be:
text/plain MIME

2009-07-17
286ERROR

Last paragraph under the contain() heading.

Reads:

contain() will match against the HTML decoded text of the document, so if you want to ensure “Peanut butter & jelly” is on the page, you’d type just that in the string, not “Peanut butter & jelly”.

Should say (I believe):

contain() will match against the HTML decoded text of the document, so if you want to ensure “Peanut butter & jelly” is on the page, you’d type just that in the string, not “Peanut butter & jelly”.

Also, the last double quotation mark is straight and not curly. Typesetting issue?

2009-10-04
327ERROR

It says that the “xhr” method has one additional argument at the front, but in the example the action is missing. In the book you have

xhr :get
when it should be: xhr :get, :create

2009-10-04
331TYPO

First paragraph under the heading “Fixing what we broke”

POSTS should be POSTs

2009-07-17
262ERROR

It says, “Run that file with script/cucumber features and you’ll see that all of the steps are undefined, and that Cucumber has provided us with code snippets for all of the missing step definitions:”. However, the output says “uninitialized constant Movie (NameError)”. That means you’ve already created the step definitions, but you haven’t yet shown us the code.

2010-01-16
268SUGGEST

This chapter is lacking an official “What we’ve learned” section like the others.

2010-07-21
275OK

“to keep this example focused on the Simulated Browser style, we’ll leave the development of this code as an exercise for you.”

Cheater! ;)

2009-07-17:)
281TYPO

“In the above example, if we renamed the Movie class to Film, we’d have to change line 8 which uses the field id and line 13 which uses the field name, but line 3 would continue to work just fine.”

Those line numbers aren’t visible in the text.

2010-07-21
292TYPO

“Wrapping Up”: The other chapters used a phrase like “What We Have Learned” or something like that.

2010-01-17
52TYPO

Third full paragraph on page 52:
“After loading the Ruby files, Cucumber then then loads and starts pars-
ing all the .feature files, matching all of the steps in scenarios against
the stored step definitions.”

Note the “then then” typo.

2009-07-17
254TYPO

features/environments/cucumber.rb should be config/environments/cucumber.rb

2009-07-17
1OK

The ruby on the cover next to “The facets of ruby series” is extraordinarily pixelated in stark contrast with the rest of the otherwise high resolution cover.

2009-07-17Thanks for noticing :) \n \nThis is a beta pdf!!!! This will naturally be addressed before we go final.
299TYPO

“the stub( ) method in the (as yet) unwritten chp.mockFramework”

chp.mockFramework is written as chapter 12.

2009-10-04
303ERROR

“act as_null_object”

should be :null_object => true - or is there a .as_null_object method?

and again on page 305

2009-10-04There is an as_null_object method, which is preferred. This has been resolved in the text.
222SUGGEST

rake -T | grep “rake spec”

rake -T spec is equivalent but shorter.

2009-09-15
33TYPO

“BDUF means desiging an application in significant detail before writing the first line
of code.” I don’t know if it is totally wrong, but I think it should be “designing”.

2009-07-17
324ERROR

I’m getting:

./script/spec spec/views/messages/new.html.erb_spec.rb
F

1)
NameError in ‘messages/new.html.erb should render a form to create a message’
undefined local variable or method `messages_path’ for #
./spec/views/messages/new.html.erb_spec.rb:12:
./script/spec:10:

Finished in 0.045964 seconds

1 example, 1 failure

I don’t see where you changed routes.rb. I think you may have rearranged the code, and it doesn’t match the text.

2009-10-04
326TYPO

It says “Update the before block to do that and re-run the spec. You should now have one example, zero failures.”

That can’t be true. We haven’t put anything in the template yet. I think the code was rearranged, and the text is out of date.

It says, “Run the spec. The example we just wrote should be the only failure. Go ahead and implement the view to resolve that failure:”

I think that’s wrong too because the template is still empty.

2009-10-04
327TYPO

“Run that, watch it fail, and implement the code in the view to make it pass.”

It’s probably a bad idea to assume the reader will guess the code correctly. It’s probably better to always show the right code that he should enter.

2009-10-04
329TYPO

“Once again we’ll build on the messages example we started with earlier in this chapter. We’ll start where we left off in Section 24.2, Mock Example, on page 324. We had just produced a new page”

I don’t think you need to say that since it was just the previous section. Perhaps in an older revision, that section was further away.

2009-10-04
334OK

“If you run new.html.erb_spec.rb now, you’ll see four passing examples, including the three we just copied to the _form spec.”

Following along, I have 5 at this point:

“should render a form to create a message”
“should render a text field for the message title”
“should render a text area for the message text”
“should render recent messages”
“should render the messages/form”

2010-01-17There are 5 altogether, but only 4 in new.html.erb_spec.rb
335TYPO

“Run that and you should see 3 examples, 0 failures.”

I’m getting:

1)
‘messages/_form.html.erb should render a form to create a message’ FAILED…

Finished in 0.107088 seconds

4 examples, 1 failure

It’s because you haven’t asked me to update the form yet. On the previous page, you said, “Getting back to the _form partial, for it to be usable for both the new and edit templates it’s going to have to get a bit smarter. It’s going to need to render the for m’s action attribute to point to the messages_path( ) for a new record and the message_path(@message) for an existing record.” However, you didn’t show any changes to the template.

2010-01-17
335ERROR

“Run that and you should see 3 examples, 0 failures.”

Ah, I see the problem now. You never told me to delete “should render a form to create a message”.

2010-01-17
335ERROR

“Now that we’re done refactoring, we can go back into spec-driving mode and add an example that expects the edit template to render the form partial. Go ahead and create a spec for edit with the following example:”

You forgot to put all the require, describe, etc. stuff in the first code example for this new file.

2010-01-17
24TYPO

Last sentence on the page reads: “If that happpened…” Too much P.

2009-08-26
324SUGGEST

The last sentence of this page says to “go ahead and create the template” but it doesn’t specify how to create it. If I create an entirely blank template was done for the show template earlier in the chapter - I get the same error Shannon jj Behrens talks about in erratum #40051. If I use “script/generate scaffold messages message:string” to create it my error message matches what the book says.

If you want folks to create the template differently than what was done earlier in the chapter I think you should be explicit as to how it should be created.

2009-10-04
51TYPO

You say Now run cucumber features/codebreaker_starts_game -s from the project root, and you’ll see the following output:

But the command requires the .feature extension for the codebreaker_starts_game feature to properly run…

cucumber features/codebreaker_starts_game.feature -s

2009-09-15
54SUGGEST

Instead of calling the step file just codebreaker.rb (which will make Textmate apply a ruby or ruby on rails template to the file… instead perhaps call it codebreaker_steps.rb so that Textmate will properly classify the file as a Cucumber steps file. This assumes of course that you’re on OS X, running Textmate and using the Cucumber textmate bundle… but still, allowing for that scenerio doens’t hurt anyone not using this setup, and it only helps those of us who are. I know you can switch the .rb to be whatever you want, including Cucumber steps… but that is a global setting and then all your normal ruby or ruby on rails files will be rendered in Textmate as Cucumber steps files too. The way the bundles interpret the language requires ‘steps.rb’ to be in the file name to automatically use Cucumber Steps as the template. At least that is how it works by default, you can of course change it with the bundle editor as I’m sure you’re aware.

2009-09-19
90OK

when you run the 3rd context “with all 4 colors correct and 1 in the correct place” it fails because it’s expecting “bwww” but with how the code is setup so far it gets “wwwb” since the c char at the end is the only one that matches in place. The others are out of place so they generate the www first.

2009-12-22Exactly.
318DEFER

The BD Rails: Rails Views chapter would benefit from describing how to mock/stub/place expectations on ActionView helpers, for example when using textile you may want to
@controller.template.stub!(:textilize).and_return(‘textiled text’)

then
controller.template.should_receive(:textilize).with(service.teaser)
controller.tepmlate.should_not_receive(:textilize).with(service.name)

It took me a few hours to find this, I think it is worth adding to the chapter as these view helpers are an external dependency and their behaviour (i.e. is the textile actually converted correctly for display) seems better suited to the Cucumber level. Speccing textilize’s behaviour should be done in RedCloth’s own tests, not the application tests.

The minimum I would have found helpful is being told what to stub, it wasn’t clear whether it was @controller, the helper module, or as it turned out another object which makes MVC sense but isn’t mentioned in the literature.

2010-07-21
372DEFER

It seems that testing the “validates_uniqueness_of” model validation is a bit tricky. Blogs and forums I’ve found have a number of suggestions, but they all seem to be “workarounds” to me. This topic doesn’t appear to be covered in the RSpec book (yet). I’d really like to see this topic covered.

2010-07-21
25OK

Line numbers are getting selected when trying to copy and paste code example from PDF book page# 25.

This is the block (with #s copied over):

describe “RSpec Greeter” do
2 it “should say ‘Hello RSpec!’ when it receives the greet() message” do
3 greeter = RSpecGreeter.new
4 greeting = greeter.greet
5 greeting.should == “Hello RSpec!”
6 end
7 end

There’s an earlier example on book page# 20 with the same problem but it’s not something you are asked to enter into a text file.

2009-08-26Your PDF reader should have a column mode. On Preview on the Mac you get that by holding down the option key.
60SUGGEST

Currently written:
$: << File.join(File.dirname(FILE), “/../lib”)

Suggestion:
$: << File.join(File.dirname(FILE), ‘..’, ‘lib’)

Reason:
File.join joins the strings with File::SEPARTOR. File::SEPARTOR may be different on other systems.

2009-09-15
29TYPO

The code has a extra space character
Then /^it should say “([^\\”]*)" $/ do |greeting|

it should be
Then /^it should say “([^\\”]*)"$/ do |greeting|

(It is not visible in the pdf, I discovered it after copy&paste)

2009-09-15I can't duplicate that experience (on Mac OS using Preview), and the space is not in the source code either, so there's nothing I can really do about it anyhow. Sorry.
56TYPO

Wrong line number (minor problem!)

uninitialized constant Codebreaker (NameError)
./06/features/step_definitions/codebreaker.rb:7:in
`/^I start a new game$/’

/IF/ you use the code providerd (cb/06), the line should be 15. The difference is due to the 8 comment lines.

2010-07-21
61TYPO

Duplicated

Perhaps you’ve you’ve heard that a 1-to-1 mapping between

2009-08-26
318ffSUGGEST

This whole chapter on RSpec in Rails Views seems outdated, only the very fist basic example works. Also, as I did not get any further with the examples as they no longer match the API and there are even missing steps in the description. Finally, I used the spec_scaffold generator - which anyways created most of the “steps” discussed in this chapter, but in much better detail and with better code, too. Maybe it would be more usefull to start with the generator (scaffold, controller or model), explaining what we get there, and then work into some more pracitically relevant example?

2009-10-04
343TYPO

both code examples are for the spec, not for the controller described in the second part:

class MessagesController < ApplicationController
end

2009-10-04
344SUGGEST

Now the message text field is called “body”, while in views it was called “text”. Not important, but yet another point that makes the RoR chapters very inconsistent compared to the Codebreaker chapters.

2009-10-22
365ERROR

The #new controller specs are fine, but the instructions for adding the controller’s method accordingly are missing:

def new
@message = Message.new params[:message]
end

2009-10-22
174TYPO

“what the WidgetsControllerdoes”, missing space between words.

2009-08-26
372ERROR

The first example in here does not work ‘out of the box’, because in the former chapter, the model was implemented ‘quick and dirty’ without adding the correct inheritance schema to it. Therefore, before running the first spec (“”should be valid with valid attributes"), app/models/message.rb needs to be extended like so:

class Message < ActiveRecord::Base
end

2009-10-22
373TYPO

After adding the 3rd spec, you write (again):

Run the spec—4 examples, 0 failures, 2 pending. Wait a minute. We were
expecting it to fail, but it’s passing.

Should be: …1 pending…

2009-10-22
376ERROR

Adding the User.new to the before method isn’t good enough, because we never created the user table in the first place, and this time just adding the correct inheritance to the unfinished implementation isn’t doing the trick, either:

with ActiveRecord:
should be valid with valid attributes
Could not find table ‘users’

only “Class User\
end”:
should be valid with valid attributes
undefined method `new_record?’ for #

I.e., first we need a migration for Users or, better, mock (not stub) the User:

before(:each) do
@message = Message.new(
:title => “foo”,
:text => “foo”,
:recipient => mock_model(User)
)
end

2009-10-22Great suggestion to use mock_model here. Thanks.
379SUGGEST

Just another point about keeping these three chapters on Rails MVC consistent:
In the Rails controller section, the method’s if clause was implemented exactly reverse:

def create
message = Message.new params[:message] if message.save
flash[:notice] = “The message was saved successfully.”
redirect_to messages_path
else
render :action => “new”
end
end

2010-07-21
379ERROR

Before we get started we need to add a migration for the User model
that was added in the controllers chapter. Go ahead and generate a
migration to create the users table with a login attribute. User models
usually need more attributes, like passwords, but we’re not concer ned
with those aspects of a user right now. The only reason we’re jumping
ahead here with the user is that we’re not focusing on the behaviour
that drives a user into existence.
With the migration in place and the test database prepared let’s drive
some business rules into existence!
1) The User model again needs to be extended with the ActiveRecord class (or, if this chapter always relies on this in place, why not simply add this inheritance schema to all Models created in the Controller section to begin with)

2) This should actually suggest to add a :name attribute as ID, to be consistent with what was suggested before in the Message model:

class Message < ActiveRecord::Base
belongs_to :recipient, :class_name => User.name
validates_presence_of :title, :text, :recipient
end

2009-10-22The reference in the code to User.name is the name() method on the User class, not on its intsances. \n \nThe rest of this has all changed quite a bit for the next beta.
121SUGGEST

Up until now you use ‘context’ nested in ‘describe’ blocks. Now on this page, you nest a ‘describe’ block inside another ‘describe’ block. Then in chapter 13, Spec::Examples, you show more code examples that have ‘describe’ blocks nested within other ‘describe’ blocks and none that show ‘context’ blocks within ‘describe’ blocks. It is not until chapter 17 (p238), ‘Tools and Integration’, that you show another code snippet with a ‘context’ block within a ‘describe’ block. All this with out mentioning that ‘context’ is an alias for ‘describe’. This inconsistency may be confusing for the reader. My suggestion is either maintain the ‘context’ within ‘describe’ blocks throughout the book or explain earlier that they are interchangeable.

2010-01-15
38TYPO

Top of the page, “The game will need generate a secret code” should be “will need to generate”

2009-09-19
155TYPO

2nd paragraph, 1st sentence. “At this stage you could be forgiven for be thinking” remove 2nd instance of ‘be’

2009-09-15
59OK

I can’t seem to get my specs scripts to execute in my preferred order. Within each script, execution flows as expected, but the order the scripts are themselves run seems to be outside my control. I’ve tried renaming my RSpec scripts with a numerical prefix so they sort in my preferred order, but this seems to have no effect on the execution order. If there is a convenient way to influence the execution sequence, I’d like to see that mentioned in the book.

2009-12-06
108TYPO

but they have the wisdom to recognize quickly whether those changes are heading them in the right direction. Once they do, they typically back up to the last known good state

This should read “in the wrong direction” otherwise it does not make sense.

2009-08-26
44SUGGEST

The term “DRY” is not explained where it is first used.

Text:

Fortunately, Cucumber of fers a few dif ferent tools for DRY’ing things up
without sacrificing expressiveness and localization.

(There’s something odd with the ff pairing and it’s coming across with that extra space when copied with Preview on Mac OS X. I left the space in there in case you want to take a look at that formatting too.)

2009-08-26
31SUGGEST

“Iteration” not explained

The term “iteration” is used very early on (first reference is p31 in b8_0) but not explained. There’s even an entire section titled “Planning the First Iteration” slightly later on but there’s still no explanation what this means in that section. Much later (p145) there’s a very brief reference to an iteration being an one or two week “mini-project” but no detailed explanation.

I think it would help to explain up front, at least briefly, what an iteration (and other Agile terms used in the book) is for those not familiar with Agile development methodologies rather than waiting till later like in Chap 10.

2010-07-20
49SUGGEST

Diagram of directory structure for codebreaker somewhat ambiguous what is a file and what is a directory.

It’s a little confusing cause you don’t have a legend stating which “color” is a directory and which is a file. You can mostly figure it out just by the names and the structure except you have a grey “codebreaker” box in lib and a white “codebreaker” box in bin so for those two you might have to think: is the white one actually a file (but it doesn’t have an .rb extension like the other Ruby files) or is that just a “typo” and it’s supposed to be a directory to match what’s in the lib directory?

You might want to put slashes “/” after the directory names or use some other method to better distinguish between directories and files.

2009-12-21I added a / after the directory names. Thanks for the suggestion.
50TYPO

Page break in between code block at end of page 50.

This code is split:

Given /^I am not yet playing$/ do

end

Makes it impossible to cut and paste and the entire thing in one go (yes I know it’s not hard to type “end” manually…)

2009-08-26These sorts of issues will be dealt with when we typeset the book for print production.
60SUGGEST

Suggestion: change “$:” in spec_helper.rb code to $LOAD_PATH

Using $: makes it look a little too “Perlish” :)

You are using $LOAD_PATH in bin/codebreaker earlier on page 55 so you should probably at least make things consistent.

2009-09-15
78TYPO

cucumber -r used for the first time but inconsistent with previous usage.

In the previous usages of cucumber and features/codebreaker_submits_guess.feature the command line was just:

cucumber features/codebreaker_submits_guess.feature

but on the bottom of page 78 this changes to:

cucumber -r features features/codebreaker_submits_guess.feature

even though the output is the same (at least on my system). It also says “Now run again” when this is actually the first time we’ve used the -r switch.

There are a few other places where the -r is used (pgs 82, 110, 111, 115) but I haven’t gotten that far yet to know if it’s actually necessary or if the “short” version works as well.

2009-09-15
59OK

I should say the reason I want to execute my scripts in a particular order is as a convenience for tracking down the source of a problem, not because of code dependencies or bad design. I just want the lowest-level problems to be reported first, so if there’s broken code it’ll be most likely found at the first or second red line. One bad line of production code can cascade through all the specs, causing a bunch of red lines. I like that. I just don’t like having the culprit shuffled in with the victims.

If there’s a way to randomize the spec execution sequence, but specify a reporting sequence, that would be ideal. But absent that solution, forcing a preferred execution order would suffice.

If anything like this is possible, I’d like to see it covered.

2009-12-06There's nothing in rspec that supports a granular ordering. If you're interested in such, please file a feature request at http://rspec.lighthouseapp.com
51TYPO

We are instructed to run:
cucumber features/codebreaker_starts_game -s
but it should be
cucumber features/codebreaker_starts_game.feature -s

2009-09-15
351ERROR

The xhr example omits the action:

  1. no params or session data
    xhr :get
  2. with params
    xhr :get, :id => 2
  3. with params and session data
    xhr :get, { :id => 2 }, { :user_id => 99 }

should be

  1. no params or session data
    xhr :get, :index
  2. with params
    xhr :get, :show, :id => 2
  3. with params and session data
    xhr :get, :show, { :id => 2 }, { :user_id => 99 }
2009-10-04
340SUGGEST

I couldn’t figure out how to do something like
Spec::Matchers.define :have_image do |src|
in my matchers.rb file (using the suggested file, module & spec_helper layout)

when using simple matcher it handled should but didn’t handle should_not

2009-10-04
119TYPO

It’s role is to collect secret codes and provide statistical infor mation about which colors show up how often in which position.

Wrong its.

2009-08-26
170TYPO

An object’s internal state is an implementation detail, and not part of it’s observable behaviour.

Wrong its.

2009-08-26
174SUGGEST

Section 12.4’s opening paragraph talks about the “common pitfalls of mocking and stubbing.” However the section only mentions mocks. I was trying to figure out if “stubbing” got in there by accident or perhaps all the references to mocks really meant “test doubles.” Either way, I was confused, lol.

2010-01-17
40ERROR

“See how the Given and When steps in this scenario both use the first
person… Given x, when I y, then I should see a message

The *’ed phrase puts the then in the first person, but the actual scenario definition is:
Then the game should say “Welcome to Codebreaker!”
And the game should say “Enter guess:”

Would the “Thens” be better in the first person, or better to remove the *’ed phrase? Either way, it would align the two snippets and make them consistent.

s. love the book, can’t wait for it to be done :)

2009-09-15
52SUGGEST

Briefly mention that you will be using the Direct Model Access technique to drive the Acceptance tests, mention the other two options, and refer readers the “Behavior Driven Rails” chapter (probably best in a sidebar).

Reasoning: When I first read this section to use in a program I was starting, I misunderstood that this was the only way to implement features, so I used Direct Model Access in my desktop app and was confused and turned off because a fair chunk of my code was not being exercised. Often, I am looking for a specific technique to implement immediately, so I’ll jump back and forth a lot and read a book in non-sequential pieces.

2009-08-26I don't think this is appropriate. DMA is specific to Rails and this section of the book has nothing at all to do with Rails.
0SUGGEST

It would be nice to have a chapter or section for rails plugins and plugins engines like ‘engines’ and ‘desert’, explaining how to maintain tests on such part of rails applications that are not in the core.

2009-09-15Thanks for the suggestion, but unfortunately we can't really cover any nook and cranny in this edition of this book. We'll definitely consider this in a future edition.
218TYPO

“occurences” must be “occurrences” I suppose.
Missing “r” like HTTP’s REFERER.

2009-08-26
276ERROR

Section: Bootstrapping an app with RSpec and Cucumber

On Windows when trying to run: script/generate rspec

I receive this error: Malformed version number string mswin32 (ArgumentError)

Workaround is to change commented out line to the line below it in file vendor_gem_source_index.rb

def version_for_dir(d)
#matches = /-([^-]+)$/.match(d)
matches = /-(\\d\\.\\d\\.\\d+)/.match(d)
Gem::Version.new(matches[1]) if matches
end

there is a discussion in nabble forum about n this.

2010-01-17
343DEFER

I’m not sure if the Rails Controller chapter is the best place for this (or even if this is the best mechanism to suggest) but I feel that some information on using RSpec for spec’ing routes would be useful to the reader. If nothing else, it’d definitely be useful to me.

2010-07-21
310TYPO

“… so if you want to ensure “Peanut butter & jelly” is on the page, you’d type just that in the string, not “Peanut butter & jelly”."

This is a little confusing since the two strings are the same. Is one of them intended to use & (the HTML entity for &) instead of a plain &?

2009-09-15
27ERROR

I am using cucumber 0.3.98 with Ubuntu 8.10. When I run the example on p.27, the section where the snippets are expected following “You can implement step definitions for undefined steps with these snippets:” is empty.

See:
$ cucumber ./features
Feature: greeter says hello

In order to start learning RSpec and Cucumber
As a reader of a The RSpec Book
I want a greeter to say Hello

Scenario: greeter says hello # ./features/greeter_says_hello.feature:7
Given a greeter # ./features/greeter_says_hello.feature:8
When I send it the greet message # ./features/greeter_says_hello.feature:9
Then it should say “Hello Cucumber!” # ./features/greeter_says_hello.feature:10

1 scenario (1 undefined)
3 steps (3 undefined)
0m0.002s

You can implement step definitions for undefined steps with these snippets:

$

2009-09-15Duplicate with 40736
71OK

as_null_object does not ignore the other messages, it uses an array for some odd reason

this is my result:
spec spec/codebreaker/game_spec.rb —color
.F

1)
Spec::Mocks::MockExpectationError in ‘Codebreaker::Game starting up should prompt for the first guess’
Mock ‘messenger’ expected :puts with (“Enter guess:”) but received it with ([“Welcome to Codebreaker!”], [“Enter Guess:”])
/Users/Innovia/Sites/cukes/spec/codebreaker/game_spec.rb:15:in `block (3 levels) in

Finished in 0.004188 seconds

2 examples, 1 failure

2009-10-04By "ignore" we mean "allow without comment." It still records them for error messages.
110SUGGEST

Supply download link for:
cb/49/features/game_generates_secret_code.feature

2009-12-22
82SUGGEST

The need for the start method parameter breaks the feature “codebreaker_starts_game”. Maybe it should be left as task for the reader to complete the test cycle.

2009-12-06
151TYPO

one “be” too many

“At this stage you could be forgiven for be thinking this looks a lot like traditional top-down decomposition.”

2009-09-02
27TYPO

Following the instructions leading up to the first cucumber command—“cucumber features”—results in correct output up to and including “You can implement step definitions for undefined steps with these snippets:”, but no snippets are provided. The step_definitions folder and at least an empty greeter_steps.rb need to be present before “cucumber features” will spit out the snippet templates.

Simply including instructions to create a placeholder directory and file would help avert confusion and wasted time spent troubleshooting when the output is not as expected. (I’m on Ubuntu 9.04 though I would think the problem is not system specific. Cucumber version is 0.3.98.)

2009-09-15Thanks for letting us know - we'll definitely get it fixed. To avoid future confusion, you should probably stick to the versions listed on http://wiki.github.com/dchelimsky/rspec/code-for-the-rspec-book-beta. This particular example works as advertised with that version, as do (hopefully) most in the book. \n \nDuplicate with 40736
99SUGGEST

The code switches from “r g y c” to “r y g c” here. Why not keep consistency through all examples?

2009-12-23
126ERROR

In generator_spec.rb an instance variable @generator is set in the before method, but not used in any of the following tests.

2009-09-15
154TYPO

First word on page: “inadvertantly” should be “inadvertently”.

2009-09-15
208TYPO

5th paragraph, starting ‘When the Statement executes the generate( ) method,’ contains use of contraction-as-possessive “it’s name() method” … this should be “its name() method”

2009-09-22
210TYPO

In third paragraph, starting ‘Now we have three participants in the example:’, at the end of the paragraph, the sans-serif text contains the word ‘when’ by accident. It should read ‘Statement logs a message on generate()’

2009-09-22
217TYPO

In first paragraph of section “Counts”, at the end, I believe it should read “We can set this expectation explicitly…” rather than “We can make set this expectation explicitly…”

2009-09-22
218TYPO

misspelling of “message” (as “mesage”) in second paragraph under heading “Negative Expectation”

2009-09-22
219TYPO

heading “anything()” seems to appear too early. The last paragraph of the previous section appears after that heading, and has the first paragraph of the “anything()” section as its last couple of sentences.

2009-09-22
221TYPO

Example output appears to be incorrect in section “Custom Argument Matchers”. “BiggerThanThreeMatcher” should be “GreaterThanThreeMatcher”

2009-09-22
206OK

The method call double() causes an error with RSpec 1.2.8:
undefined method `double’ for #

2009-09-22double() is introduced in rspec-1.2.9, which hasn't been released yet. This is mentioned in the book. \n \nThere is a release candidate of 1.2.9 available now if you're interested. Just "[sudo] gem install rspec --prerelease".
210OK

For clarity, shouldn’t the code example contain a mock object instead of a “stub object”?

customer = stub(‘customer’)
customer.stub(:name).and_return(‘Aslak’)

…looks a bit weird.

2009-09-22
257ERROR

I tried to run ‘autospec’ as suggested on this page, but I found that, while raising no errors, it also did nothing at all. After a little digging, I discovered that I needed to ‘[sudo] gem install ZenTest’ (with caps) in order to have the appropriate foo installed for ‘autospec’ to function. This is under MacOS 10.5.8 (uname -a == Darwin hypercycle.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386)

2009-09-15
259OK

Perhaps not reasonably w/i the purview of the text, but after installing the ‘heckle’ gem, the example command given in the text results in an error message. According to stackoverflow.com questions 1144906 error-running-heckle-currentcode-undefined-method-translate-for-ruby2ruby
the problem is because of a silent change in API between ruby2ruby v1.2.2 and v1.2.3. Since 1.2.4 was installed by the Gem subsystem, and also failed as shown in the webpage I referenced, it looks like the problem persists. Thought you might like to know.

2009-10-04
302TYPO

at the top, “the line on which the feature is declared” should be “the line on which the scenario is declared”

2009-09-22
123ERROR

When I try to add the custom failure message:
——————
count.should be_between(min.to_i,max.to_i),
“expected #{count} to be between #{min} and #{max}”
——————

ruby complains about wrong number of arguments:
——————

  1. features/step-definitions/codebreaker.rb:69
    wrong number of arguments (2 for 1) (ArgumentError)
    ./features/step-definitions/codebreaker.rb:75:in `should’
    ——————

I have version 1.2.8 of rspec installed.

Any idea?

2009-09-15I'd need more detail - that should work as you expect. Please report this to http://rspec.lighthouseapp.com/rspec. \n \nThanks.
54ERROR

This, I believe, is technically incorrect: “How many times do we invoke Then the game should say: ….? Twice in this scenario!”
“the game should say” is invoked twice, once following “Then”, once following “And”, but “Then the game should say”, per se, only appears once. I don’t bring this up to be priggish but because it caused me genuine confusion. Unless I’m missing something and “Then the game should say” was in fact invoked twice.

2009-09-15
56SUGGEST

this:
The next question is how to express this design decision in the step definition?
is not a questions, so should have a period, not a question mark.
just sayin’

2009-09-15
387TYPO

“Run the spec—4 examples, 0 failures, 2 pending. Wait a minute. We were expecting it to fail, but it’s passing.”

should say:
“4 examples, 0 failures, 1 pending”

2009-10-22
393TYPO

The paragraph beginning with:

“Before we get started we need to add a migration for the User model that was added in the controllers chapter. Go ahead and generate a migration to create the users table with a login attribute.”

Seems to be leftover from a previous iteration of this chapter. The code examples and the remainder of the chapter does not reference this at all.

2009-10-22
72SUGGEST

When showing the example of moving the declaration of messenger to the before(:each) method, you have only updated the it “should send a welcome message” action to the new instance variable, though with the intention of removing duplication, we want to update the “should prompt for the first guess” action as well. You may want to reflect this in your example.

2009-09-15It is reflected over the next two pages. One step at a time.
27TYPO

In first code example, line 4
“As a reader of a The RSpec Book”
should be
“As a reader of The RSpec Book”

(Same for all subsequent uses of that line of code.)

2009-09-15
30TYPO

In last paragraph, “how to use in the context of” should be “how to use them in the context of”

2009-09-15
56ERROR

Last paragraph on the page says to invoke cucumber as:
cucumber features/codebreaker_starts_game -s
This does not work, and generates a ‘missing file or dir’ error. You have to add the .feature extension like so:
cucumber features/codebreaker_starts_game.feature -s

2009-09-15
27ERROR

One thing that I noticed is that the method snippets only appear if you have a step_definitions file. It could be empty, but it must exist to methods snippets to appear.

2009-09-19Duplicate of 40736
324TYPO

Missed and & in Peanut butter & jelly?

2009-09-15
357TYPO

I think the code listing between pages 357 and 358 is incorrect - I was expecting the code for messages_controller.rb rather than a repeat of the code for messages_controller_spec.rb.

2009-10-04
60OK

Page 60 (implicitly) describes the directory structure as spec/codebreaker, but the chart on page 49 shows codebreaker/spec. So I’m thinking the code on page 60 is wrong…?

2009-09-19The code is right. The top level codebreaker directory in the diagram is the project root, but you can see another codebreaker directory inside the spec directory further down.
40TYPO

Downloads of code on this page have #START, #END in them ie:

#START:title_and_narrative
Feature: code-breaker starts game

As a code-breaker
I want to start a game
So that I can break the code
#END:title_and_narrative

#START:scenario_only
Scenario: start game
Given I am not yet playing
When I start a new game
Then the game should say “Welcome to Codebreaker!”
And the game should say “Enter guess:”
#END:scenario_only

2010-07-18
207SUGGEST

The first code example in section 14.2 Method Stubs has misleading code highlighting.

On line 6 of the code example:
statement.generate.should =~ /^Statement for Aslak/

The word “for” is highlighted as a ruby keyword, and led me to some head scratching.

2010-07-21Dave Thomas: Indeed—I'm afraid our syntax highlighter can be dumb on occasions. It isn't a simple fix, so we're going to punt on this one.
88OK

Code being truncated at right margin on pages 88, 89 and 91

2009-12-22All truncated code will be addressed before we go to print.
351ERROR

“The MissingTemplate error is gone, but the spec still fails with a new error:
undefined method `spec_mocks_mock_path’ for #
What’s happening here is that the form_for( ) method used in the view expects the message to be a model, but it’s a simple stub.”
The error I get is “undefined local variable or method `messages_path’ for” ect… which makes sense since just creating new.html.erb doesn’t populate the template with a form… Steps should include adding form_for which would take care of the previous failing step..

2009-10-04
336SUGGEST

I think it would be clearer if you put the code at the very top of this page inside the class definition, that is start the code block with “class ActiveSupport::TestCase” and include the additional “end” statement. It is shown this way on page 334, but here when you tell the reader to add it to the code it’s not shown.

2009-10-22
65SUGGEST

this is the first time I’m seeing “mock” object introduced. There should be a footnote or short blurb explaining that should_receive sets up an expectation but is satisfied only after game.start is executed. I was so confused by what was going on because I thought that the messenger (STDOUT or StringIO) was receiving a puts message BEFORE game.start. It isn’t until the chapter on Spec::Mocks that the order is explained.

2009-11-23
83ERROR

My cucumber output does not match the error-free output in the beta book p83: “13 scenarios, 26 undefined steps, 13 passed steps”. I get: When I start a new game # features/step_definitions/codebreaker_steps.rb:12
wrong number of arguments (0 for 1) (ArgumentError)
./features/step_definitions/codebreaker_steps.rb:15:in `/^I start a new game$/’
features/codebreaker_starts_game.feature:9:in `When I start a new game’.

This is due to the fact that in the features/codebreaker_steps.rb, start() is still called with no arguments, while in the game_spec.rb and game.rb the start() method now requires an argument but this is never addressed in the features/codebreaker_steps.rb file.

2009-12-06
128TYPO

We could, of course, just think about how we want this to work and just write the code for it, but we want write the simplest thing that could

should be “want TO write”

2009-10-04
210TYPO

Under “Message Expectations,” you use “it’s” instead of “its”:

“In this example, if the generate( ) method fails to ask the customer double for it’s name,”

2009-10-22
70ERROR

This page introduces the “as_null_object”, supposedly as a strategy for allowing the messenger mock object to expect not ONLY the argument in should_receive, but POSSIBLY other stuff too.

It doesn’t seem to work this way. When I run spec spec/codebreaker/game_spec.rb I get the following logical error message:

Mock ‘messenger’ expected :puts with (“Enter guess:”) but received it with ([“Welcome to Codebreaker!”], [“Enter guess:’”])

It seems the as_null_object modifier allows the mock to bypass the unexpected message, but instead it seems to be expecting a specific SET of messages.

Hope that made sense.

2009-11-23Added a footnote explaining this.
83TYPO

midway down the page,

def start

should be def start(code)

2009-12-06
221TYPO

The text in the middle of the page says this: “Can’t get much more concise that this.” I believe it should say: “Can’t get much more concise than this.” The word “that” should be changed to “than”.

2009-10-22
215TYPO

the second describe() and all it() calls do not have a “do” to start the blocks in the WidgetsController example

2009-10-22
29SUGGEST

Just a small suggestion on the general writing. The phrase “go ahead and X” is used very frequently. You can simplify this and make it a little less repetitive by just writing “X”.

2009-10-22
25SUGGEST

It might help to include " (DSL)" directly after using it fully spelled out once. And maybe spelling it all out again later on through-out.

Almost a touch silly, but i ran across the term DSL later on in the book and didn’t know what it meant, so i searched for it. The line below the full spelling out matched, but when i went to that instance, it was the top line on my screen, so i didn’t see the line above it spelling it out.

2009-10-22
28SUGGEST

In the “greeter says hello” feature example, the feature description says “As a reader of a The Rspec Book”

It seems the intent is to convey that we are ‘a [user] of a [something]’ - however, it reads akwardly. It might read more clearly if it were changed to “As a reader of The Rspec Book”

2009-10-22
28ERROR

After the user is instructed to type ‘cucumber features’ it says “You should see output like this:” and shows snippets for the pending step definitions. These snippets are only displayed if a file with a .rb extension exists in the features/step_definitions/ directory.

I tested this by running ‘cucumber features’ with the following:

1. features/step_definitions does not exist - no snippets were displayed

2. features/step_definitions exists, but contains no files - no snippets were displayed

3. features/step_definitions exists, and contains the file ‘foo.txt’ - no snippets were displayed

4. features/step_definitions exists, and contains the file ‘foo.rb’ - Joy! got snippets

5. features/step_definitions exists, and contains the file ‘greeter_steps.rb’ - got snippets

2009-10-22This has been addressed in a newer version of cucumber
334ERROR

While setting up Selenium for use with Cucumber, adding the line “config.selenium_wait_timeout = 10” as indicated in the example env.rb causes a NoMethodError to be thrown when ‘rake features’ is run.

undefined method `selenium_wait_timeout=’ for # (NoMethodError)
./features/support/env.rb:22
/usr/lib/ruby/gems/1.8/gems/webrat-0.5.3/lib/webrat/core/configuration.rb:8:in `configure’
./features/support/env.rb:20

2010-01-17This was fixed in webrat-0.6.0
51TYPO

in the features section, “reponsible” should be “responsible”

2009-10-22
300TYPO

“In the default configuration, it will also runs each scenario in an isolated DB transaction.”

2009-10-04
134TYPO

“addiitonal” should be “additional”

2009-10-04
108ERROR

There is still a logic error in the Codebreaker::Game::guess method, even after the last correction.

Similar to the last correction (where a ‘b’ can be overwritten by a ‘w’), the code still suffers from the problem where a ‘w’ can be overwritten by a ‘b’.

If the code is ‘r g g c’ and the guess is ‘g g c r’, then the logic works as follows:
1) the first ‘g’ gets a ‘w’ marked in the second position
2) the second ‘g’ gets a ‘b’ overwriting the ‘w’ in the second position. The fact that the first ‘g’ still should be marked as a ‘w’ in the third position is lost.
3) the ‘r’ and ‘c’ each properly get marked as ‘w’
4) the mark returned is ‘bww’ but should be ‘bwww’

A code example demonstrating this:

module Codebreaker
describe Game do
before(:each) do
messenger = mock("messenger").as_null_object game = Game.new(messenger) end ... context "with all 4 colors correct and 1 in the correct place, w before b" do it "should mark the guess with bwww" do game.start(stub(‘generator’, :code => %w[r g g c]))
messenger.should_receive(:puts).with("bwww") game.guess(%w[g g c r])
end
end
end
end

2010-01-15
109ERROR

Another code example demonstrating another logic error:

module Codebreaker
describe Game do
before(:each) do
messenger = mock("messenger").as_null_object game = Game.new(messenger) end context "with all 4 colors correct and 2 in the correct place, w after b" do it "should mark the guess with bbww" do game.start(stub(‘generator’, :code => %w[r g c g]))
messenger.should_receive(:puts).with("bbww") game.guess(%w[r g g c])
end
end
end
end

2010-01-15
212TYPO

Inconsistency: here “life cycle” is two words, whereas on page 140 it is one.

2009-10-22
218TYPO

“developement” should be “development”

2009-10-22
159TYPO

“the acceptance criteria is “owned” by the tester" should be “the acceptance criteria are “owned” by the tester"

2009-11-23
158ERROR

Contradiction: here on page 158 in the context of describing the BDD process, you state that driving out the detail of a story (including the Acceptance Criteria) “doesn’t need to happen during the inception (and probably shouldn’t!) but it does need to happen before we start coding.”

But back on page 40, we were told that Acceptance Test Driven Planning is one of the three practices of BDD, and ATDP specifies that the acceptance tests are agreed on during or possibly before, but no later than, an iteration planning meeting.

So does BDD allow for acceptance tests to be defined any time prior to coding, or no later than iteration planning?

Furthermore, if BDD is to be more formally defined as consisting of the three specific practices referenced on page 40, then I would expect Chapter 11 to detail this.

2009-11-25That text is talking about inception, not iteration planning. \n \nInception is at the beginning of a project, when we're assembling the full initial stack of stories. That's not the same as iteration planning where we're scheduling work. I'll tweak the text to make this more clear.
225SUGGEST

Add some introductory/explanatory text to the example code in the “Yielding” subsection

2010-07-21
159SUGGEST

I’m looking for a good bit more detail on how the BDD and Cucumber/RSpec tie in with the roles and processes of agile development.

For example, we are told that testers “own” the acceptance criteria. But how does that flow into the use of tools? It seems quite natural to me to have the testers own the free text part of Cucumber features, and have developers own the step definitions (perhaps after some negotiation with the testers and BAs to get the scenarios phrased in a way that is amenable to step definition automation). Then the coders create the code, specs and step definitions following the “BDD Cycle” described earlier. As the coders finish some subset of story functionality, they check in their work in progress into source control, and the cucumber reports resulting from the continuous integration build inform the testers of what scenarios in the story are ready for him to start manual/exploratory testing. Then this should flow in to product owner acceptance of the story when all acceptance criteria are demonstrated.

You’ve started the description of how we kick off use of BDD. Tie it in more tightly with all of the processes within an agile iteration.

Also, some discussion is warranted here regarding the applicability of BDD and Cucumber/RSpec to acceptance criteria in general. What types of acceptance criteria should be driven out by BDD? Everything, always, or are there times when other methods like prototyping of screens (without true end-to-end slices of functionality) should be used instead? Similarly, what types of acceptance criteria are appropriate to drive out using Cucumber and RSpec, vs. others which are more appropriate for other tools or manual processes? When different methods are more appropriate, what roles should own them?

Should there be a process step early in each story where the acceptance criteria are discussed, and the testers and coders decide how each one should be demonstrated, with some handled by coders using Cucumber/RSpec, and others demonstrated by testers using other processes/tools like manual testing or GUI automation tools like Selenium? Should there not be a division of responsibilities across roles so that the resulting automation test suite is complete and non-overlapping (DRY)? If so, what do you suggest for a proper division?

2010-01-15Thanks for your thoughtful comments, Tim. I agree there should be more information generally about BDD as a methodology, but that is beyond the scope of the RSpec book. A full treatment of BDD would be a book in its own right, and would necessarily be tool-agnostic (although it might have opinions :) \n \nWhen you talk about roles and processes of "agile development" I'm guessing you are referring to Scrum because you mention roles like Customer and Product Owner. Also you mention "processes within an agile iteration". Some agile methods don't even have iterations (Lean and Kanban for instance) and some use a different term like Sprint (Scrum again) or Timebox (DSDM). \n \nDitto your comments about acceptance criteria. That is another topic worth a fuller discussion in a BDD methodology book (think "XP Explained", or "Domain-Driven Design"), and I would like to expand on the relationship with models like Systems Thinking and Lean. \n \nAs regards your last question, I don't think DRY applies so much to acceptance testing. A test suite is made up of complementary tests, so there is no reason not to test the same behaviour for different reasons (correctness, speed/latency, repeatability/idempotence, concurrency, etc.). The primary value of tests is readability, both in terms of the test narrative and the error when something fails. I blogged about this a while ago at http://dannorth.net/2008/06/let-your-examples-flow.
115SUGGEST

The Cucumber “World” concept has not been introduced to the reader yet at this point. Perhaps add a forward reference to the Cucumber chapter, or rephrase.

2010-01-17
113ERROR

I don’t agree with this assertion in the text:
“On the other hand, if we pass it [the generator] to new( ), then we have to create a new Game every time we want to play a new game.”
Why? The Game::initialize() method can save a reference to the Generator, and Game::start() can invoke Generator::code() to create a new secret code each time a new game starts.

2010-01-17
77SUGGEST

“Luckily, we have tools in both RSpec and Cucumber to keep things simultaneously readable and DRY.”

On the contrary, I find that the combination of both RSpec and Cucumber causes a decidedly non-DRY result. When the BDD Cycle process is followed, a redundant RSpec code example is created for every failing Cucumber scenario. The result is a lot of overlapping tests. In the final iteration of the Codebreaker, the resulting RSpec and Cucumber suites were about 80% redundant with one another.

While I recognize that the primary purpose of Cucumber scenarios and RSpec code examples is to drive out the design, an important secondary use for them is as a regression test suite. As a result of the overlap of the RSpec and Cucumber suites, the majority of features in the Codebreaker app had two tests which would fail if any of the functionality changed. Over time this would result in a significant drag on development extensions of the app.

Shouldn’t we be trying to have a DRY test suite with minimal redundancy? Specifically, I question the wisdom of creating a failing RSpec example for every failing Cucumber step definition. What is the harm in allowing the step definition to drive the application design directly?

Perhaps overlap of test suites is not such a big issue in a more serious application. In a toy app like Codebreaker, there is little behavior which is not directly externally visible to users. This may ultimately be the cause of why the two test suites overlap so drastically. Bigger apps with more hidden details would have more RSpec examples not duplicated as Cucumber scenarios, so the proportion of overlapping tests would be smaller.

Still, why should there need to be redundant test coverage even for externally facing behaviors? It seems like some guidance is in order regarding which tool is more appropriate for which kinds of behaviors. E.g., Cucumber should be used for externally visible behaviors which are important enough to be included in acceptance criteria for features, whereas RSpec should be used for lower-level behaviors. Or similarly Cucumber is a tool for black-box behavioral testing where RSpec is for white box.

If the authors truly believe that there is real value in creating the redundant RSpec tests in order to better drive out the design (and I’m not catching how the redundant RSpec example is any better than the step definition it matches), perhaps then the process should include a step to delete the redundant RSpec tests from the test suite following story acceptance (or feature release). If their value has played out, why pay the cost of dragging along the baggage of redundant tests?

Furthermore, I think there should be a clearer distinction between what behaviors should be demonstrated in Cucumber vs. RSpec acknowledging the target audience for the tools. RSpec is a developer-centric tool, where Cucumber bridges the gap to testers and BAs. I think a strong argument can be made that all non-trivial externally visible behaviors should be reflected in Cucumber scenarios. In the BDD cycle when creating RSpec tests, if the developer discovers a new behavior needed by the app, your description has him creating an RSpec code example for it. But should that behavior then be demonstrated by a Cucumber scenario which duplicates (or preferably replaces) the RSpec example? The advantage of moving the behavioral demonstration to Cucumber is that you have made it accessible to testers and BAs, which assures that they become aware of it and gives them a change to review it. Developers alone should not be the ones to decide important functionality of the app. In the Codebreaker app, an example of this is adding the ‘reveal’ feature to Game::guess(). While this was done to facilitate testing, it resulted in the addition of important externally accessible behavior, and the BAs should be aware of it. E.g., the BAs might object to adding a mechanism to the game which makes it so easy to cheat, because they might be targeting the app toward competition use. Leaving the demonstration of the behavior “buried” down in RSpec is unwise from an agile process perspective.

Throughout the book, I would expect to see more information regarding best practices for use of the tools and how they should fit into agile processes, not just a demonstration of how the tools work. Some of what I am asking for belongs more in Chapter 11, but I would also expect to see more about how to make appropriate use of the tools throughout the extended Codebreaker example in Part 1.

2009-12-06Hey Tim - you've presented a lot to think and talk about here, and I'd love to discuss it with you, but the errata page is really not the right forum. If you're interested in a conversation, please re-post to the discussion forum at: http://forums.pragprog.com/forums/95. \n \nYou also might want to consider posting this on the rspec users (http://rubyforge.org/mailman/listinfo/rspec-users) or cucumber (http://groups.google.com/group/cukes) lists/groups where more people who have experience with BDD can chime in. I really hope you will post in either location, but I can't really mark this "fixed" or "not fixed." \n \nCheers, \nDavid
334SUGGEST

It says “To modify this feature file to run through Selenium, we must make.” It should say “we had to make”.

2009-10-22
42OK

Just to make things 100% idiot-proof, maybe you should state that the file we have just written goes into the features subdirectory.

2009-12-06It is already present in the path, which is in both the links to the example code files and in the text.
369TYPO

The last paragraph references creating the messages_controller.rb file and adding in the MessagesController class, but the following code is from the messages_controller_spec.rb displayed earlier in the page.

2009-10-22
39TYPO

Does that sound like we’re putting the developer’s needs ahead of the
needs of the stakeholder’s needs?
=>
Does that sound like we’re putting the developer’s needs ahead of the
needs of the stakeholder(s)?

2009-10-22
75SUGGEST

Has it been explicitly explained how to “run the script” before this point?
The description is verbose enough that a line or two on running the bin/codebreaker script would be helpful without being OTT.

2009-11-23
204TYPO

“Can’t get much more concise that this.” should read: " Can’t get much more concise than this."

2009-10-22
100ERROR

Between chapters, the code used in the scenarios seems to have swapped from “r g y c” to “r y g c,” causing the output to differ from that presented in the book.

2009-12-23
32TYPO

We picked a game because we thought it be more

I think you meant -
We picked a game because we thought it would be more
^

2009-11-23
52OK

The given block that starts on page 51 is interrupted by footnotes on that page, followed by a gray box explaining the download files, and then there’s the word “end” - code block should not be broken up if at all possible for clarity purposes

2009-11-23Formatting issues like this will be managed when we go to copy edit, which doesn't happen until the end of the beta program.
55OK

I’m getting errors after copying code from the pdf into gedit and then running cucumber - code that has a " followed by a $ is inserting a space when copied into the editor - this results in a step undefined error - this happens with all such code that I have copied, such as the following - (as a matter of fact, the space was added when pasting into this “description” box, so it must be there but not showing in the .pdf

Then /^I should see “([^\\”]*)" $/ do |message|
@message.should == message
end

2009-12-06Not sure what reader you're using, but what you're describing is a function of the reader and there's little we can do about that.
62OK

Similar issue here as reported before - there’s a big “Joe Asks” box followed by the word “end”, which is the final bit of code from the previous page interrupted by footnotes and “Joe Asks”

2009-11-23David Chelimsky says: Formatting issues like this will be managed when we go to copy edit, which doesn't happen until the end of the beta program.
61OK

Working the code along with the text was very intuitive up to this page - all of a sudden, it’s just “add code to this file a command”, add another command to another file, include this, include that - and voila everything will work. I take it you’re assuming everyone knows what $LOAD_PATH and File.join and File.dirname commands are doing. Obviously, one can figure it out but the intent of the book should be more tutorial and explanation, as previous pages were.

2009-12-21The book assumes a basic working knowledge of Ruby, which includes understanding the things you're asking that we explain. We do try to explain some things as we go along, but we can't stop to explain everything and still keep advanced readers interested, so we've attempted to strike the right balance.
62OK

I’m getting lost at this point - on page 60 the chapter starts with “we’re going to use RSpec to describe behavior” then it’s three pages of adding code to various files, ending with running an RSpec command that really tells us nothing - then moving on to cucumber again? The book had a great pace and I knew exactly what was going on until Chapter 5.

2009-12-06Not sure how to help you with that. The infrastructure we add there is necessary before we can proceed.
71OK

Had to use , :null_object => true in declaring the mock as as_null_object blew up

2009-11-23Are you using rspec-1.2.9? If you are and you're still seeing this, please report a bug to the rspec tracker at http://rspec.lighthouseapp.com.
74SUGGEST

Looking at the code, especially when doing refactors - the refactored lines should be highlighted in some way to immediately make obvious what is being changed

2010-01-15
75SUGGEST

I really think this chapter needs some work - we end on page 72 with an spec command. Then we do a bunch of fairly clear refactorings, only to be told to “run the feature again” - well, the last thing we did was spec - now we’re back to features. This chapter really bounces back and forth and loses the reader along the way

2010-01-15
83TYPO

def start
@messenger….

should be
def start(code)
@messsenger…

otherwise test breaks again

2009-12-06
344TYPO

There are two “The”s in the second section of "render(), response(), and contain().

2009-11-23
347TYPO

“Update the before block to use mock_model( )”

The before block was in beta 10.0 its no longer in beta 11.0

2010-01-17
348SUGGEST

text from 348 to 351 needs breaking up with some headers. Its very easy to get lost in the example. I would suggest some sub headings like

Create Message Class
Mock As New Record
Add Input Field
Mock Title Attribute
Mock Null Object
Dry up with before(:each)

Perhaps these could be notes in the margin if titles are to unobtrusive

2010-07-21
354OK

orphaned ‘end’ from code example at beginning of page - should be kept with rest of code example

2009-11-24Formatting issues like this will be managed when we go to copy edit, which doesn't happen until the end of the beta program.
360TYPO

“Open the new template and remove the form. ”
should be a bit more specific?
“Open the new template and remove the render of the form partial. ”

2009-12-22
303TYPO

In the rspec_model generation snippet, the ‘rake db:migrate’ task is misspelled as ‘rake db:mgirate’

2009-11-23
370OK

p369/370
We don’t need
.and_return(@message)
once we have refactored the “creates a new message” using a before block. Our before block ensures the message is returned for the save and our test is not concerned about the message

2009-12-22The stub in the before block gets overridden by the expectation in the example, so we actually do need to return it in this case, otherwise the example raises an error on nil.save.
405SUGGEST

This should be part of the Subscription spec:

it “ignores messages from previous months” do
user.sent_messages << Message.create!( :title => "Book Update", :text => "Beta 11 includes great stuff!", :recipient => mock_model(User), :created_at => Time.now - 60*60*24*31 ) subscription.can_send_message?(@user).should == true
end

Also I can’t see why you’re passing the date into can_send_message. There is no obvious current need to do this. Shouldn’t we just spec it as it is used in user? i.e. subscription.can_send_message? self

2010-01-15
391SUGGEST

This change of messages_controller break loads of the tests. It’s not at all obvious how to refactor the tests and controller in tandem to achieve this. Especially as I can’t see how to reference the current_user. This needs to be explained.

2010-07-23
301TYPO

“Go ahead and run script/cucumber —tag focus from the project root” should be “Go ahead and run script/cucumber —tag @focus from the project root”, to work with cucumber 0.4.3

2009-11-23
303TYPO

“Now run cucumber -t focus so we can see how we’re doing” should be “Now run cucumber -t @focus so we can see how we’re doing”, when using cucumber 0.4.3. Also, is it intentional to use ‘cucumber’, rather than ‘script/cucumber’? If so, you probably want to call out the difference and explain that it’s a shortcut and/or how it differs from ‘script/cucumber’.

2009-12-06
83SUGGEST

Under “A Small Change Goes a Long Way”

I just don’t think it’s explained very well when you say “Run the feature again with cucumber” that you mean “cucumber features/codebreaker_submits_guess.feature” and not just “cucumber” which is why the former poster thought they had to send a code in codebreaker_steps.rb. I got confused, too, when I didn’t get the 13/26/13 thing. Then I realized what you meant by “Run the feature again with cucumber”… I would clarify this.

2009-12-06
51OK

In section 4.2 Steps and Step Definitions, the code example is split, with the “end” being orphaned on page 52 and separated from the widow by a callout “Doanloadable Files.”

That is, on page 51 there is some code that should read:

Given /I am not yet playing/ do
pending
end

But this code is split by (a) the page break, (b) footers, © the “Downloadable Files” call-out.

So on page 51 you see:
Given /I am not yet playing/ do
pending

1. As we’ll review later in Chapter 18 …

then on page 52 you see:
| Downloadable Files
| blah blah blah
+———

end

which is a little odd.

2009-11-23Formatting issues like this will be managed when we go to copy edit, which doesn't happen until the end of the beta program.
303TYPO

after doing “script/generate rspec_model”
migrate is written wrong (rake db:mgirate<)

2009-11-23
301TYPO

I got following error when I run “script/cucumber —tag focus”

Tag names must start with an @ sign. The following tag name didn’t: focus (RuntimeError)

The error disappear when run follwing,
run script/cucumber —tag @focus

2009-11-23
34SUGGEST

I think you should spell out the fact that the computer is taking the Code Maker role.

2009-11-23
45ERROR

“This looks a lot like the scenario declarations we wrote for the code- breaker starts game feature, with two subtle differences” - should refer to the code-breaker submits guess feature.

2009-11-23
344TYPO

require ‘webrat/integrations/rspec-rails’

should be:

require ‘webrat/integration/rspec-rails’

2009-12-06
344TYPO

“… outermost describe( ) block, “mes-
sages/show.html.erb”in this case. …"

It’s missing a space before “in this case.”

Maybe “messages/show.html.erb” should not break in two lines as it is a filename.
—lucas

2009-11-23
394OK

on rails_models/beta2/03/app/models/user.rb snippet

“…
has_many :received_messages, :class_name => Message.name,
:foreign_key => ”recipient_id"
…"

Should be
“:class_name => Message”

and not
“:class_name => Message.name”

2009-12-22:class_name should reference a String, not a class. It should either be as/is (Message.name), or represented as a String ("Message")
344TYPO

The second sentence in the first paragraph under render(), response() and contain() says: “The The rendered content[…]”

Hope that’s clear enough ;)

2009-11-23
301TYPO

First full paragraph on the page starts with “The do,”. It should be “They do,”.

2009-11-23
33DEFER

I would like more information on the higher-level project descriptions i.e. outcomes and feature sets, and how they fit in. Specifically, I want to know how they would fit in with the codebreaker example - what are the feature sets for it? Would there be outcomes?

2010-07-18
303TYPO

Last sentence of last paragraph, file name should be movie.rb not movies.rb.

2009-11-23
356TYPO

In the _form code at the bottom of the page, the line beginning with “describe” should have a triangle marker next to it denoting the line has changed.

2010-01-17
357TYPO

The two code lines beginning with “@message.stub” should have triangle markers denoting these lines have changed.

2010-01-17
356ERROR

In the code for _form.html.erb_spec.rb both the book and the download are missing the empty Message class definition (class Message; end). I get:
NameError in ‘messages/_form.html.erb renders a form to create a message’
uninitialized constant Message

when I don’t include the empty class definition in the code.

2010-01-17
338ERROR

A cross reference is missing in the third bullet point:

You’re not using the Webrat API. If you’re using the technique
described in [CROSS REF],

2010-01-17
348TYPO

“undefined method `message_path’”

should be

undefined method `messages_path’

with an extra s.

Same for:

“there is no message_path route”

2009-12-06
119ERROR

In the inner line of the Then implementation, you can’t line-break before the . because Ruby will think it’s an end-of-statement.

secret_codes.count_for(color, position)
.should be_between etc

should be

secret_codes.count_for(color, position).
should be_between etc

Tested on MRI 1.8.7p174

2009-11-23
368SUGGEST

If you created the app with “rails views_example” and have been following along, adding code as you read, you get an “uninitialized constant Message” error rather than the “No action responded to create”. As far as I can tell the book never says when to create the message.rb model file. I think the book would be improved if you mentioned at some point when to create message.rb. Seems like you expected this to happen sometime in the last chapter (see my comment #41571:).

2010-01-17
378TYPO

3rd line up from the bottom of the page should say:
Now it fails with uninitialized constant FooController::AccessDenied

At least that is the error I got.

2010-07-21
381TYPO

Last word, first paragraph missing an ‘a’ from behaviour.

2009-12-06
301TYPO

The line:
“The do, however, facilitate conversation between the customer and devel-”

should be “They do…”

2009-12-06
389ERROR

This page says: “Now all examples are passing…” but I’m still getting an error: “uninitialized constant Message::User (NameError)” Looking at the schema.rb from the downloadable code it looks like a User model got generated but I don’t see this mentioned in the book.

To get things working I did the following:
script/generate rspec_model user name:string email:string
rake db:migrate
rake db:test:prepare

2010-07-21
36OK

In the footnote, is the word “smaller” supposed to be “larger” or “bigger”?

2009-12-06No. That's the joke. Rather than getting a bigger card to fit more information on, you should get an even smaller card to enforce the constraint of having very little detail on the card.
40TYPO

you use “the the” right before the start of the narrative paragraph: … which improves our ability to plan iterations, hence the the name Acceptance Test Driven Planning.

2009-12-06
41SUGGEST

I noticed that on page 28, you use the “In order to… As a… I want” style, but on this page you are still using the older “As a… I want… So that…” Is this intentional, or did pg. 41 not get updated. You may have mentioned it, but it might be helpful to mention the theory behind keeping the “In order to” first (Liz Keogh has some great stuff on this).

2010-01-17
61OK

“We’ll want to load game.rb and any other source files from a single location, so require the file from lib/codebreaker.rb”

Huh, lol?! Why would we want to do that? It’d be great if this was expanded on. When I read it, it seemed like needless complexity, but I’m sure there’s a really great reason/learning-experience there…

Thanks - love the book!!

2009-12-06This is a standard convention in many libraries. It helps with namespacing (it would not be good to have a top level Game class), organization, and code navigation.
314ERROR

env.rb file for simulated_browser/03 supplied with the code is incorrect. It referrs to selenium and throws errors when run as suggested in the book in the footnote 2. However, if you are following along (I am), the env.rb file that gets generated is fine and the code executes correctly. So, in a nutshell, the code supplied with the book is out of sync with the book.

Bharat

2010-01-17
317TYPO

In the last sentence of the first paragraph, I believe it should say unobtrusive instead of obtrusive.

2009-12-06
344TYPO

Last paragraph starts with The The.

2009-12-06
398SUGGEST

On the last paragraph of this page you ask for a migration, but don’t mention doing “db:test:prepare” as you have done in other places in the book. Might be nice to make mention of that here too.

2010-01-15
83TYPO

My cucumber returns:
13 scenarios (13 undefined)
39 steps (26 undefined, 13 passed)
I guess this is OK as none of the scenarios are finished with their definitions - but I spend a while trying to hunt for a return as it is quoted in the book - until I concluded the above guess.

2009-12-06
353TYPO

new.html.erb_spec.rb file code has dropped the line:
class Message;end
inadvarently and therefore the all the tests fail.
Bharat

2010-01-17
115SUGGEST

I don’t understand the footnote on this page: “Note that the code included when you require spec/stubs/cucumber does not verify message expectations.”

I’m guessing it means that you still have to require rspec in addition to “require ‘spec/stubs/cucumber’,” but I’d love some more info here.

Thanks!

2009-12-22
84ERROR

The example code for cb/27/lib/codebreaker/game.rb should contain the argument “code” for the def start method (fixed below):

def start(code)
messenger.puts "Welcome to Codebreaker!" messenger.puts “Enter guess:”
end

2009-12-06
304SUGGEST

I believe that it would be a lot better if the rails example was as integrated as the codebreaker.

In truth it defines a very different aproach from regular rails and it doesn’t make sense to use old rails approach to continue the example because the rspec way is only in latter chapters.

Its a great book and it would be great if you could make it more complete, as some issues are very fresh and aren’t easy to track down over the web.

2009-12-06Appreciate the thought and it's something we may do in a 2nd addition.
420TYPO

Eliminate the the second instance of the word “be” from the sentence: “In order to control how many messages can be sent in a month, the subscription will need to be know how many messages have already been sent.”

On the very first line of this page.

2009-12-06
135TYPO

feel for how to do go about it

2009-12-06
145OK

Using the code linked to from pp 144-145, rspec is generating errors for the two summary tests:

Spec::Mocks::MockExpectationError in ‘Codebreaker::Game marking a guess with the text ’summary’ after one guess should print the summary’
Mock “messenger” received :send_summary with unexpected arguments
expected: ([#<Codebreaker::Guess:0x101807710 mark=["w", "w"], guess=[“b”, “w”, “y”, “r”]>])
got: ([[#<Codebreaker::Guess:0x101808390 mark=["w", "w"], guess=[“b”, “w”, “y”, “r”]>]])

and

Spec::Mocks::MockExpectationError in ‘Codebreaker::Game marking a guess with the text ’summary’ after three guesses should print the summary’
Mock “messenger” received :send_summary with unexpected arguments
expected: ([#<Codebreaker::Guess:0x1017fd968 mark=["w", "w"], guess=[“b”, “w”, “y”, “r”]>, #<Codebreaker::Guess:0x1017fd788 mark=["b", "b", "b"], guess=[“r”, “y”, “g”, “g”]>, #<Codebreaker::Guess:0x1017fd5a8 mark=["b", "b", "w"], guess=[“r”, “c”, “y”, “c”]>])
got: ([[#<Codebreaker::Guess:0x1017ff1a0 mark=["w", "w"], guess=[“b”, “w”, “y”, “r”]>, #<Codebreaker::Guess:0x1017febb0 mark=["b", "b", "b"], guess=[“r”, “y”, “g”, “g”]>, #<Codebreaker::Guess:0x1017fe5e8 mark=["b", "b", "w"], guess=[“r”, “c”, “y”, “c”]>]])

Changing code back to pass strings and matching the strings works.

rspec 1.2.9
ruby 1.8.7

2009-12-06That code is part of the source download. If you grab the entire code/cb/73 directory and run 'spec spec' all specs pass. Any chance there is an error somewhere else (like in the specs themselves)?
27SUGGEST

The “gem install cucumber” should be on a seperate line in the blue “code” font. this would match the “gem install rspec” instruction on page 26 and make it easier to find.

2009-12-06
88OK

spec spec/codebreaker/game_spec.rb —format nested
gives a false positive for the:
messenger.should_recieve(:puts).with(“bbbb”)
3 examples, 0 failures
(If it matters: My system is windows XP, Ruby 1.9.1p243, rspec 1.2.9). It cathes the missing ‘guess’, if I comment that out - so what could the problem be ?

2009-12-21If that's true it's a bug related to ruby on windows. The failure message you see in the book is generated by running the code. Can you please verify that it's a bug and report it to http://rspec.lighthouseinfo.com? \n \nThx
410ERROR

current_user is not defined in the messages_controller context, thus the spec throwing an error.

2010-07-25
41TYPO

Just above title “Narrative”:
" hence the the name Acceptance Test Driven
Planning."
should be
" hence the name Acceptance Test Driven
Planning."

2009-12-06
354ERROR

Under Snow Leopard, Cucumber + Selenium + Firefox is teh fux0red. Either need to patch Selenium or use Safari.

Also, current Selenium changed transaction behavior, so scenarios need @no-txn to work.

2010-01-17Solution is at http://agilesoftwaretesting.com/?p=105
144ERROR

Pages 144-145, related to #41707.

I was receiving the same Spec errors pertaining to :send_summary. The code in code/cb/73 had one additional fix that isn’t covered in the text of the chapter, which is the addition of the def ==(other) method in guess.rb

The game_spec.rb file will not pass until the def ==(other) method is added to guess.rb, but there’s no explanation as to what the method does or why it is needed.

2009-12-22
165SUGGEST

The paragraph “Outcome-based planning” ends with “and that that’s ok” which might be correct but the two “that” sound very strange and could it be dropped anyways.

2010-07-18The book hasn't been through copyedit yet. Wording issues like this will be addressed when we get there. \n
219OK

I find your diagrams such as in Figure 13.2 to be a bit confusing and generally not helpful in understanding the flow of how the example works. Maybe it’s just me, but it could be something to improve upon.

2009-12-23It is a complex interaction, but that diagram is a standard UML interaction diagram. It'll make sense to readers who have experience with UML.
145TYPO

Very begining of section 9.3, Cucumber in the Outfield:
“If you run cucumber now, you’ll see some some failures […]”

I can read some “some” duplication in this sentence (not mine, the one of the book ;-)

2009-12-22
152TYPO

psuedo-code -> pseudo-code in “With that in mind, your next refactoring exercise, and this is admittedly a doozy, is to convert the current mark algorithm to one that expresses this psuedo-code.”

2009-12-22
52TYPO

Shouldn’t

Given /I am not yet playing/ do

be

Given /^I am not yet playing$/ do

?

2009-12-21
0OK

Could you include a short section on testing rake tasks? I think that could be pretty helpful.

2009-12-21Sorry, but scope is closed for this book - we're getting close to print now.
130OK

codes.uniq.length.should be >= 95

It fails with expected >= 95, got 1.

I think it should be: “It fails with expected <= 95, got 1.”

2009-12-22>= is correct
354TYPO

Typo around middle of the page at “Now that we’ve seen how we to configure Webrat, Cucumber, and Rails
to work with Selenium …”. You use “we to” and only one of those words should be present.

2009-12-22
356TYPO

[CROSS REF] should reference sections 21.2 and 21.3

2010-01-17
358OK

There is a code line ending with TRUNC, is this supposed to be truncated?

Line starts with “selenium.is_ordered …”

2009-12-22Yes - all of the truncated code will be addressed before we go to print.
98SUGGEST

From your page: Google “exploratory testing” and you’ll find upwards of 785,000
results. Testing is a craft of its own, rich with literature, experience,
and community. But the details of exploratory testing are outside the
scope of this book, and simply “exploring the app” will suffice for our
needs.

Your point about testing is well-taken, but using Google counts is getting to be notoriously tricky. I think the huge counts are overly suggestive and maybe can’t even by counted on.

When I did it today (2009-12-11), I got about 653,000 results. Actually going through them — I clicked on page 10 and got page 8 — ends with “In order to show you the most relevant results, we have omitted some entries very similar to the 734 already displayed.
If you like, you can repeat the search with the omitted results included.”

When I searched with the term in quotes, I got about 61,500 results. Again, I clicked on page 10 and got page 8 with “In order to show you the most relevant results, we have omitted some entries very similar to the 715 already displayed.
If you like, you can repeat the search with the omitted results included.”

I frankly don’t know how to evaluate the huge count. I think the but bottoming out at less than 800 also certainly suggests something. But I can’t say I’m even clear about that.

2009-12-21Fair enough. Changed it to "hundreds of thousands"
227SUGGEST

This section indicates that a clarification will be made about the differences of using stub, mock and double to make a spec more clear, but I don’t think it is really addressed in the chapter. After finishing the chapter, I am still unsure of when to really use mock vs. double. The chapter alludes that mock presents a tighter connection to the subject of the spec than stub, but the double instance doesn’t seem to be addressed.

2010-07-21
368TYPO

Should there be a green arrow next to the code line “<%= f.text_field :title %>” do denote that this is the new line to add in the file? (location at approx middle of page)

2009-12-22
372TYPO

Last line before section 23.3 starts, “specs, the can be very helpful throughout the spec suite.”, the word “the” should be “they”.

2010-01-17
382TYPO

left out the word “see” in the sentence: “If you run
that spec now you should it fail with:” in the paragraph below the first example on the page.

2009-12-22
367OK

Is there any benefit to creating the Message class in the spec helper? Why not actually go ahead and create the model at this point? Is it just for simplicity?

2009-12-22It's just a technique to keep you moving. We're trying to stay focused on the task at hand, which is not creating a Message class.
29SUGGEST

The cucumber output in my terminal is colored and seems to be one of the major features of cucumber (run it till it’s green!). Have you thought about applying the same colors to the output in the book instead of everything being blue?

2009-12-21We hadn't because none of that will show up in print (which is black and white).
402SUGGEST

PORO = Plain old ruby object, yes? Is this abbreviation defined elsewhere, I had to google it.

2009-12-21p362 in the section on views.
229TYPO

Practicioner should be practitioner

2009-12-22
21OK

When viewing the PDF using Adobe 9.2.0 on Windows XP the equals signs within the code sample appear instead as what look to be bolded dashes. When I copy and paste the code sample into emacs the code appears correctly with the equals sign:

describe MovieList do
context “when first created” do
it “should be empty” do
movie_list = MovieList.new
movie_list.should be_empty
end
end
end

Therefore this issue only appears when viewing sample code within the Adobe PDF viewer but copy and paste into another program renders the sample code correctly. This issue is not unique to page #21 of the PDF but it is the first instance I noted it.

I can provide a screenshot of the error if desired.

Asa
bourea@hotmail.com

2010-07-18Sounds like an issue with your PDF viewer. Not much we can do about that here.
59OK

“… run cucumber -s again and you should see
output like this: …”

I think you meant to write “cucumber features/codebreaker_starts_game.feature -s” instead of “cucumber -s” to get output quoted within book.

2009-12-22That output is actually generated by running that command (cucumber -s) without the filename.
61OK

spec/codebreaker/ should be codebreaker/spec/

2009-12-22It's correct as/is. The file is spec/codebreaker/game_spec.rb.
65OK

Might want to include spec command along the lines of:
spec spec/game_spec.rb…

2009-12-22By now the reader has typed "spec spec" (or similar) several times.
85TYPO

game = Game.new - this line fails with wrong number of arguments (0 for 1) should it instead be game = Game.new(@messenger) ?

2009-12-21
324TYPO

In “Scenario: Hide minutes for times ending with 00”, the When is: ‘When I set the showtime to “2007-10-10” at “2:15pm”’. Shouldn’t it be: ‘When I set the showtime to “2007-10-10” at “2:00pm”’?

2009-12-22
82SUGGEST

This part of the chapter becomes VERY fuzzy. It’s the first time my code breaks and does not behave like the book as I go along. Maybe you should clarify a bit.

If this…

“The one that is failing is the only example left that is still calling start() with no code, and it’s a near duplicate of the passing example that says (passing the code to start). We can now safely remove the failing example, and remove the parenthetical context from the passing example, leaving us with this:”

… is true, why are we instructed to to this…

“def start
messenger.puts "Welcome to Codebreaker!" messenger.puts ”Enter guess:"
end"

??? - Should’nt it be instead…

“def start(code)
messenger.puts "Welcome to Codebreaker!" messenger.puts ”Enter guess:"
end"

… If one wants to insure that the code is required by the start method?

2009-12-21
120TYPO

secret_codes.count_for(color, position). <- remove period

should be_between(min.to_i,max.to_i) <- add space after comma for consistency

2009-12-22We need the period because should() is being called on the result of that line. \n \nAdded the space.
310TYPO

Need to update:
[sudo] gem install cucumber rspec-rails webrat

to:
gem install cucumber-rails rspec-rails webrat

Starting with Cucumber 0.4.5 you will need the cucumber-rails gem

2010-01-17
320TYPO

script/cucumber -tag @focus fails with:

Missing these required gems:
database_cleaner >=0.2.3

I ran rake gems:install to no avail but gem install database_cleaner worked.

2010-07-21
322TYPO

cucumber -t focus should instead be cucumber -t @focus

2009-12-23
337TYPO

webrat_steps.rb should be renamed web_steps.rb

2010-01-17
378TYPO

Download rails_views/messages/15/spec/views/messages/edit.html.erb_spec.rb -> need to add class Message; end within download file

2010-01-17
384TYPO

of of other components

remove redundant of

2010-01-17
141SUGGEST

In “Designing Interfaces with Mock Objects”, we go through a section of refactoring, in particular the Game spec. There’s a part where we happen to end up comparing equality between objects:

@messenger.should_receive(:send_summary).with([Guess.new(%w[b w y r], %w[w w])])

The last two tests in the Game spec will fail even when it looks like everything should be fine, because there’s no equality defined in the Guess class yet. I looked through the code examples relating to that section (rev 73) and found this in the Guess class:

def (other) other.guess self.guess && other.mark == self.mark
end

There doesn’t seem to be any mention of this method before page 153, and if it’s left to be an exercise to the reader, it wasn’t an obvious one. I spent quite a long time trying to figure out what was going wrong. It was frustrating because I’d been following the examples and instructions and felt compelled reread that section several times before giving up and digging into the example code. Some clarity would be nice here :)

2010-01-15
395DEFER

It’d be great if you could add a note as to how to handle errors that are raised in Webrat/Cucumber. On 395, the example of implementing an “access denied” feature in your ApplicationController is a good one, but it left me lost when I did the next logical step, which was to try and build it out using Cucumber.

Here’s what I tried, in the wild, with the application controller/spec implemented as suggested:

Scenario: Users cannot sign up when sign ups are disabled
Given sign ups are disabled
When I go to the sign up page
Then I should see “forbidden”

The second step (using the built-in when I go to…) causes an AccessDenied error to be thrown (as you’d expect). However, when Webrat encounters the exception, it reraises it and the test fails. I’m not sure how to handle this (maybe with lambda { visit … } ?), but some clarification would be fantastic here, seeing as it’s the next logical step someone might try.

2010-07-21
395SUGGEST

Addendum to #41956: The solution was found in features/support/env.rb which specifies the @allow-rescue tag.

2010-07-21
313ERROR

Installing the Cucumber gem installs 0.5.3. When I ran the ‘script/generate cucumber’ I got “Couldn’t find ‘cucumber’ generator”. When I dug around, I found that after Cucumber 0.4.5 you need to install the Cucumber-Rails gem. Either the old gem needs to be specified, or the instructions to install Cucumber-Rails gem needs to be added.

2010-01-17
37TYPO

Should the phrase “breaking the guess” be “breaking the code”?

2010-01-15
56TYPO

The sentence “it is very, very liberating, and results consistently in more usable APIs” should be written as “it is very, very liberating and results consistently in more usable APIs” or “it is very, very liberating, and it results consistently in more usable APIs”.

2010-01-15
310ERROR

Now needs the gem ‘cucumber-rails’, in order to get script/generate cucumber to work.

You’ll also need to specify “—webrat” and “—rspec”, given the other gems listed.

2010-01-17
310TYPO

script/generate cucumber - add the “—spork” unless on Windows?

2010-07-21
409TYPO

Near the bottom of “Should I spec associations?” box. Pretty sure there is some kind of typo here:

“They’re just part of wiring up the association, and an that requires them won’t work correctly without them, so there is no need to spec them directly either.”

2010-01-15
352ERROR

Simply commenting out “Cucumber::Rails.use_transactional_fixtures” caused the scenarios to fail. Setting it to false will make the scenarios pass again. (I’m using all the latest gems)

2010-01-17
377OK

For an existing record, shouldn’t the method be “put”?

2010-01-17There is a hidden field named _method that is set to "put", but the method attribute of the form tag is still "post"
320ERROR

Running script/cucumber —tag @focus (on Win32) results in:

WARNING: C:/data/donp/NetBeansProjects/showtime/features/support/env.rb:18: cucumber/webrat/element_locator.rb is deprecated and will be removed in Cucumber 0.6.0.
Use cucumber/web/tableish instead.

Solution is to comment out line 18 in features/support/env.rb:
#require ‘cucumber/webrat/element_locator’ # Deprecated in favor of #tableish - remove this line if you don’t use #element_at or #table_at

2010-07-21
41TYPO

There is a double “the” (“the the”) in the final of the third paragraph.

“hence the the name Acceptance Test Driven Planning.”

Regards.

2010-01-17
279TYPO

the link to textmate bundle has a typo
should be svn.textmate.org/trunk/Bundles/Ruby%20RSpec.tmbundle

2010-01-18
322SUGGEST

FYI, on MS Windows XP with ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32], Time.now.strftime(“%l”) => “”. I notice that the %l isn’t documented in the Pickaxe. I used:
def formatted_time
hour = showtime_time.strftime(“%I”).to_i.to_s
hour + showtime_time.strftime(“:%M%p”).strip.downcase
end

2010-07-21
303TYPO

Second para after “Bundling in vendor/gems” - “With that configration in place” should be “With that config*u*ration in place”

2010-01-19
305TYPO

Second sentence - “…use together to begin driving development from the outside.” Thinking that should be “from the outside-in” since you say that everywhere else, including the preceding sentence. ;)

Maybe:

“So far we’ve explored the concepts of BDD in Rails at a high level, and set up a project with the recommended tools. In the next chapter we’ll take a look at how Cucumber and Rails and be used together to really begin the outside-in development of our application. Turn the page and let’s begin.”

Or something like that. ;)

2010-07-21Something like that, indeed.
302TYPO

When explaining the output of script/generate cucumber there is no description for config/cucumber.yml.

2010-07-21
303SUGGEST

For the “Bundling in vendor/gems” and “Bundling in vendor/plugins” - what I forsee happening is someone relatively new to Rails reading the book and following it blindly, but being confused when they get here. Some more context as to /why/ one would pick one, the other, or neither might be helpful. Maybe a little callout section or something just before those two sections.

2010-07-21
34TYPO

Dropped the end of the 4th paragraph - “A - indicates a number match: one of the numbers in the guess is the same as one of the numbers in the secret code, but in a”

2010-02-03
303SUGGEST

Regarding the “Bundling in vendor/gems” section starting on p.303; Unpacking dependencies installs Nokogiri which will cause an error when running the first scenario on p.309. Shouldn’t the book instruct the reader to remove Nokogiri from vendor/gems as it contains native extensions? I think this was mentioned in passing on b12 but has not been included on b13.

2010-07-21
36SUGGEST

In the “Focus on the Role” section, the “Coh04” link Is being displayed in bright green. This is incredibly hard to read on the gray background.

I’m viewing the PDF using Preview.app on a 13" Macbook Pro running Snow Leopard (10.6.2). I don’t think I have done any customization that would cause the color to be different on my system, but don’t remember for sure.

The same bright green link also appears in the body text on Page 35 (“JAH02”) and, while it’s easier to read on a white background, it is still somewhat painful.

I do see that this is the same in other PragPub books (e.g. Agile Web Development with Rails) so maybe it is something particular to my machine. At any rate, I thought I’d point it out in case it is something that could be configured in your PDF files.

2010-02-11I've passed this info on to the publisher. Thx.
42TYPO

In the fifth paragraph that begins “Inside the codebreaker directory”, the feature file name should be “codebreaker_starts_game.feature” as I’m pretty sure we’re breaking “codes”, not fish (“cods”). ;-)

2010-02-03
60TYPO

#start (last but one line) is formatted green like a comment, but isn’t a comment.

2010-02-03
61TYPO

Two lines with #start are formatted green like comments, but aren’t comments.

2010-02-03
50TYPO

Second paragraph ends with “Here are the contents of the two files:” and there are no contents listed.

2010-02-03
44SUGGEST

This is definitely nit-picking, but the feature’s explanation text is not parallel. I think it would read better as follows:

For each number in the guess that matches the number and position of a number in the secret code, the mark includes one +. For each number in the guess that matches the number but not the position of a number in the secret code, the mark includes one -.

The only change is the final phrase: “the mark includes one -.”

2010-02-03
106TYPO

“documents it’s responsibility” s/b “documents its responsibility”

2010-02-03
56TYPO

The second sentence of the “Then” section is problematic.

BTW, the Existing Errata I am seeing doesn’t seem to match the page I’m looking at.

In the RSpec book, the second sentence of the “Then” section that begins on page 55 is problematic. I believe it should read:

The last snippet is a single step definition that will handle both the Then and And steps in the scenario, passing whatever is captured by the ([^\\"]*) part of the regular expression to the method block as the message parameter.

I added a “the” before “([^\\”]*)“, removed a ”the" from between “regular expression” and “to the block”, and added the modifier “method” in front of the word “block” to make it more obvious which block we are dealing with.

2010-02-03
75TYPO

Given /^the secret code is “([^\\”]*)"$/ do |secret|
game = Codebreaker::Game.new(output)
game.start(secret)
end

should be

Given /^the secret code is “([^\\”]*)"$/ do |secret|
game = Codebreaker::Game.new(output) game.start(secret)
end

Otherwise this code found on page 78

When /^I guess “([^\\”]*)"$/ do |guess|
@game.guess(guess)
end

will return different results then shown because @game will be nil.

2010-02-03
286TYPO

In the paragraph that starts with “Cucumber makes it easy…”.

“Cucumber makes it easy for us to do this, but allowing us to invoke from within step definitions.”

Should this be:

“Cucumber makes it easy for us to do this, by allowing us to invoke from within step definitions.”?

The ‘but’ should be ‘by’.

2010-02-03
286TYPO

Same paragraph as above: “Cucumber makes it easy…”

“…four-step version above, we can can write a…”

There are two cans back to back.

2010-02-03
291TYPO

There is a type on the Scenario title.

“three of a kind beast two pair”

should be

“three of a kind beats two pair”

2010-02-03
292TYPO

In the middle of the first paragraph on the page:

“…and stores the cell vlues in a…”

should be

“…and stores the cell values in a…”

2010-02-03
63TYPO

The example on this page is supposed to be demonstrating a red or failing spec, but the text is blue. Probably would be good to actually see a red failing spec.

2010-07-21
273ERROR

The sidebar states:
"For example, if you
want to use Japanese, the first 2 lines might look like this:

  1. language: pt
    Ele Ãl’ portuguÃłs"

I believe this is Portuguese, not Japanese.

2010-07-21
63ERROR

The last paragraph of section 5.2 indicates that I should see a FAILED-1 on the third line of the output, but I am not seeing this. The reason is that you give the command as:

spec spec —color

In order for the output to match what you have listed in the book, the command should be:

spec spec —color —format nested

2010-02-03
70TYPO

In the second clause of the second sentence of the paragraph that begins “The first call to let() defines…”, “return” should be “returned”:

“…and that same value is return[ed] every subsequent time…”

2010-02-03
71SUGGEST

The instruction to “chmod 755 bin/codebreaker” only applies to *nix systems… unless there was an instruction that I missed for Windows users to install and use Cygwin. :)

Also, wouldn’t it be a bit safer to give the command as “chmod +x bin/codebreaker”? Or maybe that’s not available on all *nix systems.

2010-02-03
79TYPO

Code snippet at top of page is missing the ‘@’ symbol in front of output.

2010-02-03Take a look at p56 in beta 13. It shows an output() method that encapsulates the instance variable, so no @ is needed.
115TYPO

Fourth paragraph (including code snippet), fourth line, sentence beginning with “There is no long a” should be “There is no longer a”.

2010-02-03
285TYPO

Duplicate “to” in second paragraph in chapter “19.2 World”:
In some cases it can be handy to [to] invoke …

2010-02-03
115TYPO

“There is no long a 1 in the secret, so we move on to the 4 in the third position of the guess.” should be

“There is no longer a 1 in the secret, so we move on to the 4 in the third position of the guess.”

2010-02-03
79TYPO

Section 6.3, “What We’ve Learned” is empty. I’m pretty sure I learned something. :)

2010-07-20
81ERROR

The output from my spec command does not match what is listed.

Using the command:

spec spec —color —format nested

My output is:

Codebreaker::Game
#start
sends a welcome message
prompts for the first guess
#guess
with no matches
sends a mark with ’’ (FAILED - 1)

1)
Spec::Mocks::MockExpectationError in ‘Codebreaker::Game#guess with no matches sends a mark with ’’’
Double “output” expected :puts with (“”) once, but received it 0 times
/Users/pablosan/Source/codebreaker/spec/codebreaker/game_spec.rb:26:in `block (4 levels) in
/opt/local/lib/ruby1.9/1.9.1/timeout.rb:44:in `timeout’

Finished in 0.005912 seconds

3 examples, 1 failure

—- end of output —-

Specifically, I don’t see the verbiage you have in your example:

Double “output” received :puts with unexpected arguments
expected: (“”) got: ([“Welcome to Codebreaker!”], [“Enter guess:”])

—- end of output —-

Upon further inspection, specifically of the trace in my output, I’m thinking there might be some configuration funkiness on my machine that is causing this?

I remember seeing something about configuration that would give a listing of all output like I see in your example. I just don’t remember if it was in the book or in other errata comments.

2010-07-21
300TYPO

In section 20.2 (Setting up a Rails project), in the list of gems to install, it says:

$ [sudo] gem install selenium-client —version 0.2.18

I suspect the selenium-client version is actually supposed to be 1.2.18.

2010-02-03
83ERROR

The code example that comes after the paragraph that begins “The current implementation of guess always sends an empty string…” is incomplete and will not make the test pass. This is because the code references an instance variable, “@secret” that has never been defined.

This code snippet should include adding a new line to the “start” method that stores the passed in “secret” in an instance variable:

def start(secret)
output.puts 'Welcome to Codebreaker!' output.puts ‘Enter guess:’
@secret = secret
end

2010-07-21
85SUGGEST

This is nit-picking again, but…

To maintain symmetry and improve readability, I would swap your order of secret and guess (so that it parallels the elsif check):

def guess(guess)
if secret[0] == guess[0] mark = '+' elsif secret.include?(guess[0])
mark = ‘-’
else
mark = ’’
end

I know this code is throw away code, but it may not always be. So I prefer to make even (potential) throw-away code as readable as possible, especially when putting an example in a book.

2010-02-03This is very subjective. I actually prefer the way it is in the book because we're saying "if the first number in the guess is the first number in the secret .."
87SUGGEST

Something is bothering me about the game.rb test cases. There is duplication in the line:

game.start(‘1234’)

It appears in every test case, yet I’m not sure refactoring that line out into a before method is a good idea. The more I thought about it, the more I realized that my hang-up was with the fact that we always used the same secret code. That seems like a test smell to me: we could end up with an implementation that would only work when the secret code is ‘1234’.

So I think I would change the secret code for every test… or at least use more than one secret code in the test cases.

2010-02-03I like your instinct, and might consider that if it weren't a teaching example. In an earlier version of the book there were some different codes and other beta readers expressed confusion about it :)
87ERROR

In implementing the loop in the guess method, why did you opt for Array#map? map creates an (unnecessary) new array containing the values returned by the block. Instead of:

(0..3).map do |index|

The correct method to use in this case is each:

(0..3).each do |index|

2010-02-03
259ERROR

I didn’t copy the example directly, but I adapted it to my own project and I found I needed to use ‘def’ instead of ‘define_method’ in my macros.

2010-02-03
96ERROR

In the game.rb code example at the end of the page, the marker for a change to the code is wrong: nothing was change on the line:

@output.puts ‘’*exact_match_count(guess) ’-’*number_match_count

The only change to this method was the removal of a line of code: the declaration of the local variable exact_match_count at the beginning of the method.

2010-02-03As the previous paragraph suggests, that line changes to pass the guess to the exact_match_count method.
97ERROR

In the code snippet showing the method exact_match_count, there is a change marker on the line:

if exact_match?(guess, index)

Nothing changed on this line of code as far as I can tell.

2010-02-03
97TYPO

The last line of the page and the section has a typo:

Run the specs and the should all pass.

The second “the” should be “they”:

Run the specs and they should all pass.

2010-02-03
98TYPO

In the paragraph that begins “Briefly, what’s happening is that…” The word “iteration” in the last sentence of the paragraph should be “iterating”:

The second block argument is the next value in the collection we’re >iterating<= on: 0 the first time, 1 the second, etc.

Also, the “Briefly, what’s happening is that…” is a bit too conversational for my tastes. It reads a bit awkwardly (kind of like this sentence). Consider:

Here is a brief explanation: the count variable is initialized…

…or something.

2010-02-03
100TYPO

In the bullet points beneath “Extract Class”, the slash should be removed from “as/is” in the third bullet point, yielding “as is”.

2010-02-03
100TYPO

In the bullet points beneath “Extract Class”, the fourth bullet point incorrectly suggests passing the guess parameter to Marker.new. We should, in fact, be passing the secret instance variable to Marker.new.

2010-02-03
106TYPO

The sentence “It’s still responsible for sending a mark to the output, but it’s no longer rep- sonsible for calculating the mark” has a spelling error: “repsonsible” should be “responsible”

2010-02-03
106OK

I like the fact that you removed duplicate test cases from game_spec.rb. However, the single guess test case is a little simplistic. Why not test for something that covers all cases? Like:

describe “#guess” do
it “sends the mark to output” do
game.start(‘1234’ )
output.should_receive(:puts).with(‘-’ )
game.guess(‘1354’ )
end
end

The advantage here would be a chance to catch a problem introduced in the marker_spec.rb test cases: maybe someone edits the marker_spec test cases so they aren’t providing the coverage needed. You’d at least have a chance of catching something at the game_spec level.

2010-02-11The Game is no longer responsible for the mark, it is only responsible for sending the mark to the output.
79DEFER

When you introduce the game of Codebreaker you mention that “The code-maker, which will be played by the application we’re going to write, creates a secret code of four numbers between 1 and 6.” Since valid numbers are only between 1 and 6, why would we include scenarios that (seemingly arbitrarily) try guessing numbers above 6? Your scenarios:

Scenarios: no matches
| code | guess | mark |
| 1234 | 5678 | |

Further, your rules differ from the Bulls and Cows game mentioned on Wikidpedia in that (later on in the book) you allow duplicate numbers in the secret code, and the original game rules state that “the digits must all be different” (they also seem to allow all digits, 1-9). This is suggested by your test scenarios on page 112:

Scenarios: matches with duplicates
| code | guess | mark |
.
.
| 1134 | 1155 | |
.
.
.

This wasn’t confusing to me until I hit Chapter 9 (specifically section 9.1), when you went in a direction that seems counterintuitive to me, having referenced the original game rules, and comparing the written instructions to the examples.

To be clear, I’m not bothered by your rules being different from the original game, I just think the examples lack some continuity, causing confusion for the reader… at list this reader spent a few befuddled minutes getting back on track. :)

2010-07-21
116SUGGEST

Like I mentioned with your use of the map iterator method earlier, I really think the each iterator method is more appropriate in this case. This change would need to be made in both code snippets on the page.

2010-02-03
149DEFER

In the RSpec examples earlier in the book, you pass a string parameter to “describe” that includes the pound/hash/number sign. Example:

describe “#start” do

Having used other BDD frameworks like JSpec and JBehave, it was not clear to me why the pound sign was prepended to the string. I’m guessing it is done to match the convention of Ruby’s ri documentation tool, but it might be nice to have this convention explained in this section of the book, where “describe” is explored in detail.

2010-07-18
34TYPO

Looks like something is missing at the end of this paragraph:

A - indicates a number match: one of the numbers in the guess is the same as one of the numbers in the secret code, but in a

2010-02-03
56TYPO

Then /^I should see “([^\\”]*)" $/ do |message|
should be
Then /^I should see “([^\\”]*)"$/ do |message| as is the downloaded code

Note the space in the text causes the output to differ from what is shown…

2010-02-03It is correct in the PDF. What PDF viewer are you using?
50ERROR

I am getting the following error after I put in the second feature of the Mastermind game and run cucumber.

features/codebreaker_submits_guess.feature:20:2: Parse error, expected “|”. (Cucumber::Parser::SyntaxError)

It seems to be expecting another pipe but all looks good. Her is the code around line 20. With line 20 being the first line of the second scenario.

Scenario: no matches
\t | code | guess | mark |
\t | 1234 | 5678 | |

\tScenarios: 1 number correct
\t | code | guess | mark |
\t | 1234 | 1555 | + |
\t | 1234 | 2555 | - |

cucumber 0.6.2
OS X 10.6.2
Ruby 1.8.7

2010-02-03I'm not getting this error. Please report it to the cucumber google group: http://groups.google.com/group/cukes.
47TYPO

Here’s the whole feature with thirteen scenarios expressed in a
mere twenty five lines (beginning with the Scenario Outline):

Scenario Outline: submit guess
Given the secret code is “
When I guess “
Then the mark should be “
Scenarios: no matches
| code | guess | mark |
| 1234 | 5678 | |
Scenarios: 1 number correct
| code | guess | mark |
| 1234 | 1555 | + |
| 1234 | 2555 | - |
Scenarios: 2 numbers correct
| code | guess | mark |
| 1234 | 5254 | |
| 1234 | 5154 | +- |
| 1234 | 2545 | — |

Scenarios: 3 numbers correct
| code | guess | mark |
| 1234 | 5234 | + |
| 1234 | 5134 | - |
| 1234 | 5124 | +— |
| 1234 | 5123 | —- |
Scenarios: all numbers correct
| code | guess | mark |
| 1234 | 1234 | |
| 1234 | 1243 | — |
| 1234 | 1423 | +—- |
| 1234 | 4321 | —— |

I think this is 14 in 27

2010-02-03
147SUGGEST

Maybe I missed the explanation somewhere in the book, but you mention that the “it” method accepts a string and an optional Hash along with the optional block. What is the Hash’s purpose? Shouldn’t there be an example of how to use the optional Hash parameter?

I checked the ri documentation for RSpec, but that didn’t help a whole lot either. My next step will be to Google it, but it seems like this book has a responsibility to cover this feature.

2010-07-18
60TYPO

I had to play with the $LOAD_PATH to get this command to work:
spec spec/codebreaker/game_spec.rb —format nested

Ubuntu:

spec_helper.rb:
$LOAD_PATH << File.expand_path(File.join(‘..’, ‘lib’), File.dirname(FILE))

game_spec.rb:
$LOAD_PATH << File.expand_path(File.join(‘..’), File.dirname(FILE))

2010-02-03The current version of rspec, 1.3, add lib to the load path. Are you using an older version?
267TYPO

At page footer: langauges should be languages

2010-02-03
276TYPO

There is an extra “about” in the last sentence of the second paragraph; “for now, let’s talk about about the step keywords.”

2010-02-03
83SUGGEST

At some point in section 7.1 we need to update the start method by adding @secret = secret. I don’t think you tell us that. I figured it out by debugging an error but I thought I’d let you know.

def start(secret)
secret = secret output.puts ‘Welcome to Codebreaker!’
@output.puts ‘Enter guess:’
end

Love the book!

2010-07-21
102OK

marker = Marker.new(@secret, guess)
should be updated to remove instance variable
marker = Marker.new(secret, guess)

2010-02-03There is no local variable there - the @secret _is_ an instance variable.
20OK

Getting the words right

“We believe that most of the problems that software development teams face are communication problems, and so are the rest.”

The rest of what???

2010-02-03The rest of the problems! (it's a bit tongue in cheek) \n
29ERROR

Hello Cucumber
[…]add two directories named features and spec, and move the greeter_spec.rb file from the RSpec example into the hello/spec directory.

I have a big problem with this sentence, because it leads one to falsely believe that hello/spec/greeter_spec.rb is somehow necessary for the Hello Cucumber example. It took me several reads to realize it is not necessary.

You can rework the text on page 32 to include creating the spec directory and moving the file. Then you can demonstrate how one has both Cucumber and RSpec working examples in a shared directory structure.

2010-07-21
34OK

Suggest reworking the first sentence to read as follows:
3.1 Introducing Codebreaker
Codebreaker is a two-person logic game in which a player, the code-breaker, tries to break a secret code created by the other player, the code-maker.

2010-02-03
34SUGGEST

Suggest changing your example to make it really clear (or really difficult to confuse) that the ‘+’ and ‘-’ do not correspond to positions:

“For example, given a secret code of 1234, a guess of 2536 would be marked ‘+-’”

The two, earning a ‘-’, is first in sequence, but marked second, and the three is later in the sequence, but marked ‘+’ first.

2010-02-03
319TYPO

“Once those additions and changes are in place, re-running our scenario shows us that we’ve got one step left:1”

“Once those additions and changes are in place, re-run the scenario and you’ll see that we’ve got one step left”

Redundant sentences.

2010-07-21
359ERROR

In the section “Extracting Partials for Organization”, should the second paragraph’s last sentence be changed to “… to rely on a recent_messages local variable rather than on an instance variable.” since the next section refers to it as a local?

2010-07-21
135OK

behaviour should be behavior

2010-02-03We use the British spelling for behaviour since it's in the title of the book.
34SUGGEST

3.1 Introducing Codebreaker, 4th paragraph : For example, given a secret code …

In B12, I made a wrong assumption about the black marker and the green peg in the second position. I read the new chapter 3 and again believe that the + comes first because it corresponds to the ones. Even if the next paragraph makes it clear that there is no particular order, I agree with #42184. So it would read :

For example, given a secret code 1234, a guess with 2536 would earn a -. The is for the 3 in the third position in the guess, …

Sounds that 3 is bound to third position ? I had an idea to completely scramble/mix up numbers and positions :

For example, given a secret code 1236, a guess with 2456 would earn a +. The + is for the 6 in the fourth position in the guess, … The is for the 2 in the first position in the guess …

… but it no longer corresponds to all the examples with 1234. What a headache !

2010-02-03
47SUGGEST

Scenarios: no matches
| code | guess | mark |
| 1234 | 5678 | |

Isn’t 78 in contradiction with 3.1 page 34 second paragraph : the code-breaker makes a guess of four numbers (again, 1 to 6) ?

2010-02-11
51DEFER

Suggest to put the figure 4-1 back.

Reason : as I tried running cb/04 (old code) on page 55, I was stuck with require errors and wanted to check if my directory structure is correct, but couldn’t find the figure, which has been removed from B13.
I had appreciated the figure 4-1 and the following explanations on pages B12 51-52, especially the parallelism between lib and spec (related to the updating of $LOAD_PATH in env.rb, something not familiar for a newbie). I have adopted this scheme for my RSpec development now, lib + spec with a require_helper.rb similar to env.rb.

2010-07-18
234DEFER

Last paragraph : By default, the spec command only loads files ending with _spec.rb. As you’ll see later in this chapter, … you can configure RSpec …

I haven’t found an explicit explanation in the rest of the chapter. Suggestion if it is not elsewhere :

By default, the spec command only loads files ending with _spec.rb. While this pattern is the convention, you can configure RSpec to load files based on any pattern you choose. For example, if your files end with _t.rb, add the following option :

\t\t—pattern *_t.rb

2010-07-21
240SUGGEST

Paragraph “Invoke With Options Stored in a File with –options”

Suggestion : give also the short form of —options, which is uppercase -O.

Reason : having read the book “Scripted GUI testing” before, I used to run the tests with the command :
\t\tspec file.rb -fn -c

After having read this paragraph and created the spec.opts file, I naturally gave the command :
\t\tspec ./ –o spec.opts

… and it did not work !

2010-07-21
118TYPO

starting poing for continued development.

2010-02-03
291TYPO

Scenario: three of a kind beast two pair

Should be “beats”

2010-02-03
CTYPO

This seems to be a snippet from the original (b.12) codebreaker example.

2010-07-20
279TYPO

In Section 18.10, Organizing Features, second paragraph, last sentence, change from: “as described earlier in Section 19.5” to: “as described later in Section 19.5”.

2010-02-03
281TYPO

In Section 18.11, Tags, under heading “Tags to the rescue”, in the last example, change from: “OR NOT tagged with bar” to: “OR NOT tagged with @bar”.

2010-02-03
273TYPO

It´s portuguese on the sidebar and it has some character-encoding related error. The phrase should be: Ele é português.

2010-07-21
367TYPO

The fourth paragraph below the section 24.5 header (including code samples), second line reads; “To see this in action, create a spec/helpers/roles.rb file.” Shouldn’t that be spec/helpers/application_helper_spec.rb?

2010-07-21
378TYPO

last sentence on page reads; “Let’s look a closer at each of the methods we used.”

2010-02-03
78ERROR

in cb2/19/features/step_definitions/codebreaker_steps.rb, your When instantiates Game with a local variable (game = Codebreaker::Game.new(output)). On the next page, in cb2/20/features/step_definitions/codebreaker_steps.rb, your When refers to the Game object as an instance variable (@game.guess(guess)). This doesn’t work, resulting in a confusing error: “undefined method ‘guess’ for nil:NilClass”.

If the Game object is instantiated with an instance variable, then the example works as described on page 78.

2010-02-03
136TYPO

Second parapgrah: “…, as you should already have a decent feel for how to do go about it”. The “how to do go about it” should be “how to do it”

2010-07-20
61ERROR

I had to change spec/spec_helper.rb to include the following to get the spec to run

$LOAD_PATH << File.expand_path(‘../../codebreaker/lib’, FILE)

prior to the

require ‘codebreaker’

2010-02-03The current version of rspec, 1.3, add lib to the load path. Are you using an older version?
167TYPO

- One goal BDD is getting the words right.
+ One goal of BDD is getting the words right.

It occurs to me now that this might be a joke, but I suspect that the humor will be lost on many readers who will assume that it’s a typo.

2010-02-03
118TYPO

“To be clear, this <<>> not production code, and is not intended to be shipped.”

2010-02-03
47SUGGEST

From the Scenario Outline on this page you can infer that the mark will always print the +’s before the -’s. But this fact is never explicitly stated anywhere. And in fact, I completely missed it on my first run through. It wasn’t until the later chapter where you deal with duplicates that I realized the rule was already implied.

Is there some way that the Cucumber could updated to make this rule explicit in order to avoid confusion and increase communication? It could be added to the feature description, but it seems like it would be even better if it actually became an explicitly stated rule of its own. Is this possible?

Thanks!

2010-02-11
90TYPO

“Learned” is misspelled as “leared” in the last sentence before section 7.4, a sentence that also incorrectly separates “meantime” into “mean time”:

“In the mean time, let’s review what we’ve leared so far.”

Since Shakespeare is the only person who ever Leared in the (Greenwich) Mean Time, the book should probably target the rest of us and the learning we do in the meantime.

2010-02-11
92SUGGEST

You begin Chapter 8 with nearly the same Fowler quote that you began section 5.4 with, though they are different in their wording:

5.4
In the preface to his seminal book on Refactoring [FBB99], Martin Fowler writes: “Refactoring is the process of changing a software system in such a way that it does not alter the external behaviour of the code yet improves its internal structure.”

Chapter 8
In his book, Refactoring [FBB+99], Martin Fowler describes refactoring as “a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.”

Reading the quote in chapter 8, it feels as if the authors have unintentionally repeated themselves, even though the second quote adds some new ideas. Maybe it should be introduced in a way that acknowledges that Fowler has already been mentioned, then says that Fowler further defines refactoring as such and such (using the quote).

2010-07-20
178TYPO

In Ruby, there are two values that are evaluate as false in a boolean expression.

Change “are evaluate” to “evaluate.”

2010-02-11
54SUGGEST

On page 54 of B13, the last line of the output of the example cucumber run from the page before is listed directly below the sidebar. Because it’s a single line, it would probably be a good thing to find a way to put it with the rest of the output. “0m0.003s” looks pretty odd after the sidebar, especially considering the page content doesn’t describe that line at all.

2010-02-11This will be addressed in typesetting.
327TYPO

Missing space:

“By default, Rails’ TestUploadedFile uses the text/plainMIME type.”

Should be:

“By default, Rails’ TestUploadedFile uses the text/plain MIME type.”

2010-07-21
345TYPO

“If anything behaves differently, it’s a pointer to an inadvertent external dependency that has crept it.”

Should be:

“If anything behaves differently, it’s a pointer to an inadvertent external dependency that has crept in.”

2010-07-21
90TYPO

Along with the “leared” typo, the sentence lacks its final dot.

2010-02-11
100ERROR

“Create a new Marker in the guess method, passing its guess parameter to Marker.new”: actually, the parameter is @secret.

2010-02-11
44SUGGEST

Some where in the “Submit a Guess” subsection, add a sentence telling the reader to create a new file named codebreaker_submits_guess.feature.

2010-07-20
171TYPO

The code sample after “Here are some examples:” has one empty line you may get rid of.

2010-07-18
169SUGGEST

“In addition to equal(expected), others include:
include(item)
…”

The repetition sounds clunky. You may change for something smoother, say “In addition to equal(expected), you may use:”

2010-07-18
280ERROR

The Tag wip outcomment the scenario cucumber --tags wip won’t run scenarions with tag @wip

2010-07-21
56OK

I’m reading the .mobi version of the book, and got quite confused about where to put ‘class Output’. Upon looking at the pdf version, it became immediately clear that ‘class Output’ belongs in features/step definitions/codebreaker_steps.rb, but that information is omitted on the .mobi version. Could this be added in the next release? (I can imagine this impacting all of my reading of the book, as well as other books by PragProg, etc.)

2010-07-20Dave says: Is there not a hyperlink about the code fragment—I see it here when reading the mobi version
70SUGGEST

Flag changed lines in first code block for consistency.

2010-07-21
77TYPO

Per the fifth errata on page 75, the code change (which makes game an instance variable) would have a corresponding change on page 77.

2010-07-21
77ERROR

Per the fifth errata on page 75, the code change (which makes game an instance variable) would have a corresponding change on page 77.

2010-07-21
340TYPO

when setting up database cleaner with selenium - it suggests adding the following lines to features/support/env.rb:
require ‘database_cleaner’
require ‘database_cleaner/cucumber’
DatabaseCleaner.strategy = :truncation

the 1st and 3rd of these lines have been included on the examples previously given on page 338 - someone following along would already have added them in… suggest removing from the earlier examples.

Cheers,
Andy

2010-07-21
55OK

Great book!

in cb2/04/features/support/env.rb

Although it doesn’t affect the outcome of the examples, the following statement is incorrect:

$LOAD_PATH << File.expand_path(‘../../../lib’, FILE)

It should be the following:

$LOAD_PATH << File.expand_path(‘../../lib’, File.dirname(FILE))

Notice there are only two ‘..’ in the latter, since it doesn’t erroneously consider FILE to be a directory name instead of a file name.

2010-07-18
56TYPO

First paragraph “the regular expression the to the block” which should be “the regular expression to the block” (remove first “the”)

2010-06-15
57DEFER

With MRI 1.9, running cucumber does not say ‘wrong number of arguments (1 for 0)’ as menthioned in this page.

Ruby 1.9’s Object#initialize(inherited from BasicObject) accepts any number of arguments(arity returns –1) while 1.8’s accepts none(arity returns 0)
See [ruby-core:27080] for this change.

2010-07-21The examples are all written against 1.8. I'll note that in the beginning of the book.
60DEFER

Output of Ruby 1.9 differ.

$ spec spec/codebreaker/game_spec.rb —format nested
Codebreaker::Game
#start
sends a welcome message (FAILED - 1)
prompts for the first guess (FAILED - 2)

1)
ArgumentError in ‘Codebreaker::Game#start sends a welcome message’
wrong number of arguments (1 for 0)

2)
ArgumentError in ‘Codebreaker::Game#start prompts for the first guess’
wrong number of arguments (1 for 0)

2010-07-21The examples are all written against 1.8. I'll note that in the beginning of the book.
100ERROR

Third bulletpoint “Create a new Marker in the guess method, passing its guess parameter to Marker.new” should be:

“Create a new Marker in the guess method, passing @secret to Marker.new”

The code example that follows the instructions is correct.

2010-07-21
45TYPO

Placeholders are not quoted. Quoted later (p.47) without mention.

2010-07-21
75ERROR

The following line did not work for me

Given /^the secret code is “([^\\”]*)" $/ do |secret|

Running cucumber would still give me:

Given /^the secret code is 1234$/ do
pending # express the regexp above with the code you wish you had
end

However, when I removed the quotes from around the parentheses as follows, it works fine:

Given /^the secret code is ([^\\"]*)$/ do |secret|

cucumber v0.6.2 with ruby 1.9.1 (it might be a ruby 1.9 thing)

2010-07-21
54SUGGEST

last line on the page - “Create a lib directory with a codebreaker subdirectory, and add a game.rb file in lib/codebreaker with the following:”

Since lib exists as a standard directory with directories associated with each application It’s confusing. Better would be:
“Create a lib subdirectory in codebreaker with a codebreaker subdirectory, and add a game.rb file in codebreaker/lib/codebreaker with the following:”

2010-07-18
97TYPO

4th line of page indicates a right pointing triangle denote change. It hasn’t changed from previous incarnation.

2010-07-21
310TYPO

For the code snipped labelled “Download cucumber_rails/01/features/step_definitions/showtime_steps.rb” — the letters “fi” in “step_definitions” morphed into a ligature (they’re run together as a single Unicode character). So when you click or copy/paste the “cucumber_rails/01/features/step_definitions/showtime_steps.rb” path in the PDF, it can’t find it.

2010-07-21
54TYPO

In the first paragraph after the sidebar, last sentence, you are missing the word “a”. It should read, “… because it has a failing step.”

2010-07-20
54SUGGEST

In the last paragraph, second sentence, it would probably read better if you said, “… which also calls the start( ) method, …”.

2010-07-18The book hasn't been through copy-edit yet. Wording issues like this will be addressed when we get there.
382ERROR

I get a different error (using rspec 1.3.0, rspec-rails 1.3.2) :
F

1)
ActionController::UnknownAction in ‘ApplicationController handling AccessDenied exceptions redirects to the /401.html (a
ccess denied) page’
No action responded to index. Actions:
./spec/controllers/application_controller_spec.rb:9:
./magazine_slave.rb:22:in `run’
magazine_slave_provider.rb:17:

Finished in 0.765615 seconds

1 example, 1 failure
<— Slave(1) run done!

C:\\data\\donp\\NetBeansProjects\\temp\\views_example>

2010-07-21
363SUGGEST

Fails to mention a line that needs to be edited for the “renders a form to update a message” case

:action => message_path(@message) is different

It seems to me that there should be a little arrow pointing out this line. When I copy/ pasted the ‘new record’ example and edited it, I missed this line.

2010-07-21
176TYPO

In the first paragraph of the section titled “Expecting a Throw”, the second sentence does not read right. It should probably be, “The main difference is that we use throw/catch to express expected circumstances as opposed to exceptional circumstances.”

2010-07-21
178TYPO

In the first sentence on the page, it looks like the word “is” is missing after the word “intention”. So the beginning of the sentence should read, “While that does express what our intention is, …”.

2010-07-21
182TYPO

In the third paragraph, last sentence, the word “on” is missing after the word “based”. So the end of the sentence should read, “… the example passes or fails based on the outcome of that comparison.”

2010-07-21
203TYPO

The “hash_not_including()” heading occurs between the example of hash_including() and the sentence describing the hash_including() example. The heading should be moved down one paragraph.

2010-07-21
233TYPO

The section title in the PDF table of contents for “The spec Command” shows up as “The 4-1spec Command”.

2010-07-21
245TYPO

At the end of the sidebar, you say, “… everything is honky-dory.” In my neck of the woods, we say everything is hunky-dory. Honky refers to a white dude. (I guess I failed the PC test)

2010-07-21Awesome catch! Thanks.
253TYPO

In the 6th paragraph of the Matcher DSL section, first sentence, you have, “… creates a in instance of …”. I believe you meant to say “… creates an instance of …”.

2010-07-21
261TYPO

In the description for the example_pending(example_proxy, message) method, last sentence, you refer to the (as yet) unwritten sec.pending section. Is this a reference to section 12.2 Pending Examples which has already been written?

2010-07-21
277TYPO

In the second paragraph, last sentence, the word “a” is missing. The sentence should read, “Better to put that in a separate scenario.”

2010-07-21
275TYPO

In the PDF table of contents for section 18.7 The cucumber Command, it has, “The 4-1cucumber Command”.

2010-07-21
287TYPO

In the last paragraph of the “Joe Asks” sidebar, toward the end of the second sentence, you have, “… make it easier to understand reuse a step definition.” It seems to me that you should only have “understand” or “reuse”. If you meant to have both words, then maybe you should say “understand/reuse”.

2010-07-21
53SUGGEST

In “Given /^I am not yet playing$/ do”, not is formatted as a Ruby keyword when it is just there as part of the regexp.

2010-07-21Dave Thomas: Indeed—I'm afraid our syntax highlighter can be dumb on occasions. It isn't a simple fix, so we're going to punt on this one.
341TYPO

In the 2nd para, “One of Webrat’s goals is to ensure the programmer maintains the full power of it’s underlying tools” should use its, not it’s.

2010-07-21
116DEFER

In ruby 1.9, it fails with
undefined method `map’ for 1234
not
undefined method `delete_at’ for 1234
since String in Ruby 1.9 is not Enumerable.

If this book is focusing ruby 1.8.x, that fact should be explicitly mentioned in Preface, near Gem versions section.

2010-07-21The examples are all written against 1.8. I'll note that in the beginning of the book.
60TYPO

‘gem_original_require’: no such file to load — spec_helper (LoadError)

2010-07-21
371TYPO

In the quote in the header, “When the steak dinner is ready the waiter delivers it the customer for her enjoyment.” should read “…delivers it to the customer…”.

2010-07-21
56OK

This is a repeat but you asked for more information and don’t appear to have gotten it. The code snippet below contains a space after the regular expression causing the output to differ from the expected value. This is in Adobe Acrobat 8. You don’t notice there’s a space between the " and the $/ until you copy and paste the code into an editor. Someone typing the snippet while reading would likely not see the space.

Then /^I should see “([^\\”]*)" $/ do |message|
output.messages.should include(message)
end

2010-07-21We've tried to reproduce this in Acrobat (Windowss) and Preview (Mac) and can not. I do not see the space there, nor should it be there.
88TYPO

On the middle of this page, the following sentence misses an “it”: “The 2 in the first position of the guess is a number match, so gets…”. Should be: “The 2 in the first position of the guess is a number match, so it gets…”

2010-07-20
55TYPO

This is the wrong output.

“Now run cucumber again, and you should see some different
results:
Scenario: startgame
Given Iamnot yetplaying
WhenI starta newgame
ThenI shouldsee ”Welcome to Codebreaker!"
AndI shouldsee “Enter guess:”
1 scenario (1undefined)
4 steps(2 undefined, 2passed)
0m0.002s

2010-07-21
57TYPO

‘expected []to include “Welcome to Codebreaker!”’ not in output.

2010-07-18
57TYPO

‘expected []to include “Welcome to Codebreaker!”’ not in output.

Opps… (#42441) should be removed…nothing wrong. It was my mistake.

2010-07-18
57DEFER

Scenario: start game
Given I am not yet playing
When I start a new game
Then I should see “Welcome to Codebreaker!”

Ruby 1.8.7
expected [] to include “Welcome to Codebreaker!”

Ruby 1.9.1
undefined method `include’ for # (NoMethodError)

2010-07-21The examples are all written against 1.8. I'll note that in the beginning of the book.
300OK

After installing cucumber and rspec gems, when runnin script/generate cucumber —rpsec —webrat I get the following error: invalid option: —rpsec

2010-07-21That's because it's spelled rspec, not rpsec :)
356TYPO

2nd paragraph from bottom of page reads “… rspec-rails offers us alternative …”

Should be " … rspec-rails offers us an alternative …"

2010-07-21
31OK

The class CucumberGreeter has a method named “greet” in the greeter_steps.rb file listed on page 31 (I have not checked the downloaded code).

The “Then” cucumber step definition states “@message.should == greeting” which fails. This failure is not show in the books output, the book states that this successfully runs.

Either the classes method needs to be changed to “greeting” or the cucumber step definition needs to be changed to “greet”.

The output displayed at the bottom of page 31 and the top of page 32 does not reflect this error, it shows a successful run from the “cucumber features” command.

2010-07-21In "@message.should == greeting", 'greeting' refers to the block argument in the step definition. It works as advertised if you copy everything verbatim.
34TYPO

"A - indicates a number match : one of the numbers in the guess is the same as one of the numbers in the secret code, but in a

For example, given a secret code 1234, a guess with 1456 would earn a
+-."

In the snippet above, the paragraph ends with “but in a”

2010-06-15
50TYPO

"At this point, the feature files should be in the features/ directory, each with the .feature file extension. Cucumber recognizes this extension and treats these files as input. Here are the contents of the two files:

We should also have an env.rb file in features/support directory. The .rb extension tells Cucumber that we’re using Ruby."

The first paragraph ends with “Here are the contents of the two files:” but never lists the contents.

2010-07-20
55OK

According to the text on this page, the below snippet is supposed to be added to the file “lib/codebreaker.rb”

require ‘codebreaker/game’

Yet this page states that the below snippet is to be added to the file “features/support/env.rb”

$LOAD_PATH << File.expand_path(‘../../../lib’, FILE)
require ‘codebreaker’

The File.expand_path includes the lib directory so when running this example, it errors since our codebreaker.rb files tells us to “require ‘codebreaker/game’” this should be changed to “require ‘game’” to properly run.

2010-07-21
309ERROR

Contrary to the suggestion about the tag focus option:

run script/cucumber —tag @focus shows

script/cucumber —tag focus
Using the default profile…
/Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement

0 scenarios
0 steps
0m0.000s

It runs nothing, not even the scenario marked as focus as suggested.

2010-07-21
339ERROR

On Snow Leopard 10.6.2 with the following gems:

webrat 0.7.0
selenium-client 1.2.18
rspec (1.3.0)
cucumber (0.6.3)
cucumber-rails (0.3.0)

Using Firefox 3.6.2 (OR thru safari)
I get
18:22:03.802 ERROR - Failed to start new browser session, shutdown browser and clear all session data
org.openqa.selenium.server.RemoteCommandException: timed out waiting for window ‘null’ to appear

2010-07-21
118TYPO

Cucumber scenarios, and used them as our starting
poing for continued development.

“poing” should be “point”

2010-07-18
393ERROR

It suggests adding a relationship to recipient as:

class Message < ActiveRecord::Base
belongs_to :recipient, :class_name => User.name validates_presence_of :title, :text
end

It then suggests that the test will fail on expected valid, but in fact fails on uninitialized constant Message::User

As we’ve yet to define a User object, this makes sense.

2010-07-25
155TYPO

“We’ll talk about grouping by method later this chapter.”

The “later this chapter” part, should be something similar to “later IN this chapter”

2010-07-18
34TYPO

The line below on that page is incomplete :
‘A - indicates a number match: one of the numbers in the guess is the same as one of the numbers in the secret code, but in a’

2010-06-15
270TYPO

First sentence, second paragraph. “an example from a a photo editing system”

2010-07-21
149ERROR

In the output of the fourth example of usage of “describe”, the words “require” and “and” should not be highlighted.

2010-07-21Dave Thomas: Indeed—I'm afraid our syntax highlighter can be dumb on occasions. It isn't a simple fix, so we're going to punt on this one.
159SUGGEST

Maybe you should use mail@example.com instead of e@mail.com. The example.com domain is intended for exactly that purpose, but e@mail.com might as well really exist.

2010-07-18
178TYPO

Boolean, not boolean

2010-07-18
171ERROR

The section “Do not use !=” says that != isn’t a method in Ruby, which is not entirely true because in newer versions, in fact, it is:

$ ruby -v -e “p Object.new.respond_to?(:!=)”
ruby 1.9.2dev (2009-07-18 trunk 24186) [i686-linux]
true

2010-07-21
40SUGGEST

“So now we have our release plan with three stories.” - Do we? On page 38, we had identified 4 stories, then discovered a potential 5th story on page 39 on the need for a secret code. The preceding “User Stories are a Planning Tool” doesn’t shed any light on how we arrived at three stories and it’s not clear what those three stories are.

2010-07-20
273TYPO

It says “if you want to use Japanese, the first 2 lines might look like this:” and then the following example is in Portugese (and there seems to be an encoding problem too, because the non-ascii letters in the example have become two letters each: “Ãl” and “Ãł” should probably have been “é” and “ê”).

2010-07-21
383TYPO

25.3 FAQ
“Controllers are the lynchpins of every interaction…”

That should be ‘linchpins’. Linch is a right-angle projection; a linchpin can hold two things together such as a tractor and a trailer.

Lynch is to kill.

2010-07-21
31TYPO

this line
Then /^I should see “([^\\”]*)" $/ do |greeting|

has an embedded space between the final " and the $, and with this space in place, cutting and pasting from the pdf to the rb (and then running “cucumber features”) causes the “Then” to be seen as “undefined”. Removing the space allows the “Then” to pass.

2010-06-15I think that this is an artifact of whatever PDF reader you are using. The text is correct (missing the space) before it is processed, and I don't see the space when I look at it the PDF using Preview on a Mac.
80TYPO

s/responsility/responsibility/

2010-07-20
348TYPO

To include webrat, it should be

require ‘webrat/integrations/rspec-rails’

and not

require ‘webrat/integration/rspec-rails’

2010-07-21
271TYPO

“Considering acceptance to be contextual is not a without its costs.”. An ‘a’ seems to have crept in.

2010-07-21
184TYPO

Item 13.7, First paragraph.

There is an “a” that is not needed:

Sometimes we end up with a an example …

2010-07-21
35TYPO

In the following sentence, you don’t need the comma: “These are also very high level, and don’t really tell us much about how the system should respond to these actions.”

2010-06-15
54TYPO

Two “with”s in the following sentence are confusing: “It is very liberating, and it results in more usable APIs than I would have come up with starting with the object receiving the message.”

2010-07-18The book hasn't been through copyedit yet. Wording issues like this will be addressed when we get there.
383ERROR

hi

i get an undefined method `controller_name’ error

views_example/spec/controllers/application_controller_spec.rb:9:in `block in <top (required)>‘: undefined method `controller_name’ for Spec::Example::ExampleGroup::Subclass_1:Class (NoMethodError)

rails (2.3.5)
rspec (1.3.0)
rspec-rails (1.3.2)

2010-07-21
389TYPO

Chapter 26 :: Writing Model Specs :: Making it real
Let’s imagine they also lead us to want a recipient_id to rep-
resent the user who receives the messsage.

2010-07-21
161SUGGEST

In the section titled “Sharing Examples in a Module”, the first sentence begins “In addition to share_examples_for( )…” refers to the ‘share_examples_for’ method while in the previous code listing the method is named ‘shared_examples_for’. While the ‘shared’ variation is only an alias for the ‘share’ version, this seems inconsistent and could lead to minor confusion.

2010-07-18
57OK

Currently reads memoization, but I think it probably needs to be “memorization”. It’s in the first line of that page (57).

2010-07-18Memoization is correct: http://lmgtfy.com/?q=memoization
40TYPO

Section 3.3, 2nd paragraph: ATDD should be ATDP

2010-06-16That's talking about ATDD in order to set up the difference between it and ATDP. Fine as/is
199TYPO

s/use it several examples/use it in several examples/

2010-07-21
279SUGGEST

“as described earlier in Section 19.5, Background, on page 289.”

should probably read

“as will be described later in Section 19.5, Background, on page 289.”

2010-07-21
62DEFER

With ruby 1.9.1p378 and rspec 2.0.0.beta.8, I had to specify:

game = Codebreaker::Game.new(output)

or I receive:

Failure/Error: game = Game.new(output)
uninitialized constant Rspec::Core::ExampleGroup::Nested_1::Nested_1::Game
# ./spec/codebreaker/game_spec.rb:8:in `block (3 levels) in

for the initialization of the Game class in game_spec.rb

2010-07-21The examples are all written against 1.8. I'll note that in the beginning of the book.
71TYPO

At the end of section 5.4, on this page, it states:

“By the end of the next chapter, you’ll actually be able to play the game!”

but at the end of Chapter 6, you are not able to play the game.

2010-07-20
301TYPO

The bullet point starting:
“config/cucumber.yml:” has no follow-on explanation. All the other bullet points do. I’d suggest adding something here to go over the contents of the file.

2010-07-21
27SUGGEST

Attempting to install cucumber reveals that gherkin is listed as a dependency:

metatron:~ james$ sudo gem install cucumber
Password:
ERROR: Error installing cucumber:
\tcucumber requires gherkin (>= 1.0.24, runtime)

sudo gem install gherkin solves the problem quite nicely, but it may be good to explicitly list the gherkin dependency in the text.

2010-06-15This is resolved in cucumber and, in an effort to keep the book valid for a long time forward (during which cucumber is unlikely to be renamed, but its dependencies might change), I'm going to leave it as/is.
416TYPO

Under Contracts,
actual.should respond_to(*messages)
and
actual.should_not respond_to(*messages)
the “Passes if” and “Passes unless” code is wrong.

Have:
messages.each { |m| m.respond_to?(m) }

Should be:
messages.each { |m| actual.respond_to?(m) }

2010-07-21
42TYPO

5th paragraph, 2nd line. “codbreaker_starts_game.feature”. Missing ‘e’, should be “codebreaker_starts_game.feature” .

2010-06-16
267TYPO

In section 18.1, 4th paragraph, the last few words, “through it’s APIs” s/b “through its APIs.”

2010-07-21
269SUGGEST

I think the Connextra Format section needs to be removed and replaced with one explaining the “In order to…” format or an additional section explaining this format’s origin needs to be added. The problem is that the book explains Connextra but then goes on to use examples using the alternate format, with no introduction to it since way back on page 142. This is probably just a leftover from the previous Beta books that used the Connextra format.

2010-07-21
63TYPO

“The next line sets up a message expectation: an expectation that the output object should receive the puts messsage with the string ’Welcome to Codebreaker!’ as its only argument.”

The second ‘message’ has an extra ‘s’.

2010-07-20
62ERROR

require ‘spec’ is not needed in the following code block:

$LOAD_PATH << File.join(File.dirname(FILE),“..” ,“lib” )
require ‘spec’
require ‘codebreaker’

2010-07-21
52ERROR

In the last section on the page, the text states “…so in this example the And() on the last line…”

The previous example has only Given(), When() and Then() “fragments.”

2010-06-16Formatting problem - the And falls on the top of the next page. Should be resolved before printing.
50OK

The second paragraph states “Here are the contents of the two files:” I was unclear if this introduction was the appropriate place for a code listing or if a reference (link) to the previous chapter would suffice.

2010-07-18
52DEFER

The first paragraph of the second section states: “The last two, And() and But() take on the meaning of the previous Given(), When() or Then()….”

When I thought about this as a programmer, I wondered, “If Cucumber only hashes the block with the regular expression, how does it distinguish two identical regular expressions occurring in a different context (for example, one after a When() and one after a Then()).”

Although this may be a technical Cucumber question, and although it may never occur in practice, addressing it with a footnote might help readers to know that it was considered.

2010-07-18
52DEFER

The last line of the first paragraph in the second section states: “…the And() on the last line of the scenario is treated as a Then().”

When I first read this fragment, I understood it as described in the previous chapter: merely a convention. However, when I put on my developer hat and thought about how I might use Cucumber, I asked myself, “Do I need to translate my textual ”Ands" and “Buts” into “Thens” and “Whens” when I use Cucumber?"

On further reading, I believe I do not, but I am uncertain without even more reading.

It might be nice to clarify more of how this works (or refer to a future section for more details).

2010-07-18
54TYPO

The last sentence on the page states: “Create a lib directory with a codebreaker subdirectory…”

I could not quite picture the directory structure that we need to create.

Because I’m a visual person who likes the big picture before details, I would find a sidebar describing at least the standard Cucumber directory structure (no files, just directories) either here or perhaps earlier in the book.

2010-07-18
286286OK

I believe that I’ve discovered an error at this late stage—but I could be wrong. Doesn’t the scenario steps ‘repeating’ snippet example given in section 19.3 need to use “And” instead of “When” (repeated four times) at the bottom of page 286 and top or 287?

IOW, where you have:

(Bottom of 286:)
When “I select #{source} as the source account”
When “I select #{target} as the target account”
When “I set #{amount} as the amount”
(Top of 287:)
When “I click transfer”
—-
Shouldn’t that instead be:
And “I select #{source} as the source account”
And “I select #{target} as the target account”
And “I set #{amount} as the amount”
And “I click transfer”

?

Of course the first ‘When’ at the top is correct—THIS IS CORRECT HERE:
When /I transfer (.) from (.) to (.*)/ do |amount, source, target|

2010-07-21Given, When, Then, And, and But are all interchangeable.
300TYPO

This line:
$ [sudo] gem install selenium-client —version 0.2.18

Should be:

$ [sudo] gem install selenium-client —version 1.2.18

(Or whatever version you’re using to test all the code in chapters 20 onwards. There is no version 0.2.18 of selenium-client, but there is a 1.2.18, so I assume that’s the one you meant.)

2010-07-21
34SUGGEST

We begin this chapter by describing an “exact match” and “number match”; however, these phrases become the more generic phrase “correct” throughout much of the remainder of the chapter.

I found this change difficult. I was continually asking myself, “Does correct mean an exact match or only a number match.”

I think the chapter becomes easier to understand if we use these two terms rather than the more generic “correct.”

2010-06-15"correct" refers to a mix of exact and number matches. I swapped in the word "match" or "matching", where appropriate, and I think it's a nice improvement. Thanks.
34TYPO

The last paragraph in the first section states: “What we don’t know is which three are in the guess…”

Should this be “…in the code…” (since the player knows that guess she made)?

2010-07-20
42OK

The footnote, number 7, indicates that Cucumber supports several languages.

Do we want to either list these languages here, or add a reference in the footnote where an interested reader can find these additional languages?

2010-07-18
43OK

The feature description at the bottom of the page uses the word “number.” Although technically accurate, I found myself (with a math/physics background) having to remember that “number” did not describe the complete 4-digit number but only a single digit.

Might the term “digit” better communicate our intent?

2010-07-18
44SUGGEST

The last sentence on the page reads “Let’s add more scenarios with all four number correct…”

When I read that, I thought “four matching numbers in the correct positions” (since that is my goal). However, we intend to describe situations in which we have guessed four matching digits but have not yet determined the matching positions.

Might this be better phrased by adding, “…but, perhaps, not in the correct position”? Or by using the technical term “four number (or digit) matches”?

2010-06-16
45SUGGEST

The fourth paragraph uses the term “localization.”

When I first read this word, I thought of localization in the context of internationalization; however, I do not believe that this is the intended use here (although the Cucumber community may use this term in a special way).

If it is not the general use of localization (within i18n), do we need to define how we plan to use it?

2010-06-16Changed to 'cohesion'.
45TYPO

Footnote number 8 is on the word “localization”; however, the footnote describes the DRY principle.

I believe the footnote should be on the word “DRY’ing.”

2010-06-16Editor likes footnotes at the end of sentences. Leaving as/is.
46SUGGEST

The first paragraph of the second section states “…all four number are correct….”

Might the term “match” be clearer than “are correct”?

2010-06-16
47DEFER

The first paragraph states: “…the placeholders are bound by position….”

Will we eventually learn how Cucumber binds by position?

2010-07-18
47OK

The Scenario Outline at the bottom of the page puts double quotation marks around each placeholder. For example, it says, ‘Given the secret code is “”.’

I do not believe the double quotation marks are needed.

2010-07-18
62DEFER

ruby 1.9.2dev (2010-05-13 revision 27783) [x86_64-darwin10]
and
rspec (2.0.0.beta.8)
I have to use namespace
game = Codebreaker::Game.new(output)
otherawys:

Failure/Error: game = Game.new(output)
uninitialized constant Rspec::Core::ExampleGroup::Nested_1::Nested_1::Game
# ./spec/codebreaker/game_spec.rb:9:in `block (3 levels) in

2010-07-21The examples are all written against 1.8. I'll note that in the beginning of the book.
51OK

The sidebar entitled “Downloadable Files” is not referenced in the text (at least near its position).

I thought it would be useful to have it referenced nearby.

2010-07-18
52DEFER

The second paragraph describes the key to understand how Given(), When() and Then() work ‘under the hood.’

Do we need to explain this idea further here or to refer to another section for more details?

2010-07-21
53SUGGEST

In the second paragraph of the second section, the book states “…writing the code we wish we had.”

I think it would help to refer to the sidebar of page 54.

2010-07-18
54SUGGEST

The last sentence on the page states: “Create a lib directory…”

The first several times that I read this paragraph, I was unclear where to actually create this directory. Since we had primarily only referred to the features subdirectory, I though it should be within features, but it is actually a sibling to features.

How can we clarify this directory structure?

2010-07-18
55DEFER

The third paragraph on the page begins “Cucumber will load features/support/env.rb….”

I think this paragraph provides a great summary of what occurs at run time; however, it might be to have this explanation before the detailed instructions. Another alternative would be to introduce the detailed instructions with a summary of their purpose.

2010-07-18
56TYPO

The first sentence on the page states: “…whatever is captured by ([^\\”]*) part…."

I believe “the” is needed before the regular expression.

2010-07-20
57OK

The first paragraph of this page explains the Output.output method.

I do not understand the reason for needing the memoization technique. In order to call output(), I must already have an instance of the Output class. When I call the output() method on this instance, I get a new instance.

What is the reason for this technique?

2010-07-21"In order to call output(), I must already have an instance of the Output class." That is not correct. You can call output() before the instance is created, which is what happens in the first code snippet on page 56.
57OK

The code example after the second paragraph contains the expression “game = Codebreaker::Game.new(output)”

I am unclear where we define the variable “output.”

In addition, when I actually run the code (not the downloaded code but the code I’ve been building with the book), Cucumber reports that “output” is undefined.

2010-07-21It's the output defined in the last code snippet on the previous page.
60OK

The fourth paragraph describes the “parallel structures” of the directories.

On my first reading, I had two questions about the structure. First, I found it difficult to “visualize” what this structure “looks like” (simply by reading). Second, I was unclear of the rationale behind the structure?

Later, when I finally had access to a computer and could create the actual directory structure, I was able to “see” the created structure.

Do we want readers to be able to visualize and rationalize the directory structure even without “following along” on a computer?

2010-07-18
62OK

The last line of the next to the last paragraph says “…on the first line of the example.”

I am unclear to what example this fragment refers. The code fragment on this page does not refer to “output” until line seven (if one counts blank lines).

2010-07-18
67OK

In the fourth paragraph, we describe the Null Object design pattern by referring to PLoP3.

I’m unclear how many readers will be familiar with this series. In addition, we may want to either refer to a page on the web or to Fowler’s description of a null object in the context of refactoring.

2010-07-18
81ERROR

This expands upon erratum #42145

In the “sends a mark with ’’” step, the lines of code given do not provide the output reported.

Given:
game.start(‘1234’)
output.should_receive(:puts).with(’‘)
game.guess(’5555’)

Changing the order of the expressions causes the output to match that of the book:

output.should_receive(:puts).with(’‘)
game.start(’1234’)
game.guess(‘5555’)

2010-07-21
127TYPO

The following sentence:

“Imagine for a moment that you could do this, namely providing production-quality software every two weeks”

should read

[…], namely, provide production-quality […]

i.e., there should be a comma after namely, and “providing” should be “provide”

2010-07-18The book hasn't been through copy-edit yet. Wording issues like this will be addressed when we get there.
129TYPO

In the sentence: “Delivering production quality software week after week takes a lot of discipline and practice”

“production quality” should probably be hyphenated, since it acts as a compound modifier to “software”.

2010-07-18The book hasn't been through copyedit yet. Wording issues like this will be addressed when we get there.
(c)TYPO

This “problem” will likely fix itself in the next printing.

The copyright states: B13.0 printing, January 19, 2009

This should be 2010

2010-06-15
241SUGGEST

In the section describing autotest it is unclear whether or not you need to install the ZenTest library in order to use the autospec wrapper. (Actually, the “thin wrapper” bit should have been a dead giveaway, but somehow I drew the wrong conclusion — possibly because I had tab completion for “autospec” on the command line).

Also the instructions to go to “the codebreaker directory that you created in chapter 4 on page 50” was a bit confusing — page 50 describes creating a features directory, not a codebreaker directory.

Initially I tried going to the codebreaker project directory and calling autospec, but did not get any noticeable response. Thinking I was in the wrong codebreaker directory I checked to see if I had a features/codebreaker (nope), then tried spec/codebreaker (yepp, but still no response). The only codebreaker directory left to try was lib/codebreaker.

I jumped back and forth in the book between page 241 and page 50 several times before concluding that I needed to install ZenTest.

2010-07-21
46ERROR

The second bullet states “Variable data placeholders in .”

Based on later sections of the book, I believe that the placeholders must be in and “”.

2010-06-16They don't have to be. That's just a convention some follow - purely a matter of context and taste.
76DEFER

When I put on my “tester” hat, I did not see a problem adding an argument to the #start method. When I put on my “developer” hat, I was unclear of the rationale for adding the argument.

Perhaps we need to explain the rationale for the actions we are about to take.

2010-07-18
76SUGGEST

The first code fragment on the page simply adds a default argument to #start.

When I first read this, I thought, “What! We’re adding a default argument simply to make a test pass?”

On later reading, I understood it was part of the refactoring we were doing.

I think if we explain our eventual goal early, it will avoid developers “dismissing” these techniques.

2010-07-21
81ERROR

This is related to #42145.

The output of the spec command an my machine differs as described in #42145; however, I believe the difference is due to calling #as_null_object. Not calling it produces the output in the book; calling it produces output like:
1)
Spec::Mocks::MockExpectationError in ‘Codebreaker::Game#guess with no matches sends a mark with ’’’
Double “output” expected :puts with (“”) once, but received it 0 times

2010-07-21
290SUGGEST

I believe self-hosted type of examples (i.e. examples where Cucumber/RSpec is used to define/test Cucumber/RSpec) shouldn’t be used throughout the book. They’re often hard to read because separation between Cucumber/RSpec specific things and things under test/being described isn’t immediately obvious.

2010-07-21
156SUGGEST

This gets run once and only once in its own instance of Object
——
It is not clear what “its own instance of Object” is referring to.

2010-07-21
174SUGGEST

“puts hash.methods”

You probably mean hash as any hash variable, but hash is also a Object method. It is more clear to say any_hash.methods

2010-07-18
201ERROR

checking_account.should_receive(:transfer).with(50, savings_account)

savings_account should be a string or a symbol

2010-07-18
284TYPO

“You can implement step…” sentence should be in normal black text.

2010-07-21
71TYPO

This might be confusing to Windows users;

$ bin/codebreaker

They need to enter:

bin\\codebreaker

2010-07-21
173SUGGEST

Beginning on page 173, we use lambda expressions. (I’m unclear if lambda is an expression or not.)

All the previous examples do not use lambda and many later examples do not use lambda.

Might it be worthwhile to explain the reason for these examples using lamdba while others do not?

2010-07-18
175SUGGEST

When reading the section named Expecting Errors, I “ignored” the fact that all the snippets involving raise_error given in the book were embedded used a lambda instead of simply using the expression being tested.

Because should() and should_not() did not require the lambda to delay the evaluation of the function call, I mistakenly thought that raise_error() would not require the lambda.

When I attempted to use the raise_error matcher on my own, I discovered that rspec did not “catch” the RuntimeError as part of the raise_error matcher; instead, it handled it as an error in the specification (bad words, I think).

As I researched the issue, I discovered that all examples using the raise_error matcher used lambda. I eventually realized that it was required, and I slowly began to understand why rspec considered the (expected) exception that my code raised was an error (never making it to the raise_error matcher). However, since this time is the first time that the expression under test must be within a lambda, I think it would be useful to explain it - for the uninitiated.

Thanks.

2010-07-21
56OK

def puts(message) messages << message
end

should be

def puts(message) @messages << message
end

Notice the missing @ sign (making it a global object) before messages

2010-07-21The code is correct. The messages on line 7 references the messages method on line 2. If we added the @ sign, then the @messages instance variable might not be defined when puts gets called.
266SUGGEST

The first sentence is the key idea.

Great job!

(Not really a suggestion but sometimes one needs “atta boys.”)

2010-07-21
274SUGGEST

In the last line of the example at the bottom of the page, we include arguments in double quotes.

Do double quotes produce replaceable arguments?

2010-07-21
276TYPO

The second paragraph in the Given section at the bottom of the page states: “…not bound by pre-condition contracts, and can explicitly violate….”

I think the word “we” is missing before “can.”

2010-07-21
277SUGGEST

In the second paragraph, after the Then expectations, we write “…while that may be a legitimate outcome….”

I found this phrase through the end of the sentence confusing.

2010-07-21Will be addressed in copyedit.
277SUGGEST

The third paragraph states: “..we can talk about two general approaches that offer different costs and benefits….”

Do these different approaches only offer different costs and benefits or do these approaches have different purposes or goals?

2010-07-21
278SUGGEST

The first paragraph states: “…more of the long term maintenance burden….”

I do not understand. Is the maintenance burden maintaining the tests or maintaining the applications? If it is the burden of maintaining the tests, can we explain this idea more (since we do not talk about this maintenance burden elsewhere).

2010-07-21
278SUGGEST

At the end of the second paragraph, we write: “…borne by the step definitions, in Ruby.”

Does that mean that different languages have different costs?

2010-07-21
278SUGGEST

In the first paragraph of the section named “Organizing Features,” we write: “…you can easily manage that with tags and profiles.”

What are tags? What are profiles? We explain tags on the next page, but we do not explain profiles until the next chapter.

2010-07-21
285DEFER

In the second paragraph on the page, we write: “…contains one or more ‘capture groups’….”

I believe this reference is the first reference to “capture groups.” If so, can we explain them better?

2010-07-21
285SUGGEST

The last paragraph contains the phrase “…below features//.rb”

I’m uncertain what this unusual direcory “name” is communicating? Are we trying to communicate “any .rb file in features or any of its subdirectories”?

2010-07-21
287SUGGEST

Finally, the “Joe Asks…” sidebar describes the use of double quotes to indicates step arguments!

I think we need to move this sidebar, or perhaps part of the explanation, earlier in the book - perhaps as early as chapter 1.

2010-07-21
288SUGGEST

The last sentence of the first paragraph ends with: “which we typically do from the Gherkin feature files.”

I do not understand this phrase in the context of this paragraph.

2010-07-21
288SUGGEST

The list in the middle of the page contains: “AfterStep : Executed after every step.”

I cannot envision how one might actually use this feature, and I do not believe we discuss it in detail in the text.

What recommendations do you have for using this feature?

2010-07-21
288SUGGEST

In the third paragraph from the end of the page, we describe using multiple “Before” hooks.

What is the order in which these different hooks are executed (before each scenario)?

2010-07-21
289SUGGEST

The first (non-code) paragraph states: “…just like we can do on the command line with —tags.”

I believe we have explained this usage earlier. If so, I believe a “back-reference” would help to remind me of those details.

2010-07-21
294SUGGEST

The first paragraph in the section named “Configuration” (finally) defines profiles.

On earlier references to this term, we need to add “forward references” to this section.

2010-07-21
294SUGGEST

The section named “Configuration” describes profiles.

Is a profile simply a shortcut for a specific set of command-line options?

2010-07-21
295SUGGEST

The first sentence on the page says: “profiles to run on our CI servers.”

Will all our intended readers understand the acronym CI?

2010-07-21
88ERROR

At the top of the page, you have:
Run the specs and they should all pass. Run the scenarios and you should see that 12 are passing, leaving only 3 failing scenarios to go.

But we are dealing with 14 scenarios, not 15… we have 11 passing, and 3 failing… unless I missed something.

2010-07-21
79SUGGEST

Chapter: Adding New Features: What we’ve learned:
- Changed requirements from the outside which rendered the requirements on the inside incorrect.
- Fixed ArgumentError without breaking the RSpec examples by temporarily using an optional parameter.
- Saw impact on other features.
- Realized that runtime errors due to structural discrepencies are likely to impact all of the scenarios at once.
- Added the code we wished we had in the most simplest way (with an emply method).
- Did not write any RSpec examples for the “Given” or “When” scenario steps.
- Finally received a logical failure in Cucumber “Then” Scenario step which indicated that it is time to drill down into RSpec.

2010-07-20
81TYPO

On the code example, the “let” lines are marked as new with a yellow triangle but they shouldn’t as they were introduced before.

2010-07-20
81TYPO

Sorry, forget the previous erratum, I did not notice the “let” lines had been moved up. They’re OK.

2010-07-20
298SUGGEST

This portion of the book seems to assume a fairly intimate knowledge of Rails. Since I do not have this knowledge, I found it fairly difficult to follow.

Do we need to state the assumption that a knowledge of Rails is expected to read and understand the book or do we need to provide a bit more background on Rails?

2010-07-21This will be stated in the preface.
60SUGGEST

While color highlighting seems to be the default for Cucumber, color isn’t the default for RSpec. Adding -c to the spec command adds useful color highlighting.

spec -c spec/codebreaker/game_spec.rb —format nested

2010-07-21
75TYPO

The Given /^the secret code is “([^\\”]*)" $/ do |secret| didn’t work for me either, but the suggestion to remove the quotes (#Erratum 42386) didn’t work either.

Hardcoding
Given /^the secret code is 1234$/ do |secret|
did work of course.

I’m using Ruby 1.8.7 and Cucumber 0.6.4.

2010-07-21
89OK

I don’t think you have introduced the last context “with 1 number match and 1 exact match (in that order)” yet.

2010-07-21It's on the previous page.
93ERROR

the second line should read “if number_match?(guess, index) && !exact_match?(guess, index)” which includes the bug fix from the last chapter

2010-07-21
236ERROR

On rspec2, instead of “spec specs —format specdoc”, it is “rspec spec —format documentation”, I guess you’re talking about this?

2010-07-21
277TYPO

“at a higher altitude then when I started” => “then” should be “than”

2010-07-21
287TYPO

“This doesn’t mean you should always use the explcit style” => “explcit” should be “explicit”

2010-07-21
84SUGGEST

maybe you should say that when you modify the guess method you even have to modify “start” and add secret=secret, otherwhise "if secret.include?( guess[0])" will fail

2010-07-21
30OK

The Cucumber Then step:

Then /^I should see “([^\\”]*)" $/ do |greeting|
@message.should == greeting
end

makes use of RSpec’s should method. Consequently, this step will generate an error if the RSpec GEM is not installed.

Anyone dipping into the book to find out about Cucumber may not recognize this subtlety.

It would be helpful to mention that:

Any value returned from a Cucumber step is ignored. To flag an error condition in a Cucumber step, an exception must be raised and this is what the should method does (as do other expectations).

2010-07-21Section 2.1, Installation, says to install both gems.
34TYPO

A - indicates a number match: one of the numbers in the guess is the same as one of the numbers in the secret code, but in a

Should Be -

A - indicates a number match: one of the numbers in the guess is the same as one of the numbers in the secret code, but in a different position

2010-07-18
90TYPO

Last line before section 7.4 leared -> learned

2010-07-21
28TYPO

In the last sentence on the page, “community” is misspelled.
“All of the authors of this book and many other knowledgable members of the commity are members, and will be happy to help you sort it out.”

2010-07-25
22TYPO

In section 1.2; end of first paragraph: There’s a space missing between “object” and “does” in the sentence “What an objectdoes is significantly more important.”

2010-07-25
25TYPO

In the sidebar “Cucumber Seeds”, fiancée is misspelled (it should be an acute accent rather than a grave accent on the penultimate “e”).

“Aslak dubbed it Cucumber at the suggestion of his fiancèe, Patricia Carrier, thinking it would be a short-lived working title until it was merged back into RSpec.”

2010-07-25
42TYPO

Section 3.3 first paragraph, first and second sentence.

The number referencing the footnote after the first sentence has a space before it: “Acceptance Test Driven Planning is one of three practices of BDD. 5”

In the second sentence there is a space missing between “Driven” and “Development”: “It is an extension of Acceptance Test DrivenDevelopment, which is a formalization of the notion of Customer Tests in XP.”

2010-07-25
52TYPO

Chapter heading and first sentence run together (I think). It looks like it should be “Automating Features with Cucumber” and then “In the last chapter…”

Automating Features
with Cucumber In the last chapter we selected the stories for the first iteration, and wrote them out as features and scenarios in plain text using Cucumber.

2010-07-25
54TYPO

In the last paragraph on the page, there is a missing space between “run” and “cucumber”:
“Now runcucumber features/codebreaker_starts_game.feature from the project root”

2010-07-25
59TYPO

section 4.3, second and third paragraphs.

There is a missing space after the period that ends the first paragraph, and missing space after “fakes,”:
“You’re probably familiar with stubs and mocks.Test double is a generic name for them, along with fakes,spies, etc, etc.”

2010-07-25
63TYPO

Not necessarily a typo, but an inconsistency. The last paragraph talks about the spec command, but then the code example uses the rspec command:

"Open up a shell and cd to the codebreaker project root directory and run the game_spec.rb file with the spec command,1 like this:

rspec spec/codebreaker/game_spec.rb —format doc"

The spec command is referenced again on page 71 right before the last code example before section 5.4:
“Run the spec command again, and you should see”

2010-07-28
82TYPO

In section 6.3, first sentence, it says: “In this chapter we introduced Scenario Outlines in Cucumber, which allow us to express groups of similar scenarios in a readable, scannable, and DRY format.”

Actually, scenario outlines were introduced in an earlier chapter (page 47).

2010-07-28
146TYPO

In the last sentence of the second paragraph there is a space missing between closing square bracket of “[feature]” and next word, “so”:
“As a [stakeholder], I want [feature]so that [benefit].”

2010-07-28
30TYPO

After adding RSpecGreeter class to the file and re-running test rspec command misses ‘r’ - spec greeter_spec.rb

2010-07-28
34TYPO

In second to last paragraph rspec command misses “r” in two places - You can type “r”spec spec and the “r”spec command will run everything inside the spec directory.

2010-07-28
23OK

The Rails for Java Dev book says it’s inspired by JBehav, p 214.

1.3 RSpec
RSpec was created by Steven Baker in 2005, inspired by Dave’s afore- mentioned article.

2010-07-28Well, one of us has it right :)
30TYPO

Maybe should be rspec, not spec.

p30:
Run the spec again by typing spec greeter_spec.rb, and the output should be something like this:
$ spec greeter_spec.rb .
Finished in 0.00075 seconds 1 example, 0 failures

$ gem list
rspec (2.0.0.beta.18, 1.3.0)

$ spec -h
/Users/bgm37/.rvm/rubies/ruby-1.9.2-preview3/lib/ruby/1.9.1/rubygems.rb:335:in `bin_path’: can’t find executable spec for rspec-2.0.0.beta.18 (Gem::Exception)
from :282:in `method_missing’
from /Users/bgm37/.rvm/gems/ruby-1.9.2-preview3/bin/spec:19:in `

2010-07-28Right - I'll update the book to say 'rspec'. \n \nAlso - to use the 'spec' command (for rspec-1) with rspec-2 installed on the system, you need to specify the version: \n \nspec _1.3.0_ spec
391TYPO

In the paragraph immediately preceding the example, the word “minispec” appears as if it is supposed to be quoted, but is instead surrounded by mojibake—a sequence of gibberish accented characters, which may be due to an encoding issue. It doesn’t quite copy and paste properly from the PDF to this form, but it’s something like â˘AIJminispecâ˘A˙I (with the accents appearing over the letters, rather than separately as they are showing up on my browser). The problem occurs in both Preview and Adobe Reader.

2010-08-16
19TYPO

In the first sentence of last paragraph there is a space before the reference to footnote 2.

2010-08-16
26TYPO

In the first sentence of first paragraph there is a space before the reference to footnote 3.

2010-08-16
70TYPO

In the last line of the page there is a missing space between ‘refactor’ and ‘in the green’:
“we prefer to refactorin the green”

2010-08-16
83TYPO

In the first sentence of section 7.1 there is a missing space between ‘scenarios’ and ‘within a feature’:
“From the perspective of business value, the order in which we get the scenarioswithin a feature to pass doesn’t really matter.”

2010-08-16
89TYPO

In the first line of the page, there is a missing space between ‘of’ and ‘systems’:
“That applies to names ofsystems”

2010-08-16
101TYPO

In the first sentence of the second paragraph, there is a missing space between “Ruby’s” and “inject”:
“We can reduce the duplication using Ruby’sinject iterator”

2010-08-16
104TYPO

In the first sentence on the page, there is an extra space before the period:
“Now that we have this structure, of course, we can smell some new odors .”

2010-08-16
122TYPO

In the first sentence of the second paragraph, there is a missing space between ‘serve’ and ‘as’:
“This is a small demonstration of how code examples serveas regression tests”

2010-08-16
127TYPO

In the penultimate line of the second paragraph there are four successive periods instead of an ellipsis:
“establishing standards and formalized accreditation for the review committees . . . . You can certainly see where the effort has gone.”

2010-08-16
288ERROR

Running rake rspec yields
rake No examples matching ./spec//*_spec.rb could be found
rather than 0 examples, 0 failures

I think this is because until I generate the first spec it doesn’t find any files to check. Problem goes away as soon as there is at least one _spec.rb file in a spec subdirectory

2010-08-16
211SUGGEST

In the pre-refactored “uses the customer’s name in the header” spec you create your logger as

logger = mock(“logger”)

Since you aren’t setting any expectations on the logger it may be clearer to create it as a stub or double.

2010-08-16
12TYPO

That last word on the page is spelled everbody. Should be everybody.

2010-08-16
21OK

“Once we acknowledge this, it changes the way we think about driving out code.”

The phrase “driving out code” is probably intended to be “driving our code.”

2010-08-04
303TYPO

Near the bottom of the page the following sentence is repeated twice, once with a footnote and once without:

Once those additions and changes are in place, re-run
the scenario and you’ll see that we’ve got one step left:[1]

2010-08-16
203TYPO

Th last sentence of second paragraph seems to be missing a word:
“This reads a bit better than exactly(1).times, and is recommended approach:”
(should perhaps read “and is the recommended approach”)

2010-08-16
221TYPO

In the second sentence of the third paragraph, there is a contraction of “it is”/“it has” (“it’s”) instead of the possessive adjective “its”:
“Once we have one to use, we can pass it’s module name directly to the mock_with( ) method, like this:”

2010-08-16
224TYPO

In the last sentence of the first paragraph under the header “Run Several Specs at Once” it says:
“So if your spec files are in the rspec directory (they are, aren’t they?), you can just do this:
rspec spec

Should this be “the spec directory”? Or perhaps the command should be “rspec rspec” in order to specify the rspec directory (if the convention has changed in Rails 3)?

2010-08-16The "spec" directory is correct.
0SUGGEST

There’s a bit of a mix between British and American spelling (EN-gb: “behaviour”, en-US: gray, color). Is this a deliberate decision?

2010-08-16The name Behaviour Driven Development was coined by a brit, so that is the spelling we use. The rest of the book uses american spellings. Yes, deliberate.
143TYPO

In the middle of third paragraph there is a space before the reference to footnote 3:
“We start by writing a code example 3 to describe the behaviour we want”

2010-08-16
146TYPO

The first sentence of the third paragraph is missing a space between ‘givens,’ and ‘events’:
“We use the slightly artificial structure of givens,events and outcomes”

This same issue is also seen two sentences further along, between “given),” and “or”:
“Rather it means that each step is either setting something up in a known state (a given),or exercising some behaviour (an event)”

2010-08-16
155TYPO

In the third paragraph, second sentence, after the output for Newspaper, there is a space missing between ‘refactor’ and ‘in the green’:
“One is to comment out the failing example so you can refactorin the green, and then uncomment the example and continue on.”

2010-08-16
157TYPO

In the last sentence of the second paragraph of section 12.3 there’s a space missing between “Rspec’s” and “before()”: “Right now, let?s talk about grouping things by Initial State, using RSpec?sbefore( ) hook.”

2010-08-16
160TYPO

On the last sentence of the third-from-last paragraph, there is a space missing between ‘a’ and ‘begin/ensure/end’:
“We could get around that with abegin/ensure/end structure, like this:”

2010-08-16
338ERROR

The example at the top of the page, “renders a text field for the message title” uses the deprecated

response.should …

instead of

rendered.should …

The downloadable code sample contains the same error.

2010-08-16
344TYPO

In the sentence “When the messsage doesn’t tell us exactly what we need to do next, however, that’s a good case for a view spec.” message is misspelled as messsage.

2010-08-16
348SUGGEST

This page states that running rake spec:controllers will result in a “no route matches” error. However, if you’re continuing from the previous chapter, you’ve already done the recommended solution, adding resources :messages to the routes.rb. This results in you not receiving the error mentioned in the book.

This probably isn’t a big deal though.

2010-08-16
350TYPO

There are a few instances of “messsages” on this page instead of “messages”.

2010-08-16
351ERROR

I think the expected error at the top of the page is incorrect. You say to expect a failure with the message:

Failure/Error: Message.should_receive(:new).with(“text” => “a quick brown fox” )
(<Message(id: integer, created_at: datetime, updated_at: datetime) (class)>).new({“text” =>“a quick brown fox” })
expected: 1 time
received: 0 times

but I received:

Failure/Error: message.should_receive(:save)
(Mock “Message_1001”).save(any args)
expected: 1 time
received: 0 times

I think my failure is the one which matches the example at the top of the page.

2010-08-16
336ERROR

Changing double(‘Message’) to mock_model(‘Message’) and running ‘rspec spec’ results in an error different from that, which was expected.

Expected error:
undefined method ‘message_path’

Actual error:
The mock_model method can only accept as its first argument:
* A String representing a Class that does not exist
* A String representing a Class that extends ActiveModel::Naming
* A Class that extends ActiveModel::Naming

It received Message
# /home/kenneth/.rvm/gems/ruby-1.9.2-head@therspecbook/gems/rspec-rails-2.0.0.beta.19/lib/rspec/rails/mocks.rb:61:in `mock_model’
# ./spec/views/messsages/new.html.erb_spec.rb:5:in `block (2 levels) in <top (required)>’

2010-08-16I get "undefined method 'message_path'". Are you sure you've got Message in quotes?
375TYPO

The code snippet at the top of this page is supposed to be different from the one in the previous page. But they’re exactly the same.

2010-08-16
363ERROR

After setting up the controller method and running the examples, the book says to expect an “uninitialized constant AccessDenied” error. However, I received an “uninitialized constant StubResourcesController” error. This error persisted until the ApplicationController was modified on the next page (364) to rescue from AccessDenied.

2010-08-16That was an rspec issue which will be fixed in the beta 20 release
375ERROR

The MessagesController create action is exactly as in page 374, where it should have changed to tell the current user to send a message.

2010-08-16
31OK

In the greeter_steps.rb sample there is a space in the regular expression: “([^” ]*)". If you create the file by means of copy and paste from the PDF, that space makes the step become undefined when you run cucumber command.

2010-08-16The problem is with your PDF reader and there's nothing we can really do about it. There is no space in the text that we use to generate the book, and there is no space when I copy/paste in my PDF reader (Mac Preview).
229TYPO

Autotest.discover { “rspec2” }
should be
Autotest.add_discovery { “rspec2” }

2010-08-16
114TYPO

the new paragraph:
…: one each for the exact matches in the first, …
should be (i think)
…: one for each of the exact matches in the first, …

2010-08-16
286TYPO

In 19.2 (Setting Up a Rails 3 Project)
Between execution of the “rails new showtime” command and the “bundle install” command on the following page the user should be instructed to change to the showtime directory (“cd showtime”).

2010-08-16
343ERROR

Just above the last code snippet, the book says:

That example fails with:
undefined method `display_for’ for #

But the error really is:
Failure/Error: content.should nil expected: nil, got: "content" (using )

2010-08-16I get "undefined method `display_for'"
348SUGGEST

Under the section titled “Time to introduce the model”

If the reader has been following along with the book since the chapter on Rails Views (i.e. View Specs), he/she will not encounter the error that says:

No route matches {:message=>{“text” =>“a quick brown fox” },
:controller=>“messages” , :action=>“create” }

because that error was already addressed in the previous chapter. I humbly suggest you notify the reader about this. First time readers who are new to RSpec & Cucumber might wonder why they’re getting a different error. :-)

2010-08-16I don't see any reference to setting up routes in the views chapter. Can you point me to where that is (please open up a new erratum). Thanks! \n \n[Update] Found it, never mind. Fixed.
349TYPO

Under the section titled “Temporarily pending”

“Once Once we get the redirect working, we’ll
remove the pending declaration.” - The word ‘Once’ was typed twice.

2010-08-16
160SUGGEST

The paragraph finishing up the discussion about before() and after() methods
closes with:
“The next two sections will address that problem by introducing Helper Methods and Shared Examples.”

But then a chapter about around() follows.

2010-08-16
375TYPO

The code example at the top of page has not changed from the previous example as inferred by the text.

2010-08-16
334ERROR

After changing show.html.erb to “<%= @message.text %>” the returned error is “undefined method `text’ for nil:nilClass” instead of “You have a nil object when you didn’t expect it!” using ruby 1.8.7.

2010-08-16
371ERROR

The second to the last code snippet raises

`const_missing’: uninitialized constant Message::User (NameError)

In the book, the ‘User’ model isn’t generated until page 375.

2010-08-16
329TYPO

Second to the last paragraph. Second sentence. Near “…when an third-party…” ‘an’ should be ‘a’ :-)

2010-08-17
336ERROR

Sorry, I got error #44444 because instead of typing rails new ‘messages’, I accidentally typed rails new ‘message.’ Because of this, a class or a module named ‘Message’ already exists in my application and it’s neither a String nor a subclass of ActiveModel::Naming.

2010-08-18Thanks for following up.
378TYPO

The last code block adds a second test which immediately passes because we had already added the message attributes to the first test. Would it perhaps be better to add the second test as a failing test as soon as we identify the need for the message attributes, get that test passing and then return and get the first test to pass?

2010-08-18I think your suggestion is a perfectly valid approach, but as neither of these examples leads us to add the attributes to the model (we defined them as requirements earlier in the chapter), it's really a judgement call.
393TYPO

Section A.3 Guards, paragraph 4, line 2:

“after a particular version of MRI has been release,” should end “has been RELEASED”. (Add the ‘D’ to the end of release.)

2010-08-17
348OK

After generating the Message model and migrating the development db
with ‘rake db:migrate’ i had to setup the test db with ‘rake db:test:prepare’.

2010-09-04You shouldn't have to if you're running rake, which is what is used on that page (and throughout that section).
370OK

Why not using let(:message) instead of setting an
instance variable in a before block? Like it’s done
in the remainder of the book.

2010-09-04It's done both ways in different parts of the book. Both styles work, are supported, valid and people use them out in the wild.
333DEFER

While i understand that the structure and organization of
chapter 23, 24 and 25 makes perfect sense from a technical
point of view (making each chapter a topic-reference of its own),
i have to admit that this structure seems really odd given the
perspective of a reader who arrives here after reading chapters 1 to 22.

There are no failing scenarios here that are leading to the code examples
and finally the implementation. Gone is the BDD-cycle. Requirements seem
to be coming from the ‘Design Phase’ in chapter 10.2:

  • Why is there the need for a recipient in 25.1?
    (Ok, it’s obvious that a message will have a recipient, but
    that is also true for almost all other aspects of a simple
    tutorial application …)
  • Why do we need a user in 25.2?

I assume you have good reasons for leaving out cucumber here, but
i have to say that most notably chapter 25 leaves the (wrong) impression that all
this ‘Outside-In’ style of development maybe is not that important at all.

Maybe it would be possible to maintain the bdd-cycle-outside-in style without destroying
the self-containment of the chapters by providing some sidebars with the associated
cucumber features/scenarios?

2010-09-04
81OK

Regular expression in step definitions are missing one backslash:
Then /^the mark should be "([“]*)”$/ <—- missing after

2010-09-04It's not actually necessary so cucumber doesn't generate.
401TYPO

“actual < (expected + delta) or > (expected - delta)” is always true. Did you mean “and” instead?

2010-09-04
35DEFER

The description of codebreaker doesn’t state that a number can only occur once. Perhaps a good example of specifications not being complete when you start a project?

2010-09-04
91SUGGEST

At risk of engaging in TMTOWTDI, couldn’t you use 0…(guess.length).each rather than use a magic number?

2010-09-04
106OK

Do you mean “Don’t forget to remove it from the Game file.” rather than “Don’t forget to remove it from the Game class.”?

2010-09-04Nope, though the result is the same.
119OK

String#map doesn’t work in ruby 1.9. It tells you that you didn’t specify what you were iterating by.

2010-09-04The book explicitly states that the examples work in 1.8 and might work in 1.9.
352OK

Running “rake spec:controllers” after updating messages_controller_spec.rb to the code shown in the “Tidy Up” section gives this error for the third example:

1) MessagesController POST create redirects to the Messages index
Failure/Error: response.should redirect_to(:action => “index”)
wrong number of arguments (1 for 0)

I’ve copied your code directly from the source, as well as tried running the rake task directly within the code folder—all give the same error. Changing the second line of the “redirects to the Messages index” to only “response.should” brings me back to green, but obviously this isn’t the test we want.

2010-09-04That was the case with earlier beta versions of rspec and rails, but not with the versions cited in the book: rails-3.0.0.rc and rspec-rails-2.0.0.beta.19. Also works as prescribed with rails 3.0.0 (final) and rspec-rails-2.0.0.beta.20.
341OK

Shouldn’t mock_model(User, …) be rather mock_model(“User”, …)? Occurs twice on page 341.

2010-09-04Not necessarily - either works.
192OK

Line 2 of the code snippet should be “include RSpec::Mocks”, shouldn’t it?

2010-09-04Nope. That's included implicitly.
379OK

“Also, the messages table doesn’t have a sender_id field so be sure to make a migration which adds it.”

And, again on p. 382: “We need a Subscription model and a migration that generates the subscriptions table and a subscription_id on the users table. Go ahead and add all that…”

You’ve given, except for a couple of instances in the first chapter dedicated to Rails, all the low-level code and commands users who are new to Rails need to follow along with the text. I even recall a couple of comments plainly acknowledging that some of your readers may be just plain ol’ Rubyists. I have no problem with the above statements myself, but in this context, they’re just downright lazy…

2010-09-04
287TYPO

The first line appears to be mis-worded:
“We add them to the :test group to make sure that they’re code is available when running in the test environment.”

2010-09-04
333OK

In the code example (rails_views/messages/01/spec/views/messages/show.html.erb_spec.rb) it reads:

rendered.should contain(“Hello world!”)

when it should read:

response.should contain(“Hello world!”)

2010-09-04rendered is correct for rspec-2/rails-3
99TYPO

In the sentence:

The last line of the guess method didn’t change, but it’s reference to
exact_match_count now points to the method instead of a local, temp
variable.

it’s

should be

its

2010-09-12
298OK

Webrat isn’t compatible with Rails3 (last time I checked about a week ago) Do you have any plans to replace Webrat refs with Capybara?? Might be confusing to people if the final version of this book is released and there’s still no rails3 compatible version.

2010-09-08Webrat is compatible with rails 3 (and has been since the 0.7.2.beta.1 release about a month ago). If you are having specific issues, please contact the rspec-users mailing list.
199TYPO

Code is using #stub! where it should be using #stub tp be consistent with other method calls.

2010-09-12
343ERROR

Note: this is already logged as a bug (I guess we can’t comment on existing bugs???) but David says he gets “undefined method: display_for” as the book describes.

I think it IS correctly logged as an error as, in the previous step you define the method display_for in the helper, thus, the REAL error should be that the content should be nil, but isn’t

2010-09-12Yeah - I wish this could be more of a conversation tool. \n \nAnyhow, the "previous step" is not really a previous step :) It's just an explanation of an API that we'd like to expose, but it's not really written anywhere in any code until after we have the failing example. The "undefined method" error is, therefore, the correct error at that point. Does that make sense?
149SUGGEST

The RSpec book should include a section on how to create scriptlets. An RSpec scriptlet is a piece of reusable example that can be invoked from multiple test scripts.

The way I do it is to include a file under my project’s lib directory.
project/lib/project/scriptlets/forms.rb

module YourProject
module Scriptlets
module Forms
module ValidateForms
def it_will_validate_that_the_form_has_the_correct_number_of_form_field(expected_number)
it “will validate that we have the correct number of form fields” do
filed_minus_submit = App[‘form_designer_list’].item_view.count – 1
filed_minus_submit.should == expected_number
end
end
end

# The following makes use of the Ruby Module#included hook pattern
# This method is invoked each time a class or module includes module Forms
# receiver is the class (or module) that included module Forms
def self.included(receiver)
receiver.extend ValidateForms
end
end
end

Then in my test script,
describe “Fill in the main form”
include YourProject::Scriptlets::Forms
it_will_validate_that_the_form_has_the_correct_number_of_form_field(8)

it “will do the rest” do

end
end

2010-09-12RSpec already has shared example groups.
391TYPO

In the code for minispec, the first class name is PostiveSpec. Shouldn’t it be PositiveSpec?

2010-09-12
333ERROR

The Gemfile example on this page only shows including “rspec-rails” , but the contain() method called later is from webrat. The example on this page wouldn’t run until I also included “webrat” in my Gemfile.

2010-09-12
338ERROR

The example at the bottom of this page gives me the following failure:

Failures:
1) messages/new.html.erb renders a form to create a message
Failure/Error: render
Model Message does not respond to title

2010-09-12
72OK

undefined method `let’ (Ubuntu x64 10.04, rspec v2.0.0.beta.20, ruby v1.9.2p0 via rvm)

Testing goes well till cb/14/spec/codebreaker/game_spec.rb (with instance variables); but in cb/15/spec/codebreaker/game_spec.rb I have this error:

2) Codebreaker::Game #start prompts for the first guess
Failure/Error: let(:output) { double(‘output’).as_null_object }
undefined method `let’ for #
# ./spec/codebreaker/game_spec.rb:8:in `block (3 levels) in

Anyway… wonderful book!

2010-09-12That error suggests that you're trying to use let in an example rather than in an example group. If that's not the case, please report this to http://github.com/rspec/rspec-core/issues. \n \nThx
191TYPO

“Method stubs and messsage expectations…”

“messsage” with three s

2010-09-12
199TYPO

In the “Partial Mocking” example, stub methods are used, but not mock methods (as I suppose it should be, considering the title of the paragraph)

2010-09-12It's got both. should_receive is the method used for mocking.
26TYPO

In the third paragraph, there is an extra space before the second sentence which I would have thought would have been handled by the paragraph formatting code. You might have a non-breaking space or something like that where you did not intend to have one.

2010-10-11
59ERROR

When I run “cucumber features/codebreaker_starts_game.feature” prior to adding the definition for initialize to the Game class, I do not get the message, “wrong number of arguments (1 for 0) (ArgumentError)”. In fact, that step passes. If I add the code:

def initialize
end

to the Game class, I do get the wrong number of arguments error. I have not been able to track down the problem yet. I am running cucumber 0.8.5 with ruby 1.9.2 p0 on FreeBSD 7.3.

2010-10-14The code examples are all run against 1.8.7 (this is stated at the beginning of the book). What you've found is an interesting quirk of ruby-1.9.2 - http://gist.github.com/626494. I'm not sure if it's a feature or bug, but it sure is surprising.
81TYPO

In the last paragraph, first sentence, you say that we will remove the default value in the next chapter. We have already removed the default value on page 79. The code listing cb/18/lib/codebreaker/game.rb reflects the removed default value.

2010-10-14
84TYPO

In the listing for game_spec.rb, you have triangles in the left margin for the two let statements. These lines are unchanged from what we did back on page 72 as is shown in cb/15/spec/codebreaker/game_spec.rb.

2010-09-16
84SUGGEST

Please ignore errata #45064. I didn’t notice that the let lines moved up a block. Sorry for the noise.

2010-09-16
118SUGGEST

In the code listing for marker_spec.rb, you might want to place a triangle in the left margin of the pending statement to draw attention to it.

2010-10-14
81ERROR

Using rspec 2.0.0.beta.22 and cucumber 0.8.5 and ruby 1.9.2 via rvm

The code in the block headed by:
cb/22/features/step_definitions/codebreaker_steps.rb

Then /^the mark should be “([^”]*)"$/ do |mark|
output.messages.should include(mark)
end

However the suggested steps listed by cucumber are along the lines of:

Then /^the mark should be \\\\\\+$/ do
pending # express the regexp above with the code you wish you had
end

The step listed in the book is not matched by cucumber and does not work.

2010-10-14What's in the book is correct. Not sure why you're seeing different output from cucumber, but that's what I see, and it does work as advertised. \n
329TYPO

first paragraph: while debugging failures could be reworded, eg. “while debugging fails.”

2010-10-11
312TYPO

In the code for cucumber_rails/01/features/showtime_descriptions.feature, the first scenario is tagged with wip, but the text in the paragraph following the code refers to the tag focus. These two should either both be wip or both be focus.

2010-10-16
312TYPO

“Go ahead and run script/cucumber —tag @focus from the project root” should be —tags instead of —tag.

2010-10-16
62TYPO

It says:
“run the game_spec.rb with spec command like this:”
but actually uses ‘rspec’ command in quote below instead of ‘spec’.

2010-10-14
62TYPO

“rspec spec/codebreaker/game_spec.rb —format doc”

This command omits ‘—color’ switch but output is shown with color in PDF version.

2010-10-11
83TYPO

First paragraph in section 7.1 - missing space in the second line after word ‘scenarios’.

2010-10-11
59ERROR

After adding the Output class definition to codebreaker_steps.rb we are instructed to run the cucumber command again and should see an ArgumentError. However, the example code as currently written will return a NameError (undefined local variable or method ‘output’ for #). I think the Output.output method needs to be a class method.


class Output
def Output.output
@output ||= Output.new
end
end


Codebreaker::Game.new(Output.output)

2010-10-11
59SUGGEST

Please ignore my last submission regarding the output method. I failed to see that it was implemented as a global method, outside of the Output class definition. My bad!

2010-10-11
99TYPO

“The last line of the guess method didn’t change, but it’s reference to exact_match_count now points to the method instead of a local, temp variable.” - there should not be an apostrophe in “its” !

Also, it is rather confusing that the last line of the exact_match_count method returns an identically-named variable, especially if the reader isn’t familiar with Ruby’s mechanism for resolving this type of ambiguity. When I initially scan-read this sentence, I mistakenly thought it was talking about the last line of the exact_match_count, and ended up thinking “huh? the method is returning a reference to itself rather than to the count variable?”

Obviously this can be avoided by Rename Variable, which you already do implicitly when introducing use of inject later on. One solution would be to do this Rename Variable earlier, at the same time as the two Extract Methods, although that probably violates some rule about only doing one refactoring at a time … but if so, you are arguably already violating that when you do it at the same time as introducing inject :-p

2010-10-14
80ERROR

Given /^the secret code is “([^”]*)"$/ do |secret|
game = Codebreaker::Game.new(output) game.start(secret)
end

should be:

When /^I guess “([^”]*)"$/ do |guess|
game = Codebreaker::Game.new(output) game.guess(guess)
end

I am guessing at that stage we are still working on “I guess …” scenario.

2010-10-11
80ERROR

There is no error as previously reported. The book is correct.

2010-10-11
172TYPO

“Ruby is bit more complicated” should say “Ruby is a bit more complicated”

2010-10-14
21TYPO

“Whether we’re talking an object” in the section “It’s All Behavior”. I feel there should be a pause or a word after talking: (i.e. talking about an object).

2010-10-14
28SUGGEST

This is the “given” in this example (the “when”, the “then”). These words are not set in italics in the Mobi version as they are in the PDF.

2010-10-14
30SUGGEST

The part about “move the greeter_spec.rb file” confused me. The step definition on the next page uses CucumberGreeter.new, which I immediately thought was an error, and should have been RSpecGreeter.rb. Since these examples don’t share code, I would treat them as separate, and not put them together at least until page 33 where it currently says “If you moved…”

2010-10-14
287TYPO

In the first line on the page, “that they’re code is available” should be “that their code is available”.

2010-10-14
206TYPO

… to express more specfic constraints.

should be

… to express more specific constraints.

2010-11-07
206TYPO

… we can express this expectation something like this:

should be

… we can express this expectation like this:

2010-11-07
207SUGGEST

Now, the message will be:
Mock ‘subject’ expected :msg with (a number greater than 3)
but received it with (2)

Given the message just above, it would be more consistent to use:

Mock ‘calculator’ expected :add with (a number greater than 3)
but received it with (3)

2010-11-07
209TYPO

The @network in each of these variations behave …

should be

The @network in each of these variations behaves …

2010-11-06
32TYPO

On this line:

Then /^I should see “([^” ]*)"$/ do |greeting|

there is a space between the ‘"’ and the ‘]’.
That space makes the step undefined when running cucumber.

2010-11-06
332TYPO

The first sentence of the second paragraph should change. Current form: “We use views to display data provided by models which are, in turn provided by controllers.”

Either ditch the comma, or add another one right after “in turn” to balance it. I would encourage ditching it to promote sentence flow; the role of controllers in the sentence isn’t fundamental enough to justify the gravity of those commas.

2010-11-06
425TYPO

The links to the RSpec book and the PragProg catalog on this page do not work in Preview on OSX. The other links that are prefixed with the h-t-t-p:/-/ work fine.

I had to spell out the protocol like that because when I tried to just put it in, the error message I got (in green) said hyperlinks weren’t allowed.

2010-11-07
34TYPO

Different output when we run cucumber features.
The output in this page(successful scenario) is is the same as the previous output(failing scenario)

2010-11-07
31/32TYPO

Output fom the example run appears to be duplicated

2010-11-07
34TYPO

The example results following the successful test are copied from the failed test results on the previous page (p33).

2010-11-07
196SUGGEST

section: Mixing Method Stubs and Message Expectations
The book says:
“By using the mock( ) method to generate the logger double and the stub( )
method to generate the customer double, we’re helping to express that
these objects are playing different roles in the example.”

The code example above doesn’t use mock() or stub() to generate a double. Maybe it’s implied but since I’m just learning I’m not sure.
Thanks,
Sam

2010-11-07
176TYPO

Under the Ch, ch, ch, ch, changes heading. There is a typo. It should say “Ruby on Rails” instead it says “Ruby on RailsRuby on Rails”

2010-11-07
389ERROR

PDF table-of-contents: the appendices seem to be mis-nested.

2010-11-07
170DEFER

I think “nontechnical” should be hyphenated: “non-technical”

167DEFER

There’s a missing space after the comma: “It /is/ DRY,/and/ it’s so complicated.”

297ERROR

the first output of the “completing the feature” section is not correct, it should show that there is an error, as the step it’s not passing because the minutes are showed!!!

2010-11-27
59DEFER

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…”.

93TYPO

Under Learning from Rapid Feedback: “Both failures are because of one or more minus sign than…” should be “Both failures are because of one or more minus signs than…”

2010-11-27
288ERROR

Instead of:
script/rails generate rspec:install
You could say:
rails g rspec:install

2010-11-27
22DEFER

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 and they can get it back.”

176DEFER

Ruby on RailsRuby on Rails extends …

176SUGGEST

For the real estate examples under the Ch, ch, ch, ch, changes heading, the use of underscores in the sale and commission numbers is confusing.

2010-11-27
200ERROR

The first example does not actually call Widget.find, so the expectation that the Widget class should receive the find() message will never be met.

2010-11-27It's called by the put action, not in the example itself.
200DEFER

“The first example specifies that the WidgetsController finds the widget, so we set an expectation that the Widget class should receive the find() method.” This should be “find() message” rather than “find() method” because messages are received, not methods.

106DEFER

“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 means simply “Create a marker.rb file in lib/codebreaker and move the Marker class into that file.” With no module around it? That works, but I’m not sure it’s just what was meant. It’s a Ruby-newbie issue but it might be worth trying to clarify a bit.

183DEFER

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

193DEFER

“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 this means that every other pattern is usually (but not always) a variation, or the nearly every (but not all) patterns are variations? There is a difference in meaning.

196TYPO

By using the mock( ) method to generate the logger double and the stub( ) method to generate the customer double,…

As previously pointed out, this is confusing since “mock()” does not occur in the example. Given several uses of the word “mock,” it would be helpful to remind us again that here it means a message expectation, expressed by the “should_receive.” At least, I think so!

2010-11-29
232DEFER

RSpec::Core::RakeTask.new do |t|
t.rspec_opts = [“—color”]
end

spec_opts takes an array of strings,…

Should “spec_opts” be “rspec_opts”?

238DEFER

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 can run the [sic] rest of the suite…”

367DEFER

The database migration on this page specifies “recipient_id”:

“script/rails generate model message title:string text:text recipient_id:integer”

On PDF page 371 and 372, the reference is to “recipient” (no “_id”). Admittedly I’m a beginner in Ruby but for me this example fails.

For context, I’m running Rails 3.0.3 and Ruby 1.9.2p0.

300DEFER

“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 practice.”

Awkward sentence with “for in practice.” Consider rewording at least to “that in practice we use RSpec for,” if not the more formal “for which in practice we use RSpec.”

101OK

Next step! line looks like it should be a section header, but is formatted like normal text.

2011-04-05It is not a section header.
130DEFER

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

251ERROR

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.

273TYPO

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 above corresponds to Kindle location.

43DEFER

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 reads: We picked out two stories that will result in working software sufficient to interact with it in a meaningful way.

Poor third story…

67DEFER

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 “Codebreaker::Game#start”, the # is treated as the start of a comment. This could be overlooked were it not for the explicit instruction to “use the —color flag”.

102TYPO

Missing space between “Ruby’s” and “inject” in the second paragraph.

2011-04-05
34DEFER

The phrase “go ahead and ” is used too much throughout the book. It would improve the writing to remove that part and just state the “”. For example, on page 34, the phrase could be removed from the sentence beginning with “Go ahead and add a step_definitions directory.”

113OK

depot>rails generate scaffold Product\\title:string …

hi, i’m a noob, but for me the backslash after Product did’nt work, i used “/”

2011-04-05p 113 is in the first part of the book. Please re-report with the correct page number.
232ERROR

The example Rakefile for RCov doesn’t seem to be valid for RSpec 2.0 (as is used in the book so far), but rather for the older version 1.3:

require ‘rake’
require ‘rspec/core/rake_task’
namespace :spec do
desc “Run specs with RCov”
RSpec::Core::RakeTask.new(‘rcov’) do |t|
t.spec_files = FileList[‘spec//*_spec.rb’]
t.rcov = true
t.rcov_opts = [‘—exclude’, ‘\\/Library\\/Ruby’]
end
end

The solution for me, as found through a Google search, was to replace

t.spec_files = FileList[‘spec//*_spec.rb’]

with..

t.pattern = ‘spec//*_spec.rb’

Regards,
Johan

2011-04-05
338DEFER

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_spec.rb on pdf page 338 results in a an unintended failure:

Failures:
1) messages/new.html.erb renders a text field for the message title
Failure/Error: form.should have_selector(“input”, type: “text”, name: “message[title]”, value: “the title”)
expected following output to contain a tag:

186TYPO

Last sentence of first paragraph ends:

should be greater than or equal to 980 and less than or equal to 1,f020.”

The very last word “1,f020” shouldn’t have an “f” in the middle of it.

2011-04-05
270TYPO

“Create a step_definitions subdirectory in features, and add a file named hotel_steps.rb.”

However, the code snippet that follows gives a path of “cucumber/02/features/step_definitions/room_steps.rb”

hotel_steps.rb != room_steps.rb

2011-04-05
296TYPO

The first time cucumber is run under “Completing the Feature” I would think that only 1 of 2 scenarios should pass. The second one “2pm” vs “2:00pm” should fail. The text suggests that is what happens as the next task is fixing the showtime method.

2011-04-05
97OK

“We’ll clean this up during our refactoring this chapter.” should be “We’ll clean this up during our refactoring this in chapter.”

2011-04-05
102TYPO

“using Ruby’sinject iterator in each” has no space between “Ruby’s” and “inject”.

2011-04-05
43OK

The change to code_breaker_steps.rb to pass the Output test double into the constructor is incorrectly referencing the output variable (output vs. @output)

Should be:

When /^I start a new game$/ do
game = Codebreaker::Game.new(@output)
game.start
end

instead of

When /^I start a new game$/ do
game = Codebreaker::Game.new(output)
game.start
end

2011-04-05It's referencing the output method, not a variable. Look at the bottom of the first listing on the same page.
249TYPO

The reference for formatter method “dump_summary” doesn’t match the rest of the reference entries, because it is preceded by the keyword “def”.

This also results in awkward wrapping on an already long method declaration.

2011-04-05
295TYPO

“The model generator creates a movie_spec.rb because RSpec registered itself as the test framework when we ran script/rails generate rspec:install.”

This is true of rails 3, but not rails 2, where it does not create the file.

2011-04-05Correct. The book covers Rails 3.
127OK

“at this stage … by this stage”

2011-04-05That's intentional. Read it again. It's funny, even though Dan wrote it.
92OK

By the time I got the the second paragraph on page 92, I had 11 passing, not 12. I checked everything a couple of times, but could not see anything wrong and so I continued. By the time I completed the following steps through page 94, everything was passing.

2011-04-05I just went through it again and I see 12 passing. Do you have a total of 15 scenarios? If not, be sure to check the feature against the listing on pp77/78
1DEFER
  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 somehow felt sad because “disciplined approach” detailed part from previous
versions was omitted/under-emphasized. It was a great value for me to read it,
and definitely helped my career a lot, per se, “you’re not silly, you’re on
the right path”.

## On testing
Test everything that could possibly break. A lot of debate here.
Not even a mention in the book. I know it’s hard to talk on this, but it’s
worth at least mentioning it.

## On workflow
I’m unaware of the constraints, but I would like to see a section of BDD DVCS
workflow and deployment. I’m not sure if they’re on scope, but feature branches,
staging servers, deployment from day one, and a few other topics are often
under-valued or unpracticed on communities, I’m a strong believer that
stuff works better that way, and I was wondering if there are any plans about
it. Agile.

## On autotesting
Also, although the some implementations are a little bit buggy at this time, I
would also suggest to focus on automated testing on your development machine,
projects such as autotest-[notification], spork and possibly guard, and the
rspec/cucumber support are worth mentioning.
I’d also like to see to some point CI scenarios.

## On mocks
On test doubles, I have almost nothing to say. Great coverage.
What’s not clear to me by reading it, it’s the role of mock objects on high
level testing, I mean the cucumber part.
I haven’t faced this situation, but I do have the doubt.
I mean, a feature is supposed to be integrated, it’s supposed to test your
entire stack, but might also be supposed to be contained, isn’t?
My doubt here is probably just an indicator of bad design, but what happens
when you feel the need for a mock object on your features? Their role on
rspec is well understood, as a matter of fact, I’m confident with them since
I’ve got another layer of testing that allows me to see how are the parts
working, that’s why it seems a big no-no to me to use of them on cucumber, but
again, what do you when you feel the need?

## On milestones
An excelent part that one about release planning and milestones: This gets in,
that gets out. A little more emphasis could be added into this customer-driven
iteration negotiation, and even if they’re other sources that deal with the
topic I would like to see more about reacting to change, new features breaking
schedule, etc. Absolutely awesome the part of one-week iterations, I have to
say I was shocked, I’ve been ranging on 2-4 weeks iterations, definitely I must
try that in the near future.

## On Cucumber
I’ve experienced in the past, begginners at BDD have problems with Cucumber,
because they tend to be much specific and they abstract away from the business
requirements on writing the scenarios, they get to deep into implementation,
and they even have problems with Regexps because of that. Although that
though can be extracted from the book, I’ve felt somehow it lacks a little more
emphasis on this part.

## On Rails BDD
For the rails part, I must only say I was one of the ones that were expecting a real project in the “Agile Web Development with Rails 4” way.
Totally omitted capybara, I assume there’s a very good reason on doing that.
What about database_cleaner? Wasn’t database_cleaner on the Gemfile sufficient?
On view testing, three state models, only one mentioned: there are factories,
fixtures and mocks. Each with it’s own advantages and disavantages,
but certainly each of them are widely used.

Suggest something like “def and; self; end” to rspec authors, allowing:
mock_model(“Message”).as_new_record.and.as_null_object
# instead of
# mock_model(“Message”).as_new_record.as_null_object

I don’t like script/rails at all, who does that?
rails g controller messages
instead of:
script/rails generate controller Messages

Also, seems like —no-helper is no longer valid.
A rails bug maybe? It displays ‘—helper’, and even that isn’t allowed.

Migrations: I feel something missing here.
Shouldn’t be possible to explain at least something like nulldb or similar,
can’t remember exactly, adding to migrations continously while a model evolves, or generating a model from a set of expectations on what we might need?
Shouldn’t we favoring field_id:references instead of a simple field_id:integer?

The shoulda people will feel a little offended, not a single
mention to their matchers ;)

“is valid with valid attributes” <- pointless? This is not behavior.
What makes valid attributes?

On associations, agree you shouldn’t spec them directly.

## On Progressive Enhancement (or the lack of)
Based on experience, and in this book’s scope, I was sad that progressive
enhancement wasn’t mentioned at all in the book.
We aren’t all the time building RIAs in the strict sense,
so this model of FE developing actually helps you on testing your app.
It brings a lot of benefits, but from a testing standpoint
(or a lazy standpoint maybe), it allows you to focus on testing your app
entirely without javascript at first, and then adding those automated browser
scenarios only on those enhancements.
Ex. if you’ve got a file upload field which gets replaced by a drop area on a
drag-drop UX, you just abstract away from that initially, make sure the form is working, the views are rendered and the file is uploaded, then your
selenium tests complements that.
Narrowed down concept, simple enough, but missing from the book.

## Colophon
Finally, I wouldn’t expect you to take my suggestions to the line, you’re far
better than that, but since this has become (or I expect it to become) the
point of authority for BDD, I believe some of those points will fill the gaps
in such an important book.

Nevertheless, a terrific work, a must-have book, and an amazing source of
knowledge.
Didn’t change the way I program, I’ve been on this for a while now,
but it certainly enhanced the way I do it, I feel a better developer already.
Keep going, since you guys are my model of inspiration.

Thanks NaN ;)

On Cucumber part, there are still examples which use b/w instead of +/-.

120OK

I received undefined method `map’ for 1234 instead of undefined method `delete_at’ for 1234

2011-04-05The examples in the book work as described with ruby-1.8.7. If you run it w/ 1.9.2 you'll get the error you mentioned.
167TYPO

Missing space after the comma in “It is DRY, and it’s so complicated.”

2011-04-05
230DEFER

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 while, it was also not listed on page 18. Please consider adding the appropriate gem to page 18 or mentioning where to find it on page 230.

61OK

“start game” scenario wont fail in ruby 1.9.2 because of strange ruby behavior:

  1. Ruby 1.9.2

ruby-1.9.2-p0 > class O; end
nil
ruby-1.9.2-p0 > O.new(1,2,3)
#

  1. Ruby 1.8.7

irb(main):001:0> class O; end
nil
irb(main):002:0> O.new(1,2,3)
ArgumentError: wrong number of arguments (3 for 0)
\tfrom (irb):2:in `initialize’
\tfrom (irb):2:in `new’
\tfrom (irb):2

2011-04-05The examples in the book were written to work with ruby 1.8.7, so the book is fine here (though if we get to a 2nd edition we'll update to 1.9.2). \n \nYes, that is odd behavior, and it's due to an unfortunate change to ruby 1.9.2 that I believe (hope) is being reversed for 1.9.3.
73DEFER

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 sure the numbers always progress in sequence.

296OK

I cannot seem to get both scenarios to run by simply removing :wip from the rake command. I have to remove the tag from the feature file. I am using the same version of cucumber-rails as the example. It seems counter to what I read before about tags.

2011-04-05Probably your cucumber.yml file has an exclusion of wip tags in the default profile.
59OK

The path in the code:
$LOAD_PATH << File.expand_path(‘../../../lib’, FILE)

Should not it be
$LOAD_PATH << File.expand_path(‘../../lib’, FILE)
?

2011-04-05$LOAD_PATH << File.expand_path('../../../lib', _FILE_) is correct. \n \nThe __FILE__ argument provides the starting point. The first ../ gets you to the same directory as the file: support. The 2nd ../ gets you to the features dir. The 3rd ../ gets you to the project root dir, below which lies the lib dir.
287DEFER

The autotest/discover.rb would not be any more generated since this commit f47e87b39a6f2bc24b71d701c8b509fd6e32acb1 in the rspec-rails repository.

238OK

It says you can require ‘ping’ to do a ping in your ruby code.

This used to work under ruby 1.8.7, but having recently upgraded to ruby 1.9.2 this require no longer works. It seems that ping has been removed from the ruby 1.9.2 library.

2011-04-05Per the Ruby and Gem Versions section of the Preface, the examples all work with Ruby 1.8.7. I'll change the footnote text to say "Most of the examples" instead of "The examples all ..." in the next printing.
304SUGGEST

The instructions are to run “rake features” instead of “rake cucumber” as previously done. This results in a deprecation message that tells me to run “rake -T cucumber”. This is an extremely minor point, but I had not seen “rake features” before, and it seems “rake cucumber” would be the better choice.

2011-04-05
34OK

the output of cucumber features should be successful, but you have the same failing output as used on page 33

2011-04-05I can't find what you're referring to on pages 33/34 of the PDF or printed book.
324SUGGEST

The line for installing the database_cleaner plugin should have a note that the syntax has changed in rails 3.

script/plugin install (Rails 2)
rails plugin install (Rails 3)

2011-04-05
326TYPO

The “When” condition at the bottom of the page is missing its “do”.
Reads: When /^I agree to the Terms of Service$/ d
Should read: When /^I agree to the Terms of Service$/ do

2011-04-05
344DEFER

“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 21, where they are actually talked about and used.

376TYPO

Just above the second code example of the page there’s a space missing:
Reads: Add an emptysend_message( ) method to the User model
Should read: Add an empty send_message( ) method to the User model

2011-04-05
152DEFER

Your code snippet formatter has decided that the text following => is ruby code and highlighted “require” and “and” inappropriately in the second line:

describe User, “should require password length between 5 and 40” { … }
=> User should require password length between 5 and 40

260TYPO

The reader is asked to a create a file named features/booking.feature but the code download and the cucumber output comments on the following page uses a file called book_room.feature. It looks like running cucumber on file features/booking.feature creates a file called book_room.feature, which of course is not the case.

2011-04-05
196ERROR

“To explain what we mean, let’s look at an example that uses
both a method stub and a method expectation.” - shouldn’t it be “method stub and a message expectation”?

2011-04-05
239ERROR

missing space before “:flexmock” :)

2011-04-05
85DEFER

Recommend Enumerable#count, not enumerable#inject. The #count method does exactly what’s required here. Using #inject makes the code harder to read to save a temporary variable. Using #count still gets rid of the temporary variable, and improves readability to boot.

350OK

Here, it says that we’ll have two passing examples, but the “redirects to the Messages index” will fail with the error :
Could not find table ‘messages’
because, since we are not stubbing Message in that example, it falls through to the real method. I added a stub in my code, if you have a better suggestion, email me at mpj@mpj.me

2011-04-05Per page 347, you should have a messages table by then.
120DEFER

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 future print run

272OK

I get Lexing error on line 2 when I use the syntax with steps %Q{} Maybe my fault, dunno.

2011-04-05It works for me as specified. It's just Ruby. Please report that to the cucumber issue tracker if you're still having trouble with it.
293OK

My installation of Cucumber didn’t work until I did it like its Github page specifies including dependencies like Capybara and Database Cleaner.
In Gemfile:

group :development, :test do
\tgem ‘rspec-rails’, ‘>= 2.0.0’
\tgem ‘cucumber-rails’, ‘>= 0.3.2’
\tgem ‘webrat’, ‘>= 0.7.2’
\tgem ‘capybara’
\tgem ‘database_cleaner’
end

Otherwise I get non initialized errors for both constants Copybara and DatabaseCleaner.

2011-04-05If you use the versions in the book everything work just fine.
59OK

My codebreaker.rb only works with
require ‘game’
rather than
require ‘codebreaker/game’
I’m using ruby 1.9.2

2011-04-05That would suggest that your file/directory layout is not the same as described in earlier pages. What's there works correctly if the steps are followed, so I'm going to close this. If you want some help debugging your environment, please write to the rspec-users mailing list.
361ERROR

The render_teplate variant with template extension ‘js’ is not supported by rspec for rails 3.

2011-04-05
67ERROR

In the 2nd to last paragraph, you say “Sometimes failures are logical failures, and sometimes they’re errors. In this case, we have an error.”. It seems to me that this is a logical failure - our expectation was not met. I would expect that an error would be a ruby error like referencing a method that doesn’t exist. If this is really an error, could you explain what you mean by that?

2011-04-05
191ERROR

In the logger example, if the customer fails …

should read

In the logger example, if the statement fails …

2011-04-05
291ERROR

The first instance of the cucumber output on the page should not show both scenarios passing. Otherwise there would be no reason to change the code of formatted_time.

2011-04-05
181DEFER

In “/… for Aslak/”, the word for should not be printed like a keyword.

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

200OK

Use the pattern for the customer double as well.

In before block: @customer = double(‘customer’, :name => ‘Aslak’)
In the second example remove the method stub for customer.

This may require that the subsequent explanation gets adapted.

2011-04-05'Aslak' is used on the next line as part of the expected argument to log(). Putting that in the before block means you have to look to the before to understand what's going on in the example. It's subtle, and under many circumstances I'd do what you suggest, but in this case I'm going to leave it as/is.
203SUGGEST

… and just haven’t gotten to it yet.

should read

… and the team just hasn’t gotten to it yet.

2011-04-05
206OK

… earlier this chapter.

should read

… earlier in this chapter.

2011-04-05
280DEFER

In “:require”, the word require should not be printed like a keyword.

313DEFER

In “/… logged in as …/”, the word in should not be printed like a keyword.

313TYPO

Every once in awhile, …

should read

Every once in a while, …

2011-04-05
262ERROR

the file name of the snippet is named “hotel_steps.rb” but the example file is named “room_steps.rb”

2011-04-05
280ERROR

in order to get the example running in rails 3.0.5 add
gem ‘capybara’
gem ‘database_cleaner’
to the group in the Gemfile

2011-04-05
31TYPO

checking

59SUGGEST

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 occur at the end of the line in the epub version and looks like it is part of the file name (code-breaker.rb)

Cucumber will load features/support/env.rb, which now requires lib/code- breaker.rb, which, in turn, requires lib/codebreaker/game.rb, which is

75TYPO

“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, which is missing upto this point.

Feel free to reach me at khan [dot] mohammad [at] acm [dot] org, if you need further clarification.

169TYPO

Third paragraph:
Currently Reads:
“…anything that begins with have_ to a predicate on the target object beginning with has_”

have_ and has_ should be switched.

It SHOULD read:
“…anything that begins with has_ to a predicate on the target object beginning with have_”

221SUGGEST

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 using rails.

347TYPO

Example rails_controllers/messages/13/spec/controllers/messages_controller_spec.rb is missing the line Message.stub(:new).and_return(message). This winds up being fixed in following examples due to the refactoring in the “Tidy Up” section.

348TYPO

In the example rails_controllers/messages/15/spec/controllers/messages_controller_spec.rb the before block needs

job.stub(:save).and_return(true)

to make the “saves the message” test pass.

288ERROR

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 uninitialized.

73SUGGEST

I suggest that the definition of the let() method to be updated/verified.

let() { }

i’m beginning to have a suspicion that the “name” which you feed into a call to let() is to be defined as “the name of the resource which the contents of the block are to be assigned to. For example, the generated of a mocked resource object that is to be used throughout a spec”.

326TYPO

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

42TYPO

The code example is shown as

Then /^I should see “([^”]*)"$/ do …

but in the following paragraph, the regex is shown
as ([^\\"]*) - note added backslash.

The presence or absences of the backslash does not make
any difference in the operation of the code. However
Textmate get pretty confused (gets out of phase about which
is the open/closed quotes) without the backslash.

The downloadable code examples do not have the backslash.

102SUGGEST

It’s being picky, but following the mantra that readability is paramount, isn’t this rather cryptic?

count + (number_match?(guess, index) ? 1 : 0)

I’d write this instead:

count += 1 if number_match?(guess, index)

Or I’m just not a fan of the ternary operator ;)

225ERROR

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”

92TYPO

“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 , le av in g o n ly t h r e e failin g s c e n ario s
t o g o ”. There are 14 tests in total where 11 now are passing (not 12), and 3 fails.

47TYPO

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 previous page.

0TYPO

After location 62 on Kindle, there are some doubled hyphens, which are probably meant to be en-dashes: “Test—Driven”.

274TYPO

At the beginning of the last sentence of the fifth paragraph (immediately before the “Tagged Hooks” subsection): “When we do,…” is somewhat confusing. Perhaps something like, “We can use a tagged hook if we don’t want that hook to run for all scenarios.” would be clearer.

270TYPO

s/pending/undefined/

“Several things changed when we added the step definition. First, the scenario and step are no longer pending, but passing.”

The scenario and step were previously undefined rather than pending. If we had run the cucumber command after pasting the cucumber-provided snippet but before editing it, then they would have temporarily been pending.

353ERROR

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 #save method has not been stubbed, so we’re relying on the behavior of Mock#as_null_object to return a truthy response. In rspec-rails 2.8.1, there is a bug which causes as_null_object to return nil instead (GitHub rspec-rails issue 488). The bug was fixed in commit 7fa15c4157, but has yet to be released. So when you run rspec, the test fails. I checked the book errata and this wasn’t mentioned it, and googling eventually let me to the bug and its fix on GitHub. I thought I’d mention it so that you can list it on the errata page while a fixed release is pending.

Thanks!
Justin

Relevant text:

Download rails_controllers/messages/17/app/controllers/messages_controller.rb

def create
message = Message.new(params[:message])
if message.save
flash[:notice] = “The message was saved successfully.”
end
redirect_to :action => “index”
end

Run that, and you’ll see that it passes. Now we have two passing exam-
ples that specify the happy path, so let’s move on to examples of what
should happen when the save fails.

203TYPO

“Article.stub_chain” should be “article.stub_chain”

94SUGGEST

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 intent of the code. I suggest changing:

def number_match?(guess, index)
@secret.include?(guess[index]) && !exact_match?(guess, index)
end

…to…

def number_match?(guess, index)
@secret.include?(guess[index]) unless exact_match?(guess, index)
end

While the “a && !b” expression makes sense to programmers familiar with C-style syntax, I would argue that “unless” is not only more appropriate for Ruby, but does a superior job of conveying the intent of the method.

88TYPO

missing change mark before:

def initialize(secret, guess)

100SUGGEST

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 … end” when that is not true.

353TYPO

First paragraph reads:

“The most obvious bit is the duplication in the past two examples”

“past” should be “last”

103ERROR

@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

287ERROR

In 19.2 “Setting up a Rails 3 Project”, running ‘bundle install’ gives the following error:

% rails generate rspec:install
WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called.
To avoid this warning, move ‘gem cucumber-rails’ under only group :test in your Gemfile
create .rspec
create spec
create spec/spec_helper.rb

This appears to be a change introduced about 6 months ago (see blog post here): See github.com/cucumber/cucumber-rails/pull/171 (can’t provide a proper URL because of the submission filter).

Setting up a separate group with :test only and moving ‘gem “cucumber-rails”’ into this group gets past this issue. e.g.

group :test do
gem “cucumber-rails”, “>= 0.3.2”
end

118SUGGEST

You do realize that this new implementation could have been achieved by just reversing the order of the checking like this:
secret.include?(guess[index]) && !exact_match?(index)
reverse it to
guess.include?(secret[index]) && !exact_match?(index)

80TYPO

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 output.should_receive

60ERROR

The code in step definition

Then /^I should see “([^”]*)"$/ do |message|
output.messages.should include(message)
end

is using should method. When I followed the book using Ruby 1.9.3-p125 I was running into an error:

undefined method `should’ for # (NoMethodError)

Only when I included RSpec it could use all the ‘should’ methods. I included RSpec using a Gemfile, but as the book does not say anything about Gemfile, maybe including RSpec in a different way would work as well.

60ERROR

The need for including RSpec appeared only when I used Guard for automating running Cucumber acceptance tests. When running Cucumber manually it all works fine.

I’m sorry for the confusion, but in case someone else is using Guard it might be useful. I will also look into Guard to see why it runs Cucumber differently in that case than when Cucumber is run manually.

150ERROR

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

253TYPO

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

232TYPO

“spec_opts takes an array of strings” (first sentence right under the “About Code Coverage” sidebar) but the (non-deprecated) option’s name is actually “rspec_opts”.

238ERROR

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

91SUGGEST

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 in This version of cucumber with the error shown below. The error can be resolved by removing the “#” from the #START_HIGHLIGHT & #END_HIGHLIGHT in the Feature section.

The cucumber error message is:
features/codebreaker_submits_guess.feature: Lexing error on line 12: ’ Each position in the secret code can only be matched once. For example, a’. See http//wikigithubcom/cucumber/gherkin/lexingerror for more information. (Gherkin::Lexer::LexingError)
/usr/local/lib/ruby/gems/1.9.1/gems/gherkin-2.11.0/lib/gherkin/lexer/i18n_lexer.rb:22:in `scan’
/usr/local/lib/ruby/gems/1.9.1/gems/gherkin-2.11.0/lib/gherkin/lexer/i18n_lexer.rb:22:in `scan’
/usr/local/lib/ruby/gems/1.9.1/gems/gherkin-2.11.0/lib/gherkin/parser/parser.rb:31:in `parse’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/feature_file.rb:37:in `parse’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:28:in `block in load’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:26:in `each’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:26:in `load’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/features_loader.rb:14:in `features’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:170:in `features’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:46:in `run!’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:43:in `execute!’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:20:in `execute’
/usr/local/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/bin/cucumber:14:in `<top (required)>’
/usr/local/bin/cucumber:23:in `load’
/usr/local/bin/cucumber:23:in `

296ERROR

Content of simulated_browser\\05\\app\\models\\genre.rb I downloaded from the website should be:

class Genre < ActiveRecord::Base
attr_accessible :name
end

Rather than:

class Genre < ActiveRecord::Base
end

The missing line causes the When step and the scenario to fail.

61ERROR

[Using ruby 1.9.3-p194] After modifying the line

game = Codebreaker::Game.new(output)

and running Cucumber the book indicates that the test will fail due to the incorrect number of arguments. However, it actually first fails because the variable output is undefined. The error message is:

NameError: undefined local variable or method `output’ for #

adding the line output = Output.new (shown below) initializes output so that the call to Codebreaker::Game.new can occur — at which time it will fail in accordance with the book’s text. The step definition change described above is shown here:

When /^I start a new game$/ do
#output = Output.new #<— added line
Codebreaker::Game.new(output)
game.start
end

78ERROR

[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.

The code for all Scenarios: below the Scenario outline should be changed Examples:

For example:

Scenarios: no matches
| code | guess | mark |
| 1234 | 5555 | |

Becomes..

Examples: no matches
| code | guess | mark |
| 1234 | 5555 | |

81ERROR

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 provided in the start method of Game.

That is (in the game.rb file):

def start(secret=nil)
..
end

If one removes the default (=nil) from the start arguments it will fail as the book indicates.

232TYPO

Under the “Matcher Protocol” subsubsection of subsection 16.7, under the “matches?” list item, the second sentence contains a typo: “Return true for a passing expection or false for a failure.”

(should be “expectation” not “expection”)

278ERROR

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.

77TYPO

This is a dummy. Throw me away.

16TYPO

The code sample hello/5/features/step_definitions/greeter_steps.rb appears to be missing a blank line before “Given…”.

145ERROR

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 like this:”
The “and set_status() does as well” should be removed since Thing.new will not return the return value of the initialize method but will return the newly created Thing instance.

338ERROR

The book says "The assigns() method returns a hash representing instance variables that were assigned to the view by the controller. Run rake spec:controllers, and the new
example fails with this:

expected #<Message:0x81b0b900 @name=“Message_1005”>
got nil

however my failure message was:

/Users/akkdio/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -S rspec ./spec/controllers/messages_controller_spec.rb
….F*

Pending:
MessagesController POST create when the message fails to save successfully renders the new template
# Not yet implemented
# ./spec/controllers/messages_controller_spec.rb:38

Failures:

1) MessagesController POST create when the message fails to save successfully assigns @message
Failure/Error: post :create
ActionView::MissingTemplate:
Missing template messages/create, application/create with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in:
* “#
# ./spec/controllers/messages_controller_spec.rb:34:in `block (4 levels) in <top (required)>’

Finished in 0.10912 seconds
6 examples, 1 failure, 1 pending

I added the following as the book suggests:

def create
message = Message.new(params[:message]) if message.save
flash[:notice] = “The message was saved successfully.”
➤ redirect_to :action => “index”

➤ else
➤ render :action => “new”
➤ end
end

and the example passes. I don’t know why but I never get the failure the book says I should get.

340TYPO

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(:save).and_return(false)
post :create
assigns[:message].should eq(message)
end

Yet this is the same code as on page 339:

it “assigns @message” do
message.stub(:save).and_return(false)
post :create
assigns[:message].should eq(message)
end

237TYPO

“pending_count)” missing a parentheses, should be “pending_count()”.

I’m really enjoying this book so far. Thanks!

179TYPO

Book has test-specific subclasspattern

(with no space between subclass and pattern)

210TYPO

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 the two.

210TYPO

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 the two.

215TYPO

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 deal. I’m just trying to give you more samples of what to look for.

The book has:

The output contains the contents of a hash with keys such as:example_group, :description,:location,:caller, and so on.

There is a line wrap just before :description. The :foo words are in italics(?). Again, we see no space before the :foo words. Other examples, like on page 216:

RSpec exposes a configuration object that supports the definition of global before, after, and around hooks, as well as hooks to include modules in examples or extend example group classes.

format nicely (with “before”, “after”, “around”, and “include” in a different font (tt?)

HTH

14ERROR

Last then line missing closing $/

61TYPO

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 Shouldn’t We Avoid a One-to-One Mapping?, on page 62 for”

74TYPO

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 submit a”

8092ERROR

undefined method `[]’ for nil:NilClass (NoMethodError)
./lib/codebreaker/game.rb:30:in `exact_match?’
./lib/codebreaker/game.rb:17:in `block in guess’
./lib/codebreaker/game.rb:16:in `each’
./lib/codebreaker/game.rb:16:in `map’
./lib/codebreaker/game.rb:16:in `guess’
./features/step_definitions/codebreaker_steps.rb:36:in `/^I guess “(.*?)”$/’
features/codebreaker_submits_guess.feature:18:in `When I guess “”’

201ERROR

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:


In the second example, we override that stub with the expectation. Once the expectation is met, any subsequent calls to log() are caught by the stub and essentially ignored.

My testing indicates otherwise. It is the ‘.as_null_object()’ that causes any subsequent calls to log() to be ignored. To prove this, simply create code that causes log() twice, observe that everything is ok, and then take out the ‘.as_null_object()’ (and the “@database.(begin|end)” lines if u have them. Observe then that repeated calls to log() will FAIL, and that they are not “caught by the stub and essentially ignored”!

143TYPO

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

74TYPO

The third sentence contains ‘subimt’, should be ‘submit’

59TYPO

“subimt a guess” should read “submit a guess” in the third line of the first paragraph on page 59 of the PDF.

41TYPO

“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. remove the dash.) Page 40 tells you to make a codebreaker.rb file. Page 41 refers to it with a - in the name.

7459TYPO

Section 6.1, first paragraph: “subimt” should be “submit”.

149139TYPO

Third paragraph starts with a sentence fragment:

“——> so you can refactor <—— There are a couple of…. etc”

(arrows added for emphasis)

1SUGGEST

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 use the preferred syntax, e.g. “expect([]).to be_empty”

42SUGGEST

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/ a Test Double and a message expectation is set on “puts”, which feels like mocking a low-level API. Recommend renaming Output to View or Display or similar so we end up mocking e.g. view.display or display.show or similar rather than output.puts.

117ERROR

marker = Marker.new(‘1234’,‘1155’)
marker.number_match_count.should == 0

should be
marker = Marker.new(‘1234’,‘1155’)
marker.number_match_count.should == 1

because the first 1 on the guess does match with de the first 1 on secret

139TYPO

The third paragraph starts with

so you can refactor

which is suspended in mid-air.

145SUGGEST

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 : block given to yield (SyntaxError).

To make it work as expected, split the yield :

result = Thing.new do |thing| … end
yield result

Another solution is :

yield(Thing.new { |thing| …
})

————— file to test it —————

class Thing
def initialize
puts “in Thing initialize”
yield self
end

def do_fancy_stuff(*p)
puts “in do_fancy_stuff”
end

def set_status(p)
puts “in set_status(#{p})”
end
end

describe Thing do
def given_thing_with(options)
puts “in given_thing_with(#{options.inspect})”

  1. yield Thing.new do |thing|
  2. result = Thing.new do |thing|
    yield(Thing.new { |thing|
    puts “in block to Thing.new in given_thing_with, thing=#{thing.inspect}”
    thing.set_status(options[:status])
  3. end
    })
  4. yield result
    end

it “should do something when ok” do
puts “in test should do something when ok”
given_thing_with(:status => ‘ok’) do |thing|
puts “in block to given_thing_with in it … ok, thing=#{thing.inspect}”
thing.do_fancy_stuff(1, true, :move => ‘left’, :obstacles => nil)
end
end
end

————— output —————

$ rspec thing_spec.rb —format doc

Thing
in test should do something when ok
in given_thing_with({:status=>“ok”})
in Thing initialize
in block to Thing.new in given_thing_with, thing=#
in set_status(ok)
in block to given_thing_with in it … ok, thing=#
in do_fancy_stuff
should do something when ok

Finished in 0.00045 seconds
1 example, 0 failures

165SUGGEST

In section “Owned Collections”, paragraph 5, line 2 :

players_on(). When it receives a message, it doesn’t understand (like players_on()),

——> I would suppress the comma after

When it receives a message

[ meaning : When it receives a message that it doesn’t understand (like players_on()) ]

183SUGGEST

In section Stub Chain, second paragraph :

Article.recent.published.authored_by(params[:author_id])

——> shouldn’t it be article ?

Also 3rd line from bottom :

Article.stub(:recent).and_return(recent)

Also Article.stub_chain on PDF page 184.

182SUGGEST

Executing the example “describe WidgetsController”.

$ gem install rails

Successfully installed rails-4.0.2

I have added four missing do’s and changed Widget to widget (except Widget.new()).

WidgetsController
PUT update with valid attributes
redirects to the list of widgets (FAILED - 1)
PUT update with valid attributes
finds the widget (FAILED - 2)
updates the widget’s attributes (FAILED - 3)

NoMethodError:
undefined method `put’ for #

188SUGGEST

Section Custom Argument Matchers.

I had difficulties to make an example with

calculator.should_receive(:add).with(greater_than_3)

working. During a Google search with GreaterThanThreeMatcher, I have found a Github page which was actually a copy of code/mocking/custom_arg_matchers_spec.rb.

——> it would be nice to add a green bar with this path before

class GreaterThanThreeMatcher (fourth paragraph)

and also on the next page before class GreaterThanMatcher.

Note that I had to change

module Spec

to

module RSpec.

——> and the error message for

calculator = double(‘calculator’)
calculator.should_receive(:add).with(greater_than_3)
calculator.add 3

is

Double “calculator” received :add with unexpected arguments
expected: (#)
got: (3)

215SUGGEST

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 example(s).

258ERROR

Bottom of the page, the link in footnote 2

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

gives an error 404.

3ERROR

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/2014/09/29/a-new-look-at-test-driven-development.html

43ERROR

Completion of code on page 43 when running cucumber get “undefined method” error for messages.

code snippet

class Output
def messages
@messages ||= []
end
def puts(message)
messages << message
end
end

def output
@output ||= Output.new
end

Then /^I should see “([^”]*)"$/ do |message|
\toutput.messages.should include(message)
end

43ERROR

Found correct to the previous error on forum.

The following code causes a clash with RSpec’s BuiltIn::Output

def output
@output ||= Output.new
end
Then …..
output.messages.should ……
end

Changed this to:
def msg_out
@output ||= Output.new
end

Then …..
expect(msg_out.messages).to include(message)
end

Now receiving the correct “Expectations” failure of ‘….expected [] to include…..’

14SUGGEST

syntax Should has been deprecated replace with Expect

Section 2.3 Hello Cucumber
hello/3/features/greeter_says_hello.feature

Scenario: ……..
Then I expect “Hello Cucumber !”

hello/4/features/step_definitions/greeter_steps.rb

Given….
When…
Then(/^I expect “([^”]*)"$/) do |greeting|
expect(@message).to eq(greeting)

12ERROR

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 transpec gem “ie gem install transpec” to convert the code
The new line will be converted will be
expect(greeting).to eq(“Hello RSpec!”)

Categories: