06 Oct 2012, 03:55
Generic-user-small

Steve Zhang (22 posts)

I am disappointed with the webrat section of chapter 21, it omitted the detailed steps, which give me too many troubles, I feel it is a good chance to show the BDD in Rails. Unfortunately the source code does not working in my environment, so I have to do step by step, following the cucumber error message. Finally I make the step 2 working. And I found following issues

  1. app/views/movies/new.html.erb <%= f.label :release_year%> should be <%= f.label :release_year, “Release Year” %>

  2. db/migrate/20101015174811_create_genres_movies.rb

create_table :genres_movies, :id => false do |t|
      t.integer :genre_id
      t.integer :movie_id
      t.timestamps
end

should be

create_table :genres_movies, :id => false do |t|
      t.integer :genre_id
      t.integer :movie_id
end

I found t.timestamps cause the exception: SQLite3::ConstraintException: constraint failed: INSERT INTO “genres_movies” (“movie_id”, “genre_id”) VALUES (1, 1) (ActiveRecord::StatementInvalid)

15 Oct 2012, 12:31
Me_pragsmall

Andrew Gellene (33 posts)

Steve,

Thank you so much for posting. I wasted two days trying to figure this out. I am just learning so this was really hard for me.

I do not understand why a book on testing and development does not test their own code to work?

26 Feb 2013, 05:04
Dchelimsky_pragsmall

David Chelimsky (206 posts)

Steve, Andrew - sorry you had trouble with this. We actually did test every single example in the book. The code in the book is pulled in from code files that have tests associated that either passed or failed as expected (so we could show the failure messages in the book). It’s entirely possible we messed something up with this one, but please know that we made a very serious effort to test all the code.

Are you using all the versions prescribed in the preface?

  You must be logged in to comment