ridley 4.2.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile +1 -1
  4. data/README.md +4 -4
  5. data/lib/ridley/connection.rb +1 -2
  6. data/lib/ridley/errors.rb +1 -0
  7. data/lib/ridley/mixin/params_validate.rb +4 -0
  8. data/lib/ridley/version.rb +1 -1
  9. data/ridley.gemspec +2 -2
  10. data/spec/acceptance/client_resource_spec.rb +12 -12
  11. data/spec/acceptance/cookbook_resource_spec.rb +15 -15
  12. data/spec/acceptance/data_bag_item_resource_spec.rb +14 -14
  13. data/spec/acceptance/data_bag_resource_spec.rb +4 -4
  14. data/spec/acceptance/environment_resource_spec.rb +14 -14
  15. data/spec/acceptance/node_resource_spec.rb +15 -15
  16. data/spec/acceptance/role_resource_spec.rb +14 -14
  17. data/spec/acceptance/sandbox_resource_spec.rb +3 -3
  18. data/spec/acceptance/search_resource_spec.rb +6 -6
  19. data/spec/acceptance/user_resource_spec.rb +21 -21
  20. data/spec/support/each_matcher.rb +2 -2
  21. data/spec/support/filepath_matchers.rb +2 -2
  22. data/spec/support/shared_examples/ridley_resource.rb +39 -39
  23. data/spec/unit/ridley/chef/cookbook/metadata_spec.rb +8 -8
  24. data/spec/unit/ridley/chef/cookbook/syntax_check_spec.rb +15 -15
  25. data/spec/unit/ridley/chef/cookbook_spec.rb +124 -118
  26. data/spec/unit/ridley/chef/digester_spec.rb +2 -2
  27. data/spec/unit/ridley/chef_object_spec.rb +35 -35
  28. data/spec/unit/ridley/chef_objects/client_object_spec.rb +2 -2
  29. data/spec/unit/ridley/chef_objects/cookbook_object_spec.rb +12 -12
  30. data/spec/unit/ridley/chef_objects/data_bag_item_object_spec.rb +7 -7
  31. data/spec/unit/ridley/chef_objects/data_bag_object_spec.rb +4 -1
  32. data/spec/unit/ridley/chef_objects/environment_object_spec.rb +10 -10
  33. data/spec/unit/ridley/chef_objects/node_object_spec.rb +28 -28
  34. data/spec/unit/ridley/chef_objects/role_object_spec.rb +10 -10
  35. data/spec/unit/ridley/chef_objects/sandbox_object_spec.rb +6 -6
  36. data/spec/unit/ridley/client_spec.rb +59 -21
  37. data/spec/unit/ridley/connection_spec.rb +7 -7
  38. data/spec/unit/ridley/errors_spec.rb +3 -3
  39. data/spec/unit/ridley/middleware/chef_auth_spec.rb +2 -2
  40. data/spec/unit/ridley/middleware/chef_response_spec.rb +29 -29
  41. data/spec/unit/ridley/middleware/parse_json_spec.rb +14 -14
  42. data/spec/unit/ridley/mixins/from_file_spec.rb +3 -3
  43. data/spec/unit/ridley/resource_spec.rb +5 -5
  44. data/spec/unit/ridley/resources/cookbook_resource_spec.rb +10 -10
  45. data/spec/unit/ridley/resources/data_bag_item_resource_spec.rb +1 -1
  46. data/spec/unit/ridley/resources/data_bag_resource_spec.rb +6 -3
  47. data/spec/unit/ridley/resources/environment_resource_spec.rb +4 -4
  48. data/spec/unit/ridley/resources/role_resource_spec.rb +1 -1
  49. data/spec/unit/ridley/resources/sandbox_resource_spec.rb +7 -7
  50. data/spec/unit/ridley/resources/search_resource_spec.rb +22 -22
  51. data/spec/unit/ridley/sandbox_uploader_spec.rb +3 -3
  52. data/spec/unit/ridley_spec.rb +6 -6
  53. metadata +15 -18
  54. data/lib/ridley/middleware/gzip.rb +0 -18
  55. data/spec/unit/ridley/middleware/gzip_spec.rb +0 -59
@@ -17,36 +17,36 @@ describe Ridley::Chef::Cookbook::Metadata do
17
17
  :choice => [ "test1", "test2" ],
18
18
  :default => "test1"
19
19
  }
20
- lambda {
20
+ expect {
21
21
  subject.attribute("test_cookbook/test", options)
22
- }.should_not raise_error
22
+ }.not_to raise_error
23
23
 
24
24
  options = {
25
25
  :type => "boolean",
26
26
  :choice => [ true, false ],
27
27
  :default => true
28
28
  }
