diff options
Diffstat (limited to 'spec/features/snippets/show_spec.rb')
-rw-r--r-- | spec/features/snippets/show_spec.rb | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/spec/features/snippets/show_spec.rb b/spec/features/snippets/show_spec.rb index 3fe0b60b18f..367a479f62a 100644 --- a/spec/features/snippets/show_spec.rb +++ b/spec/features/snippets/show_spec.rb @@ -68,23 +68,45 @@ describe 'Snippet', :js do end end - context 'with cached Redcarpet html' do - let(:snippet) { create(:personal_snippet, :public, file_name: file_name, content: content, cached_markdown_version: CacheMarkdownField::CACHE_REDCARPET_VERSION) } + context 'Markdown rendering' do + let(:snippet) { create(:personal_snippet, :public, file_name: file_name, content: content) } let(:file_name) { 'test.md' } let(:content) { "1. one\n - sublist\n" } - it 'renders correctly' do - expect(page).to have_xpath("//ol//li//ul") + context 'when rendering default markdown' do + it 'renders using CommonMark' do + expect(page).to have_content("sublist") + expect(page).not_to have_xpath("//ol//li//ul") + end end - end - context 'with cached CommonMark html' do - let(:snippet) { create(:personal_snippet, :public, file_name: file_name, content: content, cached_markdown_version: CacheMarkdownField::CACHE_COMMONMARK_VERSION) } - let(:file_name) { 'test.md' } - let(:content) { "1. one\n - sublist\n" } + context 'when rendering legacy markdown' do + before do + visit snippet_path(snippet, legacy_render: 1) - it 'renders correctly' do - expect(page).not_to have_xpath("//ol//li//ul") + wait_for_requests + end + + it 'renders using RedCarpet' do + expect(page).to have_content("sublist") + expect(page).to have_xpath("//ol//li//ul") + end + end + + context 'with cached CommonMark html' do + let(:snippet) { create(:personal_snippet, :public, file_name: file_name, content: content, cached_markdown_version: CacheMarkdownField::CACHE_COMMONMARK_VERSION) } + + it 'renders correctly' do + expect(page).not_to have_xpath("//ol//li//ul") + end + end + + context 'with cached Redcarpet html' do + let(:snippet) { create(:personal_snippet, :public, file_name: file_name, content: content, cached_markdown_version: CacheMarkdownField::CACHE_REDCARPET_VERSION) } + + it 'renders correctly' do + expect(page).to have_xpath("//ol//li//ul") + end end end |