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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-08-28 16:14:39 +0300
committerNick Thomas <nick@gitlab.com>2018-09-05 17:10:39 +0300
commit03c733849c1fad9885b0b947e60744633b7f5bd6 (patch)
tree013bd8a1a0470f053178e51f22f517907c58bb8b /spec
parentdb28db414c8ab3d253294e430cd99d14499fad2e (diff)
Convert global templates to vendored templates via a ::TemplateFinder
Diffstat (limited to 'spec')
-rw-r--r--spec/finders/template_finder_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/finders/template_finder_spec.rb b/spec/finders/template_finder_spec.rb
new file mode 100644
index 00000000000..59c5427ee50
--- /dev/null
+++ b/spec/finders/template_finder_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+describe TemplateFinder do
+ using RSpec::Parameterized::TableSyntax
+
+ describe '#execute' do
+ where(:type, :vendored_name) do
+ :dockerfiles | 'Binary'
+ :gitignores | 'Actionscript'
+ :gitlab_ci_ymls | 'Android'
+ end
+
+ with_them do
+ it 'returns all vendored templates when no name is specified' do
+ result = described_class.new(type).execute
+
+ expect(result).to include(have_attributes(name: vendored_name))
+ end
+
+ it 'returns only the specified vendored template when a name is specified' do
+ result = described_class.new(type, name: vendored_name).execute
+
+ expect(result).to have_attributes(name: vendored_name)
+ end
+
+ it 'returns nil when an unknown name is specified' do
+ result = described_class.new(type, name: 'unknown').execute
+
+ expect(result).to be_nil
+ end
+ end
+ end
+end