[rspec-users] Test case for file import

aslak hellesoy aslak.hellesoy at gmail.com
Tue Nov 13 11:37:21 EST 2007


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
>


More information about the rspec-users mailing list