29
- lambda {
29
+ expect {
30
30
  subject.attribute("test_cookbook/test", options)
31
- }.should_not raise_error
31
+ }.not_to raise_error
32
32
 
33
33
  options = {
34
34
  :type => "numeric",
35
35
  :choice => [ 1337, 420 ],
36
36
  :default => 1337
37
37
  }
38
- lambda {
38
+ expect {
39
39
  subject.attribute("test_cookbook/test", options)
40
- }.should_not raise_error
40
+ }.not_to raise_error
41
41
 
42
42
  options = {
43
43
  :type => "numeric",
44
44
  :choice => [ true, "false" ],
45
45
  :default => false
46
46
  }
47
- lambda {
47
+ expect {
48
48
  subject.attribute("test_cookbook/test", options)
49
- }.should raise_error
49
+ }.to raise_error
50
50
  end
51
51
  end
52
52
  end
@@ -12,7 +12,7 @@ describe Ridley::Chef::Cookbook::SyntaxCheck do
12
12
  subject { syntax_check }
13
13
 
14
14
  before(:each) do
15
- subject.stub(:chefignore) { chefignore }
15
+ allow(subject).to receive(:chefignore) { chefignore }
16
16
  end
17
17
 
18
18
  describe "#ruby_files" do
@@ -55,7 +55,7 @@ describe Ridley::Chef::Cookbook::SyntaxCheck do
55
55
  it "checks if a file has already been validated" do
56
56
  valid_template_file = cookbook_dir.join("templates/default/temp.txt.erb").to_s
57
57
  subject.validated(valid_template_file)
58
- expect(subject.validated?(valid_template_file)).to be_true
58
+ expect(subject.validated?(valid_template_file)).to be_truthy
59
59
  end
60
60
  end
61
61
 
@@ -63,7 +63,7 @@ describe Ridley::Chef::Cookbook::SyntaxCheck do
63
63
  let(:validated_files) { double('validated_files') }
64
64
 
65
65
  before(:each) do
66
- subject.stub(:validated_files) { validated_files }
66
+ allow(subject).to receive(:validated_files) { validated_files }
67
67
  end
68
68
 
69
69
  it "records a file as validated" do
@@ -77,35 +77,35 @@ describe Ridley::Chef::Cookbook::SyntaxCheck do
77
77
 
78
78
  describe "#validate_ruby_files" do
79
79
  it "asks #untested_ruby_files for a list of files and calls #validate_ruby_file on each" do
80
- subject.stub(:validate_ruby_file).with(anything()).exactly(9).times { true }
81
- expect(subject.validate_ruby_files).to be_true
80
+ allow(subject).to receive(:validate_ruby_file).with(anything()).exactly(9).times { true }
81
+ expect(subject.validate_ruby_files).to be_truthy
82
82
  end
83
83
 
84
84
  it "marks the successfully validated ruby files" do
85
- subject.stub(:validated).with(anything()).exactly(9).times
86
- expect(subject.validate_ruby_files).to be_true
85
+ allow(subject).to receive(:validated).with(anything()).exactly(9).times
86
+ expect(subject.validate_ruby_files).to be_truthy
87
87
  end
88
88
 
89
89
  it "returns false if any ruby file fails to validate" do
90
- subject.stub(:validate_ruby_file).with(/\.rb$/) { false }
91
- expect(subject.validate_ruby_files).to be_false
90
+ allow(subject).to receive(:validate_ruby_file).with(/\.rb$/) { false }
91
+ expect(subject.validate_ruby_files).to be_falsey
92
92
  end
93
93
  end
94
94
 
95
95
  describe "#validate_templates" do
96
96
  it "asks #untested_template_files for a list of erb files and calls #validate_template on each" do
97
- subject.stub(:validate_template).with(anything()).exactly(9).times { true }
98
- expect(subject.validate_templates).to be_true
97
+ allow(subject).to receive(:validate_template).with(anything()).exactly(9).times { true }
98
+ expect(subject.validate_templates).to be_truthy
99
99
  end
100
100
 
101
101
  it "marks the successfully validated erb files" do
102
- subject.stub(:validated).with(anything()).exactly(9).times
103
- expect(subject.validate_templates).to be_true
102
+ allow(subject).to receive(:validated).with(anything()).exactly(9).times
103
+ expect(subject.validate_templates).to be_truthy
104
104
  end
105
105
 
106
106
  it "returns false if any erb file fails to validate" do
