2019-08-22 06:57:44 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-08-11 02:50:56 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 14:09:03 -04:00
|
|
|
RSpec.describe Gitlab::MarkupHelper do
|
2014-08-11 02:50:56 -04:00
|
|
|
describe '#markup?' do
|
|
|
|
%w(textile rdoc org creole wiki
|
2015-05-12 19:54:13 -04:00
|
|
|
mediawiki rst adoc ad asciidoc mdown md markdown).each do |type|
|
2014-08-11 02:50:56 -04:00
|
|
|
it "returns true for #{type} files" do
|
2017-07-25 13:09:00 -04:00
|
|
|
expect(described_class.markup?("README.#{type}")).to be_truthy
|
2014-08-11 02:50:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false when given a non-markup filename' do
|
2017-07-25 13:09:00 -04:00
|
|
|
expect(described_class.markup?('README.rb')).not_to be_truthy
|
2014-08-11 02:50:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#gitlab_markdown?' do
|
2015-08-12 15:29:00 -04:00
|
|
|
%w(mdown mkd mkdn md markdown).each do |type|
|
2014-08-11 02:50:56 -04:00
|
|
|
it "returns true for #{type} files" do
|
2017-07-25 13:09:00 -04:00
|
|
|
expect(described_class.gitlab_markdown?("README.#{type}")).to be_truthy
|
2014-08-11 02:50:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false when given a non-markdown filename' do
|
2017-07-25 13:09:00 -04:00
|
|
|
expect(described_class.gitlab_markdown?('README.rb')).not_to be_truthy
|
2014-08-11 02:50:56 -04:00
|
|
|
end
|
|
|
|
end
|
2015-05-12 19:07:48 -04:00
|
|
|
|
|
|
|
describe '#asciidoc?' do
|
|
|
|
%w(adoc ad asciidoc ADOC).each do |type|
|
|
|
|
it "returns true for #{type} files" do
|
2017-07-25 13:09:00 -04:00
|
|
|
expect(described_class.asciidoc?("README.#{type}")).to be_truthy
|
2015-05-12 19:07:48 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false when given a non-asciidoc filename' do
|
2017-07-25 13:09:00 -04:00
|
|
|
expect(described_class.asciidoc?('README.rb')).not_to be_truthy
|
2015-05-12 19:07:48 -04:00
|
|
|
end
|
|
|
|
end
|
2014-08-11 02:50:56 -04:00
|
|
|
end
|