Welcome to mirror list, hosted at ThFree Co, Russian Federation.

markup_helper_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6af6d50439c1e28e54f1aba670c517c33e4d73cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'spec_helper'

describe Gitlab::MarkupHelper, lib: true do
  describe '#markup?' do
    %w[textile rdoc org creole wiki
       mediawiki rst adoc ad asciidoc mdown md markdown].each do |type|
      it "returns true for #{type} files" do
        expect(Gitlab::MarkupHelper.markup?("README.#{type}")).to be_truthy
      end
    end

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

  describe '#gitlab_markdown?' do
    %w[mdown mkd mkdn md markdown].each do |type|
      it "returns true for #{type} files" do
        expect(Gitlab::MarkupHelper.gitlab_markdown?("README.#{type}")).to be_truthy
      end
    end

    it 'returns false when given a non-markdown filename' do
      expect(Gitlab::MarkupHelper.gitlab_markdown?('README.rb')).not_to be_truthy
    end
  end

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

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