BigW Consortium Gitlab

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

3
describe Gitlab::MarkupHelper 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(described_class.markup?("README.#{type}")).to be_truthy
9 10 11 12
      end
    end

    it 'returns false when given a non-markup filename' do
13
      expect(described_class.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(described_class.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(described_class.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(described_class.asciidoc?("README.#{type}")).to be_truthy
33 34 35 36
      end
    end

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