r10k 3.14.1 → 5.0.1
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 +4 -4
- data/.github/dependabot.yml +17 -0
- data/.github/workflows/docker.yml +9 -4
- data/.github/workflows/release.yml +3 -2
- data/.github/workflows/rspec_tests.yml +8 -10
- data/CHANGELOG.mkd +100 -0
- data/CODEOWNERS +1 -2
- data/Gemfile +2 -2
- data/README.mkd +18 -19
- data/doc/common-patterns.mkd +1 -2
- data/doc/dynamic-environments/configuration.mkd +91 -12
- data/doc/dynamic-environments/usage.mkd +4 -0
- data/doc/dynamic-environments/workflow-guide.mkd +3 -3
- data/doc/faq.mkd +1 -1
- data/doc/puppetfile.mkd +9 -3
- data/integration/Gemfile +3 -4
- data/integration/Rakefile +58 -23
- data/integration/files/pre-suite/git_config.pp.erb +1 -1
- data/integration/pre-suite/00_pe_install.rb +3 -0
- data/integration/pre-suite/10_git_config.rb +1 -3
- data/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb +5 -4
- data/integration/tests/basic_functionality/negative/negative_bad_proxy.rb +1 -1
- data/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +2 -2
- data/integration/tests/basic_functionality/proxy_with_puppetfile.rb +2 -2
- data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +3 -3
- data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +3 -3
- data/integration/tests/command_line/deploy_env_without_mod_update.rb +0 -3
- data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +0 -3
- data/integration/tests/git_source/HTTP_proxy_and_git_source.rb +5 -10
- data/integration/tests/git_source/git_source_git.rb +1 -4
- data/integration/tests/git_source/git_source_repeated_remote.rb +2 -5
- data/integration/tests/git_source/git_source_submodule.rb +1 -1
- data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +1 -1
- data/integration/tests/purging/content_not_purged_at_root.rb +2 -5
- data/integration/tests/purging/default_purging.rb +0 -3
- data/integration/tests/purging/{does_not_purge_files_on_white_list.rb → does_not_purge_files_on_allowlist.rb} +2 -5
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +1 -4
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +1 -4
- data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +1 -4
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +3 -2
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +1 -5
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +1 -4
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +1 -4
- data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +0 -3
- data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +0 -3
- data/lib/r10k/action/deploy/environment.rb +2 -19
- data/lib/r10k/action/deploy/module.rb +1 -0
- data/lib/r10k/action/puppetfile/check.rb +7 -0
- data/lib/r10k/action/puppetfile/install.rb +3 -1
- data/lib/r10k/cli/deploy.rb +15 -1
- data/lib/r10k/cli/puppetfile.rb +1 -0
- data/lib/r10k/content_synchronizer.rb +7 -2
- data/lib/r10k/environment/with_modules.rb +24 -1
- data/lib/r10k/environment.rb +0 -1
- data/lib/r10k/git/rugged/bare_repository.rb +5 -4
- data/lib/r10k/git/rugged/thin_repository.rb +7 -0
- data/lib/r10k/git/rugged/working_repository.rb +13 -7
- data/lib/r10k/git/shellgit/thin_repository.rb +5 -1
- data/lib/r10k/git/shellgit/working_repository.rb +5 -4
- data/lib/r10k/git/stateful_repository.rb +4 -4
- data/lib/r10k/module/base.rb +3 -3
- data/lib/r10k/module/git.rb +19 -5
- data/lib/r10k/module_loader/puppetfile/dsl.rb +4 -0
- data/lib/r10k/module_loader/puppetfile.rb +22 -14
- data/lib/r10k/puppetfile.rb +1 -1
- data/lib/r10k/settings/container.rb +1 -0
- data/lib/r10k/settings.rb +6 -7
- data/lib/r10k/tarball.rb +1 -1
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +34 -82
- data/r10k.gemspec +8 -18
- metadata +40 -213
- data/.github/workflows/stale.yml +0 -21
- data/.travis.yml +0 -42
- data/docker/.gitignore +0 -1
- data/docker/.rspec +0 -4
- data/docker/Gemfile +0 -11
- data/docker/Makefile +0 -92
- data/docker/README.md +0 -28
- data/docker/docker-compose.yml +0 -18
- data/docker/r10k/Dockerfile +0 -68
- data/docker/r10k/adduser.sh +0 -13
- data/docker/r10k/docker-entrypoint.d/10-analytics.sh +0 -30
- data/docker/r10k/docker-entrypoint.sh +0 -10
- data/docker/r10k/release.Dockerfile +0 -55
- data/docker/spec/dockerfile_spec.rb +0 -37
- data/docker/spec/fixtures/Puppetfile +0 -2
- data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +0 -83
- data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +0 -128
- data/integration/tests/purging/invalid_whitelist_types.rb +0 -63
- data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +0 -49
- data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +0 -68
- data/lib/r10k/environment/bare.rb +0 -13
- data/spec/fixtures/empty/.empty +0 -0
- data/spec/fixtures/integration/git/puppet-boolean-bare.tar +0 -0
- data/spec/fixtures/module/forge/bad_module/metadata.json +0 -1
- data/spec/fixtures/module/forge/eight_hundred/Modulefile +0 -8
- data/spec/fixtures/module/forge/eight_hundred/metadata.json +0 -19
- data/spec/fixtures/tarball/tarball.tar.gz +0 -0
- data/spec/fixtures/unit/action/r10k.yaml +0 -5
- data/spec/fixtures/unit/action/r10k_cachedir.yaml +0 -2
- data/spec/fixtures/unit/action/r10k_creds.yaml +0 -9
- data/spec/fixtures/unit/action/r10k_forge_auth.yaml +0 -4
- data/spec/fixtures/unit/action/r10k_forge_auth_no_url.yaml +0 -3
- data/spec/fixtures/unit/action/r10k_generate_types.yaml +0 -3
- data/spec/fixtures/unit/action/r10k_logging.yaml +0 -12
- data/spec/fixtures/unit/action/r10k_puppet_path.yaml +0 -3
- data/spec/fixtures/unit/puppetfile/argument-error/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +0 -5
- data/spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile +0 -10
- data/spec/fixtures/unit/puppetfile/forge-override/Puppetfile +0 -8
- data/spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/load-error/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/name-error/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/valid-forge-with-version/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/valid-forge-without-version/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/various-modules/Puppetfile +0 -10
- data/spec/fixtures/unit/puppetfile/various-modules/Puppetfile.new +0 -10
- data/spec/fixtures/unit/util/purgeable/managed_one/expected_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/managed_symlink_file +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_allowlisted_2/ignored_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_expected_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/unmanaged_symlink_dir +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_symlink_dir +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_one/unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/unmanaged_symlink_file +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_two/.hidden/unmanaged_3 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/expected_2 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/unmanaged_2 +0 -0
- data/spec/fixtures/unit/util/subprocess/runner/no-execute.sh +0 -3
- data/spec/integration/git/rugged/bare_repository_spec.rb +0 -13
- data/spec/integration/git/rugged/cache_spec.rb +0 -33
- data/spec/integration/git/rugged/thin_repository_spec.rb +0 -14
- data/spec/integration/git/rugged/working_repository_spec.rb +0 -48
- data/spec/integration/git/shellgit/bare_repository_spec.rb +0 -13
- data/spec/integration/git/shellgit/thin_repository_spec.rb +0 -14
- data/spec/integration/git/shellgit/working_repository_spec.rb +0 -13
- data/spec/integration/git/stateful_repository_spec.rb +0 -159
- data/spec/integration/util/purageable_spec.rb +0 -41
- data/spec/matchers/exit_with.rb +0 -28
- data/spec/matchers/match_realpath.rb +0 -18
- data/spec/r10k-mocks/mock_config.rb +0 -33
- data/spec/r10k-mocks/mock_env.rb +0 -18
- data/spec/r10k-mocks/mock_source.rb +0 -17
- data/spec/r10k-mocks.rb +0 -3
- data/spec/shared-contexts/git-fixtures.rb +0 -55
- data/spec/shared-contexts/tarball.rb +0 -32
- data/spec/shared-examples/deploy-actions.rb +0 -69
- data/spec/shared-examples/git/bare_repository.rb +0 -132
- data/spec/shared-examples/git/thin_repository.rb +0 -26
- data/spec/shared-examples/git/working_repository.rb +0 -207
- data/spec/shared-examples/git-repository.rb +0 -38
- data/spec/shared-examples/puppetfile-action.rb +0 -39
- data/spec/shared-examples/settings/ancestry.rb +0 -44
- data/spec/shared-examples/subprocess-runner.rb +0 -89
- data/spec/spec_helper.rb +0 -41
- data/spec/unit/action/cri_runner_spec.rb +0 -72
- data/spec/unit/action/deploy/deploy_helpers_spec.rb +0 -38
- data/spec/unit/action/deploy/display_spec.rb +0 -61
- data/spec/unit/action/deploy/environment_spec.rb +0 -640
- data/spec/unit/action/deploy/module_spec.rb +0 -476
- data/spec/unit/action/puppetfile/check_spec.rb +0 -53
- data/spec/unit/action/puppetfile/cri_runner_spec.rb +0 -47
- data/spec/unit/action/puppetfile/install_spec.rb +0 -112
- data/spec/unit/action/puppetfile/purge_spec.rb +0 -60
- data/spec/unit/action/runner_spec.rb +0 -407
- data/spec/unit/action/visitor_spec.rb +0 -39
- data/spec/unit/cli_spec.rb +0 -9
- data/spec/unit/deployment/config_spec.rb +0 -33
- data/spec/unit/deployment_spec.rb +0 -162
- data/spec/unit/environment/bare_spec.rb +0 -13
- data/spec/unit/environment/base_spec.rb +0 -122
- data/spec/unit/environment/git_spec.rb +0 -114
- data/spec/unit/environment/name_spec.rb +0 -181
- data/spec/unit/environment/plain_spec.rb +0 -8
- data/spec/unit/environment/svn_spec.rb +0 -146
- data/spec/unit/environment/tarball_spec.rb +0 -45
- data/spec/unit/environment/with_modules_spec.rb +0 -75
- data/spec/unit/errors/formatting_spec.rb +0 -84
- data/spec/unit/feature_spec.rb +0 -50
- data/spec/unit/forge/module_release_spec.rb +0 -213
- data/spec/unit/git/alternates_spec.rb +0 -116
- data/spec/unit/git/cache_spec.rb +0 -66
- data/spec/unit/git/rugged/cache_spec.rb +0 -48
- data/spec/unit/git/rugged/credentials_spec.rb +0 -215
- data/spec/unit/git/shellgit/cache_spec.rb +0 -27
- data/spec/unit/git/stateful_repository_spec.rb +0 -45
- data/spec/unit/git_spec.rb +0 -102
- data/spec/unit/initializers_spec.rb +0 -68
- data/spec/unit/instance_cache_spec.rb +0 -78
- data/spec/unit/keyed_factory_spec.rb +0 -51
- data/spec/unit/logging/terminaloutputter_spec.rb +0 -53
- data/spec/unit/logging_spec.rb +0 -68
- data/spec/unit/module/base_spec.rb +0 -118
- data/spec/unit/module/forge_spec.rb +0 -271
- data/spec/unit/module/git_spec.rb +0 -387
- data/spec/unit/module/metadata_file_spec.rb +0 -68
- data/spec/unit/module/svn_spec.rb +0 -208
- data/spec/unit/module/tarball_spec.rb +0 -70
- data/spec/unit/module_loader/puppetfile_spec.rb +0 -421
- data/spec/unit/module_spec.rb +0 -114
- data/spec/unit/puppetfile_spec.rb +0 -304
- data/spec/unit/settings/collection_spec.rb +0 -123
- data/spec/unit/settings/container_spec.rb +0 -92
- data/spec/unit/settings/definition_spec.rb +0 -79
- data/spec/unit/settings/enum_definition_spec.rb +0 -20
- data/spec/unit/settings/inheritance_spec.rb +0 -38
- data/spec/unit/settings/list_spec.rb +0 -88
- data/spec/unit/settings/loader_spec.rb +0 -110
- data/spec/unit/settings/uri_definition_spec.rb +0 -23
- data/spec/unit/settings_spec.rb +0 -303
- data/spec/unit/source/base_spec.rb +0 -31
- data/spec/unit/source/exec_spec.rb +0 -81
- data/spec/unit/source/git_spec.rb +0 -233
- data/spec/unit/source/hash_spec.rb +0 -54
- data/spec/unit/source/svn_spec.rb +0 -196
- data/spec/unit/source/yaml_spec.rb +0 -42
- data/spec/unit/source_spec.rb +0 -10
- data/spec/unit/svn/remote_spec.rb +0 -21
- data/spec/unit/svn/working_dir_spec.rb +0 -56
- data/spec/unit/tarball_spec.rb +0 -57
- data/spec/unit/util/attempt_spec.rb +0 -82
- data/spec/unit/util/cacheable_spec.rb +0 -23
- data/spec/unit/util/commands_spec.rb +0 -61
- data/spec/unit/util/downloader_spec.rb +0 -98
- data/spec/unit/util/exec_env_spec.rb +0 -56
- data/spec/unit/util/purgeable_spec.rb +0 -267
- data/spec/unit/util/setopts_spec.rb +0 -83
- data/spec/unit/util/subprocess/result_spec.rb +0 -36
- data/spec/unit/util/subprocess/runner/posix_spec.rb +0 -7
- data/spec/unit/util/subprocess/runner/pump_spec.rb +0 -79
- data/spec/unit/util/subprocess/runner/windows_spec.rb +0 -7
- data/spec/unit/util/subprocess/subprocess_error_spec.rb +0 -26
- data/spec/unit/util/subprocess_spec.rb +0 -65
- data/spec/unit/util/symbolize_keys_spec.rb +0 -67
@@ -1,304 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'r10k/puppetfile'
|
3
|
-
|
4
|
-
describe R10K::Puppetfile do
|
5
|
-
|
6
|
-
subject do
|
7
|
-
described_class.new(
|
8
|
-
'/some/nonexistent/basedir',
|
9
|
-
{puppetfile_name: 'Puppetfile.r10k'}
|
10
|
-
)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "a custom puppetfile_name" do
|
14
|
-
it "is the basedir joined with '/Puppetfile.r10k' path" do
|
15
|
-
expect(subject.puppetfile_path).to eq '/some/nonexistent/basedir/Puppetfile.r10k'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
describe R10K::Puppetfile do
|
22
|
-
|
23
|
-
describe "a custom relative puppetfile_path" do
|
24
|
-
it "is the basedir joined with the puppetfile_path" do
|
25
|
-
relative_subject = described_class.new('/some/nonexistent/basedir',
|
26
|
-
{puppetfile_path: 'relative/Puppetfile'})
|
27
|
-
expect(relative_subject.puppetfile_path).to eq '/some/nonexistent/basedir/relative/Puppetfile'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "a custom absolute puppetfile_path" do
|
32
|
-
it "is the puppetfile_path as given" do
|
33
|
-
absolute_subject = described_class.new('/some/nonexistent/basedir',
|
34
|
-
{puppetfile_path: '/some/absolute/custom/Puppetfile'})
|
35
|
-
expect(absolute_subject.puppetfile_path).to eq '/some/absolute/custom/Puppetfile'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe R10K::Puppetfile do
|
41
|
-
|
42
|
-
subject do
|
43
|
-
described_class.new( '/some/nonexistent/basedir', {})
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "backwards compatibility with older calling conventions" do
|
47
|
-
it "honors all arguments correctly" do
|
48
|
-
puppetfile = described_class.new('/some/nonexistant/basedir', '/some/nonexistant/basedir/site-modules', nil, 'Pupupupetfile', true)
|
49
|
-
expect(puppetfile.force).to eq(true)
|
50
|
-
expect(puppetfile.moduledir).to eq('/some/nonexistant/basedir/site-modules')
|
51
|
-
expect(puppetfile.puppetfile_path).to eq('/some/nonexistant/basedir/Pupupupetfile')
|
52
|
-
expect(puppetfile.overrides).to eq({})
|
53
|
-
end
|
54
|
-
|
55
|
-
it "handles defaults correctly" do
|
56
|
-
puppetfile = described_class.new('/some/nonexistant/basedir', nil, nil, nil)
|
57
|
-
expect(puppetfile.force).to eq(false)
|
58
|
-
expect(puppetfile.moduledir).to eq('/some/nonexistant/basedir/modules')
|
59
|
-
expect(puppetfile.puppetfile_path).to eq('/some/nonexistant/basedir/Puppetfile')
|
60
|
-
expect(puppetfile.overrides).to eq({})
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "the default moduledir" do
|
65
|
-
it "is the basedir joined with '/modules' path" do
|
66
|
-
expect(subject.moduledir).to eq '/some/nonexistent/basedir/modules'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "the default puppetfile" do
|
71
|
-
it "is the basedir joined with '/Puppetfile' path" do
|
72
|
-
expect(subject.puppetfile_path).to eq '/some/nonexistent/basedir/Puppetfile'
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
describe "setting moduledir" do
|
78
|
-
it "changes to given moduledir if it is an absolute path" do
|
79
|
-
subject.set_moduledir('/absolute/path/moduledir')
|
80
|
-
expect(subject.moduledir).to eq '/absolute/path/moduledir'
|
81
|
-
end
|
82
|
-
|
83
|
-
it "joins the basedir with the given moduledir if it is a relative path" do
|
84
|
-
subject.set_moduledir('relative/moduledir')
|
85
|
-
expect(subject.moduledir).to eq '/some/nonexistent/basedir/relative/moduledir'
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "loading a Puppetfile" do
|
90
|
-
context 'using load' do
|
91
|
-
it "returns the loaded content" do
|
92
|
-
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
93
|
-
subject = described_class.new(path, {})
|
94
|
-
|
95
|
-
loaded_content = subject.load
|
96
|
-
expect(loaded_content).to be_an_instance_of(Hash)
|
97
|
-
|
98
|
-
has_some_data = loaded_content.values.none?(&:empty?)
|
99
|
-
expect(has_some_data).to be true
|
100
|
-
end
|
101
|
-
|
102
|
-
it "handles a relative basedir" do
|
103
|
-
path = File.join('spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
104
|
-
subject = described_class.new(path, {})
|
105
|
-
|
106
|
-
loaded_content = subject.load
|
107
|
-
expect(loaded_content).to be_an_instance_of(Hash)
|
108
|
-
|
109
|
-
has_some_data = loaded_content.values.none?(&:empty?)
|
110
|
-
expect(has_some_data).to be true
|
111
|
-
end
|
112
|
-
|
113
|
-
it "is idempotent" do
|
114
|
-
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
115
|
-
subject = described_class.new(path, {})
|
116
|
-
|
117
|
-
expect(subject.loader).to receive(:load!).and_call_original.once
|
118
|
-
|
119
|
-
loaded_content1 = subject.load
|
120
|
-
expect(subject.loaded?).to be true
|
121
|
-
loaded_content2 = subject.load
|
122
|
-
|
123
|
-
expect(loaded_content2).to eq(loaded_content1)
|
124
|
-
end
|
125
|
-
|
126
|
-
it "returns nil if Puppetfile doesn't exist" do
|
127
|
-
path = '/rando/path/that/wont/exist'
|
128
|
-
subject = described_class.new(path, {})
|
129
|
-
expect(subject.load).to eq nil
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
context 'using load!' do
|
134
|
-
it "returns the loaded content" do
|
135
|
-
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
136
|
-
subject = described_class.new(path, {})
|
137
|
-
|
138
|
-
loaded_content = subject.load!
|
139
|
-
expect(loaded_content).to be_an_instance_of(Hash)
|
140
|
-
|
141
|
-
has_some_data = loaded_content.values.none?(&:empty?)
|
142
|
-
expect(has_some_data).to be true
|
143
|
-
end
|
144
|
-
|
145
|
-
it "raises if Puppetfile doesn't exist" do
|
146
|
-
path = '/rando/path/that/wont/exist'
|
147
|
-
subject = described_class.new(path, {})
|
148
|
-
expect {
|
149
|
-
subject.load!
|
150
|
-
}.to raise_error(/No such file or directory.*\/rando\/path\/.*/)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
describe 'default_branch_override' do
|
156
|
-
it 'is passed correctly to module loader init' do
|
157
|
-
# This path doesn't matter so long as it has a Puppetfile within it
|
158
|
-
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
159
|
-
subject = described_class.new(path, {overrides: {environments: {default_branch_override: 'foo'}}})
|
160
|
-
|
161
|
-
repo = instance_double('R10K::Git::StatefulRepository')
|
162
|
-
allow(repo).to receive(:resolve).with('foo').and_return(true)
|
163
|
-
allow(R10K::Git::StatefulRepository).to receive(:new).and_return(repo)
|
164
|
-
|
165
|
-
allow(subject.loader).to receive(:puppetfile_content).and_return <<-EOPF
|
166
|
-
# Track control branch and fall-back to main if no matching branch.
|
167
|
-
mod 'hieradata',
|
168
|
-
:git => 'git@git.example.com:organization/hieradata.git',
|
169
|
-
:branch => :control_branch,
|
170
|
-
:default_branch => 'main'
|
171
|
-
EOPF
|
172
|
-
|
173
|
-
expect(subject.logger).not_to receive(:warn).
|
174
|
-
with(/Mismatch between passed and initialized.*preferring passed value/)
|
175
|
-
|
176
|
-
subject.load
|
177
|
-
|
178
|
-
loaded_module = subject.modules.first
|
179
|
-
expect(loaded_module.version).to eq('foo')
|
180
|
-
end
|
181
|
-
|
182
|
-
it 'overrides module loader init if needed' do
|
183
|
-
# This path doesn't matter so long as it has a Puppetfile within it
|
184
|
-
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
185
|
-
subject = described_class.new(path, {overrides: {environments: {default_branch_override: 'foo'}}})
|
186
|
-
|
187
|
-
repo = instance_double('R10K::Git::StatefulRepository')
|
188
|
-
allow(repo).to receive(:resolve).with('bar').and_return(true)
|
189
|
-
allow(R10K::Git::StatefulRepository).to receive(:new).and_return(repo)
|
190
|
-
|
191
|
-
allow(subject.loader).to receive(:puppetfile_content).and_return <<-EOPF
|
192
|
-
# Track control branch and fall-back to main if no matching branch.
|
193
|
-
mod 'hieradata',
|
194
|
-
:git => 'git@git.example.com:organization/hieradata.git',
|
195
|
-
:branch => :control_branch,
|
196
|
-
:default_branch => 'main'
|
197
|
-
EOPF
|
198
|
-
|
199
|
-
expect(subject.logger).to receive(:warn).
|
200
|
-
with(/Mismatch between passed and initialized.*preferring passed value/)
|
201
|
-
|
202
|
-
subject.load('bar')
|
203
|
-
loaded_module = subject.modules.first
|
204
|
-
expect(loaded_module.version).to eq('bar')
|
205
|
-
end
|
206
|
-
|
207
|
-
it 'does not warn if passed and initialized default_branch_overrides match' do
|
208
|
-
# This path doesn't matter so long as it has a Puppetfile within it
|
209
|
-
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'valid-forge-with-version')
|
210
|
-
subject = described_class.new(path, {overrides: {environments: {default_branch_override: 'foo'}}})
|
211
|
-
|
212
|
-
repo = instance_double('R10K::Git::StatefulRepository')
|
213
|
-
allow(repo).to receive(:resolve).with('foo').and_return(true)
|
214
|
-
allow(R10K::Git::StatefulRepository).to receive(:new).and_return(repo)
|
215
|
-
|
216
|
-
allow(subject.loader).to receive(:puppetfile_content).and_return <<-EOPF
|
217
|
-
# Track control branch and fall-back to main if no matching branch.
|
218
|
-
mod 'hieradata',
|
219
|
-
:git => 'git@git.example.com:organization/hieradata.git',
|
220
|
-
:branch => :control_branch,
|
221
|
-
:default_branch => 'main'
|
222
|
-
EOPF
|
223
|
-
|
224
|
-
expect(subject.logger).not_to receive(:warn).
|
225
|
-
with(/Mismatch between passed and initialized.*preferring passed value/)
|
226
|
-
|
227
|
-
subject.load('foo')
|
228
|
-
loaded_module = subject.modules.first
|
229
|
-
expect(loaded_module.version).to eq('foo')
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
describe "accepting a visitor" do
|
234
|
-
it "passes itself to the visitor" do
|
235
|
-
visitor = spy('visitor')
|
236
|
-
expect(visitor).to receive(:visit).with(:puppetfile, subject)
|
237
|
-
subject.accept(visitor)
|
238
|
-
end
|
239
|
-
|
240
|
-
it "synchronizes each module if the visitor yields" do
|
241
|
-
visitor = spy('visitor')
|
242
|
-
expect(visitor).to receive(:visit) do |type, other, &block|
|
243
|
-
expect(type).to eq :puppetfile
|
244
|
-
expect(other).to eq subject
|
245
|
-
block.call
|
246
|
-
end
|
247
|
-
|
248
|
-
mod1 = instance_double('R10K::Module::Base', :cachedir => :none)
|
249
|
-
mod2 = instance_double('R10K::Module::Base', :cachedir => :none)
|
250
|
-
expect(mod1).to receive(:sync)
|
251
|
-
expect(mod2).to receive(:sync)
|
252
|
-
expect(subject).to receive(:modules).and_return([mod1, mod2])
|
253
|
-
|
254
|
-
subject.accept(visitor)
|
255
|
-
end
|
256
|
-
|
257
|
-
it "creates a thread pool to visit concurrently if pool_size setting is greater than one" do
|
258
|
-
pool_size = 3
|
259
|
-
|
260
|
-
subject.settings[:pool_size] = pool_size
|
261
|
-
|
262
|
-
visitor = spy('visitor')
|
263
|
-
expect(visitor).to receive(:visit) do |type, other, &block|
|
264
|
-
expect(type).to eq :puppetfile
|
265
|
-
expect(other).to eq subject
|
266
|
-
block.call
|
267
|
-
end
|
268
|
-
|
269
|
-
mod1 = instance_double('R10K::Module::Base', :cachedir => :none)
|
270
|
-
mod2 = instance_double('R10K::Module::Base', :cachedir => :none)
|
271
|
-
expect(mod1).to receive(:sync)
|
272
|
-
expect(mod2).to receive(:sync)
|
273
|
-
expect(subject).to receive(:modules).and_return([mod1, mod2])
|
274
|
-
|
275
|
-
expect(Thread).to receive(:new).exactly(pool_size).and_call_original
|
276
|
-
expect(Queue).to receive(:new).and_call_original.twice
|
277
|
-
|
278
|
-
subject.accept(visitor)
|
279
|
-
end
|
280
|
-
|
281
|
-
it "Creates queues of modules grouped by cachedir" do
|
282
|
-
visitor = spy('visitor')
|
283
|
-
expect(visitor).to receive(:visit) do |type, other, &block|
|
284
|
-
expect(type).to eq :puppetfile
|
285
|
-
expect(other).to eq subject
|
286
|
-
block.call
|
287
|
-
end
|
288
|
-
|
289
|
-
m1 = instance_double('R10K::Module::Base', :cachedir => '/dev/null/A')
|
290
|
-
m2 = instance_double('R10K::Module::Base', :cachedir => '/dev/null/B')
|
291
|
-
m3 = instance_double('R10K::Module::Base', :cachedir => '/dev/null/C')
|
292
|
-
m4 = instance_double('R10K::Module::Base', :cachedir => '/dev/null/C')
|
293
|
-
m5 = instance_double('R10K::Module::Base', :cachedir => '/dev/null/D')
|
294
|
-
m6 = instance_double('R10K::Module::Base', :cachedir => '/dev/null/D')
|
295
|
-
|
296
|
-
modules = [m1, m2, m3, m4, m5, m6]
|
297
|
-
|
298
|
-
queue = R10K::ContentSynchronizer.modules_visit_queue(modules, visitor, subject)
|
299
|
-
expect(queue.length).to be 4
|
300
|
-
queue_array = 4.times.map { queue.pop }
|
301
|
-
expect(queue_array).to match_array([[m1], [m2], [m3, m4], [m5, m6]])
|
302
|
-
end
|
303
|
-
end
|
304
|
-
end
|
@@ -1,123 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'r10k/settings/collection'
|
3
|
-
require 'r10k/settings/definition'
|
4
|
-
|
5
|
-
describe R10K::Settings::Collection do
|
6
|
-
|
7
|
-
let(:symbol_defn) { R10K::Settings::Definition.new(:symbol_defn, :validate => lambda { |x| raise TypeError unless x.is_a?(Symbol) }) }
|
8
|
-
let(:default_defn) { R10K::Settings::Definition.new(:default_defn, :default => lambda { "Defaults are fun" }) }
|
9
|
-
|
10
|
-
subject do
|
11
|
-
described_class.new(:collection, [symbol_defn, default_defn])
|
12
|
-
end
|
13
|
-
|
14
|
-
it_behaves_like "a setting with ancestors"
|
15
|
-
|
16
|
-
describe "#evaluate" do
|
17
|
-
it "assigns values, validates them, and resolves a final value" do
|
18
|
-
expect(subject).to receive(:assign).with({:default_defn => :squid})
|
19
|
-
expect(subject).to receive(:validate)
|
20
|
-
expect(subject).to receive(:resolve)
|
21
|
-
subject.evaluate({:default_defn => :squid})
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#assign' do
|
26
|
-
it "assigns values to the appropriate setting" do
|
27
|
-
subject.assign({:symbol_defn => :hello})
|
28
|
-
expect(symbol_defn.value).to eq :hello
|
29
|
-
end
|
30
|
-
|
31
|
-
it "can accept invalid settings" do
|
32
|
-
subject.assign({:hardly_a_setting => "nope nope nope"})
|
33
|
-
end
|
34
|
-
|
35
|
-
it "silently ignores attempts to assign nil" do
|
36
|
-
subject.assign(nil)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#validate' do
|
41
|
-
it "raises an error containing a hash of nested validation errors" do
|
42
|
-
subject.assign({:symbol_defn => "Definitely not a symbol"})
|
43
|
-
expect {
|
44
|
-
errors = subject.validate
|
45
|
-
}.to raise_error do |error|
|
46
|
-
expect(error).to be_a_kind_of(R10K::Settings::Collection::ValidationError)
|
47
|
-
errors = error.errors
|
48
|
-
expect(errors.size).to eq 1
|
49
|
-
expect(errors[:symbol_defn]).to be_a_kind_of(TypeError)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it "it does not raise an error if no errors were found" do
|
54
|
-
subject.assign({:default_defn => "yep"})
|
55
|
-
expect(subject.validate).to be_nil
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#resolve' do
|
60
|
-
it "returns a frozen hash of all settings" do
|
61
|
-
subject.assign({:symbol_defn => :some_value})
|
62
|
-
rv = subject.resolve
|
63
|
-
expect(rv).to be_frozen
|
64
|
-
expect(rv).to eq({:symbol_defn => :some_value, :default_defn => "Defaults are fun"})
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe R10K::Settings::Collection::ValidationError do
|
70
|
-
|
71
|
-
|
72
|
-
let(:flat_errors) do
|
73
|
-
described_class.new("Validation failures for some group", errors: {
|
74
|
-
some_defn: ArgumentError.new("some_defn is wrong, somehow."),
|
75
|
-
uri_setting: ArgumentError.new("uri_setting NOTAURI is not a URI.")
|
76
|
-
})
|
77
|
-
end
|
78
|
-
|
79
|
-
let(:flat_error_text) do
|
80
|
-
[
|
81
|
-
"Validation failures for some group:",
|
82
|
-
" some_defn:",
|
83
|
-
" some_defn is wrong, somehow.",
|
84
|
-
" uri_setting:",
|
85
|
-
" uri_setting NOTAURI is not a URI."]
|
86
|
-
.join("\n")
|
87
|
-
end
|
88
|
-
|
89
|
-
let(:nested_errors) do
|
90
|
-
described_class.new("Validation failures for some nesting group", errors: {
|
91
|
-
file_setting: ArgumentError.new("file_setting is a potato, not a file."),
|
92
|
-
nested: flat_errors
|
93
|
-
})
|
94
|
-
end
|
95
|
-
|
96
|
-
let(:nested_error_text) do
|
97
|
-
[
|
98
|
-
"Validation failures for some nesting group:",
|
99
|
-
" file_setting:",
|
100
|
-
" file_setting is a potato, not a file.",
|
101
|
-
" nested:",
|
102
|
-
" Validation failures for some group:",
|
103
|
-
" some_defn:",
|
104
|
-
" some_defn is wrong, somehow.",
|
105
|
-
" uri_setting:",
|
106
|
-
" uri_setting NOTAURI is not a URI."
|
107
|
-
].join("\n")
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "formatting a human readable error message" do
|
111
|
-
describe "no with no nested validation errors" do
|
112
|
-
it "generates a human readable set of validation errors." do
|
113
|
-
expect(flat_errors.format).to eq flat_error_text
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe "with nested validation errors" do
|
118
|
-
it "generates a human readable set of validation errors." do
|
119
|
-
expect(nested_errors.format).to eq nested_error_text
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require 'r10k/settings'
|
4
|
-
|
5
|
-
describe R10K::Settings::Container do
|
6
|
-
|
7
|
-
describe 'validating keys' do
|
8
|
-
it 'can add new valid keys' do
|
9
|
-
subject.add_valid_key(:v)
|
10
|
-
subject[:v]
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'can check if a key is valid' do
|
14
|
-
subject.add_valid_key(:v)
|
15
|
-
expect(subject.valid_key?(:v)).to be_truthy
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'can list all valid keys' do
|
19
|
-
subject.add_valid_key(:v)
|
20
|
-
subject.add_valid_key(:w)
|
21
|
-
|
22
|
-
expect(subject.valid_keys).to include :v
|
23
|
-
expect(subject.valid_keys).to include :w
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'specifying settings' do
|
28
|
-
it 'fails if a setting application uses an invalid key' do
|
29
|
-
expect { subject[:invalid] = 'fail' }.to raise_error R10K::Settings::Container::InvalidKey
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'can look up values that it sets' do
|
33
|
-
subject.add_valid_key :v
|
34
|
-
subject[:v] = 'set'
|
35
|
-
expect(subject[:v]).to eq 'set'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'looking up settings' do
|
40
|
-
before do
|
41
|
-
subject.add_valid_key :v
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'fails if a setting lookup uses an invalid key' do
|
45
|
-
expect { subject[:invalid] }.to raise_error R10K::Settings::Container::InvalidKey
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'returns nil if a key is valid but no setting is present' do
|
49
|
-
expect(subject[:v]).to be_nil
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'with a parent container' do
|
53
|
-
let(:parent) { described_class.new.tap { |p| p.add_valid_key :v } }
|
54
|
-
subject { described_class.new(parent) }
|
55
|
-
|
56
|
-
it 'uses its setting over a parent value' do
|
57
|
-
subject[:v] = 'child'
|
58
|
-
parent[:v] = 'parent'
|
59
|
-
expect(subject[:v]).to eq 'child'
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'duplicates and stores the parent object to avoid modifying the parent object' do
|
63
|
-
parent[:v] = {}
|
64
|
-
subject[:v][:hello] = "world"
|
65
|
-
expect(subject[:v]).to eq({hello: "world"})
|
66
|
-
expect(parent[:v]).to eq({})
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'falls back to the parent value if it does not have a value' do
|
70
|
-
parent[:v] = 'parent'
|
71
|
-
expect(subject[:v]).to eq 'parent'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "resetting" do
|
77
|
-
before do
|
78
|
-
subject.add_valid_key :v
|
79
|
-
end
|
80
|
-
|
81
|
-
it "unsets all settings" do
|
82
|
-
subject[:v] = "hi"
|
83
|
-
subject.reset!
|
84
|
-
expect(subject[:v]).to be_nil
|
85
|
-
end
|
86
|
-
|
87
|
-
it "doesn't remove valid values" do
|
88
|
-
subject.reset!
|
89
|
-
expect(subject.valid_key?(:v)).to be_truthy
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'r10k/settings/definition'
|
3
|
-
require 'r10k/settings/collection'
|
4
|
-
require 'r10k/settings/list'
|
5
|
-
|
6
|
-
describe R10K::Settings::Definition do
|
7
|
-
subject { described_class.new(:setting) }
|
8
|
-
|
9
|
-
it_behaves_like "a setting with ancestors"
|
10
|
-
|
11
|
-
describe "#evaluate" do
|
12
|
-
it "assigns a value, validates it, and resolves a final value" do
|
13
|
-
expect(subject).to receive(:assign).with("myvalue")
|
14
|
-
expect(subject).to receive(:validate)
|
15
|
-
expect(subject).to receive(:resolve)
|
16
|
-
subject.evaluate("myvalue")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "#assign" do
|
21
|
-
it 'stores the provided value' do
|
22
|
-
subject.assign("I'm the value")
|
23
|
-
expect(subject.value).to eq "I'm the value"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "normalizes the stored value when a normalize hook is set" do
|
27
|
-
subject = described_class.new(:setting, :normalize => lambda { |input| input.to_sym })
|
28
|
-
subject.assign("symbolizeme")
|
29
|
-
expect(subject.value).to eq :symbolizeme
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "#validate" do
|
34
|
-
it "does nothing if a value has not been assigned" do
|
35
|
-
subject = described_class.new(:setting, :validate => lambda { |_| raise "Shouldn't be called" })
|
36
|
-
subject.validate
|
37
|
-
end
|
38
|
-
|
39
|
-
it "does nothing if a validate hook has not been assigned" do
|
40
|
-
subject.assign("I'm the value")
|
41
|
-
subject.validate
|
42
|
-
end
|
43
|
-
|
44
|
-
it "raises up errors raised from the validate hook" do
|
45
|
-
subject = described_class.new(:satellite, :validate => lambda { |input| raise ArgumentError, "Invalid value #{input}: that's no moon!" })
|
46
|
-
subject.assign("Alderaan")
|
47
|
-
expect {
|
48
|
-
subject.validate
|
49
|
-
}.to raise_error(ArgumentError, "Invalid value Alderaan: that's no moon!")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "returns if the validate hook did not raise an error" do
|
53
|
-
subject = described_class.new(:setting, :validate => lambda { |_| "That's a moon" })
|
54
|
-
subject.assign("Mun")
|
55
|
-
subject.validate
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "#resolve" do
|
60
|
-
it "returns the value when the value has been given" do
|
61
|
-
subject.assign("Mun")
|
62
|
-
expect(subject.resolve).to eq "Mun"
|
63
|
-
end
|
64
|
-
|
65
|
-
it "resolves the default when the default is a proc" do
|
66
|
-
subject = described_class.new(:setting, :default => lambda { "Minmus" })
|
67
|
-
expect(subject.resolve).to eq "Minmus"
|
68
|
-
end
|
69
|
-
|
70
|
-
it "returns the default when the default is not a proc" do
|
71
|
-
subject = described_class.new(:setting, :default => "Ike")
|
72
|
-
expect(subject.resolve).to eq "Ike"
|
73
|
-
end
|
74
|
-
|
75
|
-
it "returns nil when there is no value nor default" do
|
76
|
-
expect(subject.resolve).to be_nil
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'r10k/settings/enum_definition'
|
3
|
-
|
4
|
-
describe R10K::Settings::EnumDefinition do
|
5
|
-
|
6
|
-
subject { described_class.new(:enum, :enum => %w[one two three]) }
|
7
|
-
|
8
|
-
describe '#validate' do
|
9
|
-
it "doesn't raise an error when given an expected value" do
|
10
|
-
subject.assign('two')
|
11
|
-
subject.validate
|
12
|
-
end
|
13
|
-
it "raises an error when given a value outside the enum" do
|
14
|
-
subject.assign('dos')
|
15
|
-
expect {
|
16
|
-
subject.validate
|
17
|
-
}.to raise_error(ArgumentError, "Setting enum should be one of #{%w[one two three].inspect}, not 'dos'")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'r10k/settings/collection'
|
3
|
-
require 'r10k/settings/definition'
|
4
|
-
|
5
|
-
RSpec.describe 'R10K::Settings inheritance' do
|
6
|
-
subject do
|
7
|
-
R10K::Settings::Collection.new(:parent_settings, [
|
8
|
-
R10K::Settings::Definition.new(:banana, {
|
9
|
-
:default => 'cavendish',
|
10
|
-
}),
|
11
|
-
|
12
|
-
R10K::Settings::Collection.new(:child_settings, [
|
13
|
-
R10K::Settings::Definition.new(:banana, {
|
14
|
-
:default => :inherit,
|
15
|
-
}),
|
16
|
-
]),
|
17
|
-
])
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "child settings" do
|
21
|
-
let(:setting) { subject[:child_settings][:banana] }
|
22
|
-
|
23
|
-
context "when child value is not set" do
|
24
|
-
it "should resolve to default value from parent" do
|
25
|
-
expect(setting.value).to be_nil
|
26
|
-
expect(setting.resolve).to eq 'cavendish'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "when child value is set" do
|
31
|
-
before(:each) { setting.assign('gros michel') }
|
32
|
-
|
33
|
-
it "should resolve to child value" do
|
34
|
-
expect(setting.resolve).to eq 'gros michel'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|