diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-07 11:59:16 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-07 11:59:16 +0300 |
commit | 34fc5b050a4e70bf491be9a49cfa2dc0a7a9a9a2 (patch) | |
tree | 0947b9e2a71ba876a30a1d41d36cd50e15c24e6b | |
parent | ff02c63cd3cfbaebb16ed770e377ae318c6be054 (diff) | |
parent | 7e42c22991896e52a28537ff61a48334bf84f7c9 (diff) |
Merge branch 'dz-fix-group-label-404' into 'master'
Fix 404 error when visit group label edit page
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/25158
See merge request !7957
-rw-r--r-- | config/routes/group.rb | 22 | ||||
-rw-r--r-- | spec/features/groups/labels/edit_spec.rb | 21 |
2 files changed, 32 insertions, 11 deletions
diff --git a/config/routes/group.rb b/config/routes/group.rb index 9fe72990994..776c31c9dac 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -1,15 +1,5 @@ resources :groups, only: [:index, :new, :create] -scope(path: 'groups/*id', - controller: :groups, - constraints: { id: Gitlab::Regex.namespace_route_regex }) do - get :edit, as: :edit_group - get :issues, as: :issues_group - get :merge_requests, as: :merge_requests_group - get :projects, as: :projects_group - get :activity, as: :activity_group -end - scope(path: 'groups/*group_id', module: :groups, as: :group, @@ -22,10 +12,20 @@ scope(path: 'groups/*group_id', resource :avatar, only: [:destroy] resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :update, :new, :create] - resources :labels, except: [:show], constraints: { id: /\d+/ } do + resources :labels, except: [:show] do post :toggle_subscription, on: :member end end +scope(path: 'groups/*id', + controller: :groups, + constraints: { id: Gitlab::Regex.namespace_route_regex }) do + get :edit, as: :edit_group + get :issues, as: :issues_group + get :merge_requests, as: :merge_requests_group + get :projects, as: :projects_group + get :activity, as: :activity_group +end + # Must be last route in this file get 'groups/*id' => 'groups#show', as: :group_canonical, constraints: { id: Gitlab::Regex.namespace_route_regex } diff --git a/spec/features/groups/labels/edit_spec.rb b/spec/features/groups/labels/edit_spec.rb new file mode 100644 index 00000000000..69281cecb7b --- /dev/null +++ b/spec/features/groups/labels/edit_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +feature 'Edit group label', feature: true do + given(:user) { create(:user) } + given(:group) { create(:group) } + given(:label) { create(:group_label, group: group) } + + background do + group.add_owner(user) + login_as(user) + visit edit_group_label_path(group, label) + end + + scenario 'update label with new title' do + fill_in 'label_title', with: 'new label name' + click_button 'Save changes' + + expect(current_path).to eq(root_path) + expect(label.reload.title).to eq('new label name') + end +end |