2019-12-04 20:38:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'fast_spec_helper'
|
2015-09-11 14:41:01 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::MarkupHelper do
|
2015-09-11 14:41:01 +05:30
|
|
|
describe '#markup?' do
|
|
|
|
%w(textile rdoc org creole wiki
|
|
|
|
mediawiki rst adoc ad asciidoc mdown md markdown).each do |type|
|
|
|
|
it "returns true for #{type} files" do
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(described_class.markup?("README.#{type}")).to be_truthy
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false when given a non-markup filename' do
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(described_class.markup?('README.rb')).not_to be_truthy
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#gitlab_markdown?' do
|
|
|
|
%w(mdown mkd mkdn md markdown).each do |type|
|
|
|
|
it "returns true for #{type} files" do
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(described_class.gitlab_markdown?("README.#{type}")).to be_truthy
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false when given a non-markdown filename' do
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(described_class.gitlab_markdown?('README.rb')).not_to be_truthy
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#asciidoc?' do
|
|
|
|
%w(adoc ad asciidoc ADOC).each do |type|
|
|
|
|
it "returns true for #{type} files" do
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(described_class.asciidoc?("README.#{type}")).to be_truthy
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false when given a non-asciidoc filename' do
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(described_class.asciidoc?('README.rb')).not_to be_truthy
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|