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