I’m following along in the book (great stuff, by the way). In section 7.2 on page 117 (B7.0), once I add the @lets stub a class@ test in test/unit/project_test.rb, it breaks the first test, @should be able to retrieve projects based on day@. The error message is as follows:
1) Failure: test_should_be_able_to_retrieve_projects_based_on_day(ProjectTest) [test/unit/project_test.rb:8]: <["2009-01-06", "2009-01-07"]> expected but was <>.
If I remove the @lets stub a class@ test, none of the other tests fail. I think it may have something to do with overriding the find method, but I didn’t think stubbing a method in one test would affect other tests.
I posted a gist of my project_test.rb file here. My environment includes the following:
- rvm 1.0.11
- ruby 1.9.2-p0
- rails 3.0.0
- factory_girl 1.3.2
- mocha 0.9.8
- sqlite3-ruby 1.3.1
I placed @require ‘mocha’@ in test/test_helper.rb.
Has anyone else experienced this problem?