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
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Public Snippets', :js do
|
2020-01-01 13:55:28 +05:30
|
|
|
before do
|
|
|
|
stub_feature_flags(snippets_vue: false)
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'Unauthenticated user should see public snippets' do
|
2017-08-17 22:00:37 +05:30
|
|
|
public_snippet = create(:personal_snippet, :public)
|
|
|
|
|
|
|
|
visit snippet_path(public_snippet)
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expect(page).to have_content(public_snippet.content)
|
2019-12-21 20:55:43 +05:30
|
|
|
expect(page).to have_css('.js-embed-btn', visible: false)
|
|
|
|
expect(page).to have_css('.js-share-btn', visible: false)
|
2020-01-01 13:55:28 +05:30
|
|
|
expect(page.find('.js-snippet-url-area')).to be_readonly
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'Unauthenticated user should see raw public snippets' do
|
2017-08-17 22:00:37 +05:30
|
|
|
public_snippet = create(:personal_snippet, :public)
|
|
|
|
|
|
|
|
visit raw_snippet_path(public_snippet)
|
|
|
|
|
|
|
|
expect(page).to have_content(public_snippet.content)
|
|
|
|
end
|
|
|
|
end
|