gitlab-org--gitlab-foss/spec/features/snippets/create_snippet_spec.rb

37 lines
1 KiB
Ruby
Raw Normal View History

require 'rails_helper'
2017-04-13 12:47:28 -04:00
feature 'Create Snippet', :js, feature: true do
before do
login_as :user
visit new_snippet_path
end
scenario 'Authenticated user creates a snippet' do
fill_in 'personal_snippet_title', with: 'My Snippet Title'
page.within('.file-editor') do
2017-04-13 12:47:28 -04:00
find('.ace_editor').native.send_keys 'Hello World!'
end
click_button 'Create snippet'
2017-04-13 12:47:28 -04:00
wait_for_ajax
expect(page).to have_content('My Snippet Title')
expect(page).to have_content('Hello World!')
end
2017-01-15 03:48:35 -05:00
scenario 'Authenticated user creates a snippet with + in filename' do
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'
2017-04-13 12:47:28 -04:00
find('.ace_editor').native.send_keys 'Hello World!'
2017-01-15 03:48:35 -05:00
end
click_button 'Create snippet'
2017-04-13 12:47:28 -04:00
wait_for_ajax
2017-01-15 03:48:35 -05:00
expect(page).to have_content('My Snippet Title')
expect(page).to have_content('snippet+file+name')
expect(page).to have_content('Hello World!')
end
end