Nadeesha Meththananda
2008-Jan-08  07:50 UTC
how to write test case for DataBase search ....
Hi All i have written codes to do a database search in my appication using the mysql fully text search. it works properly. bt now i have a problem in writing test case for it. so can some body pls help me how to write testing codes for this database searching function. Thanks Nadeesha -- 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 -~----------~----~----~----~------~----~------~--~---
If you have built an application using scaffold then you can easily modify database search criteria. Just modify the first line in the controller script> @myController = myController.find :allto something like> @mController = myController.find :all, :name => "Controller Name"This is Ruby for SELECT * FROM my_controllers WHERE name=''Controller Name''>If you are new to RoR then you should look at scaffolding to get you up and going with your database quickly. Look at this http://wiki.rubyonrails.org/rails/pages/ScaffoldGenerator> > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Nadeesha Meththananda
2008-Jan-09  10:34 UTC
Re: how to write test case for DataBase search ....
hi Matt
Thanks for the tips. bt the case is i need to write the test case for 
the functionality in my controller. this controller is written only to 
do DB search only. so i need to write a test case codes for it.
   def test_public_search_with_data
   get :public_search, {}, {:query => "help"}
    assert_response 200
  end
some what like this . bt the case is this is not working propely. so i 
want to know whether the my approach is correct or is their is another 
way for this.
Thanks
Nadeesha
Matt Moloney wrote:> If you have built an application using scaffold then you can easily 
> modify
> database search criteria. Just modify the first line in the controller
> script
> 
>> @myController = myController.find :all
> 
> to something like
> 
>>  @mController = myController.find :all, :name => "Controller
Name"
> 
> This is Ruby for SELECT * FROM my_controllers WHERE
name=''Controller
> Name''
>>
> 
> If you are new to RoR then you should look at scaffolding to get you up 
> and
> going with your database quickly.
> 
> Look at this http://wiki.rubyonrails.org/rails/pages/ScaffoldGenerator
-- 
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
-~----------~----~----~----~------~----~------~--~---