mercredi 17 janvier 2018

UNIQUE constraint failed: users.email: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ()

this is my static_pages_controller_test,

    require 'test_helper'

class StaticPagesControllerTest < ActionDispatch::IntegrationTest
  test "should get home" do
    get static_pages_home_url
    assert_response :success
  end

  test "should get help" do
    get static_pages_help_url
    assert_response :success
  end

  test "should get about" do
    get static_pages_about_url
    assert_response :success
  end
end

Error:

StaticPagesControllerTest#test_should_get_home: ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: UNIQUE constraint failed: users.email: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2018-01-17 05:49:27.300065', '2018-01-17 05:49:27.300065', 298486374)

and i have change user.yml as,

one:
email: test1@test.com

two:
email: test2@test.com

Error:

StaticPagesControllerTest#test_should_get_about: ActiveRecord::Fixture::FormatError: fixture key is not a hash: C:/Sites/IntenetChatSystem/test/fixtures/users.yml, keys: ["one", "email",I'mtwo"]

im getting confuse what should i do,pplz give some suggesstions

Aucun commentaire:

Enregistrer un commentaire