cheffish 1.1.2 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,12 +15,10 @@ describe Chef::Resource::ChefNode do
15
15
 
16
16
  context 'and is empty' do
17
17
  context 'and we run a recipe that creates node "blah"' do
18
- with_converge do
19
- chef_node 'blah'
20
- end
21
-
22
18
  it 'the node gets created' do
23
- expect(chef_run).to have_updated 'chef_node[blah]', :create
19
+ expect_recipe {
20
+ chef_node 'blah'
21
+ }.to have_updated 'chef_node[blah]', :create
24
22
  expect(get('nodes/blah')['name']).to eq('blah')
25
23
  end
26
24
  end
@@ -39,13 +37,11 @@ describe Chef::Resource::ChefNode do
39
37
 
40
38
  context 'and a recipe is run that creates node "blah" on the second chef server using with_chef_server' do
41
39
 
42
- with_converge do
43
- with_chef_server 'http://127.0.0.1:8899'
44
- chef_node 'blah'
45
- end
46
-
47
40
  it 'the node is created on the second chef server but not the first' do
48
- expect(chef_run).to have_updated 'chef_node[blah]', :create
41
+ expect_recipe {
42
+ with_chef_server 'http://127.0.0.1:8899'
43
+ chef_node 'blah'
44
+ }.to have_updated 'chef_node[blah]', :create
49
45
  expect { get('nodes/blah') }.to raise_error(Net::HTTPServerException)
50
46
  expect(get('http://127.0.0.1:8899/nodes/blah')['name']).to eq('blah')
51
47
  end
@@ -53,14 +49,12 @@ describe Chef::Resource::ChefNode do
53
49
 
54
50
  context 'and a recipe is run that creates node "blah" on the second chef server using chef_server' do
55
51
 
56
- with_converge do
57
- chef_node 'blah' do
58
- chef_server({ :chef_server_url => 'http://127.0.0.1:8899' })
59
- end
60
- end
61
-
62
52
  it 'the node is created on the second chef server but not the first' do
63
- expect(chef_run).to have_updated 'chef_node[blah]', :create
53
+ expect_recipe {
54
+ chef_node 'blah' do
55
+ chef_server({ :chef_server_url => 'http://127.0.0.1:8899' })
56
+ end
57
+ }.to have_updated 'chef_node[blah]', :create
64
58
  expect { get('nodes/blah') }.to raise_error(Net::HTTPServerException)
65
59
  expect(get('http://127.0.0.1:8899/nodes/blah')['name']).to eq('blah')
66
60
  end
@@ -71,12 +65,10 @@ describe Chef::Resource::ChefNode do
71
65
  context 'and has a node named "blah"' do
72
66
  node 'blah', {}
73
67
 
74
- with_converge do
75
- chef_node 'blah'
76
- end
77
-
78
68
  it 'chef_node "blah" does not get created or updated' do
79
- expect(chef_run).not_to have_updated 'chef_node[blah]', :create
69
+ expect_recipe {
70
+ chef_node 'blah'
71
+ }.not_to have_updated 'chef_node[blah]', :create
80
72
  end
81
73
  end
82
74
 
@@ -122,9 +114,9 @@ describe Chef::Resource::ChefNode do
122
114
  }
123
115
 
124
116
  it 'chef_node with no attributes modifies nothing' do