107
- subject.stub(:validate_template).with(/\.erb$/) { false }
108
- expect(subject.validate_templates).to be_false
107
+ allow(subject).to receive(:validate_template).with(/\.erb$/) { false }
108
+ expect(subject.validate_templates).to be_falsey
109
109
  end
110
110
  end
111
111
 
@@ -8,18 +8,18 @@ describe Ridley::Chef::Cookbook do
8
8
  let(:cookbook_path) { fixtures_path.join("example_cookbook") }
9
9
 
10
10
  it "returns an instance of Ridley::Chef::Cookbook" do
11
- subject.from_path(cookbook_path).should be_a(described_class)
11
+ expect(subject.from_path(cookbook_path)).to be_a(described_class)
12
12
  end
13
13
 
14
14
  it "has a cookbook_name attribute set to the value of the 'name' attribute in the metadata" do
15
- subject.from_path(cookbook_path).cookbook_name.should eql("example_cookbook")
15
+ expect(subject.from_path(cookbook_path).cookbook_name).to eql("example_cookbook")
16
16
  end
17
17
 
18
18
  context "given a path that does not contain a metadata file" do
19
19
  it "raises an IOError" do
20
- lambda {
20
+ expect {
21
21
  subject.from_path(Dir.mktmpdir)
22
- }.should raise_error(IOError)
22
+ }.to raise_error(IOError)
23
23
  end
24
24
  end
25
25
 
@@ -51,7 +51,7 @@ describe Ridley::Chef::Cookbook do
51
51
  end
52
52
 
53
53
  it "sets the name of the cookbook from the metadata.rb" do
54
- subject.from_path(cookbook_path).cookbook_name.should eql("rspec_test")
54
+ expect(subject.from_path(cookbook_path).cookbook_name).to eql("rspec_test")
55
55
  end
56
56
  end
57
57
 
@@ -73,7 +73,7 @@ describe Ridley::Chef::Cookbook do
73
73
  end
74
74
 
75
75
  it "prefers the metadata.json" do
76
- subject.from_path(cookbook_path).cookbook_name.should eql("json_metadata")
76
+ expect(subject.from_path(cookbook_path).cookbook_name).to eql("json_metadata")
77
77
  end
78
78
  end
79
79
  end
@@ -81,7 +81,7 @@ describe Ridley::Chef::Cookbook do
81
81
  describe "::checksum" do
82
82
  it "delegates to Ridley::Chef::Digester.md5_checksum_for_file" do
83
83
  path = fixtures_path.join("example_cookbook", "metadata.rb")
84
- Ridley::Chef::Digester.should_receive(:md5_checksum_for_file).with(path)
84
+ expect(Ridley::Chef::Digester).to receive(:md5_checksum_for_file).with(path)
85
85
 
86
86
  subject.checksum(path)
87
87
  end
@@ -96,11 +96,11 @@ describe Ridley::Chef::Cookbook do
96
96
 
97
97
  describe "#checksums" do
98
98
  it "returns a Hash" do
99
- subject.checksums.should be_a(Hash)
99
+ expect(subject.checksums).to be_a(Hash)
100
100
  end
101
101
 
102
102
  it "has a key value for every cookbook file" do
103
- subject.checksums.should have(subject.send(:files).length).items
103
+ expect(subject.checksums.size).to eq(subject.send(:files).length)
104
104
  end
105
105
  end
106
106
 
@@ -118,10 +118,10 @@ describe Ridley::Chef::Cookbook do
118
118
  end
119
119
 
120
120
  it "compiles the raw metadata.rb into a metadata.json file in the path of the cookbook" do
121
- expect(subject.compiled_metadata?).to be_false
121
+ expect(subject.compiled_metadata?).to be_falsey
122
122
  subject.compile_metadata
123
123
  subject.reload
124
- expect(subject.compiled_metadata?).to be_true
124
+ expect(subject.compiled_metadata?).to be_truthy
125
125
  expect(subject.cookbook_name).to eql("rspec_test")
126
126
  expect(subject.version).to eql("1.2.3")
127
127
  end
@@ -132,7 +132,7 @@ describe Ridley::Chef::Cookbook do
132
132
 
133
133
  it "writes the compiled metadata to a metadata.json file at the given out path" do
134
134
  subject.compile_metadata(out_path)
135
- expect(File.exist?(File.join(out_path, "metadata.json"))).to be_true
135
+ expect(File.exist?(File.join(out_path, "metadata.json"))).to be_truthy
136
136
  end
137
137
  end
138
138
  end
@@ -152,7 +152,10 @@ describe Ridley::Chef::Cookbook do
152
152
  end
153
153
  end
154
154
 
