lundi 1 février 2016

Rails 4 STI Model Couldn't find with 'id' when running functional tests

So I have a Request model (I know it's a terrible name), and 2 single inherited models TenantRequest and PropertyRequest. Now I have fixtures for all 3. So I wrote functional controller tests for my requests_controller and my tenant_requests_controller, which both work fine. But for some reason, my property_controller tests show me the following error for every setup:

1) Error:
PropertyRequestsControllerTest#test_should_get_edit:
ActiveRecord::RecordNotFound: Couldn't find Request with 'id'=298486374
test/controllers/property_requests_controller_test.rb:12:in `block in <class:PropertyRequestsControllerTest>'

This is the tenant_request.yml:

one:
  title: This is the title of the tenant request
  body: This is the body
  user: regular
  email: jim@retail.com
  type: TenantRequest
  contact_name: Jim

Here is my property_request.yml:

one:
  title: This is the title of the property request
  body: This is the body for property
  user: broker
  email: sue@broker.com
  type: PropertyRequest
  contact_name: Sue
  budget: 1234
  city: New York
  region: Manhattan
  created_at: now
  updated_at: now
  status: open
  company: Walmart
  contact_position: Boss
  contact_phone: 555-555-5555
  squarefeet: 12345
  broker: true
  parking: true
  onsite_tour: true
  part_of_town: Downtown
  time_to_reach: 7pm
  budget: 1234

If you need more information, please let me know and I can add it. Thank you,

Aucun commentaire:

Enregistrer un commentaire