summaryrefslogtreecommitdiff
path: root/spec/helpers/projects_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/projects_helper_spec.rb')
-rw-r--r--spec/helpers/projects_helper_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
index cc443afee6e..604ce0fe0c1 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/spec/helpers/projects_helper_spec.rb
@@ -345,6 +345,14 @@ RSpec.describe ProjectsHelper do
expect(link).not_to include(user.name)
end
end
+
+ context 'when user is nil' do
+ it 'returns "(deleted)"' do
+ link = helper.link_to_member(project, nil)
+
+ expect(link).to eq("(deleted)")
+ end
+ end
end
describe 'default_clone_protocol' do
@@ -1018,4 +1026,26 @@ RSpec.describe ProjectsHelper do
end
end
end
+
+ describe '#import_from_bitbucket_message' do
+ before do
+ allow(helper).to receive(:current_user).and_return(user)
+ end
+
+ context 'as a user' do
+ it 'returns a link to contact an administrator' do
+ allow(user).to receive(:admin?).and_return(false)
+
+ expect(helper.import_from_bitbucket_message).to have_text('To enable importing projects from Bitbucket, ask your GitLab administrator to configure OAuth integration')
+ end
+ end
+
+ context 'as an administrator' do
+ it 'returns a link to configure bitbucket' do
+ allow(user).to receive(:admin?).and_return(true)
+
+ expect(helper.import_from_bitbucket_message).to have_text('To enable importing projects from Bitbucket, as administrator you need to configure OAuth integration')
+ end
+ end
+ end
end