155
- its(:compiled_metadata?) { should be_true }
155
+ describe '#compiled_metadata?' do
156
+ subject { super().compiled_metadata? }
157
+ it { is_expected.to be_truthy }
158
+ end
156
159
  end
157
160
 
158
161
  context "when a metadata.json file is not present" do
@@ -164,7 +167,10 @@ describe Ridley::Chef::Cookbook do
164
167
  end
165
168
  end
166
169
 
167
- its(:compiled_metadata?) { should be_false }
170
+ describe '#compiled_metadata?' do
171
+ subject { super().compiled_metadata? }
172
+ it { is_expected.to be_falsey }
173
+ end
168
174
  end
169
175
  end
170
176
 
@@ -181,7 +187,7 @@ describe Ridley::Chef::Cookbook do
181
187
  :providers,
182
188
  :root_files
183
189
  ].each do |category|
184
- subject.manifest.should have_key(category)
190
+ expect(subject.manifest).to have_key(category)
185
191
  end
186
192
  end
187
193
  end
@@ -190,31 +196,31 @@ describe Ridley::Chef::Cookbook do
190
196
  let(:syntax_checker) { double('syntax_checker') }
191
197
 
192
198
  before(:each) do
193
- subject.stub(:syntax_checker) { syntax_checker }
199
+ allow(subject).to receive(:syntax_checker) { syntax_checker }
194
200
  end
195
201
 
196
202
  it "asks the syntax_checker to validate the ruby and template files of the cookbook" do
197
- syntax_checker.should_receive(:validate_ruby_files).and_return(true)
198
- syntax_checker.should_receive(:validate_templates).and_return(true)
203
+ expect(syntax_checker).to receive(:validate_ruby_files).and_return(true)
204
+ expect(syntax_checker).to receive(:validate_templates).and_return(true)
199
205
 
200
206
  subject.validate
201
207
  end
202
208
 
203
209
  it "raises CookbookSyntaxError if the cookbook contains invalid ruby files" do
204
- syntax_checker.should_receive(:validate_ruby_files).and_return(false)
210
+ expect(syntax_checker).to receive(:validate_ruby_files).and_return(false)
205
211
 
206
- lambda {
212
+ expect {
207
213
  subject.validate
208
- }.should raise_error(Ridley::Errors::CookbookSyntaxError)
214
+ }.to raise_error(Ridley::Errors::CookbookSyntaxError)
209
215
  end
210
216
 
211
217
  it "raises CookbookSyntaxError if the cookbook contains invalid template files" do
212
- syntax_checker.should_receive(:validate_ruby_files).and_return(true)
213
- syntax_checker.should_receive(:validate_templates).and_return(false)
218
+ expect(syntax_checker).to receive(:validate_ruby_files).and_return(true)
219
+ expect(syntax_checker).to receive(:validate_templates).and_return(false)
214
220
 
215
- lambda {
221
+ expect {
216
222
  subject.validate
217
- }.should raise_error(Ridley::Errors::CookbookSyntaxError)
223
+ }.to raise_error(Ridley::Errors::CookbookSyntaxError)
218
224
  end
219
225
  end
220
226
 
@@ -223,23 +229,23 @@ describe Ridley::Chef::Cookbook do
223
229
  before(:each) { @metadata = subject.file_metadata(:file, file) }
224
230
 
225
231
  it "has a :path key whose value is a relative path from the CachedCookbook's path" do
226
- @metadata.should have_key(:path)
227
- @metadata[:path].should be_relative_path
228
- @metadata[:path].should eql("files/default/file.h")
232
+ expect(@metadata).to have_key(:path)
233
+ expect(@metadata[:path]).to be_relative_path
234
+ expect(@metadata[:path]).to eql("files/default/file.h")
229
235
  end
230
236
 
231
237
  it "has a :name key whose value is the basename of the target file" do
232
- @metadata.should have_key(:name)
233
- @metadata[:name].should eql("file.h")
238
+ expect(@metadata).to have_key(:name)
239
+ expect(@metadata[:name]).to eql("file.h")
234
240
  end
235
241
 
236
242
  it "has a :checksum key whose value is the checksum of the target file" do
237
- @metadata.should have_key(:checksum)
238
- @metadata[:checksum].should eql("7b1ebd2ff580ca9dc46fb27ec1653bf2")
243
+ expect(@metadata).to have_key(:checksum)
244
+ expect(@metadata[:checksum]).to eql("7b1ebd2ff580ca9dc46fb27ec1653bf2")
239
245
  end
240
246
 
241
247
  it "has a :specificity key" do
242
- @metadata.should have_key(:specificity)
248
+ expect(@metadata).to have_key(:specificity)
243
249
  end
244
250
 
