I have a number of fixtures in my test suite. For example, with acts_as_authenticated and acts_as_state_machine, I created a number of users in different account states for use in functional testing. (Suspended users can not log in, etc) Is it a good idea to run fixtures through tests to ensure that they conform to their ideals? EG: assert users(:suspended_user).suspended? If so, where should these tests go? I currently have them in my unit tests. Regards, --Dean --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The fixtures should be perfect. There is no need to test them, as it is testing a test; paradoxical. On Feb 11, 2008 3:41 PM, Dean <dean.brundage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have a number of fixtures in my test suite. For example, with > acts_as_authenticated and acts_as_state_machine, I created a number of > users in different account states for use in functional testing. > (Suspended users can not log in, etc) > > Is it a good idea to run fixtures through tests to ensure that they > conform to their ideals? > EG: assert users(:suspended_user).suspended? > > If so, where should these tests go? I currently have them in my unit > tests. > > Regards, > --Dean > > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Feb 11, 12:02 am, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The fixtures should be perfect. There is no need to test them, as it is > testing a test; paradoxical.In this case it is more like testing inputs to a test, which imho is totally appropriate. A little quality control. A lot of my tests depended on the fixtures acting as advertised so I want a little assurance that the input data is correct. It is especially handy with multiple developers that could make changes to the fixtures. Any opinions? --Dean> On Feb 11, 2008 3:41 PM, Dean <dean.brund...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have a number of fixtures in my test suite. For example, with > > acts_as_authenticated and acts_as_state_machine, I created a number of > > users in different account states for use in functional testing. > > (Suspended users can not log in, etc) > > > Is it a good idea to run fixtures through tests to ensure that they > > conform to their ideals? > > EG: assert users(:suspended_user).suspended? > > > If so, where should these tests go? I currently have them in my unit > > tests. > > > Regards, > > --Dean > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 11 Feb 2008, at 17:02, Dean wrote:> > On Feb 11, 12:02 am, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> The fixtures should be perfect. There is no need to test them, as >> it is >> testing a test; paradoxical. > > In this case it is more like testing inputs to a test, which imho is > totally appropriate. A little quality control. A lot of my tests > depended on the fixtures acting as advertised so I want a little > assurance that the input data is correct. > > It is especially handy with multiple developers that could make > changes to the fixtures. >It''s a bit of a 2 sided thing. On the one side if a test is broken because of some fixture change or similar it''s helpful to see that the test broke because of some precondition rather than having to work that out yourself, on the other hand it can make tests rather long winded and/or more changing fixtures rather long winded. I don''t think i''d ever do something quite like assert users(:suspended_user).suspended?, but in general test_foo assert some_precondition do_foo assert some_postcondition end isn''t necessarily a bad thing. Fred> Any opinions? > > --Dean > >> On Feb 11, 2008 3:41 PM, Dean <dean.brund...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> I have a number of fixtures in my test suite. For example, with >>> acts_as_authenticated and acts_as_state_machine, I created a >>> number of >>> users in different account states for use in functional testing. >>> (Suspended users can not log in, etc) >> >>> Is it a good idea to run fixtures through tests to ensure that they >>> conform to their ideals? >>> EG: assert users(:suspended_user).suspended? >> >>> If so, where should these tests go? I currently have them in my >>> unit >>> tests. >> >>> Regards, >>> --Dean >> >> -- >> Ryan Bigghttp://www.frozenplague.net >> Feel free to add me to MSN and/or GTalk as this email. > --~--~---------~--~----~------------~-------~--~----~ > 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.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Using Dean''s latest reasoning, we should write a test that tests the test that we write for the fixtures, and a test for that, and a test for that... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Feb 11, 2008 1:30 PM, Ryan Bigg (Radar) <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Using Dean''s latest reasoning, we should write a test that tests the test > that we write for the fixtures, and a test for that, and a test for that...It''s silly to think of tests as some sort of rigorous proof of your system''s correctness. Down that road are a bunch of extra, useless tests, and a lot of time spent omgquiscustodietipsoscustodes-ing. My tests do two things: 1. Increase my confidence that the system''s still working after a change 2. Help me track down the unexpected consequences of a change With that in mind, I don''t see anything wrong with testing certain fixtures: def test_important_fixtures_are_valid %w(john paul george).each do |beatle| assert(beatles(beatle.intern), "expected beatle fixture ''#{beatle}'' to be valid") end end ~ j. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Feb 11, 3:30 pm, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Using Dean''s latest reasoning, we should write a test that tests the test > that we write for the fixtures, and a test for that, and a test for that...Rather than thinking that fixtures are part of the test I believe that *go into* the test. Just as a candy company tests the chocolate they put in their product it might be appropriate to assure fixtures are kosher. I think Frederick Cheung''s advice is more helpful and will combine it with useful fixture testing as suggested by John Barnette. Regards, --Dean --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---