I wonder if anyone else is/was confused reading the Chapter 6 Unit and Functional test section...?
A few questions I had are below:
1) Within the file 'test/unit/story_test.rb' I don't exactly understand how adding the line fixtures :stories "makes sure that dummy data for our test is loaded into the database..." I'm guessing it has to do with naming of the file stories.yml in the 'fixtures' folder, but it seems to me that Ruby has a HUGE flaw in that the functionality of the code depends on files with associated names (in this case 'stories'). What if I were to accidently rename a file? Wouldn't the whole program crash?
2) On the "unit test" test_should_require_name, why are we testing if an error is on the name attribute when we create a Story object with the name attribute always being blank? Won't this always pass as true? What's the purpose of adding this test?
3) The second paragraph on page 177 states "...assert_select checks for the existence of one form element in which five p elements are nested..." Why does it say five when there are actually only 3 paragraph tags in the new form and the assertion function states :count => 3 ?
4) In the "test_should_add_story" of the functional test, we check to see if the record has been saved to the database using new_record?. Why do we want "...the assertion to tell us if it hasn't been saved at this point..."? Should this statement be true without adding the exclamation mark (!), since we successfully added a new story record?
Everything else seemed pretty straight forward even though I know I'll end up reading this chapter again. Thanks for any help anyone can give!!!