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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 12:08:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 12:08:46 +0300
commitb806264d29b8d52ccb78a41dcc3d67f2b040700c (patch)
treeaf97e9d36b2c82520d6850836dee6ba8d7ed9b17 /spec
parent34ab9be97ecf84dd2b7a3b8f3149c0f7d1d7ab5c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/admin/application_settings_controller_spec.rb7
-rw-r--r--spec/controllers/admin/users_controller_spec.rb22
-rw-r--r--spec/controllers/profiles_controller_spec.rb48
-rw-r--r--spec/controllers/projects/error_tracking_controller_spec.rb7
-rw-r--r--spec/factories/error_tracking/detailed_error.rb2
-rw-r--r--spec/fixtures/api/schemas/error_tracking/error_detailed.json3
-rw-r--r--spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb1
-rw-r--r--spec/models/error_tracking/project_error_tracking_setting_spec.rb6
-rw-r--r--spec/policies/user_policy_spec.rb32
-rw-r--r--spec/requests/api/settings_spec.rb8
-rw-r--r--spec/requests/api/users_spec.rb15
-rw-r--r--spec/services/users/update_service_spec.rb40
12 files changed, 15 insertions, 176 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb
index e2bded3f176..fa575ba2eae 100644
--- a/spec/controllers/admin/application_settings_controller_spec.rb
+++ b/spec/controllers/admin/application_settings_controller_spec.rb
@@ -102,13 +102,6 @@ describe Admin::ApplicationSettingsController do
expect(ApplicationSetting.current.minimum_password_length).to eq(10)
end
- it 'updates updating_name_disabled_for_users setting' do
- put :update, params: { application_setting: { updating_name_disabled_for_users: true } }
-
- expect(response).to redirect_to(admin_application_settings_path)
- expect(ApplicationSetting.current.updating_name_disabled_for_users).to eq(true)
- end
-
context 'external policy classification settings' do
let(:settings) do
{
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb
index 54ba7a6fb6c..ebdfbe14dec 100644
--- a/spec/controllers/admin/users_controller_spec.rb
+++ b/spec/controllers/admin/users_controller_spec.rb
@@ -257,28 +257,6 @@ describe Admin::UsersController do
end
describe 'POST update' do
- context 'updating name' do
- context 'when the ability to update their name is disabled for users' do
- before do
- stub_application_setting(updating_name_disabled_for_users: true)
- end
-
- it 'updates the name' do
- params = {
- id: user.to_param,
- user: {
- name: 'New Name'
- }
- }
-
- put :update, params: params
-
- expect(response).to redirect_to(admin_user_path(user))
- expect(user.reload.name).to eq('New Name')
- end
- end
- end
-
context 'when the password has changed' do
def update_password(user, password, password_confirmation = nil)
params = {
diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb
index 85b3ba286a1..265f941e146 100644
--- a/spec/controllers/profiles_controller_spec.rb
+++ b/spec/controllers/profiles_controller_spec.rb
@@ -81,54 +81,6 @@ describe ProfilesController, :request_store do
expect(ldap_user.location).to eq('City, Country')
end
- context 'updating name' do
- subject { put :update, params: { user: { name: 'New Name' } } }
-
- context 'when the ability to update thier name is not disabled for users' do
- before do
- stub_application_setting(updating_name_disabled_for_users: false)
- sign_in(user)
- end
-
- it 'updates the name' do
- subject
-
- expect(response.status).to eq(302)
- expect(user.reload.name).to eq('New Name')
- end
- end
-
- context 'when the ability to update their name is disabled for users' do
- before do
- stub_application_setting(updating_name_disabled_for_users: true)
- end
-
- context 'as a regular user' do
- it 'does not update the name' do
- sign_in(user)
-
- subject
-
- expect(response.status).to eq(302)
- expect(user.reload.name).not_to eq('New Name')
- end
- end
-
- context 'as an admin user' do
- it 'updates the name' do
- admin = create(:admin)
-
- sign_in(admin)
-
- subject
-
- expect(response.status).to eq(302)
- expect(admin.reload.name).to eq('New Name')
- end
- end
- end
- end
-
it 'allows setting a user status' do
sign_in(user)
diff --git a/spec/controllers/projects/error_tracking_controller_spec.rb b/spec/controllers/projects/error_tracking_controller_spec.rb
index 65459b845f9..588c4b05528 100644
--- a/spec/controllers/projects/error_tracking_controller_spec.rb
+++ b/spec/controllers/projects/error_tracking_controller_spec.rb
@@ -224,7 +224,12 @@ describe Projects::ErrorTrackingController do
let(:error) { build(:detailed_error_tracking_error) }
it 'returns an error' do
- expected_error = error.as_json.except('first_release_version').merge({ 'gitlab_commit' => nil })
+ expected_error = error.as_json.except('first_release_version').merge(
+ {
+ 'gitlab_commit' => nil,
+ 'gitlab_commit_path' => nil
+ }
+ )
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('error_tracking/issue_detailed')
diff --git a/spec/factories/error_tracking/detailed_error.rb b/spec/factories/error_tracking/detailed_error.rb
index 7e217246f91..07b6c53e3cd 100644
--- a/spec/factories/error_tracking/detailed_error.rb
+++ b/spec/factories/error_tracking/detailed_error.rb
@@ -34,7 +34,7 @@ FactoryBot.define do
last_release_last_commit { '9ad419c86' }
first_release_short_version { 'abc123' }
last_release_short_version { 'abc123' }
- first_release_version { '123456' }
+ first_release_version { '12345678' }
skip_create
end
diff --git a/spec/fixtures/api/schemas/error_tracking/error_detailed.json b/spec/fixtures/api/schemas/error_tracking/error_detailed.json
index 57cf5e677d6..2b6580e39f7 100644
--- a/spec/fixtures/api/schemas/error_tracking/error_detailed.json
+++ b/spec/fixtures/api/schemas/error_tracking/error_detailed.json
@@ -56,7 +56,8 @@
"last_release_last_commit": { "type": ["string", "null"] },
"first_release_short_version": { "type": ["string", "null"] },
"last_release_short_version": { "type": ["string", "null"] },
- "gitlab_commit": { "type": ["string", "null"] }
+ "gitlab_commit": { "type": ["string", "null"] },
+ "gitlab_commit_path": { "type": ["string", "null"] }
},
"additionalProperties": false
}
diff --git a/spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb b/spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb
index 15d53644884..30cede6f4cf 100644
--- a/spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb
+++ b/spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb
@@ -31,6 +31,7 @@ describe GitlabSchema.types['SentryDetailedError'] do
firstReleaseShortVersion
lastReleaseShortVersion
gitlabCommit
+ gitlabCommitPath
]
is_expected.to have_graphql_fields(*expected_fields)
diff --git a/spec/models/error_tracking/project_error_tracking_setting_spec.rb b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
index 3dfdd9c1392..6babc39cdc3 100644
--- a/spec/models/error_tracking/project_error_tracking_setting_spec.rb
+++ b/spec/models/error_tracking/project_error_tracking_setting_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
describe ErrorTracking::ProjectErrorTrackingSetting do
include ReactiveCachingHelpers
+ include Gitlab::Routing
let_it_be(:project) { create(:project) }
@@ -213,7 +214,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
describe '#issue_details' do
let(:issue) { build(:detailed_error_tracking_error) }
let(:sentry_client) { double('sentry_client', issue_details: issue) }
- let(:commit_id) { '123456' }
+ let(:commit_id) { issue.first_release_version }
let(:result) do
subject.issue_details
@@ -230,6 +231,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
it { expect(result).to eq(issue: issue) }
it { expect(result[:issue].first_release_version).to eq(commit_id) }
it { expect(result[:issue].gitlab_commit).to eq(nil) }
+ it { expect(result[:issue].gitlab_commit_path).to eq(nil) }
context 'when release version is nil' do
before do
@@ -237,6 +239,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
end
it { expect(result[:issue].gitlab_commit).to eq(nil) }
+ it { expect(result[:issue].gitlab_commit_path).to eq(nil) }
end
context 'when repo commit matches first relase version' do
@@ -248,6 +251,7 @@ describe ErrorTracking::ProjectErrorTrackingSetting do
end
it { expect(result[:issue].gitlab_commit).to eq(commit_id) }
+ it { expect(result[:issue].gitlab_commit_path).to eq("/#{project.namespace.path}/#{project.path}/commit/#{commit_id}") }
end
end
diff --git a/spec/policies/user_policy_spec.rb b/spec/policies/user_policy_spec.rb
index 0af58e96c5e..9da9d2ce49b 100644
--- a/spec/policies/user_policy_spec.rb
+++ b/spec/policies/user_policy_spec.rb
@@ -48,36 +48,4 @@ describe UserPolicy do
describe "updating a user" do
it_behaves_like 'changing a user', :update_user
end
-
- describe "updating a user's name" do
- context 'when the ability to update their name is not disabled for users' do
- before do
- stub_application_setting(updating_name_disabled_for_users: false)
- end
-
- it_behaves_like 'changing a user', :update_name
- end
-
- context 'when the ability to update their name is disabled for users' do
- before do
- stub_application_setting(updating_name_disabled_for_users: true)
- end
-
- context 'for a regular user' do
- it { is_expected.not_to be_allowed(:update_name) }
- end
-
- context 'for a ghost user' do
- let(:current_user) { create(:user, :ghost) }
-
- it { is_expected.not_to be_allowed(:update_name) }
- end
-
- context 'for an admin user' do
- let(:current_user) { create(:admin) }
-
- it { is_expected.to be_allowed(:update_name) }
- end
- end
- end
end
diff --git a/spec/requests/api/settings_spec.rb b/spec/requests/api/settings_spec.rb
index ff443fdd27a..af86ba86303 100644
--- a/spec/requests/api/settings_spec.rb
+++ b/spec/requests/api/settings_spec.rb
@@ -136,14 +136,6 @@ describe API::Settings, 'Settings' do
expect(json_response['performance_bar_allowed_group_id']).to eq(group.id)
end
- it "supports updating_name_disabled_for_users" do
- put api("/application/settings", admin),
- params: { updating_name_disabled_for_users: true }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['updating_name_disabled_for_users']).to eq(true)
- end
-
it "supports legacy performance_bar_enabled" do
put api("/application/settings", admin),
params: {
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 8b9aab33d67..0a22a09b8a6 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -645,21 +645,6 @@ describe API::Users do
expect(response).to have_gitlab_http_status(200)
end
- context 'updating name' do
- context 'when the ability to update their name is disabled for users' do
- before do
- stub_application_setting(updating_name_disabled_for_users: true)
- end
-
- it 'updates the user with new name' do
- put api("/users/#{user.id}", admin), params: { name: 'New Name' }
-
- expect(response).to have_gitlab_http_status(200)
- expect(json_response['name']).to eq('New Name')
- end
- end
- end
-
it "updates user with new bio" do
put api("/users/#{user.id}", admin), params: { bio: 'new test bio' }
diff --git a/spec/services/users/update_service_spec.rb b/spec/services/users/update_service_spec.rb
index f3c15011213..50bbb16e368 100644
--- a/spec/services/users/update_service_spec.rb
+++ b/spec/services/users/update_service_spec.rb
@@ -6,46 +6,6 @@ describe Users::UpdateService do
let(:user) { create(:user) }
describe '#execute' do
- context 'updating name' do
- context 'when the ability to update their name is not disabled for users' do
- before do
- stub_application_setting(updating_name_disabled_for_users: false)
- end
-
- it 'updates the name' do
- result = update_user(user, name: 'New Name')
-
- expect(result).to eq(status: :success)
- expect(user.name).to eq('New Name')
- end
- end
-
- context 'when the ability to update their name is disabled for users' do
- before do
- stub_application_setting(updating_name_disabled_for_users: true)
- end
-
- context 'executing as a regular user' do
- it 'does not update the name' do
- result = update_user(user, name: 'New Name')
-
- expect(result).to eq(status: :success)
- expect(user.name).not_to eq('New Name')
- end
- end
-
- context 'executing as an admin user' do
- it 'updates the name' do
- admin = create(:admin)
- result = described_class.new(admin, { user: user, name: 'New Name' }).execute
-
- expect(result).to eq(status: :success)
- expect(user.name).to eq('New Name')
- end
- end
- end
- end
-
it 'updates time preferences' do
result = update_user(user, timezone: 'Europe/Warsaw', time_display_relative: true, time_format_in_24h: false)