From ec660a6bc1ac23963067698d38516eae2da232ed Mon Sep 17 00:00:00 2001 From: George Andrinopoulos Date: Mon, 13 Mar 2017 10:05:15 +0000 Subject: Resolve transient failure in spec/models/user_spec.rb --- .../unreleased/29328-fix-transient-failure-in-model-user-spec.yml | 4 ++++ spec/models/user_spec.rb | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/29328-fix-transient-failure-in-model-user-spec.yml diff --git a/changelogs/unreleased/29328-fix-transient-failure-in-model-user-spec.yml b/changelogs/unreleased/29328-fix-transient-failure-in-model-user-spec.yml new file mode 100644 index 00000000000..dabf9968c5b --- /dev/null +++ b/changelogs/unreleased/29328-fix-transient-failure-in-model-user-spec.yml @@ -0,0 +1,4 @@ +--- +title: Add custom attributes in factories +merge_request: 9892 +author: George Andrinopoulos diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index adb5b538922..3166b951a42 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -713,8 +713,9 @@ describe User, models: true do describe '.search_with_secondary_emails' do delegate :search_with_secondary_emails, to: :described_class - let!(:user) { create(:user) } - let!(:email) { create(:email) } + let!(:user) { create(:user, name: 'John Doe', username: 'john.doe', email: 'john.doe@example.com' ) } + let!(:another_user) { create(:user, name: 'Albert Smith', username: 'albert.smith', email: 'albert.smith@example.com' ) } + let!(:email) { create(:email, user: another_user) } it 'returns users with a matching name' do expect(search_with_secondary_emails(user.name)).to eq([user]) -- cgit v1.2.1