Commit 9650841a authored by James Lopez's avatar James Lopez

Merge branch 'fj-fix-snippet-update-error-message' into 'master'

Fix snippet update error message

See merge request gitlab-org/gitlab!27082
parents 76ed3182 62c8fa78
......@@ -30,9 +30,9 @@ module SnippetsActions
end
def check_repository_error
repository_error = snippet.errors.delete(:repository)
repository_errors = Array(snippet.errors.delete(:repository))
flash.now[:alert] = repository_error if repository_error
recaptcha_check_with_fallback(repository_error.nil?) { render :edit }
flash.now[:alert] = repository_errors.first if repository_errors.present?
recaptcha_check_with_fallback(repository_errors.empty?) { render :edit }
end
end
---
title: Fix bug displaying snippet update error
merge_request: 27082
author:
type: fixed
......@@ -38,7 +38,7 @@ describe 'Projects > Snippets > User updates a snippet' do
end
it 'renders edit page and displays the error' do
expect(page).to have_content('Error updating the snippet')
expect(page.find('.flash-container span').text).to eq('Error updating the snippet')
expect(page).to have_content('Edit Snippet')
end
end
......
......@@ -71,7 +71,7 @@ describe 'User edits snippet', :js do
end
it 'renders edit page and displays the error' do
expect(page).to have_content('Error updating the snippet')
expect(page.find('.flash-container span').text).to eq('Error updating the snippet')
expect(page).to have_content('Edit Snippet')
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment