debian-mirror-gitlab/spec/features/snippets/public_snippets_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
803 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2017-08-17 22:00:37 +05:30
2020-06-23 00:09:42 +05:30
RSpec.describe 'Public Snippets', :js do
2021-01-03 14:25:43 +05:30
let(:public_snippet) { create(:personal_snippet, :public, :repository) }
let(:content) { public_snippet.blobs.first.data.strip! }
2020-01-01 13:55:28 +05:30
2021-02-22 17:27:13 +05:30
it 'unauthenticated user should see public snippets' do
2021-01-03 14:25:43 +05:30
url = Gitlab::UrlBuilder.build(public_snippet)
2017-08-17 22:00:37 +05:30
visit snippet_path(public_snippet)
2017-09-10 17:25:29 +05:30
wait_for_requests
2017-08-17 22:00:37 +05:30
2021-01-03 14:25:43 +05:30
expect(page).to have_content(content)
click_button('Embed')
expect(page).to have_field('Embed', readonly: true, with: "<script src=\"#{url}.js\"></script>")
expect(page).to have_field('Share', readonly: true, with: url)
2017-08-17 22:00:37 +05:30
end
2021-02-22 17:27:13 +05:30
it 'unauthenticated user should see raw public snippets' do
2017-08-17 22:00:37 +05:30
visit raw_snippet_path(public_snippet)
2021-01-03 14:25:43 +05:30
expect(page).to have_content(content)
2017-08-17 22:00:37 +05:30
end
end