poise 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.kitchen.travis.yml +9 -0
- data/.kitchen.yml +18 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +25 -0
- data/.yardopts +5 -0
- data/Berksfile +26 -0
- data/Berksfile.lock +10 -0
- data/CHANGELOG.md +58 -0
- data/Gemfile +32 -0
- data/LICENSE +202 -0
- data/README.md +198 -0
- data/Rakefile +17 -0
- data/lib/poise.rb +71 -0
- data/lib/poise/error.rb +24 -0
- data/lib/poise/helpers.rb +33 -0
- data/lib/poise/helpers/chefspec_matchers.rb +92 -0
- data/lib/poise/helpers/defined_in.rb +111 -0
- data/lib/poise/helpers/fused.rb +127 -0
- data/lib/poise/helpers/include_recipe.rb +62 -0
- data/lib/poise/helpers/inversion.rb +374 -0
- data/lib/poise/helpers/inversion/options_provider.rb +41 -0
- data/lib/poise/helpers/inversion/options_resource.rb +101 -0
- data/lib/poise/helpers/lazy_default.rb +62 -0
- data/lib/poise/helpers/lwrp_polyfill.rb +96 -0
- data/lib/poise/helpers/notifying_block.rb +78 -0
- data/lib/poise/helpers/option_collector.rb +117 -0
- data/lib/poise/helpers/resource_name.rb +99 -0
- data/lib/poise/helpers/subcontext_block.rb +58 -0
- data/lib/poise/helpers/subresources.rb +29 -0
- data/lib/poise/helpers/subresources/child.rb +217 -0
- data/lib/poise/helpers/subresources/container.rb +165 -0
- data/lib/poise/helpers/subresources/default_containers.rb +73 -0
- data/lib/poise/helpers/template_content.rb +165 -0
- data/lib/poise/provider.rb +55 -0
- data/lib/poise/resource.rb +75 -0
- data/lib/poise/subcontext.rb +27 -0
- data/lib/poise/subcontext/resource_collection.rb +56 -0
- data/lib/poise/subcontext/runner.rb +50 -0
- data/lib/poise/utils.rb +60 -0
- data/lib/poise/utils/resource_provider_mixin.rb +53 -0
- data/lib/poise/version.rb +20 -0
- data/poise.gemspec +38 -0
- data/test/cookbooks/poise_test/attributes/default.rb +17 -0
- data/test/cookbooks/poise_test/libraries/app.rb +43 -0
- data/test/cookbooks/poise_test/libraries/app_config.rb +46 -0
- data/test/cookbooks/poise_test/libraries/inversion.rb +67 -0
- data/test/cookbooks/poise_test/metadata.rb +18 -0
- data/test/cookbooks/poise_test/recipes/default.rb +25 -0
- data/test/cookbooks/poise_test/recipes/inversion.rb +42 -0
- data/test/gemfiles/chef-12.0.gemfile +18 -0
- data/test/gemfiles/chef-12.1.gemfile +18 -0
- data/test/gemfiles/chef-12.2.gemfile +18 -0
- data/test/gemfiles/chef-12.gemfile +18 -0
- data/test/gemfiles/master.gemfile +20 -0
- data/test/integration/default/serverspec/default_spec.rb +35 -0
- data/test/integration/default/serverspec/inversion_spec.rb +43 -0
- data/test/spec/helpers/chefspec_matchers_spec.rb +45 -0
- data/test/spec/helpers/defined_in_spec.rb +62 -0
- data/test/spec/helpers/fused_spec.rb +92 -0
- data/test/spec/helpers/include_recipe_spec.rb +34 -0
- data/test/spec/helpers/inversion/options_resource_spec.rb +212 -0
- data/test/spec/helpers/inversion_spec.rb +273 -0
- data/test/spec/helpers/lazy_default_spec.rb +74 -0
- data/test/spec/helpers/lwrp_polyfill_spec.rb +128 -0
- data/test/spec/helpers/notifying_block_spec.rb +87 -0
- data/test/spec/helpers/option_collector_spec.rb +82 -0
- data/test/spec/helpers/resource_name_spec.rb +39 -0
- data/test/spec/helpers/subcontext_block_spec.rb +94 -0
- data/test/spec/helpers/subresources/child_spec.rb +339 -0
- data/test/spec/helpers/subresources/container_spec.rb +175 -0
- data/test/spec/helpers/template_context_spec.rb +147 -0
- data/test/spec/poise_spec.rb +185 -0
- data/test/spec/provider_spec.rb +28 -0
- data/test/spec/resource_spec.rb +85 -0
- data/test/spec/spec_helper.rb +18 -0
- data/test/spec/utils/resource_provider_mixin_spec.rb +52 -0
- data/test/spec/utils_spec.rb +110 -0
- metadata +190 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
directory '/inversion'
|
18
|
+
|
19
|
+
poise_test_inversion '/inversion/a'
|
20
|
+
|
21
|
+
poise_test_inversion '/inversion/b' do
|
22
|
+
provider :one
|
23
|
+
end
|
24
|
+
|
25
|
+
poise_test_inversion 'c' do
|
26
|
+
path '/inversion/c'
|
27
|
+
end
|
28
|
+
|
29
|
+
poise_test_inversion 'd' do
|
30
|
+
path '/inversion/d'
|
31
|
+
provider :three
|
32
|
+
options :three, msg: 'd-three'
|
33
|
+
end
|
34
|
+
|
35
|
+
poise_test_inversion 'e' do
|
36
|
+
path '/inversion/e'
|
37
|
+
provider :three
|
38
|
+
end
|
39
|
+
|
40
|
+
poise_test_inversion_options 'e' do
|
41
|
+
msg 'e-three'
|
42
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
gem 'chef', '~> 12.0.0'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
gem 'chef', '~> 12.1.0'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
gem 'chef', '~> 12.2.0'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
gem 'chef', '~> 12.0'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
eval_gemfile File.expand_path('../../../Gemfile', __FILE__)
|
18
|
+
gem 'chef', github: 'chef/chef'
|
19
|
+
# gem 'halite', github: 'poise/halite'
|
20
|
+
# gem 'poise-boiler', github: 'poise/poise-boiler'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2013-2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'serverspec'
|
18
|
+
set :backend, :exec
|
19
|
+
|
20
|
+
describe file('/srv/app') do
|
21
|
+
it { is_expected.to be_a_directory }
|
22
|
+
it { is_expected.to be_owned_by 'root' }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe file('/srv/app/defaults.conf') do
|
26
|
+
it { is_expected.to be_a_file }
|
27
|
+
it { is_expected.to be_owned_by 'root' }
|
28
|
+
its(:content) { is_expected.to eq 'some defaults' }
|
29
|
+
end
|
30
|
+
|
31
|
+
describe file('/srv/app/user.conf') do
|
32
|
+
it { is_expected.to be_a_file }
|
33
|
+
it { is_expected.to be_owned_by 'root' }
|
34
|
+
its(:content) { is_expected.to eq 'user config' }
|
35
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'serverspec'
|
18
|
+
set :backend, :exec
|
19
|
+
|
20
|
+
describe file('/inversion/a') do
|
21
|
+
it { is_expected.to be_a_file }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe file('/inversion/b') do
|
25
|
+
it { is_expected.to be_a_file }
|
26
|
+
its(:content) { is_expected.to eq 'one' }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe file('/inversion/c') do
|
30
|
+
it { is_expected.to be_a_file }
|
31
|
+
its(:content) { is_expected.to eq 'two' }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe file('/inversion/d') do
|
35
|
+
it { is_expected.to be_a_file }
|
36
|
+
its(:content) { is_expected.to eq 'd-three' }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe file('/inversion/e') do
|
40
|
+
it { is_expected.to be_a_file }
|
41
|
+
its(:content) { is_expected.to eq 'e-three' }
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe Poise::Helpers::ChefspecMatchers do
|
20
|
+
context 'with an implicit name' do
|
21
|
+
resource(:poise_test, auto: false, step_into: false) do
|
22
|
+
include described_class
|
23
|
+
actions(:run)
|
24
|
+
end
|
25
|
+
recipe do
|
26
|
+
poise_test 'test'
|
27
|
+
end
|
28
|
+
|
29
|
+
it { is_expected.to run_poise_test('test') }
|
30
|
+
end # /context with an implicit name
|
31
|
+
|
32
|
+
context 'with an explicit name' do
|
33
|
+
resource(:poise_test, auto: false, step_into: false) do
|
34
|
+
include described_class
|
35
|
+
provides(:poise_other)
|
36
|
+
actions(:run)
|
37
|
+
end
|
38
|
+
recipe do
|
39
|
+
poise_other 'test'
|
40
|
+
end
|
41
|
+
|
42
|
+
it { is_expected.to run_poise_other('test') }
|
43
|
+
it { expect(chef_run.poise_other('test')).to be_a Chef::Resource }
|
44
|
+
end # /context with an explicit name
|
45
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe Poise::Helpers::DefinedIn do
|
20
|
+
let(:run_context) { double('run context') }
|
21
|
+
subject { resource(:poise_test) }
|
22
|
+
resource(:poise_test) do
|
23
|
+
include described_class
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '.included' do
|
27
|
+
its(:poise_defined_in) { is_expected.to eq __FILE__ }
|
28
|
+
end # /describe .included
|
29
|
+
|
30
|
+
describe '.inherited' do
|
31
|
+
subject { resource(:poise_test_inner) }
|
32
|
+
resource(:poise_test_inner, parent: :poise_test)
|
33
|
+
|
34
|
+
# The actual class creation happens up in the Halite spec helper.
|
35
|
+
its(:poise_defined_in) { is_expected.to end_with '/lib/halite/spec_helper.rb' }
|
36
|
+
end # /describe .inherited
|
37
|
+
|
38
|
+
describe '.poise_defined_in_cookbook' do
|
39
|
+
context 'with the default file' do
|
40
|
+
it do
|
41
|
+
expect(subject).to receive(:poise_defined_in).and_return('/src.rb')
|
42
|
+
expect(Poise::Utils).to receive(:find_cookbook_name).with(run_context, '/src.rb').and_return('cookbook')
|
43
|
+
expect(subject.poise_defined_in_cookbook(run_context)).to eq 'cookbook'
|
44
|
+
end
|
45
|
+
end # /context with the default file
|
46
|
+
|
47
|
+
context 'with a specific file' do
|
48
|
+
it do
|
49
|
+
expect(Poise::Utils).to receive(:find_cookbook_name).with(run_context, '/other.rb').and_return('cookbook')
|
50
|
+
expect(subject.poise_defined_in_cookbook(run_context, '/other.rb')).to eq 'cookbook'
|
51
|
+
end
|
52
|
+
end # /context with a specific file
|
53
|
+
end # /describe .poise_defined_in_cookbook
|
54
|
+
|
55
|
+
describe '#poise_defined_in_cookbook' do
|
56
|
+
subject { resource(:poise_test).new('test', run_context) }
|
57
|
+
it do
|
58
|
+
expect(subject.class).to receive(:poise_defined_in_cookbook).with(run_context, '/other.rb').and_return('cookbook')
|
59
|
+
expect(subject.poise_defined_in_cookbook('/other.rb')).to eq 'cookbook'
|
60
|
+
end
|
61
|
+
end # /describe #poise_defined_in_cookbook
|
62
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe Poise::Helpers::Fused do
|
20
|
+
resource(:poise_test) do
|
21
|
+
include described_class
|
22
|
+
|
23
|
+
action(:run) do
|
24
|
+
ruby_block 'inner'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
recipe do
|
28
|
+
poise_test 'test'
|
29
|
+
end
|
30
|
+
|
31
|
+
it { is_expected.to run_ruby_block('inner') }
|
32
|
+
|
33
|
+
context 'with a nested provider' do
|
34
|
+
resource(:poise_test) do
|
35
|
+
include described_class
|
36
|
+
|
37
|
+
action(:run) do
|
38
|
+
file 'inner' do
|
39
|
+
content new_resource.name
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it { is_expected.to create_file('inner').with(content: 'test') }
|
45
|
+
end # /context with a nested provider
|
46
|
+
|
47
|
+
context 'with a subclass' do
|
48
|
+
resource(:poise_test2, parent: :poise_test) do
|
49
|
+
action(:run) do
|
50
|
+
super()
|
51
|
+
ruby_block 'inner2'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
recipe do
|
55
|
+
poise_test2 'test'
|
56
|
+
end
|
57
|
+
|
58
|
+
it { is_expected.to run_ruby_block('inner') }
|
59
|
+
it { is_expected.to run_ruby_block('inner2') }
|
60
|
+
end # /context with a subclass
|
61
|
+
|
62
|
+
context 'with setting a default action' do
|
63
|
+
resource(:poise_test) do
|
64
|
+
include described_class
|
65
|
+
include Poise::Helpers::LWRPPolyfill
|
66
|
+
|
67
|
+
action(:install) do
|
68
|
+
ruby_block 'inner'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it { is_expected.to install_poise_test('test') }
|
73
|
+
it { is_expected.to run_ruby_block('inner') }
|
74
|
+
end # /context with setting a default action
|
75
|
+
|
76
|
+
context 'with an explicit provider' do
|
77
|
+
provider(:poise_test2) do
|
78
|
+
include Poise
|
79
|
+
def action_run
|
80
|
+
ruby_block 'explicit'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
recipe do
|
84
|
+
poise_test 'test' do
|
85
|
+
provider :poise_test2
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it { is_expected.to run_ruby_block('explicit') }
|
90
|
+
it { is_expected.to_not run_ruby_block('inner') }
|
91
|
+
end # /context with an explicit provider
|
92
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'spec_helper'
|
18
|
+
|
19
|
+
describe Poise::Helpers::IncludeRecipe do
|
20
|
+
resource(:poise_test)
|
21
|
+
provider(:poise_test) do
|
22
|
+
include described_class
|
23
|
+
|
24
|
+
def action_run
|
25
|
+
expect_any_instance_of(Chef::RunContext).to receive(:include_recipe).with('other').and_return(['other::default'])
|
26
|
+
include_recipe 'other'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
recipe do
|
30
|
+
poise_test 'test'
|
31
|
+
end
|
32
|
+
|
33
|
+
it { run_chef }
|
34
|
+
end
|