diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-06-24 16:43:46 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-08-16 15:50:17 -0300 |
commit | 28726729452ef64270534806e75a9595ea1a659d (patch) | |
tree | 7f9144f88c1fa9935f3d05d50ab9b1bcc4e7558d /spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb | |
parent | 7f853e2245eff92c037af5e007163d3e9631888d (diff) | |
download | gitlab-ce-28726729452ef64270534806e75a9595ea1a659d.tar.gz |
Load issues and merge requests templates from repository
Diffstat (limited to 'spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb')
-rw-r--r-- | spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb b/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb new file mode 100644 index 00000000000..e3b8321eda3 --- /dev/null +++ b/spec/lib/gitlab/template/gitlab_ci_yml_template_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +describe Gitlab::Template::GitlabCiYmlTemplate do + subject { described_class } + + describe '.all' do + it 'strips the gitlab-ci suffix' do + expect(subject.all.first.name).not_to end_with('.gitlab-ci.yml') + end + + it 'combines the globals and rest' do + all = subject.all.map(&:name) + + expect(all).to include('Elixir') + expect(all).to include('Docker') + 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 GitlabCiYml object of a valid file' do + ruby = subject.find('Ruby') + + expect(ruby).to be_a Gitlab::Template::GitlabCiYmlTemplate + expect(ruby.name).to eq('Ruby') + end + end + + describe '#content' do + it 'loads the full file' do + gitignore = subject.new(Rails.root.join('vendor/gitlab-ci-yml/Ruby.gitlab-ci.yml')) + + expect(gitignore.name).to eq 'Ruby' + expect(gitignore.content).to start_with('#') + end + end +end |