Hi Friends, I need to write the testcase for fileimport. Pls give me any idea -- Posted via http://www.ruby-forum.com/.
> > I need to write the testcase for fileimport. >Can you show some of your code that needs to be tested?
On Nov 6, 2007 6:51 AM, Jim Lindley <jimlindley at gmail.com> wrote:> > > > I need to write the testcase for fileimport. > > > > Can you show some of your code that needs to be tested?Actually, we''d hope that the code doesn''t exist yet. This is Behaviour DRIVEN Development, after all. Can you tell us what fileimport is supposed to do?
> > Can you show some of your code that needs to be tested? > > Actually, we''d hope that the code doesn''t exist yet. This is Behaviour > DRIVEN Development, after all. >Old habits, my apologies.
I want to write below specs specify "The system allows users to import a pre-formatted CSV file into project." specify "Each row in the spreadsheet is imported as one new Task." specify "The import WILL NOT update existing tasks." specify "If the import file has any records that fail due to errors, NONE of the records in the import file will be imported." specify"The system will allow users to browse to the import file using typical windows file open controls." Please give me any ideas Jim Lindley wrote:> >> > Can you show some of your code that needs to be tested? >> >> Actually, we''d hope that the code doesn''t exist yet. This is Behaviour >> DRIVEN Development, after all. >> > > Old habits, my apologies. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >-- View this message in context: http://www.nabble.com/Test-case-for-file-import-tf4756785.html#a13703316 Sent from the rspec-users mailing list archive at Nabble.com.
On Nov 12, 2007 11:36 AM, KarniRevuri <revurikarna at gmail.com> wrote:> > I want to write below specs > > specify "The system allows users to import a pre-formatted CSV file into > project." > specify "Each row in the spreadsheet is imported as one new Task." > specify "The import WILL NOT update existing tasks." > specify "If the import file has any records that fail due to errors, NONE > of the records in the import file will be imported." > specify"The system will allow users to browse to the import file using > typical windows file open controls." > > > Please give me any ideas >Is this related to the post that you replied to? Your question is too vague. Can you be more specific about what you need help with? Aslak> > Jim Lindley wrote: > > > >> > Can you show some of your code that needs to be tested? > >> > >> Actually, we''d hope that the code doesn''t exist yet. This is Behaviour > >> DRIVEN Development, after all. > >> > > > > Old habits, my apologies. > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > View this message in context: http://www.nabble.com/Test-case-for-file-import-tf4756785.html#a13703316 > Sent from the rspec-users mailing list archive at Nabble.com. > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aslak hellesoy wrote:> On Nov 12, 2007 11:36 AM, KarniRevuri <revurikarna at gmail.com> wrote: >> typical windows file open controls." >> >> >> Please give me any ideas >> > > Is this related to the post that you replied to? > Your question is too vague. Can you be more specific about what you > need help with? > > AslakSorry, I need write a script for file import in the below situation specify "The import WILL NOT update existing tasks." Precondtions : I''m explain about tasks view in my requirment There are already some tasks in the database Process: there is file import functionality. I need to test it. if we import any records from CSV file it wont effect the previous tasks(records) Plesase give me u r ideas -- Posted via http://www.ruby-forum.com/.
look at the RDoc for should change... describe Task do fixtures :tasks # should put 2 tasks in the database it "should not import twice from CSV" do csv = File.dirname(__FILE__) + ''/sample.csv'' # It should have 4 new tasks lambda do Task.import_from_csv(csv) end.should change {Task.count}.from(2).to(6) lambda do Task.import_from_csv(csv) end.should_not change {Task.count} end end HTH, Aslak On 11/13/07, Karni Karni <lists at ruby-forum.com> wrote:> aslak hellesoy wrote: > > On Nov 12, 2007 11:36 AM, KarniRevuri <revurikarna at gmail.com> wrote: > >> typical windows file open controls." > >> > >> > >> Please give me any ideas > >> > > > > Is this related to the post that you replied to? > > Your question is too vague. Can you be more specific about what you > > need help with? > > > > Aslak > > Sorry, > > I need write a script for file import in the below situation > > > specify "The import WILL NOT update existing tasks." > > Precondtions : > > I''m explain about tasks view in my requirment > > There are already some tasks in the database > > > Process: there is file import functionality. > > I need to test it. if we import any records from CSV file it wont > effect the previous tasks(records) > > Plesase give me u r ideas > > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aslak hellesoy wrote: Could u pls give any URL form u written this code? -- Posted via http://www.ruby-forum.com/.
Karni Karni wrote:> aslak hellesoy wrote: > > Could u pls give any URL form u written this code?Thanks for ur reply. But in my case the total code is in the controller. I'' submitting the from to a specific action with CSV file. Hoew can I pass my CSV file to that specific action -- Posted via http://www.ruby-forum.com/.
On 11/14/07, Karni Karni <lists at ruby-forum.com> wrote:> Karni Karni wrote: > > aslak hellesoy wrote: > > > > Could u pls give any URL form u written this code? > > Thanks for ur reply. But in my case the total code is in the controller.It shouldn''t be. Put business logic in the model. http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model> I'' submitting the from to a specific action with CSV file.Right. Then ask the model to pupulate rows with that CSV.> > Hoew can I pass my CSV file to that specific actionpost :my_action, :csv => <<-EOF this,is,some very,nice,csv EOF Also, take a look at this: http://www.catb.org/~esr/faqs/smart-questions.html (You''re asking for the whole solution - you''re likely to be ignored if you don''t ask more specific ones. For example show us some spec code) Aslak> -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >