lundi 16 avril 2018

Rails testing a model says 'Expected false to be truthy'

I am having site where users can create products upon signup and products can have checklists.

I am having a checklist table with following columns:-

id  |  product_id  | content  |  archived 

I am new to rails testing. I wrote the test below

  test 'should have content' do
    checklist = Checklist.new
    assert checklist.save
  end

and run the test with following command

ruby -I test test/models/checklist_test.rb

and test is failed with Expected false to be truthy error.

Is it because of the problem a checklist can be accessed using user.product.checklists i have to populate the data in fixtures first and call those in testing?

Aucun commentaire:

Enregistrer un commentaire