summaryrefslogtreecommitdiff
path: root/spec/features/snippets
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 12:08:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-10 12:08:16 +0000
commit1fa79760ad2d4bd67f5c5a27f372a7533b9b7c69 (patch)
treeffdfbd9113743831ff4f1290959a62cf6567fde5 /spec/features/snippets
parent82fa8a3d1e8466ef36b58604d20fcc145ea12118 (diff)
downloadgitlab-ce-1fa79760ad2d4bd67f5c5a27f372a7533b9b7c69.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/snippets')
-rw-r--r--spec/features/snippets/user_creates_snippet_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb
index 88f7896bfa6..f200355c6d2 100644
--- a/spec/features/snippets/user_creates_snippet_spec.rb
+++ b/spec/features/snippets/user_creates_snippet_spec.rb
@@ -78,6 +78,29 @@ shared_examples_for 'snippet editor' do
expect(reqs.first.status_code).to eq(200)
end
+ context 'when the git operation fails' do
+ let(:error) { 'This is a git error' }
+
+ before do
+ allow_next_instance_of(Snippets::CreateService) do |instance|
+ allow(instance).to receive(:create_commit).and_raise(StandardError, error)
+ end
+
+ fill_form
+
+ click_button('Create snippet')
+ wait_for_requests
+ end
+
+ it 'displays the error' do
+ expect(page).to have_content(error)
+ end
+
+ it 'renders new page' do
+ expect(page).to have_content('New Snippet')
+ end
+ end
+
it 'validation fails for the first time' do
fill_in 'personal_snippet_title', with: 'My Snippet Title'
click_button('Create snippet')