clc-promote 0.8.7 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +6 -1
- data/clc-promote.gemspec +1 -1
- data/lib/promote/cookbook.rb +2 -2
- data/lib/promote/node_finder.rb +7 -5
- data/lib/promote/promoter.rb +16 -11
- data/lib/promote/version.rb +1 -1
- data/spec/unit/promote/config_spec.rb +137 -126
- data/spec/unit/promote/cookbook_spec.rb +34 -34
- data/spec/unit/promote/promoter_spec.rb +86 -49
- data/spec/unit/promote/uploader_spec.rb +285 -285
- data/spec/unit/promote/versioner_spec.rb +339 -316
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02fb88582f6f5de1f9a927eb25e0434111743ec4
|
4
|
+
data.tar.gz: 2da80ba5d93f20956df5bfaa051a33703880d38c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79fd93f45d3707dd0d275920832354d94e70ceb7e57cad50a51e8b8695ebd60814f2c70965590b54df89280b804bd91e0fd41b7cf032014686f0c2db144ab68e
|
7
|
+
data.tar.gz: 4261f92aa90eb3f283c74488624618e489ac242b5a396216a52708d292c76b04d3ce8432660475bc160d6e943769bc353e75ab9a54b867a51b1a354ace7d5ed6
|
data/Rakefile
CHANGED
@@ -13,6 +13,11 @@ module Bundler
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
require "rubocop/rake_task"
|
17
|
+
RuboCop::RakeTask.new(:style) do |task|
|
18
|
+
task.options << "--display-cop-names"
|
19
|
+
end
|
20
|
+
|
16
21
|
RSpec::Core::RakeTask.new(:test)
|
17
22
|
|
18
|
-
task :default => [:test]
|
23
|
+
task :default => [:test, :style]
|
data/clc-promote.gemspec
CHANGED
data/lib/promote/cookbook.rb
CHANGED
@@ -79,8 +79,8 @@ module Promote
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def dependency_hash(environment_cookbook_name)
|
82
|
-
|
83
|
-
hash_src =
|
82
|
+
sync_latest_app_cookbooks(environment_cookbook_name)
|
83
|
+
hash_src = ''
|
84
84
|
dependencies.each do | k,v |
|
85
85
|
hash_src << "#{k}::#{v}::"
|
86
86
|
end
|
data/lib/promote/node_finder.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
module Promote
|
2
2
|
class NodeFinder
|
3
|
+
|
4
|
+
include ChefServer
|
5
|
+
|
3
6
|
def initialize(query, config)
|
4
7
|
@query = query
|
5
8
|
@config = config
|
6
|
-
Chef::Config.reset
|
7
|
-
Chef::Config[:client_key] = config.client_key
|
8
|
-
Chef::Config[:chef_server_url] = config.chef_server_url
|
9
|
-
Chef::Config[:node_name] = config.node_name
|
10
9
|
@searcher = Chef::Search::Query.new
|
11
10
|
end
|
12
11
|
|
13
12
|
def search
|
14
|
-
results =
|
13
|
+
results = []
|
14
|
+
with_chef_server(@config) do
|
15
|
+
results = @searcher.search(:node, @query)
|
16
|
+
end
|
15
17
|
results[0]
|
16
18
|
end
|
17
19
|
end
|
data/lib/promote/promoter.rb
CHANGED
@@ -2,6 +2,9 @@ require 'json'
|
|
2
2
|
|
3
3
|
module Promote
|
4
4
|
class Promoter
|
5
|
+
|
6
|
+
include ChefServer
|
7
|
+
|
5
8
|
attr_accessor :config
|
6
9
|
|
7
10
|
def initialize(config = Config.new)
|
@@ -84,17 +87,19 @@ module Promote
|
|
84
87
|
private
|
85
88
|
|
86
89
|
def download_files(local_root, path, cookbook_version = nil)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
90
|
+
with_chef_server(config) do
|
91
|
+
fs_config = Chef::ChefFS::Config.new(Chef::Config, cwd = Dir.pwd, {:cookbook_version => cookbook_version})
|
92
|
+
pattern = Chef::ChefFS::FilePattern.new(path)
|
93
|
+
local = Chef::ChefFS::FileSystem::ChefRepositoryFileSystemRootDir.new(
|
94
|
+
{
|
95
|
+
'environments' => ["#{local_root}/environments"],
|
96
|
+
'data_bags' => ["#{local_root}/data_bags"],
|
97
|
+
'roles' => ["#{local_root}/roles"],
|
98
|
+
'cookbooks' => ["#{local_root}/cookbooks"]
|
99
|
+
}
|
100
|
+
)
|
101
|
+
Chef::ChefFS::FileSystem.copy_to(pattern, fs_config.chef_fs, local, nil, Chef::Config)
|
102
|
+
end
|
98
103
|
end
|
99
104
|
|
100
105
|
def check_promotion(environment_to_check, probe_interval, max_wait, ui)
|
data/lib/promote/version.rb
CHANGED
@@ -1,144 +1,155 @@
|
|
1
1
|
require 'promote'
|
2
2
|
|
3
3
|
describe Promote::Config do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
let(:opts) do
|
5
|
+
{
|
6
|
+
repo_root: 'root',
|
7
|
+
cookbook_directory: 'cookbooks',
|
8
|
+
environment_directory: 'environments',
|
9
|
+
data_bag_directory: 'data_bags',
|
10
|
+
role_directory: 'roles',
|
11
|
+
temp_directory: 'temp',
|
12
|
+
node_name: 'user',
|
13
|
+
client_key: 'key',
|
14
|
+
chef_server_url: 'url',
|
15
|
+
bags: ['foo']
|
16
|
+
}
|
17
|
+
end
|
18
|
+
let(:repo_root) { subject.repo_root }
|
16
19
|
|
17
|
-
|
18
|
-
expect(subject.node_name).to eq(opts[:node_name])
|
19
|
-
end
|
20
|
-
it "assigns options to client_key attribute" do
|
21
|
-
expect(subject.client_key).to eq(opts[:client_key])
|
22
|
-
end
|
23
|
-
it "assigns options to chef_server_url attribute" do
|
24
|
-
expect(subject.chef_server_url).to eq(opts[:chef_server_url])
|
25
|
-
end
|
26
|
-
it "assigns options to repo_root attribute" do
|
27
|
-
expect(subject.repo_root).to eq(opts[:repo_root])
|
28
|
-
end
|
29
|
-
it "assigns options to cookbook_directory attribute" do
|
30
|
-
expect(subject.cookbook_directory).to eq(opts[:cookbook_directory])
|
31
|
-
end
|
32
|
-
it "assigns options to data_bag_directory attribute" do
|
33
|
-
expect(subject.data_bag_directory).to eq(opts[:data_bag_directory])
|
34
|
-
end
|
35
|
-
it "assigns options to environment_directory attribute" do
|
36
|
-
expect(subject.environment_directory).to eq(opts[:environment_directory])
|
37
|
-
end
|
38
|
-
it "assigns options to role_directory attribute" do
|
39
|
-
expect(subject.role_directory).to eq(opts[:role_directory])
|
40
|
-
end
|
41
|
-
it "assigns options to temp_directory attribute" do
|
42
|
-
expect(subject.temp_directory).to eq(opts[:temp_directory])
|
43
|
-
end
|
44
|
-
it "assigns options to bags attribute" do
|
45
|
-
expect(subject.bags).to eq(opts[:bags])
|
46
|
-
end
|
47
|
-
it "can correctly convert to a hash" do
|
48
|
-
hash = subject.to_hash
|
49
|
-
expect(hash[:repo_root]).to eq(opts[:repo_root])
|
50
|
-
end
|
20
|
+
subject { Promote::Config.new(opts) }
|
51
21
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
22
|
+
it 'assigns options to node_name attribute' do
|
23
|
+
expect(subject.node_name).to eq(opts[:node_name])
|
24
|
+
end
|
25
|
+
it 'assigns options to client_key attribute' do
|
26
|
+
expect(subject.client_key).to eq(opts[:client_key])
|
27
|
+
end
|
28
|
+
it 'assigns options to chef_server_url attribute' do
|
29
|
+
expect(subject.chef_server_url).to eq(opts[:chef_server_url])
|
30
|
+
end
|
31
|
+
it 'assigns options to repo_root attribute' do
|
32
|
+
expect(subject.repo_root).to eq(opts[:repo_root])
|
33
|
+
end
|
34
|
+
it 'assigns options to cookbook_directory attribute' do
|
35
|
+
expect(subject.cookbook_directory).to eq(opts[:cookbook_directory])
|
36
|
+
end
|
37
|
+
it 'assigns options to data_bag_directory attribute' do
|
38
|
+
expect(subject.data_bag_directory).to eq(opts[:data_bag_directory])
|
39
|
+
end
|
40
|
+
it 'assigns options to environment_directory attribute' do
|
41
|
+
expect(subject.environment_directory).to eq(opts[:environment_directory])
|
42
|
+
end
|
43
|
+
it 'assigns options to role_directory attribute' do
|
44
|
+
expect(subject.role_directory).to eq(opts[:role_directory])
|
45
|
+
end
|
46
|
+
it 'assigns options to temp_directory attribute' do
|
47
|
+
expect(subject.temp_directory).to eq(opts[:temp_directory])
|
48
|
+
end
|
49
|
+
it 'assigns options to bags attribute' do
|
50
|
+
expect(subject.bags).to eq(opts[:bags])
|
51
|
+
end
|
52
|
+
it 'can correctly convert to a hash' do
|
53
|
+
hash = subject.to_hash
|
54
|
+
expect(hash[:repo_root]).to eq(opts[:repo_root])
|
55
|
+
end
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
it "assigns environment_directory to environments off root" do
|
68
|
-
expect(subject.environment_directory).to eq(File.join(subject.repo_root, "environments"))
|
69
|
-
end
|
70
|
-
it "assigns role_directory to roles off root" do
|
71
|
-
expect(subject.role_directory).to eq(File.join(subject.repo_root, "roles"))
|
72
|
-
end
|
73
|
-
it "assigns temp_directory to tmp" do
|
74
|
-
expect(subject.temp_directory).to eq("/tmp/promote")
|
75
|
-
end
|
76
|
-
end
|
57
|
+
context 'directories are not in options' do
|
58
|
+
let(:opts) do
|
59
|
+
{
|
60
|
+
node_name: 'user',
|
61
|
+
client_key: 'key',
|
62
|
+
chef_server_url: 'url'
|
63
|
+
}
|
64
|
+
end
|
77
65
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
66
|
+
it 'assigns repo_root to pwd' do
|
67
|
+
expect(repo_root).to eq(Dir.pwd)
|
68
|
+
end
|
69
|
+
it 'assigns cookbook_directory to cookbooks off root' do
|
70
|
+
expect(subject.cookbook_directory).to eq("#{repo_root}/cookbooks")
|
71
|
+
end
|
72
|
+
it 'assigns data_bag_directory to data_bags off root' do
|
73
|
+
expect(subject.data_bag_directory).to eq("#{repo_root}/data_bags")
|
74
|
+
end
|
75
|
+
it 'assigns environment_directory to environments off root' do
|
76
|
+
expect(subject.environment_directory).to eq("#{repo_root}/environments")
|
77
|
+
end
|
78
|
+
it 'assigns role_directory to roles off root' do
|
79
|
+
expect(subject.role_directory).to eq("#{repo_root}/roles")
|
80
|
+
end
|
81
|
+
it 'assigns temp_directory to tmp' do
|
82
|
+
expect(subject.temp_directory).to eq('/tmp/promote')
|
83
|
+
end
|
84
|
+
end
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
86
|
+
context 'no --data-bag option is specified' do
|
87
|
+
let(:opts) do
|
88
|
+
{
|
89
|
+
node_name: 'user',
|
90
|
+
client_key: 'key',
|
91
|
+
chef_server_url: 'url'
|
92
|
+
}
|
93
|
+
end
|
88
94
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
:client_key => "key",
|
94
|
-
:chef_server_url => "url"}}
|
95
|
+
it 'defaults to secrets_*' do
|
96
|
+
expect(subject.bags).to eq(['secrets_*'])
|
97
|
+
end
|
98
|
+
end
|
95
99
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
it "assigns environment_directory to environments off root" do
|
106
|
-
expect(subject.environment_directory).to eq(File.join(subject.repo_root, "environments"))
|
107
|
-
end
|
108
|
-
it "assigns role_directory to roles off root" do
|
109
|
-
expect(subject.role_directory).to eq(File.join(subject.repo_root, "roles"))
|
110
|
-
end
|
111
|
-
it "assigns temp_directory to tmp" do
|
112
|
-
expect(subject.temp_directory).to eq("/tmp/promote")
|
113
|
-
end
|
114
|
-
end
|
100
|
+
context 'directories are not in options but repo root is' do
|
101
|
+
let(:opts) do
|
102
|
+
{
|
103
|
+
repo_root: 'root',
|
104
|
+
node_name: 'user',
|
105
|
+
client_key: 'key',
|
106
|
+
chef_server_url: 'url'
|
107
|
+
}
|
108
|
+
end
|
115
109
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
110
|
+
it 'assigns repo_root to pwd' do
|
111
|
+
expect(repo_root).to eq(opts[:repo_root])
|
112
|
+
end
|
113
|
+
it 'assigns cookbook_directory to cookbooks off root' do
|
114
|
+
expect(subject.cookbook_directory).to eq("#{repo_root}/cookbooks")
|
115
|
+
end
|
116
|
+
it 'assigns data_bag_directory to data_bags off root' do
|
117
|
+
expect(subject.data_bag_directory).to eq("#{repo_root}/data_bags")
|
118
|
+
end
|
119
|
+
it 'assigns environment_directory to environments off root' do
|
120
|
+
expect(subject.environment_directory).to eq("#{repo_root}/environments")
|
121
|
+
end
|
122
|
+
it 'assigns role_directory to roles off root' do
|
123
|
+
expect(subject.role_directory).to eq("#{repo_root}/roles")
|
124
|
+
end
|
125
|
+
it 'assigns temp_directory to tmp' do
|
126
|
+
expect(subject.temp_directory).to eq('/tmp/promote')
|
127
|
+
end
|
128
|
+
end
|
120
129
|
|
121
|
-
|
122
|
-
|
123
|
-
opts[:temp_directory] = "/tmp/promote_tests"
|
124
|
-
Dir.mkdir(opts[:temp_directory])
|
125
|
-
FileUtils.touch(File.join(opts[:temp_directory], 'file.txt'))
|
126
|
-
}
|
130
|
+
context 'reset_temp_dir' do
|
131
|
+
after { FileUtils.rm_rf(opts[:temp_directory]) }
|
127
132
|
|
128
|
-
|
129
|
-
|
133
|
+
context 'temp dir is populated' do
|
134
|
+
before do
|
135
|
+
opts[:temp_directory] = '/tmp/promote_tests'
|
136
|
+
Dir.mkdir(opts[:temp_directory])
|
137
|
+
FileUtils.touch(File.join(opts[:temp_directory], 'file.txt'))
|
138
|
+
end
|
130
139
|
|
131
|
-
|
132
|
-
|
133
|
-
end
|
140
|
+
it 'empties the temp directory' do
|
141
|
+
subject.reset_temp_dir
|
134
142
|
|
135
|
-
|
143
|
+
expect(Dir[File.join(subject.temp_directory, '*')]).to be_empty
|
144
|
+
end
|
145
|
+
end
|
136
146
|
|
137
|
-
|
138
|
-
|
147
|
+
context 'temp dir is populated' do
|
148
|
+
it 'creates the temp directory' do
|
149
|
+
subject.reset_temp_dir
|
139
150
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
151
|
+
expect(Dir).to exist(subject.temp_directory)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
144
155
|
end
|
@@ -16,7 +16,7 @@ describe Promote::Cookbook do
|
|
16
16
|
|
17
17
|
subject { Promote::Cookbook.new('cookbook_1', config) }
|
18
18
|
|
19
|
-
describe
|
19
|
+
describe 'dependencies' do
|
20
20
|
before {
|
21
21
|
allow(Berkshelf::Berksfile).to receive(:from_file).and_return(fake_berks)
|
22
22
|
allow(fake_berks).to receive(:list).and_return([
|
@@ -26,7 +26,7 @@ describe Promote::Cookbook do
|
|
26
26
|
])
|
27
27
|
}
|
28
28
|
|
29
|
-
it
|
29
|
+
it 'returns dependencies from lockfile' do
|
30
30
|
expect(subject.dependencies.keys.count).to be 3
|
31
31
|
expect(subject.dependencies['cookbook_2'].to_s).to eq '1.1.1'
|
32
32
|
expect(subject.dependencies['cookbook_3'].to_s).to eq '2.2.2'
|
@@ -34,84 +34,84 @@ describe Promote::Cookbook do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
describe
|
37
|
+
describe 'metadata_dependencies' do
|
38
38
|
|
39
|
-
it
|
39
|
+
it 'returns dependencies from metadata.rb' do
|
40
40
|
expect(subject.metadata_dependencies.keys.count).to be 1
|
41
41
|
expect(subject.metadata_dependencies['cookbook_2'].to_s).to eq '= 1.1.1'
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
describe
|
45
|
+
describe 'path' do
|
46
46
|
|
47
|
-
it
|
47
|
+
it 'returns the correct path of the cookbook' do
|
48
48
|
expect(subject.path).to eq(File.join(cookbook_dir, 'cookbook_1'))
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
describe
|
52
|
+
describe 'version' do
|
53
53
|
|
54
|
-
it
|
54
|
+
it 'reads the current version' do
|
55
55
|
expect(subject.version.to_s).to eq('1.0.0')
|
56
56
|
end
|
57
57
|
|
58
|
-
it
|
58
|
+
it 'writes changed version to metadata.rb' do
|
59
59
|
subject.version = Semverse::Version.new('2.2.2')
|
60
60
|
expect(Promote::Cookbook.new('cookbook_1', config).version.to_s).to eq '2.2.2'
|
61
61
|
end
|
62
62
|
|
63
|
-
it
|
63
|
+
it 'returns the new version after a version has changed' do
|
64
64
|
subject.version = Semverse::Version.new('2.2.2')
|
65
65
|
expect(subject.version.to_s).to eq('2.2.2')
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
describe
|
70
|
-
it
|
69
|
+
describe 'stamp_commit' do
|
70
|
+
it 'writes the sha1 to the end of the metadata file' do
|
71
71
|
subject.stamp_commit('commit_1')
|
72
72
|
expect(subject.raw_metadata).to end_with "\n#sha1 'commit_1'"
|
73
73
|
end
|
74
74
|
|
75
|
-
it
|
75
|
+
it 'does not write the sha1 m ore than once' do
|
76
76
|
subject.stamp_commit('commit_1')
|
77
77
|
subject.stamp_commit('commit_2')
|
78
|
-
expect(subject.raw_metadata).not_to include
|
78
|
+
expect(subject.raw_metadata).not_to include 'commit_1'
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe
|
82
|
+
describe 'sync_berksfile' do
|
83
83
|
before {
|
84
84
|
allow(File).to receive(:exist?).with(/Berksfile$/).and_return(true)
|
85
85
|
allow(File).to receive(:exist?).with(/Berksfile.lock/).and_return(true)
|
86
86
|
}
|
87
87
|
|
88
|
-
it
|
88
|
+
it 'Installs berks dependencies' do
|
89
89
|
dummy = double('berksfile')
|
90
90
|
expect(Berkshelf::Berksfile).to receive(:from_file).with(
|
91
|
-
File.join(subject.path,
|
91
|
+
File.join(subject.path, 'Berksfile')).and_return(dummy)
|
92
92
|
expect(dummy).to receive(:install)
|
93
93
|
|
94
94
|
subject.sync_berksfile
|
95
95
|
end
|
96
96
|
|
97
|
-
it
|
97
|
+
it 'Updates berks dependencies when asked to update' do
|
98
98
|
dummy = double('berksfile')
|
99
99
|
expect(Berkshelf::Berksfile).to receive(:from_file).with(
|
100
|
-
File.join(subject.path,
|
100
|
+
File.join(subject.path, 'Berksfile')).and_return(dummy)
|
101
101
|
expect(dummy).to receive(:update)
|
102
102
|
|
103
103
|
subject.sync_berksfile(true)
|
104
104
|
end
|
105
105
|
|
106
|
-
context
|
106
|
+
context 'update berksfile with no lock file' do
|
107
107
|
before {
|
108
108
|
allow(File).to receive(:exist?).with(/Berksfile.lock/).and_return(false)
|
109
109
|
}
|
110
110
|
|
111
|
-
it
|
111
|
+
it 'Installs berks dependencies instead of update' do
|
112
112
|
dummy = double('berksfile')
|
113
113
|
expect(Berkshelf::Berksfile).to receive(:from_file).with(
|
114
|
-
File.join(subject.path,
|
114
|
+
File.join(subject.path, 'Berksfile')).and_return(dummy)
|
115
115
|
expect(dummy).to receive(:install)
|
116
116
|
|
117
117
|
subject.sync_berksfile(true)
|
@@ -119,7 +119,7 @@ describe Promote::Cookbook do
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
describe
|
122
|
+
describe 'dependencies_changed_after_update?' do
|
123
123
|
before {
|
124
124
|
allow(File).to receive(:exist?).and_return(true)
|
125
125
|
allow(Berkshelf::Berksfile).to receive(:from_file).and_return(fake_berks)
|
@@ -130,12 +130,12 @@ describe Promote::Cookbook do
|
|
130
130
|
])
|
131
131
|
}
|
132
132
|
|
133
|
-
it
|
133
|
+
it 'performs a berks update' do
|
134
134
|
expect(fake_berks).to receive(:update)
|
135
135
|
subject.dependencies_changed_after_update?
|
136
136
|
end
|
137
137
|
|
138
|
-
context
|
138
|
+
context 'there is no change' do
|
139
139
|
|
140
140
|
before {
|
141
141
|
allow(fake_berks).to receive(:list).and_return(
|
@@ -152,12 +152,12 @@ describe Promote::Cookbook do
|
|
152
152
|
)
|
153
153
|
}
|
154
154
|
|
155
|
-
it
|
155
|
+
it 'returns false' do
|
156
156
|
expect(subject.dependencies_changed_after_update?).to be false
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
-
context
|
160
|
+
context 'there is a version change' do
|
161
161
|
|
162
162
|
before {
|
163
163
|
allow(Berkshelf::Berksfile).to receive(:from_file).and_return(fake_berks)
|
@@ -175,12 +175,12 @@ describe Promote::Cookbook do
|
|
175
175
|
)
|
176
176
|
}
|
177
177
|
|
178
|
-
it
|
178
|
+
it 'returns true' do
|
179
179
|
expect(subject.dependencies_changed_after_update?).to be true
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
-
context
|
183
|
+
context 'a dependency is removed' do
|
184
184
|
|
185
185
|
before {
|
186
186
|
allow(Berkshelf::Berksfile).to receive(:from_file).and_return(fake_berks)
|
@@ -197,12 +197,12 @@ describe Promote::Cookbook do
|
|
197
197
|
)
|
198
198
|
}
|
199
199
|
|
200
|
-
it
|
200
|
+
it 'returns true' do
|
201
201
|
expect(subject.dependencies_changed_after_update?).to be true
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
205
|
-
context
|
205
|
+
context 'a dependency is added' do
|
206
206
|
|
207
207
|
before {
|
208
208
|
allow(Berkshelf::Berksfile).to receive(:from_file).and_return(fake_berks)
|
@@ -221,12 +221,12 @@ describe Promote::Cookbook do
|
|
221
221
|
)
|
222
222
|
}
|
223
223
|
|
224
|
-
it
|
224
|
+
it 'returns true' do
|
225
225
|
expect(subject.dependencies_changed_after_update?).to be true
|
226
226
|
end
|
227
227
|
end
|
228
228
|
|
229
|
-
context
|
229
|
+
context 'the cookbook under test has changed' do
|
230
230
|
|
231
231
|
before {
|
232
232
|
allow(Berkshelf::Berksfile).to receive(:from_file).and_return(fake_berks)
|
@@ -242,7 +242,7 @@ describe Promote::Cookbook do
|
|
242
242
|
)
|
243
243
|
}
|
244
244
|
|
245
|
-
it
|
245
|
+
it 'returns false' do
|
246
246
|
expect(subject.dependencies_changed_after_update?).to be false
|
247
247
|
end
|
248
248
|
end
|