2014-08-11 02:50:56 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-09 05:55:36 -05:00
|
|
|
describe Gitlab::MarkupHelper, lib: true 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
|
2015-05-12 19:40:11 -04:00
|
|
|
expect(Gitlab::MarkupHelper.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
|
2015-05-12 19:40:11 -04:00
|
|
|
expect(Gitlab::MarkupHelper.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
|
2015-05-12 19:40:11 -04:00
|
|
|
expect(Gitlab::MarkupHelper.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
|
2015-05-12 19:40:11 -04:00
|
|
|
expect(Gitlab::MarkupHelper.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
|
2015-05-12 19:40:11 -04:00
|
|
|
expect(Gitlab::MarkupHelper.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
|
2015-05-12 19:40:11 -04:00
|
|
|
expect(Gitlab::MarkupHelper.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
|