diff options
author | Nick Thomas <nick@gitlab.com> | 2018-10-03 00:00:38 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-10-05 11:34:43 +0100 |
commit | 25bd49e4f57fe15f9d61dc9376a5b7dc35b30f64 (patch) | |
tree | faef4e9d73e9845413462013c868eace19a11abf /spec/finders | |
parent | ae014e189773f7299c12c1050334b3e8fe7b15d8 (diff) | |
download | gitlab-ce-25bd49e4f57fe15f9d61dc9376a5b7dc35b30f64.tar.gz |
Backport project template API to CE
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/license_template_finder_spec.rb | 4 | ||||
-rw-r--r-- | spec/finders/template_finder_spec.rb | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/spec/finders/license_template_finder_spec.rb b/spec/finders/license_template_finder_spec.rb index a97903103c9..f6f40bf33cc 100644 --- a/spec/finders/license_template_finder_spec.rb +++ b/spec/finders/license_template_finder_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe LicenseTemplateFinder do describe '#execute' do - subject(:result) { described_class.new(params).execute } + subject(:result) { described_class.new(nil, params).execute } let(:categories) { categorised_licenses.keys } let(:categorised_licenses) { result.group_by(&:category) } @@ -31,7 +31,7 @@ describe LicenseTemplateFinder do it 'returns all licenses known by the Licensee gem' do from_licensee = Licensee::License.all.map { |l| l.key } - expect(result.map(&:id)).to match_array(from_licensee) + expect(result.map(&:key)).to match_array(from_licensee) end it 'correctly copies all attributes' do diff --git a/spec/finders/template_finder_spec.rb b/spec/finders/template_finder_spec.rb index 1d399e8194f..114af9461e0 100644 --- a/spec/finders/template_finder_spec.rb +++ b/spec/finders/template_finder_spec.rb @@ -4,6 +4,8 @@ describe TemplateFinder do using RSpec::Parameterized::TableSyntax describe '#build' do + let(:project) { build_stubbed(:project) } + where(:type, :expected_class) do :dockerfiles | described_class :gitignores | described_class @@ -12,9 +14,10 @@ describe TemplateFinder do end with_them do - subject { described_class.build(type) } + subject(:finder) { described_class.build(type, project) } it { is_expected.to be_a(expected_class) } + it { expect(finder.project).to eq(project) } end end @@ -27,19 +30,19 @@ describe TemplateFinder do with_them do it 'returns all vendored templates when no name is specified' do - result = described_class.new(type).execute + result = described_class.new(type, nil).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 + result = described_class.new(type, nil, 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 + result = described_class.new(type, nil, name: 'unknown').execute expect(result).to be_nil end |