diff options
Diffstat (limited to 'spec/helpers/profiles_helper_spec.rb')
-rw-r--r-- | spec/helpers/profiles_helper_spec.rb | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/spec/helpers/profiles_helper_spec.rb b/spec/helpers/profiles_helper_spec.rb index 2ea832f95dc..c3a3c2a0178 100644 --- a/spec/helpers/profiles_helper_spec.rb +++ b/spec/helpers/profiles_helper_spec.rb @@ -13,7 +13,8 @@ RSpec.describe ProfilesHelper do private_email = user.private_commit_email emails = [ - ["Use a private email - #{private_email}", Gitlab::PrivateCommitEmail::TOKEN], + [s_('Use primary email (%{email})') % { email: user.email }, ''], + [s_("Profiles|Use a private email - %{email}").html_safe % { email: private_email }, Gitlab::PrivateCommitEmail::TOKEN], user.email, confirmed_email1.email, confirmed_email2.email @@ -23,20 +24,6 @@ RSpec.describe ProfilesHelper do end end - describe '#selected_commit_email' do - let(:user) { create(:user) } - - it 'returns main email when commit email attribute is nil' do - expect(helper.selected_commit_email(user)).to eq(user.email) - end - - it 'returns DB stored commit_email' do - user.update!(commit_email: Gitlab::PrivateCommitEmail::TOKEN) - - expect(helper.selected_commit_email(user)).to eq(Gitlab::PrivateCommitEmail::TOKEN) - end - end - describe '#email_provider_label' do it "returns nil for users without external email" do user = create(:user) @@ -152,6 +139,22 @@ RSpec.describe ProfilesHelper do end end + describe '#middle_dot_divider_classes' do + using RSpec::Parameterized::TableSyntax + + where(:stacking, :breakpoint, :expected) do + nil | nil | %w(gl-mb-3 gl-display-inline-block middle-dot-divider) + true | nil | %w(gl-mb-3 middle-dot-divider-sm gl-display-block gl-sm-display-inline-block) + nil | :sm | %w(gl-mb-3 gl-display-inline-block middle-dot-divider-sm) + end + + with_them do + it 'returns CSS classes needed to render the middle dot divider' do + expect(helper.middle_dot_divider_classes(stacking, breakpoint)).to eq expected + end + end + end + def stub_cas_omniauth_provider provider = OpenStruct.new( 'name' => 'cas3', |