GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

gitlab_ci_yml_template_spec.rb 1.01 KB
Newer Older
1 2
require 'spec_helper'

3
describe Gitlab::Template::GitlabCiYmlTemplate do
ZJ van de Weg's avatar
ZJ van de Weg committed
4
  subject { described_class }
5

6
  describe '.all' do
7 8
    it 'strips the gitlab-ci suffix' do
      expect(subject.all.first.name).not_to end_with('.gitlab-ci.yml')
9 10 11 12 13
    end

    it 'combines the globals and rest' do
      all = subject.all.map(&:name)

14 15
      expect(all).to include('Elixir')
      expect(all).to include('Docker')
16 17 18 19 20 21 22 23 24
      expect(all).to include('Ruby')
    end
  end

  describe '.find' do
    it 'returns nil if the file does not exist' do
      expect(subject.find('mepmep-yadida')).to be nil
    end

25
    it 'returns the GitlabCiYml object of a valid file' do
26 27
      ruby = subject.find('Ruby')

28
      expect(ruby).to be_a described_class
29
      expect(ruby.name).to eq('Ruby')
30 31 32 33 34
    end
  end

  describe '#content' do
    it 'loads the full file' do
35
      gitignore = subject.new(Rails.root.join('vendor/gitlab-ci-yml/Ruby.gitlab-ci.yml'))
36 37

      expect(gitignore.name).to eq 'Ruby'
38
      expect(gitignore.content).to start_with('#')
39 40 41
    end
  end
end