Topic: record not creating when uploading files in functionaltesting

Hi,i want help regarding functional test for uploading files.here my code
Controller code

 def create
     Exercise.create_new_exercise(params[:video],params[:thumbnail],params[:exercise_title],params[:musclegroup_id])
    redirect_to :controller => "fitness",:action => "index"
  end

in my Model
  def self.create_new_exercise(video, thumbnail, exercise_title, musclegroup_id)
      if validate_attachment(video) && validate_attachment(video)
       video_filename = sanitize_attachment_name(video)
       thumbnail_filename = sanitize_attachment_name(thumbnail)
       @exercise = self.new do |exercise|
        exercise.exercise_title = exercise_title
        exercise.video_name = video_filename
        exercise.thumbnail_name = thumbnail_filename
        exercise.musclegroup_id = musclegroup_id
      end
      self.upload_video(video, video_filename, @exercise.id) &&     self.upload_thumbnail(thumbnail, thumbnail_filename, @exercise.id) if @exercise.save
    end
  end

my testing code
def test_create
    num=Exercise.count
    post :create, :multipart => true,
                  :video=>fixture_file_upload('/files/CardsTric.wmv','video/x-ms-wmv'),
                  :thumbnail=>fixture_file_upload('/files/thumb3.jpg','image/jpeg'),
                  :exercise_title=>"exe33",
                  :musclegroup_id=>"11"
                 
    assert_response :redirect
    assert_redirected_to :controller => "fitness",:action => "index"
    assert_equal num+1,Exercise.count
  end

Test::Unit::AssertionFailedError: <4> expected but was
<3>.
D:\workspaceproject\Life2Go-20Feb/test/functional/exercises_controller_test.rb:28:in `test_create'

i got the above failure.record not creating.i unable to get why its not creating record.plz give me solution .am i did anything wrong.
thanks in advance
lucky

Last edited by lucky (2008-02-27 08:22:16)