test_create gets 200 instead of :success

Get freelance or telecom-job here!!

Hi Shauna, I would recommend doing the following for your test_create:

def test_create

   # obtain the number of borrowers.
   num_borrowers = Borrower.count

   # post the data to the server
   post :create, :borrower => {:SSN => '000', :LastName => 'Anyone'}

   # was the response successful.
   assert_response :success

   # did we get redirected to the correct page.
   assert_redirected_to :action => 'list'

   # did the appropriate message get displayed on success.
   assert_equal 'Borrower Anyone was added.', flash[:notice]

   # did the number of borrowers get incremented.
   assert_equal num_borrowers + 1, Borrower.count


I'm new to RoR and I have also completed the 'Ruby on Rails' course
recently in Dallas.

Good luck,


Hi...I'm pretty new to rails as well, but maybe I can help.

The response code will be either 200 (success) or 302 (redirect). Not

So, you're orignal test code looks good to me.

Unfortunatley, I don't know what the problem is though.

Or maybe try adding some code to see if the Borrower was created
properly, before saving, just to doublecheck that the parameters were
passed in properly.

  @borrower = Borrower.new(params[:borrower])
      puts "Borrower SSN: #{@borrower.LastName}" #
doublecheck the new borrowers LastName
      if @borrower.save

Is it possible that "anyone" is already in the db?

Good Luck!