debian-mirror-gitlab/spec/lib/gitlab/template/gitignore_template_spec.rb

43 lines
1,016 B
Ruby
Raw Normal View History

2019-12-04 20:38:33 +05:30
# frozen_string_literal: true
2016-06-02 11:05:42 +05:30
require 'spec_helper'
2016-09-13 17:45:13 +05:30
describe Gitlab::Template::GitignoreTemplate do
2016-06-22 15:30:34 +05:30
subject { described_class }
2016-06-02 11:05:42 +05:30
describe '.all' do
it 'strips the gitignore suffix' do
expect(subject.all.first.name).not_to end_with('.gitignore')
end
it 'combines the globals and rest' do
all = subject.all.map(&:name)
expect(all).to include('Vim')
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
it 'returns the Gitignore object of a valid file' do
ruby = subject.find('Ruby')
2017-08-17 22:00:37 +05:30
expect(ruby).to be_a described_class
2016-06-02 11:05:42 +05:30
expect(ruby.name).to eq('Ruby')
end
end
describe '#content' do
it 'loads the full file' do
gitignore = subject.new(Rails.root.join('vendor/gitignore/Ruby.gitignore'))
expect(gitignore.name).to eq 'Ruby'
expect(gitignore.content).to start_with('*.gem')
end
end
end