title: Stuck in controller unit test error
body: <p>I am <a href="https://gist.github.com/atmosx/11315814" rel="nofollow">getting this error</a> on my controller. The relevant first lines are the following:</p>
  
  <pre><code>Started at 2014-04-26 11:29:45 +0200 w/ seed 13696.                                                                                                                        [82/97]
  
  AppointmentsControllerTest
                PASS (0:00:00.088) test_should_create_appointment
                PASS (0:00:00.097) test_should_destroy_appointment
                PASS (0:00:00.141) test_should_get_edit
               ERROR (0:00:00.151) test_should_get_index
            Couldn't find Patient with id=0
          @ /Users/atma/.rvm/gems/ruby-2.1.0@rails/gems/activerecord-4.0.3/lib/active_record/relation/finder_methods.rb:198:in `raise_record_not_found_exception!'
            /Users/atma/.rvm/gems/ruby-2.1.0@rails/gems/activerecord-4.0.3/lib/active_record/relation/finder_methods.rb:284:in `find_one'
            /Users/atma/.rvm/gems/ruby-2.1.0@rails/gems/activerecord-4.0.3/lib/active_record/relation/finder_methods.rb:268:in `find_with_ids'
            /Users/atma/.rvm/gems/ruby-2.1.0@rails/gems/activerecord-4.0.3/lib/active_record/relation/finder_methods.rb:35:in `find'
            /Users/atma/.rvm/gems/ruby-2.1.0@rails/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/relation.rb:122:in `find'
            /Users/atma/.rvm/gems/ruby-2.1.0@rails/gems/activerecord-4.0.3/lib/active_record/querying.rb:3:in `find'
  </code></pre>
  
  <p>My controller looks pretty much straight forward:</p>
  
  <pre><code>require 'test_helper'
  
  class AppointmentsControllerTest &lt; ActionController::TestCase
    setup do
      @appointment = appointments(:one)
      @update = {
        patient_id: Patient.last.id,
        doctor_id: Doctor.last.id,
        date: "2014-05-01 10:24",
        status: 'Επικυρωμένο',
        notes: 'Σχόλια'
      }
    end
  
    test "should get index" do
      get :index
      assert_response :success
      assert_not_nil assigns(:appointments)
    end
  
    test "should get new" do
      get :new
      assert_response :success
    end
  
    test "should create appointment" do
      assert_difference('Appointment.count') do
        post :create, appointment: @update
      end
  
      assert_redirected_to appointment_path(assigns(:appointment))
    end
  
    test "should show appointment" do
      get :show, id: @appointment
      assert_response :success
    end
  
    test "should get edit" do
      get :edit, id: @appointment
      assert_response :success
    end
  
    test "should update appointment" do
      patch :update, id: @appointment, appointment: @update
      assert_redirected_to appointment_path(assigns(:appointment))
    end
  
    test "should destroy appointment" do
      assert_difference('Appointment.count', -1) do
        delete :destroy, id: @appointment
      end
  
      assert_redirected_to appointments_path
    end
  end
  </code></pre>
  
  <p>I have two fixtures for this controller: </p>
  
  <pre><code>one:
    patient_id: Patient.last.id
    doctor_id: Doctor.first.id
    date: "2015-01-01 10:20"
    status: 'Επικυρωμένο'
    notes: 'Ο ασθενής θα έρθει από άλλη πόλη'
  
  two:
    patient_id: Patient.first.id
    doctor_id: Doctor.last.id
    date: "2015-02-01 11:20"
    status: 'Ακυρωμένο'
    notes: 
  </code></pre>
  
  <p>I don't understand why <code>minitest</code> is requesting <code>id=0</code> since it's not defined, the <code>Patient</code> with <code>id=0</code> does not exist, there's nothing like this on fixtures or in the main controller.</p>
  
  <p>Any ideas how to deal with this? I had about 7 errors, I managed to fix my code down to 1 error. But I'm stuck with this one. Any clues on what to do here, what to look for, would be fine. Since I'm new to rails please be as descriptive as possible.</p>
  
  <p>Thanks</p>