jeudi 24 août 2017

Errow when I run rake test in Ruby on Rails

I am getting an error when I try to run a test on my very simple app in ROR. I am taking a course online and I have this very simple database that has two tables: Posts (with title and body) and Comments(with ForeignKey: post_id and body. When I run rake test I get the following error

`.........E

Error: PostsControllerTest#test_should_destroy_post: ActiveRecord::InvalidForeignKey: SQLite3::ConstraintException: FOREIGN KEY constraint failed: DELETE FROM "posts" WHERE "posts"."id" = ? app/controllers/posts_controller.rb:57:in destroy' test/controllers/posts_controller_test.rb:43:inblock (2 levels) in ' test/controllers/posts_controller_test.rb:42:in `block in '

bin/rails test test/controllers/posts_controller_test.rb:41

....

Finished in 12.539965s, 1.1164 runs/s, 1.2759 assertions/s. 14 runs, 16 assertions, 0 failures, 1 errors, 0 skips`

Any help would be appreciated. Thanks.

Aucun commentaire:

Enregistrer un commentaire