Results 1 to 4 of 4
Jan 25, 2008, 10:43 #1
Trouble with fixtures and unit tests
While creating an app similar to the "shove it" in the book, I came across an error in chapter 7 unit test (page. 226).
The console displays 5 errors..all with the same message "FixtureClassNotFound: The class "Tran" was not found". So I removed all code from error testing from one unit tests and left only votes_test.rb in place.
class VoteTest < ActiveSupport::TestCase fixtures :votes, :trans def test_story_association assert_equal trans(:first), votes(:first).trans end end
fixture data for votes.yml
first: id: 1 trans_id: 1 created_at: <% Time.now.to_s(:db) %> second: id: 2 trans_id: 1 created_at: <% Time.now.to_s(:db) %>
fixture data for trans.yml
first: id: 1 eng: Apply online fre: Faites votre demande en ligne permalink: apply-online another: id: 2 eng: Available in French fre: Disponible en français permalink: available-in_french
The code achieve says:
assert_equal stories(:first), votes(:first).story
I believe this is my problem line. is it because their "stories" fixture I name "trans" and the "story" item was also named trans?
Last edited by jennifert; Jan 25, 2008 at 10:44. Reason: missed typos in explaination