Rspecで下記のコードでuniquenessをテストしたいのですがテストがfalseを期待しているのにtrueが返ってきてしまします。間違っているところを指摘していただけるとありがたいです。
validates :username, length: {minimum:6, maximum:25}, presence: true, uniqueness: true
require 'rails_helper' RSpec.describe User, type: :model do before do @user = build(:alice) @other = build(:misa) end example "usernameは一意" do @other.username = @user.username expect(@other.valid?).to eq(false) end end
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。