gitlab-org--gitlab-foss/spec/lib/gitlab/gitignore_spec.rb

39 lines
938 B
Ruby
Raw Normal View History

2016-04-29 10:25:03 -04:00
require 'spec_helper'
describe Gitlab::Gitignore do
subject { Gitlab::Gitignore }
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')
expect(ruby).to be_a Gitlab::Gitignore
end
end
describe '#content' do
it 'loads the full file' do
gitignore = subject.new('Ruby', File.expand_path('vendor/gitignore', Rails.root))
expect(gitignore.name).to eq 'Ruby'
expect(gitignore.content).to start_with('*.gem')
end
end
end