summaryrefslogtreecommitdiff
path: root/spec/features/users/show_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/users/show_spec.rb')
-rw-r--r--spec/features/users/show_spec.rb43
1 files changed, 42 insertions, 1 deletions
diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb
index aebe2cc602d..6aeb3023db8 100644
--- a/spec/features/users/show_spec.rb
+++ b/spec/features/users/show_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe 'User page' do
let_it_be(:user) { create(:user, bio: '**Lorem** _ipsum_ dolor sit [amet](https://example.com)') }
- subject { visit(user_path(user)) }
+ subject(:visit_profile) { visit(user_path(user)) }
context 'with public profile' do
it 'shows all the tabs' do
@@ -123,6 +123,47 @@ RSpec.describe 'User page' do
end
end
+ context 'with unconfirmed user' do
+ let_it_be(:user) { create(:user, :unconfirmed) }
+
+ shared_examples 'unconfirmed user profile' do
+ before do
+ visit_profile
+ end
+
+ it 'shows user name as unconfirmed' do
+ expect(page).to have_css(".cover-title", text: 'Unconfirmed user')
+ end
+
+ it 'shows no tab' do
+ expect(page).to have_css("div.profile-header")
+ expect(page).not_to have_css("ul.nav-links")
+ end
+
+ it 'shows no additional fields' do
+ expect(page).not_to have_css(".profile-user-bio")
+ expect(page).not_to have_css(".profile-link-holder")
+ end
+
+ it 'shows private profile message' do
+ expect(page).to have_content("This user has a private profile")
+ end
+ end
+
+ context 'when visited by an authenticated user' do
+ before do
+ authenticated_user = create(:user)
+ sign_in(authenticated_user)
+ end
+
+ it_behaves_like 'unconfirmed user profile'
+ end
+
+ context 'when visited by an unauthenticated user' do
+ it_behaves_like 'unconfirmed user profile'
+ end
+ end
+
it 'shows the status if there was one' do
create(:user_status, user: user, message: "Working hard!")