From 72430ae98116f1bbf7fe05874e9e870c764fc41e Mon Sep 17 00:00:00 2001 From: Riccardo Padovani Date: Tue, 13 Jun 2017 19:13:01 +0200 Subject: [PATCH 1/4] #33461: Display own user id in account settings page --- app/views/profiles/show.html.haml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index fcfd350f0da..15672289c65 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -42,10 +42,17 @@ - if current_user.ldap_user? Some options are unavailable for LDAP accounts .col-lg-9 - .form-group - = f.label :name, class: "label-light" - = f.text_field :name, class: "form-control", required: true - %span.help-block Enter your name, so people you know can recognize you. + .row + .form-group.col-md-9 + = f.label :name, class: "label-light" + = f.text_field :name, class: "form-control", required: true + %span.help-block Enter your name, so people you know can recognize you. + + .form-group.col-md-3 + = f.label :id, class: 'label-light' do + User ID + = f.text_field :id, class: 'form-control', readonly: true + .form-group = f.label :email, class: "label-light" From 4c2df7d43cc960010ae10651207d728b450c07be Mon Sep 17 00:00:00 2001 From: Riccardo Padovani Date: Tue, 13 Jun 2017 19:17:10 +0200 Subject: [PATCH 2/4] 33641: Add changelog --- changelogs/unreleased/33461-display-user-id.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/unreleased/33461-display-user-id.yml diff --git a/changelogs/unreleased/33461-display-user-id.yml b/changelogs/unreleased/33461-display-user-id.yml new file mode 100644 index 00000000000..cba94625b07 --- /dev/null +++ b/changelogs/unreleased/33461-display-user-id.yml @@ -0,0 +1,4 @@ +--- +title: Display own user id in account settings page +merge_request: 12141 +author: Riccardo Padovani From 08141295614fb607e2ba46d20be4e40de0bf6216 Mon Sep 17 00:00:00 2001 From: Riccardo Padovani Date: Thu, 15 Jun 2017 00:16:22 +0200 Subject: [PATCH 3/4] #33641: add spec for profile page --- spec/views/profiles/show.html.haml_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 spec/views/profiles/show.html.haml_spec.rb diff --git a/spec/views/profiles/show.html.haml_spec.rb b/spec/views/profiles/show.html.haml_spec.rb new file mode 100644 index 00000000000..497e31be141 --- /dev/null +++ b/spec/views/profiles/show.html.haml_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe 'profiles/show' do + let(:user) { create(:user) } + + before do + assign(:user, user) + allow(controller).to receive(:current_user).and_return(user) + end + + context 'when the profile page is opened' do + it 'displays the correct elements' do + render + expect(rendered).to have_field("user_name", user.name) + expect(rendered).to have_field("user_id", user.id) + end + end +end From aa2e2cacb46485eae1356ba9cf684bbf2bb41d42 Mon Sep 17 00:00:00 2001 From: Riccardo Padovani Date: Thu, 15 Jun 2017 11:38:12 +0000 Subject: [PATCH 4/4] Update test to use single quotes and Four-Phase test conventions --- spec/views/profiles/show.html.haml_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/views/profiles/show.html.haml_spec.rb b/spec/views/profiles/show.html.haml_spec.rb index 497e31be141..e89a8cb9626 100644 --- a/spec/views/profiles/show.html.haml_spec.rb +++ b/spec/views/profiles/show.html.haml_spec.rb @@ -11,8 +11,9 @@ describe 'profiles/show' do context 'when the profile page is opened' do it 'displays the correct elements' do render - expect(rendered).to have_field("user_name", user.name) - expect(rendered).to have_field("user_id", user.id) + + expect(rendered).to have_field('user_name', user.name) + expect(rendered).to have_field('user_id', user.id) end end end