125
- run_recipe do
117
+ expect_recipe {
126
118
  chef_node 'blah'
127
- end
119
+ }.to be_up_to_date
128
120
  expect(get('nodes/blah')).to include(
129
121
  'name' => 'blah',
130
122
  'chef_environment' => 'blah',
@@ -137,11 +129,11 @@ describe Chef::Resource::ChefNode do
137
129
  end
138
130
 
139
131
  it 'chef_node with complete true removes everything except default, automatic and override' do
140
- run_recipe do
132
+ expect_recipe {
141
133
  chef_node 'blah' do
142
134
  complete true
143
135
  end
144
- end
136
+ }.to be_updated
145
137
  expect(get('nodes/blah')).to include(
146
138
  'name' => 'blah',
147
139
  'chef_environment' => '_default',
@@ -154,7 +146,7 @@ describe Chef::Resource::ChefNode do
154
146
  end
155
147
 
156
148
  it 'chef_node with complete true sets the given attributes' do
157
- run_recipe do
149
+ expect_recipe {
158
150
  chef_node 'blah' do
159
151
  chef_environment 'x'
160
152
  run_list [ 'recipe[y]' ]
@@ -162,7 +154,7 @@ describe Chef::Resource::ChefNode do
162
154
  tags 'c', 'd'
163
155
  complete true
164
156
  end
165
- end
157
+ }.to be_updated
166
158
  expect(get('nodes/blah')).to include(
167
159
  'name' => 'blah',
168
160
  'chef_environment' => 'x',
@@ -175,7 +167,7 @@ describe Chef::Resource::ChefNode do
175
167
  end
176
168
 
177
169
  it 'chef_node with complete true and partial attributes sets the given attributes' do
178
- run_recipe do
170
+ expect_recipe {
179
171
  chef_node 'blah' do
180
172
  chef_environment 'x'
181
173
  recipe 'y'
@@ -183,7 +175,7 @@ describe Chef::Resource::ChefNode do
183
175
  tags 'c', 'd'
184
176
  complete true
185
177
  end
186
- end
178
+ }.to be_updated
187
179
  expect(get('nodes/blah')).to include(
188
180
  'name' => 'blah',
189
181
  'chef_environment' => 'x',
@@ -212,12 +204,11 @@ describe Chef::Resource::ChefNode do
212
204
  }
213
205
 
214
206
  it 'chef_node with attributes {} removes all normal attributes but leaves tags, automatic and environment alone' do
215
- run_recipe do
207
+ expect_recipe {
216
208
  chef_node 'blah' do
217
209
  attributes({})
218
210
  end
219
- end
220
- expect(chef_run).to have_updated('chef_node[blah]', :create)
211
+ }.to have_updated('chef_node[blah]', :create)
221
212
  expect(get('nodes/blah')).to include(
222
213
  'normal' => { 'tags' => [ 'a', 'b' ] },
223
214
  'automatic' => { 'x' => 'y' },
@@ -226,12 +217,11 @@ describe Chef::Resource::ChefNode do
226
217
  end
227
218
 
228
219
  it 'chef_node with attributes { c => d } replaces normal but not tags/automatic/environment' do
229
- run_recipe do
220
+ expect_recipe {
230
221
  chef_node 'blah' do
231
222
  attributes 'c' => 'd'
232
223
  end
233
- end
234
- expect(chef_run).to have_updated('chef_node[blah]', :create)
224
+ }.to have_updated('chef_node[blah]', :create)
235
225
  expect(get('nodes/blah')).to include(
236
226
  'normal' => { 'c' => 'd', 'tags' => [ 'a', 'b' ] },
237
227
  'automatic' => { 'x' => 'y' },
@@ -240,12 +230,11 @@ describe Chef::Resource::ChefNode do
240
230
  end
241
231
 
242
232
  it 'chef_node with attributes { c => f => g, y => z } replaces normal but not tags/automatic/environment' do
243
- run_recipe do
233
+ expect_recipe {
244
234
  chef_node 'blah' do
245
235
  attributes 'c' => { 'f' => 'g' }, 'y' => 'z'
246
236
  end
247
- end
248
- expect(chef_run).to have_updated('chef_node[blah]', :create)
237
+ }.to have_updated('chef_node[blah]', :create)
249
238
  expect(get('nodes/blah')).to include(
250
239
  'normal' => { 'c' => { 'f' => 'g' }, 'y' => 'z', 'tags' => [ 'a', 'b' ] },
251
240
  'automatic' => { 'x' => 'y' },
@@ -254,12 +243,11 @@ describe Chef::Resource::ChefNode do
254
243
  end
255
244
 
256
245
  it 'chef_node with attributes { tags => [ "x" ] } replaces normal and tags but not automatic/environment' do
257
- run_recipe do
246
+ expect_recipe {
258
247
  chef_node 'blah' do
259
248
  attributes 'tags' => [ 'x' ]
260
249
  end
261
- end
262
- expect(chef_run).to have_updated('chef_node[blah]', :create)
250
+ }.to have_updated('chef_node[blah]', :create)
263
251
  expect(get('nodes/blah')).to include(
264
252
  'normal' => { 'tags' => [ 'x' ] },
265
253
  'automatic' => { 'x' => 'y' },
@@ -268,13 +256,12 @@ describe Chef::Resource::ChefNode do
268
256
  end
269
257
 
270
258
  it 'chef_node with tags "x" and attributes { "tags" => [ "y" ] } sets tags to "x"' do
271
- run_recipe do
259
+ expect_recipe {
272
260
  chef_node 'blah' do
273
261
  tags 'x'
274
262
  attributes 'tags' => [ 'y' ]
275
263
  end
276
- end
277
- expect(chef_run).to have_updated('chef_node[blah]', :create)
264
+ }.to have_updated('chef_node[blah]', :create)
278
265
  expect(get('nodes/blah')).to include(
279
266
  'normal' => {
280
267
  'tags' => [ 'x' ]
@@ -302,10 +289,9 @@ describe Chef::Resource::ChefNode do
302
289
 
303
290
  context 'basic scenarios' do
304
291
  it 'chef_node with no attributes, leaves it alone' do
305
- run_recipe do
292
+ expect_recipe {
306
293
  chef_node 'blah'
307
- end
308
- expect(chef_run).not_to have_updated('chef_node[blah]', :create)
294
+ }.not_to have_updated('chef_node[blah]', :create)
309
295
  expect(get('nodes/blah')).to include(
310
296
  'normal' => {
311
297
  'a' => 'b',
@@ -318,12 +304,11 @@ describe Chef::Resource::ChefNode do
318
304
  end
319
305
 
320
306
  it 'chef_node with attribute d, e adds the attribute' do
321
- run_recipe do
307
+ expect_recipe {
322
308
  chef_node 'blah' do
323
309
  attribute 'd', 'e'
324
310
  end
325
- end
326
- expect(chef_run).to have_updated('chef_node[blah]', :create)
311
+ }.to have_updated('chef_node[blah]', :create)
327
312
  expect(get('nodes/blah')).to include(
328
313
  'normal' => {
329
314
  'a' => 'b',
@@ -337,12 +322,11 @@ describe Chef::Resource::ChefNode do
337
322
  end
338
323
 
339
324
  it 'chef_node with attribute tags, [ "x" ] replaces tags' do
340
- run_recipe do
325
+ expect_recipe {
341
326
  chef_node 'blah' do
342
327
  attribute 'tags', [ 'x' ]
343
328
  end
344
- end
345
- expect(chef_run).to have_updated('chef_node[blah]', :create)
329
+ }.to have_updated('chef_node[blah]', :create)
346
330
  expect(get('nodes/blah')).to include(
347
331
  'normal' => {
348
332
  'a' => 'b',
@@ -355,12 +339,11 @@ describe Chef::Resource::ChefNode do
355
339
  end
356
340
 
357
341
  it 'chef_node with attribute c, x replaces the attribute' do
358
- run_recipe do
342
+ expect_recipe {
359
343
  chef_node 'blah' do
360
344
  attribute 'c', 'x'
361
345
  end
362
- end
363
- expect(chef_run).to have_updated('chef_node[blah]', :create)
346
+ }.to have_updated('chef_node[blah]', :create)
364
347
  expect(get('nodes/blah')).to include(
365
348
  'normal' => {
366
349
  'a' => 'b',
@@ -373,12 +356,11 @@ describe Chef::Resource::ChefNode do
373
356
  end
374
357
 
375
358
  it 'chef_node with attribute c, { d => x } replaces the attribute' do
376
- run_recipe do
359
+ expect_recipe {
377
360
  chef_node 'blah' do
378
361
  attribute 'c', { 'd' => 'x' }
379
362
  end
380
- end
381
- expect(chef_run).to have_updated('chef_node[blah]', :create)
363
+ }.to have_updated('chef_node[blah]', :create)
382
364
  expect(get('nodes/blah')).to include(
383
365
  'normal' => {
384
366
  'a' => 'b',
@@ -391,12 +373,11 @@ describe Chef::Resource::ChefNode do
391
373
  end
392
374
 
393
375
  it 'chef_node with attribute [ c, d ], x replaces the attribute' do
394
- run_recipe do
376
+ expect_recipe {
395
377
  chef_node 'blah' do
396
378
  attribute [ 'c', 'd' ], 'x'
397
379
  end
398
- end
399
- expect(chef_run).to have_updated('chef_node[blah]', :create)
380
+ }.to have_updated('chef_node[blah]', :create)
400
381
  expect(get('nodes/blah')).to include(
401
382
  'normal' => {
402
383
  'a' => 'b',
@@ -409,32 +390,31 @@ describe Chef::Resource::ChefNode do
409
390
  end
410
391
 
411
392
  it 'chef_node with attribute [ a, b ], x raises an error' do
412
- expect do
413
- run_recipe do
393
+ expect {
394
+ converge {
414
395
  chef_node 'blah' do
415
396
  attribute [ 'a', 'b' ], 'x'
416
397
  end
417
- end
418
- end.to raise_error /Attempt to set \["a", "b"\] to x when \["a"\] is not a hash/
398
+ }
399
+ }.to raise_error /Attempt to set \["a", "b"\] to x when \["a"\] is not a hash/
419
400
  end
420
401
 
421
402
  it 'chef_node with attribute [ a, b, c ], x raises an error' do
422
- expect do
423
- run_recipe do
403
+ expect {
404
+ converge {
424
405
  chef_node 'blah' do
425
406
  attribute [ 'a', 'b', 'c' ], 'x'
426
407
  end
427
- end
428
- end.to raise_error /Attempt to set \["a", "b", "c"\] to x when \["a"\] is not a hash/
408
+ }
409
+ }.to raise_error /Attempt to set \["a", "b", "c"\] to x when \["a"\] is not a hash/
429
410
  end
430
411
 
431
412
  it 'chef_node with attribute [ x, y ], z adds a new attribute' do
432
- run_recipe do
413
+ expect_recipe {
433
414
  chef_node 'blah' do
434
415
  attribute [ 'x', 'y' ], 'z'
435
416
  end
436
- end
437
- expect(chef_run).to have_updated('chef_node[blah]', :create)
417
+ }.to have_updated('chef_node[blah]', :create)
438
418
  expect(get('nodes/blah')).to include(
439
419
  'normal' => {
440
420
  'a' => 'b',
@@ -448,12 +428,11 @@ describe Chef::Resource::ChefNode do
448
428
  end
449
429
 
450
430
  it 'chef_node with attribute [], {} clears all attributes' do
451
- run_recipe do
431
+ expect_recipe {
452
432
  chef_node 'blah' do
453
433
  attribute([], {})
454
434
  end
455
- end
456
- expect(chef_run).to have_updated('chef_node[blah]', :create)
435
+ }.to have_updated('chef_node[blah]', :create)
457
436
  expect(get('nodes/blah')).to include(
458
437
  'normal' => { },
459
438
  'automatic' => { 'x' => 'y' },
@@ -464,12 +443,11 @@ describe Chef::Resource::ChefNode do
464
443
 
465
444
  context 'delete' do
466
445
  it 'chef_node with attribute a, :delete deletes the attribute' do
467
- run_recipe do
446
+ expect_recipe {
468
447
  chef_node 'blah' do
469
448
  attribute 'a', :delete
470
449
  end
471
- end
472
- expect(chef_run).to have_updated('chef_node[blah]', :create)
450
+ }.to have_updated('chef_node[blah]', :create)
473
451
  expect(get('nodes/blah')).to include(
474
452
  'normal' => {
475
453
  'c' => { 'd' => 'e' },
@@ -481,12 +459,11 @@ describe Chef::Resource::ChefNode do
481
459
  end
482
460
 
483
461
  it 'chef_node with attribute c, :delete deletes the attribute' do
484
- run_recipe do
462
+ expect_recipe {
485
463
  chef_node 'blah' do
486
464
  attribute 'c', :delete
487
465
  end
488
- end
489
- expect(chef_run).to have_updated('chef_node[blah]', :create)
466
+ }.to have_updated('chef_node[blah]', :create)
490
467
  expect(get('nodes/blah')).to include(
491
468
  'normal' => {
492
469
  'a' => 'b',
@@ -498,12 +475,11 @@ describe Chef::Resource::ChefNode do
498
475
  end
499
476
 
500
477
  it 'chef_node with attribute [ c, d ], :delete deletes the attribute' do
501
- run_recipe do
478
+ expect_recipe {
502
479
  chef_node 'blah' do
503
480
  attribute [ 'c', 'd' ], :delete
504
481
  end
505
- end
506
- expect(chef_run).to have_updated('chef_node[blah]', :create)
482
+ }.to have_updated('chef_node[blah]', :create)
507
483
  expect(get('nodes/blah')).to include(
508
484
  'normal' => {
509
485
  'a' => 'b',
@@ -516,12 +492,11 @@ describe Chef::Resource::ChefNode do
516
492
  end
517
493
 
518
494
  it 'chef_node with attribute xyz, :delete does nothing' do
519
- run_recipe do
495
+ expect_recipe {
520
496
  chef_node 'blah' do
521
497
  attribute 'xyz', :delete
522
498
  end
523
- end
524
- expect(chef_run).not_to have_updated('chef_node[blah]', :create)
499
+ }.not_to have_updated('chef_node[blah]', :create)
525
500
  expect(get('nodes/blah')).to include(
526
501
  'normal' => {
527
502
  'a' => 'b',
@@ -534,12 +509,11 @@ describe Chef::Resource::ChefNode do
534
509
  end
535
510
 
536
511
  it 'chef_node with attribute [ c, x ], :delete does nothing' do
537
- run_recipe do
512
+ expect_recipe {
538
513
  chef_node 'blah' do
539
514
  attribute [ 'c', 'x' ], :delete
540
515
  end
541
- end
542
- expect(chef_run).not_to have_updated('chef_node[blah]', :create)
516
+ }.not_to have_updated('chef_node[blah]', :create)
543
517
  expect(get('nodes/blah')).to include(
544
518
  'normal' => {
545
519
  'a' => 'b',
@@ -554,11 +528,11 @@ describe Chef::Resource::ChefNode do
554
528
 
555
529
  context 'types' do
556
530
  it 'chef_node with attribute a, true sets a to true' do
557
- run_recipe do
531
+ expect_recipe {
558
532
  chef_node 'blah' do
559
533
  attribute 'a', true
560
534
  end
561
- end
535
+ }.to be_updated
562
536
  expect(get('nodes/blah')).to include(
563
537
  'normal' => {
564
538
  'a' => true,
@@ -571,11 +545,11 @@ describe Chef::Resource::ChefNode do
571
545
  end
572
546
 
573
547
  it 'chef_node with attribute a, 1 sets a to 1' do
574
- run_recipe do
548
+ expect_recipe {
575
549
  chef_node 'blah' do
576
550
  attribute 'a', 1
577
551
  end
578
- end
552
+ }.to be_updated
579
553
  expect(get('nodes/blah')).to include(
580
554
  'normal' => {
581
555
  'a' => 1,
@@ -588,11 +562,11 @@ describe Chef::Resource::ChefNode do
588
562
  end
589
563
 
590
564
  it 'chef_node with attribute a, "1" sets a to "1"' do
591
- run_recipe do
565
+ expect_recipe {
592
566
  chef_node 'blah' do
593
567
  attribute 'a', "1"
594
568
  end
595
- end
569
+ }.to be_updated
596
570
  expect(get('nodes/blah')).to include(
597
571
  'normal' => {
598
572
  'a' => "1",
@@ -605,11 +579,11 @@ describe Chef::Resource::ChefNode do
605
579
  end
606
580
 
607
581
  it 'chef_node with attribute a, "" sets a to ""' do
608
- run_recipe do
582
+ expect_recipe {
609
583
  chef_node 'blah' do
610
584
  attribute 'a', ""
611
585
  end
612
- end
586
+ }.to be_updated
613
587
  expect(get('nodes/blah')).to include(
614
588
  'normal' => {
615
589
  'a' => "",
@@ -622,11 +596,11 @@ describe Chef::Resource::ChefNode do
622
596
  end
623
597
 
624
598
  it 'chef_node with attribute a, nil sets a to nil' do
625
- run_recipe do
599
+ expect_recipe {
626
600
  chef_node 'blah' do
627
601
  attribute 'a', nil
628
602
  end
629
- end
603
+ }.to be_updated
630
604
  expect(get('nodes/blah')).to include(
631
605
  'normal' => {
632
606
  'a' => nil,
@@ -641,12 +615,12 @@ describe Chef::Resource::ChefNode do
641
615
 
642
616
  context 'multiple attribute definitions' do
643
617
  it 'chef_node with attribute a, x and c, y replaces both attributes' do
644
- run_recipe do
618
+ expect_recipe {
645
619
  chef_node 'blah' do
646
620
  attribute 'a', 'x'
647
621
  attribute 'c', 'y'
648
622
  end
649
- end
623
+ }.to be_updated
650
624
  expect(get('nodes/blah')).to include(
651
625
  'normal' => {
652
626
  'a' => 'x',
@@ -659,12 +633,12 @@ describe Chef::Resource::ChefNode do
659
633
  end
660
634
 
661
635
  it 'chef_node with attribute m, x and n, y adds both attributes' do
662
- run_recipe do
636
+ expect_recipe {
663
637
  chef_node 'blah' do
664
638
  attribute 'm', 'x'
665
639
  attribute 'n', 'y'
666
640
  end
667
- end
641
+ }.to be_updated
668
642
  expect(get('nodes/blah')).to include(
669
643
  'normal' => {
670
644
  'a' => 'b',
@@ -679,12 +653,12 @@ describe Chef::Resource::ChefNode do
679
653
  end
680
654
 
681
655
  it 'chef_node with attribute [x, y], z and [x, yy], zz adds both attributes' do
682
- run_recipe do
656
+ expect_recipe {
683
657
  chef_node 'blah' do
684
658
  attribute [ 'x', 'y' ], 'z'
685
659
  attribute [ 'x', 'yy' ], 'zz'
686
660
  end
687
- end
661
+ }.to be_updated
688
662
  expect(get('nodes/blah')).to include(
689
663
  'normal' => {
690
664
  'a' => 'b',
@@ -702,12 +676,12 @@ describe Chef::Resource::ChefNode do
702
676
 
703
677
  describe 'precedence' do
704
678
  it 'chef_node with attribute a, 1 and a, 2 sets a to 2' do
705
- run_recipe do
679
+ expect_recipe {
706
680
  chef_node 'blah' do
707
681
  attribute 'a', 1
708
682
  attribute 'a', 2
709
683
  end
710
- end
684
+ }.to be_updated
711
685
  expect(get('nodes/blah')).to include(
712
686
  'normal' => {
713
687
  'a' => 2,
@@ -720,12 +694,12 @@ describe Chef::Resource::ChefNode do
720
694
  end
721
695
 
722
696
  it 'chef_node with attribute [ x, y ], 1 and [ x, y ], 2 sets [ x, y ], 2' do
723
- run_recipe do
697
+ expect_recipe {
724
698
  chef_node 'blah' do
725
699
  attribute [ 'x', 'y' ], 1
726
700
  attribute [ 'x', 'y' ], 2
727
701
  end
728
- end
702
+ }.to be_updated
729
703
  expect(get('nodes/blah')).to include(
730
704
  'normal' => {
731
705
  'a' => 'b',
@@ -739,12 +713,12 @@ describe Chef::Resource::ChefNode do
739
713
  end
740
714
 
741
715
  it 'chef_node with attribute [ c, e ], { a => 1 }, [ c, e ], { b => 2 } sets b only' do
742
- run_recipe do
716
+ expect_recipe {
743
717
  chef_node 'blah' do
744
718
  attribute [ 'c', 'e' ], { 'a' => 1 }
745
719
  attribute [ 'c', 'e' ], { 'b' => 2 }
746
720
  end
747
- end
721
+ }.to be_updated
748
722
  expect(get('nodes/blah')).to include(
749
723
  'normal' => {
750
724
  'a' => 'b',
@@ -757,12 +731,12 @@ describe Chef::Resource::ChefNode do
757
731
  end
758
732
 
759
733
  it 'chef_node with attribute [ c, e ], { a => 1 }, [ c, e, b ], 2 sets both' do
760
- run_recipe do
734
+ expect_recipe {
761
735
  chef_node 'blah' do
762
736
  attribute [ 'c', 'e' ], { 'a' => 1 }
763
737
  attribute [ 'c', 'e', 'b' ], 2
764
738
  end
765
- end
739
+ }.to be_updated
766
740
  expect(get('nodes/blah')).to include(
767
741
  'normal' => {
768
742
  'a' => 'b',
@@ -775,12 +749,12 @@ describe Chef::Resource::ChefNode do
775
749
  end
776
750
 
777
751
  it 'chef_node with attribute [ c, e, b ], 2, [ c, e ], { a => 1 } sets a only' do
778
- run_recipe do
752
+ expect_recipe {
779
753
  chef_node 'blah' do
780
754
  attribute [ 'c', 'e', 'b' ], 2
781
755
  attribute [ 'c', 'e' ], { 'a' => 1 }
782
756
  end
783
- end
757
+ }.to be_updated
784
758
  expect(get('nodes/blah')).to include(
785
759
  'normal' => {
786
760
  'a' => 'b',
@@ -800,12 +774,10 @@ describe Chef::Resource::ChefNode do
800
774
  when_the_chef_server 'is in OSC mode' do
801
775
  context 'and is empty' do
802
776
  context 'and we run a recipe that creates node "blah"' do
803
- with_converge do
804
- chef_node 'blah'
805
- end
806
-
807
777
  it 'the node gets created' do
808
- expect(chef_run).to have_updated 'chef_node[blah]', :create
778
+ expect_recipe {
779
+ chef_node 'blah'
780
+ }.to have_updated 'chef_node[blah]', :create
809
781
  expect(get('nodes/blah')['name']).to eq('blah')
810
782
  end
811
783
  end