Topic: need help on functional testing

Hi,i am new to rails testing ,i used login page and customers controllers .here is my  customers controller code

 def create
    @customer = Customer.new(params[:customer]) do |customer|
    customer.created_at = Time.now
    end
    @customer.save
   
    render :action => :new
  end

testing code:
   def test_create

    post :create, {'status'=>true},{'customer_name'=>'Abc'},
                  {'created_at' => "2008-02-08   15:52:04"}
    assert_response :success
    assert_template 'new'
   
  end


error
Test::Unit::AssertionFailedError: Expected response to be a <:success>, but was <302>
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/assertions/response_assertions.rb:26:in `assert_response'C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/assertions/response_assertions.rb:18:in `assert_response'D:\workspaceproject\Life2Go/test/functional/customers_controller_test.rb:58:in `test_create'

i got this error.i used filters in my applicationcontroller.rb file and customers controller
if i put those filter in comments ,my testing is passing .
can anyone suggest how to did functionaltesting for my controller without puting filetrs in comments.and how to test filters .
thanks in advance.

Re: need help on functional testing

Looks like you have redirect somewhere in your filters.
In general, you should not test filters itself, rather actions with filters applied.
Btw, as long as you are just starting testing, consider trying rspec.

Re: need help on functional testing

Hi liquidautumn,
thankq for u r reply i got the solution by passing session[:user] in my controller.
i have one more doubt

in my controller used RJS
can u help how to write the test case for following code:

page.form.reset 'form_new_data'

thanks in advance
lucky