samedi 14 octobre 2017

Testing with Devise

I was going through Michael Hartl's tutorial and decided to implement Devise. It works great, but now my tests are failing:

cj:~/workspace/where (profile) $ rails test
Running via Spring preloader in process 15402
Run options: --seed 61750

# Running:

E

Error:
SiteLayoutTest#test_layout_links:
ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: UNIQUE constraint failed: users.email: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2017-10-14 18:51:44.538012', '2017-10-14 18:51:44.538012', 298486374)


Error:
SiteLayoutTest#test_layout_links:
NoMethodError: undefined method `each' for nil:NilClass

I'm struggling to make sense out of what's going on here since these tests have nothing to do with the database:

require 'test_helper'

class SiteLayoutTest < ActionDispatch::IntegrationTest
  test "layout links" do
    get root_path
    assert_template 'static_pages/home'
    assert_select "a[href=?]", root_path
    assert_select "a[href=?]", help_path
    assert_select "a[href=?]", about_path
    assert_select "a[href=?]", faq_path
    assert_select "a[href=?]", contact_path
    assert_select "a[href=?]", legal_path
  end
end

Clearly, there is some setup going on that I'm failing to comprehend.

Thank you for helping a newbie who is having an awesome time learning Rails.

Aucun commentaire:

Enregistrer un commentaire