Most people want to know why their tests are failing. I want to know why they are passing. They really shouldn''t be. The test environment database defined in database.yml does not exist. I have not altered the auto-generated tests at all. When I run the following command from the site root:> ruby test/unit/gender_test.rbI expect that this should fail. However, I get "1 tests, 1 assertions, 0 failures, 0 errors" I''m working my way through the Prag Prog Agile Rails book. In the testing section (page 186), the book says that these tests should fail until I create the testing database. Is the book wrong, or do I have magic unit tests? RoR Version: 1.2.3 Ruby Version: 1.8.6 DB: Mysql Thanks for the help. Ian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ian wrote:> Most people want to know why their tests are failing. I want to know > why they are passing. They really shouldn''t be. > > The test environment database defined in database.yml does not exist. > I have not altered the auto-generated tests at all. When I run the > following command from the site root: > >> ruby test/unit/gender_test.rb > > I expect that this should fail. However, I get > > "1 tests, 1 assertions, 0 failures, 0 errors" > > I''m working my way through the Prag Prog Agile Rails book. In the > testing section (page 186), the book says that these tests should fail > until I create the testing database. Is the book wrong, or do I have > magic unit tests? > > RoR Version: 1.2.3 > Ruby Version: 1.8.6 > DB: Mysql > > Thanks for the help. > > IanIan, By default the test case that is provided by the generator for each model is assert_truth() which returns true so initially "all" test cases pass. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you for your reply. I noticed the simplicity of the default test & have some familiarity with both unit testing and Test::Unit. But the example I''m reading says that even this very simple test should fail if the database doesn''t exist. That''s where my confusion comes from. On Dec 4, 1:33 pm, Ilan Berci <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ian wrote: > > Most people want to know why their tests are failing. I want to know > > why they are passing. They really shouldn''t be. > > > The test environment database defined in database.yml does not exist. > > I have not altered the auto-generated tests at all. When I run the > > following command from the site root: > > >> ruby test/unit/gender_test.rb > > > I expect that this should fail. However, I get > > > "1 tests, 1 assertions, 0 failures, 0 errors" > > > I''m working my way through the Prag Prog Agile Rails book. In the > > testing section (page 186), the book says that these tests should fail > > until I create the testing database. Is the book wrong, or do I have > > magic unit tests? > > > RoR Version: 1.2.3 > > Ruby Version: 1.8.6 > > DB: Mysql > > > Thanks for the help. > > > Ian > > Ian, > > By default the test case that is provided by the generator for each > model is assert_truth() which returns true so initially "all" test cases > pass. > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ian,> I noticed the simplicity of the default test & have some familiarity > with both unit testing and Test::Unit. But the example I''m reading > says that even this very simple test should fail if the database > doesn''t exist. That''s where my confusion comes from.Do you have any fixtures declared in your tests? If not, then Rails might not be bothering to connect to the database at all. Jim -- Jim Menard, jimm-Xhj3G7Rj6JI@public.gmane.org, jim.menard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://www.io.com/~jimm/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---