By Developers, For Developers

Historical errata for Continuous Testing

PDF PgPaper PgTypeDescriptionFixed onComments
86ERROR

On the last line, the command line use simple quote with a dynamic text inside:
watchr -e “watch(‘^app/(.*\\.rb)’) { |m| puts ‘You changed: #{m[1]}’ }”

This result in the incorrect behavior of outputting <<You changed: #{m[1]}>> instead of <<You changed: controller/some_file.rb>>.

At least on ruby 1.8.7 / Mac OS X Snow Leopard

2011-01-04
86ERROR

The watchr command isn’t evaluating the matcher.

Given:

% watchr -e “watch(‘^app/(.*\\.rb)’) { |m| puts ‘You changed: #{m[1]}’ }”

Output:
You changed: #{m[1]}

Suggested tweak:
% watchr -e “watch(‘^app/(.*\\.rb)’) { |m| puts \\”You changed: #{m[1]}\\" }"

Output:
You changed: controllers/application_controller.rb

2011-01-04
87SUGGEST

On page 87 you say:

“Another benefit of Sass is that you can quickly validate the syntax of a stylesheet using the sass —check command (provided indirectly by the compass gem).”

I’d suggest explicitly telling the reader to install the compass gem (and any other gems that are used in the code examples).

2011-03-16
89DEFER

“One great way to create a feedback loop for views in our web application is to turn over responsibility for refreshing the browser to our continuous test runner.”

I’d suggest adding a snippet of code to give an example of how to do that.

38SUGGEST

It’s not vary clear that the method ‘zip_code’ belongs in the class User. (The indentation is also a bit weird here)

def zip_code m = Locales.current.postal_code_regex.match(self.address_text) return m[0] if m
end

2011-03-21
2ERROR

Clicking the ‘report erratum’ in the PDF does not take the user to the erratum page of the book (but to the home page of pragprog).

2011-01-04
19ERROR

If using autotest with RSpec2, spec/spec_helper.rb doesn’t need these lines:

#require ‘spec’
#require ‘spec/autorun’
#Spec::Runner.configure do |config|


  1. #end
2011-03-16
21SUGGEST

You explain that rspec 2 removes autospec in a sidebar for those who have upgraded. I think it would be less confusing to most readers if you just stuck with autotest throughout and had a sidebar for those on older versions.

Page number is from epub version.

2011-03-16
16DEFER

I am a newbie to ruby which means I have to follow your book step by step.

From page 16, I execute the below two commands with no problem:
% gem install jeweler
% gem install rspec

But in order to run the next listed command, namely:
% jeweler —rspec twits
..it appears that I should already have git installed. Now this is quite confusing as the book makes no mention of git until page 46.

My suggestion is that an explanation about what Git is and that the reader needs to install / set it up be added before having to execute this last command above.

For a newbie it is somewhat frustrating to hit a wall on the first few pages of this book.

Thank-you, Michelle

18ERROR

Pg.18 Rspec/autospec instructions don’t work for me:

C:\\DEVELOPMENT\\twits>ls
Gemfile LICENSE.txt README.rdoc Rakefile autotest lib spec

C:\\DEVELOPMENT\\twits>cat autotest/discover.rb
Autotest.add_discovery { “rspec2” }

C:\\DEVELOPMENT\\twits>ruby -v
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

C:\\DEVELOPMENT\\twits>gem list —local

* LOCAL GEMS*

autotest (4.4.6)
bundler (1.0.7)
diff-lcs (1.1.2)
git (1.2.5)
jeweler (1.5.1)
minitest (1.6.0)
rake (0.8.7)
rdiscount (1.6.5)
rdoc (2.5.8)
redcar (0.9.1)
rspec (2.2.0)
rspec-core (2.2.1)
rspec-expectations (2.2.0)
rspec-mocks (2.2.0)
rubyzip (0.9.4)
ZenTest (4.4.1)

C:\\DEVELOPMENT\\twits>autospec

REMOVAL NOTICE: you are using behaviour that has been
removed from rspec-2.

  • The ‘autospec’ command is no longer supported.
  • Please use ‘autotest’ insted.

This message will be removed from a future version of rspec.

Please provide alternative instructions so that I can resume working through your book.

Thank-you
Michelle Pace

2011-03-16
11SUGGEST

In this section you are defining test terminology, but you throw in “if we can’t do a quick smoke test and make sure that things are working properly,” without defining “smoke test.” You can’t assume your reader will know what you mean. I can guess, but I’d rather learn about testing without having to guess.

2011-01-04
12TYPO

regardless of how the test are categorized," should be “tests are” or "test is

2011-01-04
16TYPO

The project structure is show in the
s/show/shown/

2011-01-04
0TYPO

The “Report erratum” link is broken it is “books.pragprog.com//titles/rcctr/errata/add” but should be “books.pragprog.com/titles/rcctr/errata/add”

2011-01-04
17TYPO

While the principles we discuss this this book
s/this this/in this/

2011-01-04
21TYPO

When other changes are make,
s/make/made/

2011-01-04
23TYPO

It’s essential that you clearly understand why each of the FIRE attributes are important
s/are/is/

2011-01-04
24TYPO

why things are they way they are.
s/are they/are the/

2011-01-04
25TYPO

using an before( ) block
s/an/a/

2011-01-04
26ERROR

I had to add require “user” to the top of user_spec.rb to get rid of the error message “uninitialized constant User”. Then I got the error message “undefined method `twitter_username=’” so I added attr_accessor :twitter_username to user.rb. Now I’m getting the error message specified in the book.

(Sorry in advance if the code tags don’t work here the same way as in the discussion forum.)

2011-03-21
28TYPO

the first attack is on I/O in all it’s forms.
s/it’s/its/

2011-01-04
29ERROR

After installing the twitter gem, I had to add “require ‘twitter’” to user.rb. Also autotest recommends using “should ==” instead of “should be” to compare contents instead of identity. And what’s returned from last_five_tweets is a list of attributes ([#<Twitter::Search:0x1021b8b10 adapter=:net_http, consumer_key=nil, @cache=nil etc.), not five tweets so the test doesn’t pass.

2011-03-21
36TYPO

In “Global variables—for lack of a better word—are evil” the word “are” should be before the hyphenated clause.

2011-01-04
38SUGGEST

not as much of a sin as adding too little,
s/little/few/

2011-01-04
50TYPO

high interest debt get out control and
s/out/out of/

2011-01-04
52TYPO

Now lets add a feature
s/lets/let’s/

2011-01-04
0DEFER

It will be better using “bundler” instead of “jeweler”.

21TYPO

“When other changes are make…” should be, “When other changes are made,”

And “it reruns the previously failing tests, plus any new
tests triggered the changes” doesn’t make any sense, I can’t seem to understand what would be the best way to change it to make sense. I might be ignorant, but it’s puzzling.

2011-03-21
19TYPO

Section 1.4 - 3rd paragraph

“This figure maps compares the confidence…” probably should be “This figure compares the confidence…”

2011-05-11
16TYPO

“use” should be replaced by “used” in the following sentence: “We strongly believe in automated testing, and have use it with great
success over many years.”

2011-05-25
106TYPO

In the last paragraph of the page, you say you’ve introduced a variable called “all_tests_pass”, however, in the code, the variable looks like it’s actually called “@all_tests_passing”

2011-06-06
49SUGGEST

After moving (and renaming the autotest-stats.rb file to autotest/stats.rb). It is indicated to go to spec_helper and change to a require ‘autotest/stats’

After such change, you then indicate to run autotest and it will not work because you do not indicate to change the newly moved autotest/stats_spec.rb require statement to require File.expand_path(File.dirname(FILE) + ‘/../spec_helper’)

2011-06-06
49ERROR

Shouldn’t the

it “should add hooks to autotest” block be inside the describe block? it is outside of the describe block

2011-06-06
48TYPO

spec_helper is incorrectly shown in the tree structure of how the files should be

2011-06-06
89ERROR

It is described how to add spork in the code fragment. However, the author then informs the reader to run the sport command through the command line. This should be in two separate code fragments. The error:

group … do
gem ‘spork’ ..
end
spork

is typed in a single code fragment.

2011-06-06
89SUGGEST

Very confusing when indicating in running spork.

“This has added some code to the beginning of our spec_helper.rb file. We’ll need to move all of the initialization code that was in our spec_helper into the prefork() block. This will tell Spork how to initialize the environment we’ll use to run our tests. All of the time currently taken setting up this environment should then be eliminated when running tests after a file change. After moving that code, our spec_helper looks like this:”

I believe information is missing, perhaps informing the reader to run sporl with the argument for bootstrapping.

2011-06-06
90SUGGEST

Bit confusing. There is another error, though. It is supposed to show only how to call the spork program. It is including all the group dependency block, and after the block is calling “spork”…

The it says to start the server, soon you realize that spork starts up a server. More clarity needed when introducing spork.

2011-06-06
90SUGGEST

Assuming the migrations are up to date. Shouldn’t the author indicate the reader to issue a rake db:test:prepare command before running the tests?

2011-06-06
91OK

“So if we restart Watchr and make a change to one of our specs (say, gro- cery_list_spec.rb), we get output that looks like this:
Finished in 0.00239 seconds 1 example, 0 failures, 1 pending
Perfect! Nice and fast, too.”

The rails.watchr script only runs corresponding spec files when .rb files are modified inside the app directory. If you modify a *_spec.rb file it wont run it.

The watch('^spec/(.*)_spec\\.rb') { |m| run_test_matching(m[1]) } call in the rails.watchr file is intended to handle this case. Is there a problem with that call?
92SUGGEST

“or any of our Factory Girl factories change. Finally, we added some methods to find and run all the specs in our suite and changed the run_test_method() to run all the tests after failure (that is, if run() returns a non-zero value).”

Factory Girl? wasn’t introduced, author assumes reader knows what it is.

what is the “run_test_method()” ? more clarity needed

2011-06-06
88ERROR

At the bottom of the page in the “Automating Spork with Watchr”, you say “To start out, let’s add some watch() for RSpec specs:” and you don’t give any code below.

The next paragraph explain what the code (which is missing) is supposed to do.

viSUGGEST

Copyeditor is listed as Kim Wimpsett. I thought Molly McBeath was the copyeditor for this one. (The number of people who care might be countable on one hand with fingers left over, but she’s my wife…)

19SUGGEST

In the initial creation of the user2.1_spec.rb, the line:

require ‘user’

should be used just after the the spec_helper require line, in order for the test to pass.
This can be seen on the actual code for this revision.
Otherwise the test complains that the User class does not exist.

45SUGGEST

Three lines from the bottom on page 45 there is the commnad line to create the gem:

$ jeweler —rspec —gemcutter —create-repo autotest-stats

when running with jeweler 1.6.4 it comes up with :

invalid option: —gemcutter

47TYPO

On line 4 from the top the line:

…Firing up autospec …

shouldn’t that be:
…Firing up autotest …

82SUGGEST

As the watcher script file can be named everything we want, wouldn’t it be a better idea to have the watchr script file (rails.watchr), named with .rb (ie. rails.watchr.rb)?

88SUGGEST

Would it be a good idea to replace the Spork + Watchr automation with Spork + Guard automation, as Guard seems to be more recently updated?
It also uses different ‘guards’ for different testing environments as cucumber and rspec.
A list of the available guards is available in the gems wiki page.

81ERROR

You write the following:

":But first, we have to add it to our Gemfile:

$ gem install watchr"

Probably meant add it to the GemFile and then update bundler.

31TYPO

Refixed. -> prefixed

17TYPO

There is a typo at the top of the page, in the Joe Asks box, so this:

“the test/ directory, refixed with test_, to similarly named files in the lib/ directory. So”

probably meant:

“the test/ directory, prefixed with test_, to similarly named files in the lib/ directory. So”

5TYPO

The image of Figure 1 on the iPad only show the bars in blue and green. No labels or legend. They are blacked out.

20ERROR

Of course, the User class doesn’t exist yet, so the failure of this test will drive us to create it:

There is no test yet - we have only written a before block!

26TYPO

But it’s essential that we not leave the test in this state.

s/this/that/

Categories: