mardi 15 mai 2018

unit test failure rails (post does not exist)

Heres the code.

require 'test_helper'

class RsvpTest < ActiveSupport::TestCase
   def setup
    @rsvp=Rsvp.new(attending:"true", user_id:"5", id:"1",)
   end


  test "rsvp should be valid" do
    assert @rsvp.valid?, @rsvp.errors.full_messages
  end
end

while testing my rsvp I'm getting this error here It's basically saying that Post must exist. I've already created a post in my test database but alas, it's still saying that it does not exist.

Heres my test User table

Here is Test Post table

I'm fairly new to rails and I've just recently started testing. I've tried to google for an answer but I'm yet to find one. I would appreciate the help, thanks.

Aucun commentaire:

Enregistrer un commentaire