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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-16 15:09:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-16 15:09:12 +0300
commitcbfe03ae04a52d9825ff7cbeccdfe5d313adf6a2 (patch)
treee4879b35d019d3bbba1689f3ac4c48b81bf7b451 /spec/helpers/users_helper_spec.rb
parent3fd97b4bba24ca412112aad025a38a32c7a6cf8c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/users_helper_spec.rb')
-rw-r--r--spec/helpers/users_helper_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb
index 8479f8509f5..893d5cde24a 100644
--- a/spec/helpers/users_helper_spec.rb
+++ b/spec/helpers/users_helper_spec.rb
@@ -178,4 +178,42 @@ describe UsersHelper do
end
end
end
+
+ describe '#work_information' do
+ subject { helper.work_information(user) }
+
+ context 'when both job_title and organization are present' do
+ let(:user) { build(:user, organization: 'GitLab', job_title: 'Frontend Engineer') }
+
+ it 'returns job title concatenated with organization' do
+ is_expected.to eq('Frontend Engineer at GitLab')
+ end
+ end
+
+ context 'when only organization is present' do
+ let(:user) { build(:user, organization: 'GitLab') }
+
+ it "returns organization" do
+ is_expected.to eq('GitLab')
+ end
+ end
+
+ context 'when only job_title is present' do
+ let(:user) { build(:user, job_title: 'Frontend Engineer') }
+
+ it 'returns job title' do
+ is_expected.to eq('Frontend Engineer')
+ end
+ end
+
+ context 'when neither organization nor job_title are present' do
+ it { is_expected.to be_nil }
+ end
+
+ context 'when user parameter is nil' do
+ let(:user) { nil }
+
+ it { is_expected.to be_nil }
+ end
+ end
end