chef-gen-flavors 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ARUBA_STEPS.md +74 -0
- data/History.md +16 -0
- data/Manifest.txt +25 -30
- data/README.md +121 -16
- data/chef-gen-flavors.gemspec +8 -5
- data/lib/chef_gen/flavor_base.rb +42 -34
- data/lib/chef_gen/flavors.rb +36 -10
- data/lib/chef_gen/snippet/attributes.rb +13 -0
- data/lib/chef_gen/snippet/chef_spec.rb +84 -14
- data/lib/chef_gen/snippet/cookbook_base.rb +109 -23
- data/lib/chef_gen/snippet/example_file.rb +15 -0
- data/lib/chef_gen/snippet/example_template.rb +15 -0
- data/lib/chef_gen/snippet/git_init.rb +2 -0
- data/lib/chef_gen/snippet/recipes.rb +15 -0
- data/lib/chef_gen/snippet/resource_provider.rb +18 -0
- data/lib/chef_gen/snippet/standard_ignore.rb +56 -80
- data/lib/chef_gen/snippet/style_foodcritic.rb +51 -0
- data/lib/chef_gen/snippet/style_rubocop.rb +80 -0
- data/lib/chef_gen/snippet/style_tailor.rb +48 -0
- data/lib/chef_gen/snippet/test_kitchen.rb +70 -15
- data/lib/chef_gen/snippets.rb +2 -0
- data/shared/snippet/attributes/attributes_default_rb.erb +8 -0
- data/{.rspec → shared/snippet/chef_spec/_rspec.erb} +0 -0
- data/shared/snippet/chef_spec/spec_chef_runner_context_rb.erb +36 -0
- data/shared/snippet/chef_spec/spec_recipes_default_spec_rb.erb +7 -0
- data/shared/snippet/chef_spec/spec_spec_helper_rb.erb +95 -0
- data/shared/snippet/cookbookbase/Berksfile.erb +5 -0
- data/shared/snippet/cookbookbase/CHANGELOG_md.erb +5 -0
- data/shared/snippet/cookbookbase/Gemfile.erb +7 -0
- data/shared/snippet/cookbookbase/Guardfile.erb +10 -0
- data/shared/snippet/cookbookbase/README_md.erb +92 -0
- data/shared/snippet/cookbookbase/Rakefile.erb +20 -0
- data/shared/snippet/cookbookbase/metadata_rb.erb +10 -0
- data/shared/snippet/examplefile/files_default_example_conf +34 -0
- data/shared/snippet/exampletemplate/templates_default_example_conf_erb +22 -0
- data/shared/snippet/recipes/recipes_default_rb.erb +9 -0
- data/shared/snippet/resourceprovider/providers_default_rb.erb +20 -0
- data/shared/snippet/resourceprovider/resources_default_rb.erb +9 -0
- data/shared/snippet/stylerubocop/_rubocop_yml.erb +27 -0
- data/shared/snippet/testkitchen/_kitchen_yml.erb +30 -0
- data/shared/snippet/testkitchen/libraries_kitchen_helper_rb +13 -0
- data/shared/snippet/testkitchen/test_integration_default_serverspec_recipes_default_spec_rb.erb +16 -0
- data/shared/snippet/testkitchen/test_integration_default_serverspec_spec_helper_rb.erb +7 -0
- metadata +42 -32
- data/.rubocop.yml +0 -27
- data/.travis.yml +0 -6
- data/Gemfile +0 -3
- data/Guardfile +0 -15
- data/Rakefile +0 -98
- data/features/generate.feature +0 -17
- data/features/support/env.rb +0 -15
- data/spec/lib/chef_gen/flavor_base_spec.rb +0 -167
- data/spec/lib/chef_gen/flavors_spec.rb +0 -132
- data/spec/lib/chef_gen/snippet/attributes_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/chef_spec_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/cookbook_base_spec.rb +0 -32
- data/spec/lib/chef_gen/snippet/example_file_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/example_template_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/git_init_spec.rb +0 -30
- data/spec/lib/chef_gen/snippet/recipes_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/resource_provider_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/standard_ignore_spec.rb +0 -35
- data/spec/lib/chef_gen/snippet/style_rubocop_spec.rb +0 -31
- data/spec/lib/chef_gen/snippet/test_kitchen_spec.rb +0 -44
- data/spec/spec_helper.rb +0 -64
- data/spec/support/fixtures/code_generator/metadata.rb +0 -2
- data/spec/support/fixtures/code_generator/recipes/cookbook.rb +0 -1
- data/spec/support/fixtures/code_generator_2/metadata.rb +0 -2
- data/spec/support/fixtures/code_generator_2/recipes/cookbook.rb +0 -3
- data/spec/support/fixtures/code_generator_2/templates/default/README_md.erb +0 -1
- data/spec/support/fixtures/lib/chef_gen/flavor/bar.rb +0 -21
- data/spec/support/fixtures/lib/chef_gen/flavor/baz.rb +0 -6
- data/spec/support/fixtures/lib/chef_gen/flavor/foo.rb +0 -9
@@ -1,132 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavors'
|
2
|
-
|
3
|
-
# sample plugins
|
4
|
-
require 'support/fixtures/lib/chef_gen/flavor/foo'
|
5
|
-
require 'support/fixtures/lib/chef_gen/flavor/bar'
|
6
|
-
require 'support/fixtures/lib/chef_gen/flavor/baz'
|
7
|
-
|
8
|
-
RSpec.describe ChefGen::Flavors do
|
9
|
-
include ChefDKGeneratorContext
|
10
|
-
|
11
|
-
before do
|
12
|
-
ChefGen::Flavors.clear_plugins
|
13
|
-
ENV.delete('CHEFGEN_FLAVOR')
|
14
|
-
ENV.delete('CHEFDK_FLAVOR')
|
15
|
-
@orig_stdout = $stdout
|
16
|
-
$stdout = File.open(File::NULL, 'w')
|
17
|
-
end
|
18
|
-
|
19
|
-
after do
|
20
|
-
$stdout = @orig_stdout
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'should be able to load plugins' do
|
24
|
-
expect(ChefGen::Flavors.plugins).to be_a(Hash)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'should load the expected plugins' do
|
28
|
-
ChefGen::Flavors.disregard_plugin :amazing, :awesome
|
29
|
-
expect(ChefGen::Flavors.plugins.keys).to(
|
30
|
-
contain_exactly(:foo, :bar, :baz)
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'allows for the plugin list to be make explicit' do
|
35
|
-
ChefGen::Flavors.plugin :foo
|
36
|
-
expect(ChefGen::Flavors.plugins).to include(:foo)
|
37
|
-
expect(ChefGen::Flavors.plugins).not_to include(:bar)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'allows for plugins to be blacklisted' do
|
41
|
-
ChefGen::Flavors.disregard_plugin :foo, :baz
|
42
|
-
expect(ChefGen::Flavors.plugins).not_to include(:foo)
|
43
|
-
expect(ChefGen::Flavors.plugins).to include(:bar)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'should not prompt for a plugin if only one is available' do
|
47
|
-
ChefGen::Flavors.plugin :foo
|
48
|
-
expect(ChefGen::Flavors).not_to receive(:prompt_for_plugin)
|
49
|
-
ChefGen::Flavors.path
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should not prompt for a plugin if the env var matches one' do
|
53
|
-
ChefGen::Flavors.disregard_plugin :baz
|
54
|
-
ENV['CHEFGEN_FLAVOR'] = 'Foo'
|
55
|
-
expect(ChefGen::Flavors).not_to receive(:prompt_for_plugin)
|
56
|
-
ChefGen::Flavors.path
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should be case insensitive when selecting the plugin via env var' do
|
60
|
-
ChefGen::Flavors.disregard_plugin :baz
|
61
|
-
ENV['CHEFGEN_FLAVOR'] = 'foo'
|
62
|
-
expect(ChefGen::Flavors).not_to receive(:prompt_for_plugin)
|
63
|
-
ChefGen::Flavors.path
|
64
|
-
ENV.delete('CHEFGEN_FLAVOR')
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'should prompt for a plugin if the env var does not match' do
|
68
|
-
ChefGen::Flavors.disregard_plugin :baz
|
69
|
-
ENV['CHEFGEN_FLAVOR'] = 'Gzonk'
|
70
|
-
expect(ChefGen::Flavors)
|
71
|
-
.to receive(:prompt_for_plugin)
|
72
|
-
.and_return(:foo)
|
73
|
-
ChefGen::Flavors.path
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'should prompt for a plugin if the env var is not set' do
|
77
|
-
ChefGen::Flavors.disregard_plugin :baz
|
78
|
-
expect(ChefGen::Flavors)
|
79
|
-
.to receive(:prompt_for_plugin)
|
80
|
-
.and_return(:bar)
|
81
|
-
ChefGen::Flavors.path
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'should raise an error if there are no plugins available' do
|
85
|
-
ChefGen::Flavors.disregard_plugin :foo, :bar, :baz,
|
86
|
-
:amazing, :awesome
|
87
|
-
expect { ChefGen::Flavors.path }.to raise_error
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'should offer the builtin flavors as an option with the env var set' do
|
91
|
-
ENV['CHEFDK_FLAVOR'] = 'true'
|
92
|
-
ChefGen::Flavors.disregard_plugin :foo, :bar, :baz,
|
93
|
-
:amazing, :awesome
|
94
|
-
expect(ChefGen::Flavors).not_to receive(:prompt_for_plugin)
|
95
|
-
ChefGen::Flavors.path
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'should raise an error if the plugin has no description' do
|
99
|
-
ENV['CHEFGEN_FLAVOR'] = 'Baz'
|
100
|
-
expect { ChefGen::Flavors.path }.to raise_error
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'should default the code_generator path' do
|
104
|
-
ChefGen::Flavors.disregard_plugin :baz
|
105
|
-
ENV['CHEFGEN_FLAVOR'] = 'Foo'
|
106
|
-
expect(FileUtils).to receive(:cp_r).with(
|
107
|
-
%r{spec/support/fixtures/code_generator$}, String
|
108
|
-
)
|
109
|
-
ChefGen::Flavors.path
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'should respect an overridden code_generator path' do
|
113
|
-
ChefGen::Flavors.disregard_plugin :baz
|
114
|
-
ENV['CHEFGEN_FLAVOR'] = 'Bar'
|
115
|
-
expect(FileUtils).to receive(:cp_r).with(
|
116
|
-
%r{spec/support/fixtures/code_generator_2$}, String
|
117
|
-
)
|
118
|
-
ChefGen::Flavors.path
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'should copy the code_generator to a temp directory' do
|
122
|
-
ChefGen::Flavors.disregard_plugin :baz
|
123
|
-
ENV['CHEFGEN_FLAVOR'] = 'Foo'
|
124
|
-
tmpdir = Dir.tmpdir
|
125
|
-
expect(FileUtils).to receive(:cp_r).with(
|
126
|
-
%r{spec/support/fixtures/code_generator$},
|
127
|
-
%r{#{tmpdir}/chefgen_flavor\..+$}
|
128
|
-
)
|
129
|
-
expect(ChefGen::Flavors.path)
|
130
|
-
.to match(%r{#{tmpdir}/chefgen_flavor\..+$})
|
131
|
-
end
|
132
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::Attributes
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# rubocop:disable Style/RegexpLiteral
|
21
|
-
RSpec.describe ChefGen::Snippet::Attributes do
|
22
|
-
include ChefDKGeneratorContext
|
23
|
-
include DummyRecipe
|
24
|
-
|
25
|
-
%w(attributes).each do |dname|
|
26
|
-
it "should create the directory #{dname}" do
|
27
|
-
expect(@recipe).to receive(:directory).with(%r{#{dname}$})
|
28
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
29
|
-
template.generate
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
%w(attributes/default.rb).each do |fname|
|
34
|
-
it "should add a template for #{fname}" do
|
35
|
-
expect(@recipe).to receive(:template).with(%r{#{fname}$})
|
36
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
37
|
-
template.generate
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::ChefSpec
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# rubocop:disable Style/RegexpLiteral
|
21
|
-
RSpec.describe ChefGen::Snippet::ChefSpec do
|
22
|
-
include ChefDKGeneratorContext
|
23
|
-
include DummyRecipe
|
24
|
-
|
25
|
-
%w(spec spec/recipes).each do |dname|
|
26
|
-
it "should create the directory #{dname}" do
|
27
|
-
expect(@recipe).to receive(:directory).with(%r{#{dname}$})
|
28
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
29
|
-
template.generate
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
%w(.rspec spec/spec_helper.rb spec/recipes/default_spec.rb).each do |fname|
|
34
|
-
it "should add a template for #{fname}" do
|
35
|
-
expect(@recipe).to receive(:template).with(%r{#{fname}$})
|
36
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
37
|
-
template.generate
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::CookbookBase
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
RSpec.describe ChefGen::Snippet::CookbookBase do
|
21
|
-
include ChefDKGeneratorContext
|
22
|
-
include DummyRecipe
|
23
|
-
|
24
|
-
%w(Gemfile Rakefile Berksfile Guardfile README.md
|
25
|
-
CHANGELOG.md metadata.rb).each do |fname|
|
26
|
-
it "should add a template for #{fname}" do
|
27
|
-
expect(@recipe).to receive(:template).with(/#{fname}$/)
|
28
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
29
|
-
template.generate
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::ExampleFile
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# rubocop:disable Style/RegexpLiteral
|
21
|
-
RSpec.describe ChefGen::Snippet::ExampleFile do
|
22
|
-
include ChefDKGeneratorContext
|
23
|
-
include DummyRecipe
|
24
|
-
|
25
|
-
%w(files files/default).each do |dname|
|
26
|
-
it "should create the directory #{dname}" do
|
27
|
-
expect(@recipe).to receive(:directory).with(%r{#{dname}$})
|
28
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
29
|
-
template.generate
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
%w(files/default/example.conf).each do |fname|
|
34
|
-
it "should add a template for #{fname}" do
|
35
|
-
expect(@recipe).to receive(:cookbook_file).with(%r{#{fname}$})
|
36
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
37
|
-
template.generate
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::ExampleTemplate
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# rubocop:disable Style/RegexpLiteral
|
21
|
-
RSpec.describe ChefGen::Snippet::ExampleTemplate do
|
22
|
-
include ChefDKGeneratorContext
|
23
|
-
include DummyRecipe
|
24
|
-
|
25
|
-
%w(templates templates/default).each do |dname|
|
26
|
-
it "should create the directory #{dname}" do
|
27
|
-
expect(@recipe).to receive(:directory).with(%r{#{dname}$})
|
28
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
29
|
-
template.generate
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
%w(templates/default/example.conf.erb).each do |fname|
|
34
|
-
it "should add a template for #{fname}" do
|
35
|
-
expect(@recipe).to receive(:cookbook_file).with(%r{#{fname}$})
|
36
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
37
|
-
template.generate
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::GitInit
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# rubocop:disable Style/RegexpLiteral
|
21
|
-
RSpec.describe ChefGen::Snippet::GitInit do
|
22
|
-
include ChefDKGeneratorContext
|
23
|
-
include DummyRecipe
|
24
|
-
|
25
|
-
it 'should execute git init' do
|
26
|
-
expect(@recipe).to receive(:execute).with('initialize git repo')
|
27
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
28
|
-
template.generate
|
29
|
-
end
|
30
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::Recipes
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# rubocop:disable Style/RegexpLiteral
|
21
|
-
RSpec.describe ChefGen::Snippet::Recipes do
|
22
|
-
include ChefDKGeneratorContext
|
23
|
-
include DummyRecipe
|
24
|
-
|
25
|
-
%w(recipes).each do |dname|
|
26
|
-
it "should create the directory #{dname}" do
|
27
|
-
expect(@recipe).to receive(:directory).with(%r{#{dname}$})
|
28
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
29
|
-
template.generate
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
%w(recipes/default.rb).each do |fname|
|
34
|
-
it "should add a template for #{fname}" do
|
35
|
-
expect(@recipe).to receive(:template).with(%r{#{fname}$})
|
36
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
37
|
-
template.generate
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::ResourceProvider
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# rubocop:disable Style/RegexpLiteral
|
21
|
-
RSpec.describe ChefGen::Snippet::ResourceProvider do
|
22
|
-
include ChefDKGeneratorContext
|
23
|
-
include DummyRecipe
|
24
|
-
|
25
|
-
%w(resources providers).each do |dname|
|
26
|
-
it "should create the directory #{dname}" do
|
27
|
-
expect(@recipe).to receive(:directory).with(%r{#{dname}$})
|
28
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
29
|
-
template.generate
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
%w(resources/default.rb providers/default.rb).each do |fname|
|
34
|
-
it "should add a template for #{fname}" do
|
35
|
-
expect(@recipe).to receive(:template).with(%r{#{fname}$})
|
36
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
37
|
-
template.generate
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|