Hi, this is the file thermo_detector_controller_test.rb: def test_edit get :edit, :id => @don_dafii_order.id assert_response :success end def test_send_invalid_stk file_uploaded = uploaded_file("#{File.expand_path(RAILS_ROOT)}/test/fixtures/img/david_beckham.jpg", ''image/jpeg'') post :create_stk, { :id => @don_dafii_order.id, :thermo_detector => { :stk => file_uploaded }} assert_redirected_to :action => ''new_stk'' assert_equal ''Dokumen yang dikirim harus berformat pdf.'', flash[:notice] end and this is the file cartridge_heater_controller_test.rb: def test_edit get :edit, :id => @don_dafii_order.id assert_response :success end def test_send_invalid_stk file_uploaded = uploaded_file("#{File.expand_path(RAILS_ROOT)}/test/fixtures/img/david_beckham.jpg", ''image/jpeg'') post :create_stk, { :id => @don_dafii_order.id, :cartridge_heater => { :stk => file_uploaded }} assert_redirected_to :action => ''new_stk'' assert_equal ''Dokumen yang dikirim harus berformat pdf.'', flash[:notice] end How do you drying up these methods? There are duplications in model testing code too. Here is the file cartridge_heater_order_letter_test.rb def test_update assert_equal @don_dafii_order.sales_name, @cartridge.sales_name @cartridge.sales_name = ''James Bond'' assert @cartridge.save, @cartridge.errors.full_messages.join("; ") @cartridge.reload assert_equal ''James Bond'', @cartridge.sales_name end Here is the file thermo_detector_order_letter_test.rb def test_update assert_equal @don_dafii_order.sales_name, @thermo_detector.sales_name @thermo_detector.sales_name = ''James Bond'' assert @thermo_detector.save, @thermo_detector.errors.full_messages.join("; ") @thermo_detector.reload assert_equal ''James Bond'', @thermo_detector.sales_name end Thank you. -- 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 -~----------~----~----~----~------~----~------~--~---