flukus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-18 11:01 UTC
testing with code injection
Most of my unit tests are too long and repetative, so I''m trying to
refactor them with some code injection.
What I want to do is something like in category_test:
def setup
@valid_values = {:name => ["frank", "bob,
"vfdsnj543543"]}
@invalid_values = {:name => ["", nil, "some absurdely long
name that
won''t fit in the db"]}
end
I''m struggling to find a way to inject the necessary methods to test
all the possiblities. Doing anything with the base TestCase has
undesireable results.
I''d like know what other people have done to achieve this sort of
functionality?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
maybe rspec could help you, especially the stub and mock section http://rspec.info/ -- 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 -~----------~----~----~----~------~----~------~--~---
Look over heckle (http://seattlerb.rubyforge.org/heckle/). On Dec 18, 2007, at 3:01 AM, flukus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > Most of my unit tests are too long and repetative, so I''m trying to > refactor them with some code injection. > > What I want to do is something like in category_test: > > def setup > @valid_values = {:name => ["frank", "bob, "vfdsnj543543"]} > @invalid_values = {:name => ["", nil, "some absurdely long name that > won''t fit in the db"]} > end > > > I''m struggling to find a way to inject the necessary methods to test > all the possiblities. Doing anything with the base TestCase has > undesireable results. > > I''d like know what other people have done to achieve this sort of > functionality? > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---