245
251
  context "given a file or template in a 'default' directory" do
@@ -247,7 +253,7 @@ describe Ridley::Chef::Cookbook do
247
253
  before(:each) { @metadata = subject.file_metadata(:files, file) }
248
254
 
249
255
  it "has a specificity of 'default'" do
250
- @metadata[:specificity].should eql("default")
256
+ expect(@metadata[:specificity]).to eql("default")
251
257
  end
252
258
  end
253
259
 
@@ -256,7 +262,7 @@ describe Ridley::Chef::Cookbook do
256
262
  before(:each) { @metadata = subject.file_metadata(:files, file) }
257
263
 
258
264
  it "has a specificity of 'ubuntu'" do
259
- @metadata[:specificity].should eql("ubuntu")
265
+ expect(@metadata[:specificity]).to eql("ubuntu")
260
266
  end
261
267
  end
262
268
  end
@@ -271,7 +277,7 @@ describe Ridley::Chef::Cookbook do
271
277
  let(:category) { :recipes }
272
278
 
273
279
  it "has a specificity of 'default'" do
274
- @specificity.should eql("default")
280
+ expect(@specificity).to eql("default")
275
281
  end
276
282
  end
277
283
 
@@ -279,7 +285,7 @@ describe Ridley::Chef::Cookbook do
279
285
  let(:relpath) { 'default/config.erb' }
280
286
 
281
287
  it "has a specificity of 'default'" do
282
- @specificity.should eql("default")
288
+ expect(@specificity).to eql("default")
283
289
  end
284
290
  end
285
291
 
@@ -287,7 +293,7 @@ describe Ridley::Chef::Cookbook do
287
293
  let(:relpath) { 'centos/config.erb' }
288
294
 
289
295
  it "has a specificity of 'centos'" do
290
- @specificity.should eql("centos")
296
+ expect(@specificity).to eql("centos")
291
297
  end
292
298
  end
293
299
 
@@ -295,7 +301,7 @@ describe Ridley::Chef::Cookbook do
295
301
  let(:relpath) { 'config.erb' }
296
302
 
297
303
  it "has a specificity of 'root_default'" do
298
- @specificity.should eql("root_default")
304
+ expect(@specificity).to eql("root_default")
299
305
  end
300
306
  end
301
307
  end
@@ -304,255 +310,255 @@ describe Ridley::Chef::Cookbook do
304
310
  subject { cookbook.to_hash }
305
311
 
306
312
  it "has a :frozen? flag" do
307
- subject.should have_key(:frozen?)
313
+ expect(subject).to have_key(:frozen?)
308
314
  end
309
315
 
310
316
  it "has a :recipes key with a value of an Array Hashes" do
311
- subject.should have_key(:recipes)
312
- subject[:recipes].should be_a(Array)
317
+ expect(subject).to have_key(:recipes)
318
+ expect(subject[:recipes]).to be_a(Array)
313
319
  subject[:recipes].each do |item|
314
- item.should be_a(Hash)
320
+ expect(item).to be_a(Hash)
315
321
  end
316
322
  end
317
323
 
318
324
  it "has a :name key value pair in a Hash of the :recipes Array of Hashes" do
319
- subject[:recipes].first.should have_key(:name)
325
+ expect(subject[:recipes].first).to have_key(:name)
320
326
  end
321
327
 
322
328
  it "has a :path key value pair in a Hash of the :recipes Array of Hashes" do
323
- subject[:recipes].first.should have_key(:path)
329
+ expect(subject[:recipes].first).to have_key(:path)
324
330
  end
325
331
 
326
332
  it "has a :checksum key value pair in a Hash of the :recipes Array of Hashes" do
327
- subject[:recipes].first.should have_key(:checksum)
333
+ expect(subject[:recipes].first).to have_key(:checksum)
328
334
  end
329
335
 
330
336
  it "has a :specificity key value pair in a Hash of the :recipes Array of Hashes" do
331
- subject[:recipes].first.should have_key(:specificity)
337
+ expect(subject[:recipes].first).to have_key(:specificity)
332
338
  end
333
339
 
334
340
  it "has a :definitions key with a value of an Array Hashes" do
335
- subject.should have_key(:definitions)
336
- subject[:definitions].should be_a(Array)
341
+ expect(subject).to have_key(:definitions)
342
+ expect(subject[:definitions]).to be_a(Array)
337
343
  subject[:definitions].each do |item|
338
- item.should be_a(Hash)
344
+ expect(item).to be_a(Hash)
339
345
  end
340
346
  end
341
347
 
342
348
  it "has a :name key value pair in a Hash of the :definitions Array of Hashes" do
