diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-27 00:07:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-27 00:07:45 +0300 |
commit | ea335f33ff8c6870e641385a254c1f993bb04038 (patch) | |
tree | 2f2c7b69388e11c15864bbe5e9f052699c094319 /spec/features/snippets | |
parent | 6ee98e127334fd235f251c4a4a76a396f301ee77 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/snippets')
-rw-r--r-- | spec/features/snippets/user_creates_snippet_spec.rb | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index 62054c1f491..dffdbcd6940 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -7,7 +7,6 @@ shared_examples_for 'snippet editor' do stub_feature_flags(snippets_vue: false) stub_feature_flags(snippets_edit_vue: false) sign_in(user) - visit new_snippet_path end def description_field @@ -28,6 +27,8 @@ shared_examples_for 'snippet editor' do end it 'Authenticated user creates a snippet' do + visit new_snippet_path + fill_form click_button('Create snippet') @@ -42,6 +43,8 @@ shared_examples_for 'snippet editor' do end it 'previews a snippet with file' do + visit new_snippet_path + # Click placeholder first to expand full description field description_field.click fill_in 'personal_snippet_description', with: 'My Snippet' @@ -62,6 +65,8 @@ shared_examples_for 'snippet editor' do end it 'uploads a file when dragging into textarea' do + visit new_snippet_path + fill_form dropzone_file Rails.root.join('spec', 'fixtures', 'banana_sample.gif') @@ -86,6 +91,8 @@ shared_examples_for 'snippet editor' do allow(instance).to receive(:create_commit).and_raise(StandardError, error) end + visit new_snippet_path + fill_form click_button('Create snippet') @@ -107,6 +114,8 @@ shared_examples_for 'snippet editor' do end it 'validation fails for the first time' do + visit new_snippet_path + fill_in 'personal_snippet_title', with: 'My Snippet Title' click_button('Create snippet') @@ -132,6 +141,8 @@ shared_examples_for 'snippet editor' do end it 'Authenticated user creates a snippet with + in filename' do + visit new_snippet_path + fill_in 'personal_snippet_title', with: 'My Snippet Title' page.within('.file-editor') do find(:xpath, "//input[@id='personal_snippet_file_name']").set 'snippet+file+name' @@ -146,6 +157,27 @@ shared_examples_for 'snippet editor' do expect(page).to have_content('snippet+file+name') expect(page).to have_content('Hello World!') end + + context 'when snippets default visibility level is restricted' do + before do + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PRIVATE], + default_snippet_visibility: Gitlab::VisibilityLevel::PRIVATE) + end + + it 'creates a snippet using the lowest available visibility level as default' do + visit new_snippet_path + + fill_form + + click_button('Create snippet') + wait_for_requests + + visit snippets_path + click_link('Internal') + + expect(page).to have_content('My Snippet Title') + end + end end describe 'User creates snippet', :js do |