BigW Consortium Gitlab

markup_helper_spec.rb 1.22 KB
Newer Older
1 2
require 'spec_helper'

Douwe Maan committed
3
describe Gitlab::MarkupHelper, lib: true do
4 5
  describe '#markup?' do
    %w(textile rdoc org creole wiki
6
       mediawiki rst adoc ad asciidoc mdown md markdown).each do |type|
7
      it "returns true for #{type} files" do
8
        expect(Gitlab::MarkupHelper.markup?("README.#{type}")).to be_truthy
9 10 11 12
      end
    end

    it 'returns false when given a non-markup filename' do
13
      expect(Gitlab::MarkupHelper.markup?('README.rb')).not_to be_truthy
14 15 16 17
    end
  end

  describe '#gitlab_markdown?' do
18
    %w(mdown mkd mkdn md markdown).each do |type|
19
      it "returns true for #{type} files" do
20
        expect(Gitlab::MarkupHelper.gitlab_markdown?("README.#{type}")).to be_truthy
21 22 23 24
      end
    end

    it 'returns false when given a non-markdown filename' do
25
      expect(Gitlab::MarkupHelper.gitlab_markdown?('README.rb')).not_to be_truthy
26 27
    end
  end
28 29 30 31

  describe '#asciidoc?' do
    %w(adoc ad asciidoc ADOC).each do |type|
      it "returns true for #{type} files" do
32
        expect(Gitlab::MarkupHelper.asciidoc?("README.#{type}")).to be_truthy
33 34 35 36
      end
    end

    it 'returns false when given a non-asciidoc filename' do
37
      expect(Gitlab::MarkupHelper.asciidoc?('README.rb')).not_to be_truthy
38 39
    end
  end
40
end