343
- subject[:definitions].first.should have_key(:name)
349
+ expect(subject[:definitions].first).to have_key(:name)
344
350
  end
345
351
 
346
352
  it "has a :path key value pair in a Hash of the :definitions Array of Hashes" do
347
- subject[:definitions].first.should have_key(:path)
353
+ expect(subject[:definitions].first).to have_key(:path)
348
354
  end
349
355
 
350
356
  it "has a :checksum key value pair in a Hash of the :definitions Array of Hashes" do
351
- subject[:definitions].first.should have_key(:checksum)
357
+ expect(subject[:definitions].first).to have_key(:checksum)
352
358
  end
353
359
 
354
360
  it "has a :specificity key value pair in a Hash of the :definitions Array of Hashes" do
355
- subject[:definitions].first.should have_key(:specificity)
361
+ expect(subject[:definitions].first).to have_key(:specificity)
356
362
  end
357
363
 
358
364
  it "has a :libraries key with a value of an Array Hashes" do
359
- subject.should have_key(:libraries)
360
- subject[:libraries].should be_a(Array)
365
+ expect(subject).to have_key(:libraries)
366
+ expect(subject[:libraries]).to be_a(Array)
361
367
  subject[:libraries].each do |item|
362
- item.should be_a(Hash)
368
+ expect(item).to be_a(Hash)
363
369
  end
364
370
  end
365
371
 
366
372
  it "has a :name key value pair in a Hash of the :libraries Array of Hashes" do
367
- subject[:libraries].first.should have_key(:name)
373
+ expect(subject[:libraries].first).to have_key(:name)
368
374
  end
369
375
 
370
376
  it "has a :path key value pair in a Hash of the :libraries Array of Hashes" do
371
- subject[:libraries].first.should have_key(:path)
377
+ expect(subject[:libraries].first).to have_key(:path)
372
378
  end
373
379
 
374
380
  it "has a :checksum key value pair in a Hash of the :libraries Array of Hashes" do
375
- subject[:libraries].first.should have_key(:checksum)
381
+ expect(subject[:libraries].first).to have_key(:checksum)
376
382
  end
377
383
 
378
384
  it "has a :specificity key value pair in a Hash of the :libraries Array of Hashes" do
379
- subject[:libraries].first.should have_key(:specificity)
385
+ expect(subject[:libraries].first).to have_key(:specificity)
380
386
  end
381
387
 
382
388
  it "has a :attributes key with a value of an Array Hashes" do
383
- subject.should have_key(:attributes)
384
- subject[:attributes].should be_a(Array)
389
+ expect(subject).to have_key(:attributes)
390
+ expect(subject[:attributes]).to be_a(Array)
385
391
  subject[:attributes].each do |item|
386
- item.should be_a(Hash)
392
+ expect(item).to be_a(Hash)
387
393
  end
388
394
  end
389
395
 
390
396
  it "has a :name key value pair in a Hash of the :attributes Array of Hashes" do
391
- subject[:attributes].first.should have_key(:name)
397
+ expect(subject[:attributes].first).to have_key(:name)
392
398
  end
393
399
 
394
400
  it "has a :path key value pair in a Hash of the :attributes Array of Hashes" do
395
- subject[:attributes].first.should have_key(:path)
401
+ expect(subject[:attributes].first).to have_key(:path)
396
402
  end
397
403
 
398
404
  it "has a :checksum key value pair in a Hash of the :attributes Array of Hashes" do
399
- subject[:attributes].first.should have_key(:checksum)
405
+ expect(subject[:attributes].first).to have_key(:checksum)
400
406
  end
401
407
 
402
408
  it "has a :specificity key value pair in a Hash of the :attributes Array of Hashes" do
403
- subject[:attributes].first.should have_key(:specificity)
409
+ expect(subject[:attributes].first).to have_key(:specificity)
404
410
  end
405
411
 
406
412
  it "has a :files key with a value of an Array Hashes" do
407
- subject.should have_key(:files)
408
- subject[:files].should be_a(Array)
413
+ expect(subject).to have_key(:files)
414
+ expect(subject[:files]).to be_a(Array)
409
415
  subject[:files].each do |item|
410
- item.should be_a(Hash)
416
+ expect(item).to be_a(Hash)
411
417
  end
412
418
  end
413
419
 
414
420
  it "has a :name key value pair in a Hash of the :files Array of Hashes" do
415
- subject[:files].first.should have_key(:name)
421
+ expect(subject[:files].first).to have_key(:name)
416
422
  end
417
423
 
418
424
  it "has a :path key value pair in a Hash of the :files Array of Hashes" do
