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

27 lines
803 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Public Snippets', :js do
let(:public_snippet) { create(:personal_snippet, :public, :repository) }
let(:content) { public_snippet.blobs.first.data.strip! }
2018-07-05 02:32:05 -04:00
it 'Unauthenticated user should see public snippets' do
url = Gitlab::UrlBuilder.build(public_snippet)
visit snippet_path(public_snippet)
wait_for_requests
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)
end
2018-07-05 02:32:05 -04:00
it 'Unauthenticated user should see raw public snippets' do
visit raw_snippet_path(public_snippet)
expect(page).to have_content(content)
end
end