Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-01-10 20:35:04 +0300
committerMark Lapierre <mlapierre@gitlab.com>2019-01-10 20:35:04 +0300
commit9b9b9b916190da264fc5e4b38143045f579d06ac (patch)
treeffedafa3cf4597e878da6ae3b09232da1871e297
parent6a27e01abd6079dd616df29f86707891b0cfe15b (diff)
parentf48f9460fd97ee9e818a16ef0ddf41c135173cfb (diff)
Merge branch 'qa-fix-staging-25' into 'master'
[QA] Retrieve the current user name and email Closes gitlab-org/quality/staging#25 See merge request gitlab-org/gitlab-ce!24298
-rw-r--r--qa/qa/resource/base.rb4
-rw-r--r--qa/qa/resource/user.rb9
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb6
-rw-r--r--qa/spec/resource/base_spec.rb4
4 files changed, 11 insertions, 12 deletions
diff --git a/qa/qa/resource/base.rb b/qa/qa/resource/base.rb
index dcea144ab74..f325162d1c0 100644
--- a/qa/qa/resource/base.rb
+++ b/qa/qa/resource/base.rb
@@ -126,10 +126,6 @@ module QA
mod
end
- def self.attributes_names
- dynamic_attributes.instance_methods(false).sort.grep_v(/=$/)
- end
-
class DSL
def initialize(base)
@base = base
diff --git a/qa/qa/resource/user.rb b/qa/qa/resource/user.rb
index c26f0c84a1f..b9580d81171 100644
--- a/qa/qa/resource/user.rb
+++ b/qa/qa/resource/user.rb
@@ -6,9 +6,12 @@ module QA
module Resource
class User < Base
attr_reader :unique_id
- attr_writer :username, :password, :name, :email
+ attr_writer :username, :password
attr_accessor :provider, :extern_uid
+ attribute :name
+ attribute :email
+
def initialize
@unique_id = SecureRandom.hex(8)
end
@@ -22,11 +25,11 @@ module QA
end
def name
- @name ||= username
+ @name ||= api_resource&.dig(:name) || username
end
def email
- @email ||= "#{username}@example.com"
+ @email ||= api_resource&.dig(:email) || "#{username}@example.com"
end
def credentials_given?
diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb
index 203338ddf77..3a5d89e6b83 100644
--- a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb
+++ b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb
@@ -39,11 +39,15 @@ module QA
end
it 'user views raw email patch' do
+ user = Resource::User.fabricate_via_api! do |user|
+ user.username = Runtime::User.username
+ end
+
view_commit
Page::Project::Commit::Show.perform(&:select_email_patches)
- expect(page).to have_content('From: Administrator <admin@example.com>')
+ expect(page).to have_content("From: #{user.name} <#{user.email}>")
expect(page).to have_content('Subject: [PATCH] Add second file')
expect(page).to have_content('diff --git a/second b/second')
end
diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb
index dc9e16792d3..b8c406ae72a 100644
--- a/qa/spec/resource/base_spec.rb
+++ b/qa/spec/resource/base_spec.rb
@@ -138,10 +138,6 @@ describe QA::Resource::Base do
describe '.attribute' do
include_context 'simple resource'
- it 'appends new attribute' do
- expect(subject.attributes_names).to eq([:no_block, :test, :web_url])
- end
-
context 'when the attribute is populated via a block' do
it 'returns value from the block' do
result = subject.fabricate!(resource: resource)