419
- subject[:files].first.should have_key(:path)
425
+ expect(subject[:files].first).to have_key(:path)
420
426
  end
421
427
 
422
428
  it "has a :checksum key value pair in a Hash of the :files Array of Hashes" do
423
- subject[:files].first.should have_key(:checksum)
429
+ expect(subject[:files].first).to have_key(:checksum)
424
430
  end
425
431
 
426
432
  it "has a :specificity key value pair in a Hash of the :files Array of Hashes" do
427
- subject[:files].first.should have_key(:specificity)
433
+ expect(subject[:files].first).to have_key(:specificity)
428
434
  end
429
435
 
430
436
  it "has a :templates key with a value of an Array Hashes" do
431
- subject.should have_key(:templates)
432
- subject[:templates].should be_a(Array)
437
+ expect(subject).to have_key(:templates)
438
+ expect(subject[:templates]).to be_a(Array)
433
439
  subject[:templates].each do |item|
434
- item.should be_a(Hash)
440
+ expect(item).to be_a(Hash)
435
441
  end
436
442
  end
437
443
 
438
444
  it "has a :name key value pair in a Hash of the :templates Array of Hashes" do
439
- subject[:templates].first.should have_key(:name)
445
+ expect(subject[:templates].first).to have_key(:name)
440
446
  end
441
447
 
442
448
  it "has a :path key value pair in a Hash of the :templates Array of Hashes" do
443
- subject[:templates].first.should have_key(:path)
449
+ expect(subject[:templates].first).to have_key(:path)
444
450
  end
445
451
 
446
452
  it "has a :checksum key value pair in a Hash of the :templates Array of Hashes" do
447
- subject[:templates].first.should have_key(:checksum)
453
+ expect(subject[:templates].first).to have_key(:checksum)
448
454
  end
449
455
 
450
456
  it "has a :specificity key value pair in a Hash of the :templates Array of Hashes" do
451
- subject[:templates].first.should have_key(:specificity)
457
+ expect(subject[:templates].first).to have_key(:specificity)
452
458
  end
453
459
 
454
460
  it "has a :resources key with a value of an Array Hashes" do
455
- subject.should have_key(:resources)
456
- subject[:resources].should be_a(Array)
461
+ expect(subject).to have_key(:resources)
462
+ expect(subject[:resources]).to be_a(Array)
457
463
  subject[:resources].each do |item|
458
- item.should be_a(Hash)
464
+ expect(item).to be_a(Hash)
459
465
  end
460
466
  end
461
467
 
462
468
  it "has a :name key value pair in a Hash of the :resources Array of Hashes" do
463
- subject[:resources].first.should have_key(:name)
469
+ expect(subject[:resources].first).to have_key(:name)
464
470
  end
465
471
 
466
472
  it "has a :path key value pair in a Hash of the :resources Array of Hashes" do
467
- subject[:resources].first.should have_key(:path)
473
+ expect(subject[:resources].first).to have_key(:path)
468
474
  end
469
475
 
470
476
  it "has a :checksum key value pair in a Hash of the :resources Array of Hashes" do
471
- subject[:resources].first.should have_key(:checksum)
477
+ expect(subject[:resources].first).to have_key(:checksum)
472
478
  end
473
479
 
474
480
  it "has a :specificity key value pair in a Hash of the :resources Array of Hashes" do
475
- subject[:resources].first.should have_key(:specificity)
481
+ expect(subject[:resources].first).to have_key(:specificity)
476
482
  end
477
483
 
478
484
  it "has a :providers key with a value of an Array Hashes" do
479
- subject.should have_key(:providers)
480
- subject[:providers].should be_a(Array)
485
+ expect(subject).to have_key(:providers)
486
+ expect(subject[:providers]).to be_a(Array)
481
487
  subject[:providers].each do |item|
482
- item.should be_a(Hash)
488
+ expect(item).to be_a(Hash)
483
489
  end
484
490
  end
485
491
 
486
492
  it "has a :name key value pair in a Hash of the :providers Array of Hashes" do
487
- subject[:providers].first.should have_key(:name)
493
+ expect(subject[:providers].first).to have_key(:name)
488
494
  end
489
495
 
490
496
  it "has a :path key value pair in a Hash of the :providers Array of Hashes" do
491
- subject[:providers].first.should have_key(:path)
497
+ expect(subject[:providers].first).to have_key(:path)
492
498
  end
493
499
 
494
500
  it "has a :checksum key value pair in a Hash of the :providers Array of Hashes" do
495
- subject[:providers].first.should have_key(:checksum)
501
+ expect(subject[:providers].first).to have_key(:checksum)
496
502
  end
497
503
 
498
504
  it "has a :specificity key value pair in a Hash of the :providers Array of Hashes" do
499
- subject[:providers].first.should have_key(:specificity)
505
+ expect(subject[:providers].first).to have_key(:specificity)
500
506
  end
501
507
 
502
508
  it "has a :root_files key with a value of an Array Hashes" do
503
- subject.should have_key(:root_files)
504
- subject[:root_files].should be_a(Array)
509
+ expect(subject).to have_key(:root_files)
510
+ expect(subject[:root_files]).to be_a(Array)
505
511
  subject[:root_files].each do |item|
506
- item.should be_a(Hash)
512
+ expect(item).to be_a(Hash)
507
513
  end
508
514
  end
509
515
 
510
516
  it "has a :name key value pair in a Hash of the :root_files Array of Hashes" do
511
- subject[:root_files].first.should have_key(:name)
517
+ expect(subject[:root_files].first).to have_key(:name)
512
518
  end
513
519
 
514
520
  it "has a :path key value pair in a Hash of the :root_files Array of Hashes" do
515
- subject[:root_files].first.should have_key(:path)
521
+ expect(subject[:root_files].first).to have_key(:path)
516
522
  end
517
523
 
518
524
  it "has a :checksum key value pair in a Hash of the :root_files Array of Hashes" do
519
- subject[:root_files].first.should have_key(:checksum)
525
+ expect(subject[:root_files].first).to have_key(:checksum)
520
526
  end
521
527
 
522
528
  it "has a :specificity key value pair in a Hash of the :root_files Array of Hashes" do
523
- subject[:root_files].first.should have_key(:specificity)
529
+ expect(subject[:root_files].first).to have_key(:specificity)
524
530
  end
525
531
 
526
532
  it "has a :cookbook_name key with a String value" do
527
- subject.should have_key(:cookbook_name)
528
- subject[:cookbook_name].should be_a(String)
533
+ expect(subject).to have_key(:cookbook_name)
534
+ expect(subject[:cookbook_name]).to be_a(String)
529
535
  end
530
536
 
531
537
  it "has a :metadata key with a Hashie::Mash value" do
532
- subject.should have_key(:metadata)
533
- subject[:metadata].should be_a(Hashie::Mash)
538
+ expect(subject).to have_key(:metadata)
539
+ expect(subject[:metadata]).to be_a(Hashie::Mash)
534
540
  end
535
541
 
536
542
  it "has a :version key with a String value" do
537
- subject.should have_key(:version)
538
- subject[:version].should be_a(String)
543
+ expect(subject).to have_key(:version)
544
+ expect(subject[:version]).to be_a(String)
539
545
  end
540
546
 
541
547
  it "has a :name key with a String value" do
542
- subject.should have_key(:name)
543
- subject[:name].should be_a(String)
548
+ expect(subject).to have_key(:name)
549
+ expect(subject[:name]).to be_a(String)
544
550
  end
545
551
 
546
552
  it "has a value containing the cookbook name and version separated by a dash for :name" do
547
553
  name, version = subject[:name].split('-')
548
554
 
549
- name.should eql(cookbook.cookbook_name)
550
- version.should eql(cookbook.version)
555
+ expect(name).to eql(cookbook.cookbook_name)
556
+ expect(version).to eql(cookbook.version)
551
557
  end
552
558
 
553
559
  it "has a :chef_type key with Cookbook::CHEF_TYPE as the value" do
554
- subject.should have_key(:chef_type)
555
- subject[:chef_type].should eql(Ridley::Chef::Cookbook::CHEF_TYPE)
560
+ expect(subject).to have_key(:chef_type)
561
+ expect(subject[:chef_type]).to eql(Ridley::Chef::Cookbook::CHEF_TYPE)
556
562
  end
557
563
  end
558
564
 
@@ -562,12 +568,12 @@ describe Ridley::Chef::Cookbook do
562
568
  end
563
569
 
564
570
  it "has a 'json_class' key with Cookbook::CHEF_JSON_CLASS as the value" do
565
- @json.should have_json_path('json_class')
566
- parse_json(@json)['json_class'].should eql(Ridley::Chef::Cookbook::CHEF_JSON_CLASS)
571
+ expect(@json).to have_json_path('json_class')
572
+ expect(parse_json(@json)['json_class']).to eql(Ridley::Chef::Cookbook::CHEF_JSON_CLASS)
567
573
  end
568
574
 
569
575
  it "has a 'frozen?' flag" do
570
- @json.should have_json_path('frozen?')
576
+ expect(@json).to have_json_path('frozen?')
571
577
  end
572
578
  end
573
579
  end