appraisermetrics_report_service 0.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.
@@ -0,0 +1,799 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'eval report class' do
4
+ describe '#meta_data' do
5
+ context 'with keys' do
6
+ it 'renders static content' do
7
+ @pdf = EvalReport.new do
8
+ @sub = {foo: 'bar'}
9
+ cover_page
10
+ end
11
+
12
+ @cover_page_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
13
+ expect(@cover_page_content).to include('EVALUATION OF REAL PROPERTY')
14
+ end
15
+
16
+ it 'renders dynamic content from keys' do
17
+ @pdf = EvalReport.new do
18
+ @sub = Sampler.get_eval1
19
+ cover_page
20
+ end
21
+
22
+ @cover_page_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
23
+ expect(@cover_page_content).to include('Jackson Farm')
24
+ end
25
+ end
26
+
27
+ context 'without keys' do
28
+ it 'renders static content' do
29
+ @pdf = EvalReport.new do
30
+ @sub = {foo: 'bar'}
31
+ cover_page
32
+ end
33
+
34
+ @cover_page_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
35
+ expect(@cover_page_content).to include('EVALUATION OF REAL PROPERTY')
36
+ end
37
+ end
38
+ end
39
+
40
+ describe '#letter_of_transmittal' do
41
+ context 'with keys' do
42
+ it 'renders static content' do
43
+ @pdf = EvalReport.new do
44
+ @text_blocks = static_strings
45
+ @sub = Sampler.get_eval1
46
+ letter_of_transmittal
47
+ end
48
+
49
+ @transmittal_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
50
+ expect(@transmittal_content).to include('In fulfillment')
51
+ end
52
+
53
+ it 'renders dynamic content from keys' do
54
+ @pdf = EvalReport.new do
55
+ @sub = Sampler.get_eval1
56
+ @text_blocks = static_strings
57
+ letter_of_transmittal
58
+ end
59
+
60
+ @transmittal_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
61
+ expect(@transmittal_content).to include('Wheatland Bank of Idaho')
62
+ end
63
+ end
64
+
65
+ context 'without keys' do
66
+ it 'renders static content' do
67
+ @pdf = EvalReport.new do
68
+ @sub = {foo: 'bar'}
69
+ @text_blocks = static_strings
70
+ letter_of_transmittal
71
+ end
72
+
73
+ @transmittal_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
74
+ expect(@transmittal_content).to include('In fulfillment')
75
+ end
76
+ end
77
+ end
78
+
79
+ describe '#subject_images' do
80
+ context 'with images' do
81
+ it 'renders static content'
82
+
83
+ it 'renders dynamic content from keys'
84
+ end
85
+
86
+ context 'without images' do
87
+ it 'renders static content'
88
+ end
89
+ end
90
+
91
+ describe '#introduction' do
92
+ context 'with keys' do
93
+ it 'renders static content' do
94
+ @pdf = EvalReport.new do
95
+ @sub = Sampler.get_eval1
96
+ @text_blocks = static_strings
97
+ introduction
98
+ end
99
+
100
+ @introduction_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
101
+ expect(@introduction_content).to include('This Evaluation')
102
+ end
103
+ end
104
+
105
+ context 'without keys' do
106
+ it 'renders static content' do
107
+ @pdf = EvalReport.new do
108
+ @sub = {foo: 'bar'}
109
+ @text_blocks = static_strings
110
+ introduction
111
+ end
112
+
113
+ @introduction_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
114
+ expect(@introduction_content).to include('This Evaluation')
115
+ end
116
+ end
117
+ end
118
+
119
+ describe '#property_identification' do
120
+ context 'with keys' do
121
+ it 'renders static content' do
122
+ @pdf = EvalReport.new do
123
+ @sub = Sampler.get_eval1
124
+ property_identification
125
+ end
126
+
127
+ @property_identification_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
128
+ expect(@property_identification_content).to include('Effective Date of Value')
129
+ end
130
+
131
+ it 'renders dynamic content from keys' do
132
+ @pdf = EvalReport.new do
133
+ @sub = Sampler.get_eval1
134
+ property_identification
135
+ end
136
+
137
+ @property_identification_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
138
+ expect(@property_identification_content).to include('Fee Simple')
139
+ end
140
+ end
141
+
142
+ context 'without keys' do
143
+ it 'renders static content' do
144
+ @pdf = EvalReport.new do
145
+ @sub = {foo: 'bar'}
146
+ property_identification
147
+ end
148
+
149
+ @property_identification_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
150
+ expect(@property_identification_content).to include('Effective Date of Value')
151
+ end
152
+ end
153
+ end
154
+
155
+ describe '#regional_maps' do
156
+ context 'with keys' do
157
+ it 'renders static content' do
158
+ @pdf = EvalReport.new do
159
+ @sub = Sampler.get_eval1
160
+ @images = Sampler.sample_eval_images
161
+ regional_maps
162
+ end
163
+
164
+ @regional_maps_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
165
+ expect(@regional_maps_content).to include('REGIONAL MAPS')
166
+ end
167
+ end
168
+
169
+ context 'without keys' do
170
+ it 'renders static content' do
171
+ @pdf = EvalReport.new do
172
+ @sub = {foo: 'bar'}
173
+ @images = {}
174
+ regional_maps
175
+ end
176
+
177
+ @regional_maps_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
178
+ expect(@regional_maps_content).to include('REGIONAL MAPS')
179
+ end
180
+ end
181
+ end
182
+
183
+ describe '#topo_maps' do
184
+ context 'with keys' do
185
+ it 'renders image headers' do
186
+ @pdf = EvalReport.new do
187
+ @sub = {foo: 'bar'}
188
+ @images = Sampler.sample_eval_images
189
+ topo_maps
190
+ end
191
+
192
+ @topo_maps_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
193
+ expect(@topo_maps_content).to include('TOPOGRAPHICAL MAP', 'AERIAL FSA MAP')
194
+ end
195
+ end
196
+
197
+ context 'without keys' do
198
+ it 'renders static content' do
199
+ @pdf = EvalReport.new do
200
+ @sub = {foo: 'bar'}
201
+ @images = {}
202
+ topo_maps
203
+ end
204
+
205
+ @topo_maps_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
206
+ expect(@topo_maps_content).to include('No Image')
207
+ end
208
+ end
209
+ end
210
+
211
+ describe '#property_description' do
212
+ context 'with keys' do
213
+ it 'renders static content' do
214
+ @pdf = EvalReport.new do
215
+ @sub = Sampler.get_eval1
216
+ property_description
217
+ end
218
+
219
+ @property_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
220
+ expect(@property_content).to include('Effective', 'Land', 'Rights', 'Total', 'Pertinent')
221
+ end
222
+
223
+ it 'renders dynamic content from keys' do
224
+ @pdf = EvalReport.new do
225
+ @sub = Sampler.get_eval1
226
+ property_description
227
+ end
228
+
229
+ @property_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
230
+ expect(@property_content).to include('Columbia', 'Fee')
231
+ end
232
+ end
233
+
234
+ context 'without keys' do
235
+ it 'renders static content' do
236
+ @pdf = EvalReport.new do
237
+ @sub = {}
238
+ property_description
239
+ end
240
+
241
+ @property_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
242
+ expect(@property_content).to include('Effective', 'Land', 'Rights', 'Total', 'Pertinent', 'State:')
243
+ end
244
+ end
245
+ end
246
+
247
+ describe '#property_features' do
248
+ # the methods in this container are tested below individually
249
+ end
250
+
251
+ describe '#value_intro' do
252
+ context 'with text blocks' do
253
+ it 'renders static content' do
254
+ @pdf = EvalReport.new do
255
+ @sub = Sampler.get_eval1
256
+ @text_blocks ={valuation_process: 'valuation statement'}
257
+ value_intro
258
+ end
259
+
260
+ @value_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
261
+ expect(@value_content).to include('VALUATION', 'PROCESS')
262
+ end
263
+
264
+ it 'renders content from text blocks keys' do
265
+ @pdf = EvalReport.new do
266
+ @sub = Sampler.get_eval1
267
+ @text_blocks ={valuation_process: 'valuation statement'}
268
+ value_intro
269
+ end
270
+
271
+ @value_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
272
+ expect(@value_content).to include('valuation statement')
273
+ end
274
+ end
275
+
276
+ context 'without text blocks' do
277
+ it 'renders static content' do
278
+ @pdf = EvalReport.new do
279
+ @sub = {}
280
+ @text_blocks = {}
281
+ value_intro
282
+ end
283
+
284
+ @value_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
285
+ expect(@value_content).to include('VALUATION', 'PROCESS')
286
+ end
287
+ end
288
+ end
289
+
290
+ describe '#comp_methodology' do
291
+ context 'with text blocks' do
292
+ it 'renders static content' do
293
+ @pdf = EvalReport.new do
294
+ @sub = {}
295
+ @text_blocks = {comp_method: 'methodology statement'}
296
+ comp_methodology
297
+ end
298
+
299
+ @method_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
300
+ expect(@method_content).to include('DIRECT', 'METHODOLOGY', 'ESTIMATE')
301
+ end
302
+
303
+ it 'renders dynamic content from keys' do
304
+ @pdf = EvalReport.new do
305
+ @sub = {}
306
+ @text_blocks = {comp_method: 'methodology statement'}
307
+ comp_methodology
308
+ end
309
+
310
+ @method_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
311
+ expect(@method_content).to include('methodology statement')
312
+ end
313
+ end
314
+
315
+ context 'without text blocks' do
316
+ it 'renders static content' do
317
+ @pdf = EvalReport.new do
318
+ @sub = {}
319
+ @text_blocks = {}
320
+ comp_methodology
321
+ end
322
+
323
+ @method_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
324
+ expect(@method_content).to include('DIRECT', 'METHODOLOGY', 'ESTIMATE')
325
+ end
326
+ end
327
+ end
328
+
329
+ describe '#property_comparison' do
330
+ context 'with keys' do
331
+ it 'renders static content' do
332
+ @pdf = EvalReport.new do
333
+ @sub = Sampler.get_eval1
334
+ @comps = []
335
+ @recon_primary_per_acre = []
336
+ 5.times {|f| @comps << Sampler.get_comp2}
337
+ property_comparison
338
+ end
339
+
340
+ @comparison_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
341
+ expect(@comparison_content).to include('DIRECT', 'Sales', 'Conditions')
342
+ end
343
+
344
+ it 'renders dynamic content from keys' do
345
+ @pdf = EvalReport.new do
346
+ @sub = Sampler.get_eval1
347
+ @comps = []
348
+ @recon_primary_per_acre = []
349
+ 6.times {|f| @comps << Sampler.get_comp2}
350
+ property_comparison
351
+ end
352
+
353
+ @comparison_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
354
+ expect(@comparison_content).to include('Blanding', 'Solid', 'south')
355
+ end
356
+ end
357
+
358
+ context 'without keys' do
359
+ it 'renders static content' do
360
+ @pdf = EvalReport.new do
361
+ @sub = {}
362
+ @comps = []
363
+ @recon_primary_per_acre = []
364
+ property_comparison
365
+ end
366
+
367
+ @comparison_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
368
+ expect(@comparison_content).to include('DIRECT', 'Sales', 'Conditions')
369
+ end
370
+ end
371
+ end
372
+
373
+ describe '#discussion_of_sales' do
374
+ context 'with keys' do
375
+ it 'renders static content' do
376
+ @pdf = EvalReport.new do
377
+ @sub = Sampler.get_eval1
378
+ @comps = []
379
+ 6.times {|f| @comps << Sampler.get_comp2}
380
+ discussion_of_sales
381
+ end
382
+
383
+ @discussion_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
384
+ expect(@discussion_content).to include('Sale 1')
385
+ end
386
+
387
+ it 'renders dynamic content from keys' do
388
+ @pdf = EvalReport.new do
389
+ @sub = Sampler.get_eval1
390
+ @comps = []
391
+ 6.times {|f| @comps << Sampler.get_comp2}
392
+ discussion_of_sales
393
+ end
394
+
395
+ @discussion_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
396
+ expect(@discussion_content).to include('')
397
+ end
398
+ end
399
+
400
+ context 'without keys' do
401
+ it 'renders static content' do
402
+ @pdf = EvalReport.new do
403
+ @sub = Sampler.get_eval1
404
+ @comps = []
405
+ discussion_of_sales
406
+ end
407
+
408
+ @discussion_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
409
+ expect(@discussion_content).to include('Sale 1')
410
+ end
411
+ end
412
+ end
413
+
414
+ describe '#ag_sales_map' do
415
+ context 'with keys' do
416
+ it 'renders static content'
417
+
418
+ it 'renders dynamic content from keys'
419
+ end
420
+
421
+ context 'without keys' do
422
+ it 'renders static content'
423
+ end
424
+ end
425
+
426
+ describe '#val_method_and_recon' do
427
+ context 'with keys' do
428
+ it 'renders static content' do
429
+ @pdf = EvalReport.new do
430
+ @sub = Sampler.get_eval1
431
+ @text_blocks = {}
432
+ @comps = []
433
+ @recon_primary_per_acre = []
434
+ 6.times {|f| @comps << Sampler.get_comp2}
435
+ val_method_and_recon
436
+ end
437
+
438
+ @recon_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
439
+ expect(@recon_content).to include('Average', 'Median', 'Maximum')
440
+ end
441
+
442
+ #it 'renders dynamic content from keys' do
443
+ # @pdf = EvalReport.new do
444
+ # @sub = Sampler.get_eval1
445
+ # @text_blocks = {}
446
+ # @comps = []
447
+ # @recon_primary_per_acre = []
448
+ # 6.times {|f| @comps << Sampler.get_comp2}
449
+ # val_method_and_recon
450
+ # end
451
+ #
452
+ # # @recon_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
453
+ # # expect(@recon_content).to include('stff')
454
+ #end
455
+ end
456
+
457
+ context 'without keys' do
458
+ it 'renders static content' do
459
+ @pdf = EvalReport.new do
460
+ @sub = Sampler.get_eval1
461
+ @text_blocks = {}
462
+ @comps = []
463
+ @recon_primary_per_acre = []
464
+ val_method_and_recon
465
+ end
466
+
467
+ @recon_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
468
+ expect(@recon_content).to include('Average', 'Median', 'Maximum')
469
+ end
470
+
471
+ it 'renders text from blocks' do
472
+ @pdf = EvalReport.new do
473
+ @sub = {}
474
+ @text_blocks = {val_method: 'value text'}
475
+ @comps = []
476
+ @recon_primary_per_acre = []
477
+ val_method_and_recon
478
+ end
479
+
480
+ @recon_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
481
+ expect(@recon_content).to include('value text')
482
+ end
483
+ end
484
+ end
485
+
486
+ describe '#assumptions_and_conditions' do
487
+ context 'with keys' do
488
+ it 'renders static content'
489
+
490
+ it 'renders dynamic content from keys'
491
+ end
492
+
493
+ context 'without keys' do
494
+ it 'renders static content'
495
+ end
496
+ end
497
+
498
+ describe '#addenda_contents' do
499
+ context 'with keys' do
500
+ it 'renders static content'
501
+
502
+ it 'renders dynamic content from keys'
503
+ end
504
+
505
+ context 'without keys' do
506
+ it 'renders static content'
507
+ end
508
+ end
509
+
510
+ describe '#addendum_a' do
511
+ context 'with keys' do
512
+ it 'renders static content'
513
+
514
+ it 'renders dynamic content from keys'
515
+ end
516
+
517
+ context 'without keys' do
518
+ it 'renders static content'
519
+ end
520
+ end
521
+
522
+ describe '#addendum_b' do
523
+
524
+ end
525
+
526
+ describe '#header' do
527
+ context 'with keys' do
528
+ it 'renders static header content'
529
+ end
530
+ end
531
+
532
+ describe 'transaction history' do
533
+ context 'with keys' do
534
+ before :each do
535
+ @pdf = EvalReport.new do
536
+ @sub = Sampler.get_eval1
537
+ transaction_history
538
+ end
539
+ @transaction_history_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
540
+ end
541
+
542
+ it 'renders static content' do
543
+ expect(@transaction_history_content).to include('Historic')
544
+ end
545
+
546
+ it 'renders dynamic content from keys' do
547
+ expect(@transaction_history_content).to include('Prior Transfer of Title')
548
+ end
549
+ end
550
+
551
+ context 'without keys' do
552
+ it 'renders static content' do
553
+ @pdf = EvalReport.new do
554
+ @sub = {foo: 'bar'}
555
+ transaction_history
556
+ end
557
+ @transaction_history_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
558
+ expect(@transaction_history_content).to include('Historic')
559
+ end
560
+ end
561
+ end
562
+
563
+ describe 'utilities' do
564
+ context 'with keys' do
565
+ before :each do
566
+ @pdf = EvalReport.new do
567
+ @sub = Sampler.get_eval1
568
+ utilities
569
+ end
570
+ @utilities_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
571
+ end
572
+
573
+ it 'renders static content' do
574
+ expect(@utilities_content).to include('Utility Description')
575
+ end
576
+
577
+ it 'renders dynamic content from keys' do
578
+ expect(@utilities_content).to include('Electricity')
579
+ end
580
+ end
581
+
582
+ context 'without keys' do
583
+ it 'renders static content' do
584
+ @pdf = EvalReport.new do
585
+ @sub = {foo: 'bar'}
586
+ utilities
587
+ end
588
+ @utilities_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
589
+ expect(@utilities_content).to include('Utility Description')
590
+ end
591
+ end
592
+ end
593
+
594
+ describe 'improvements' do
595
+ context 'with keys' do
596
+ before :each do
597
+ @pdf = EvalReport.new do
598
+ @sub = Sampler.get_eval1
599
+ improvements
600
+ end
601
+ @improvements_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
602
+ end
603
+
604
+ it 'renders static content' do
605
+ expect(@improvements_content).to include('Unit')
606
+ end
607
+
608
+ it 'renders dynamic content from keys' do
609
+ expect(@improvements_content).to include('Potato', 'Cellar')
610
+ end
611
+ end
612
+
613
+ context 'without keys' do
614
+ it 'renders static content' do
615
+ @pdf = EvalReport.new do
616
+ @sub = {foo: 'bar'}
617
+ improvements
618
+ end
619
+
620
+ @improvements_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
621
+ expect(@improvements_content).to include('Unit')
622
+ end
623
+ end
624
+ end
625
+
626
+ describe 'water_rights' do
627
+ context 'with keys' do
628
+ before :each do
629
+ @pdf = EvalReport.new do
630
+ @sub = Sampler.get_eval1
631
+ water_rights
632
+ end
633
+ @water_rights_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
634
+ end
635
+
636
+ it 'renders static content' do
637
+ expect(@water_rights_content).to include('Source')
638
+ end
639
+
640
+ it 'renders dynamic content from keys' do
641
+ expect(@water_rights_content).to include('Surface')
642
+ end
643
+
644
+ end
645
+
646
+ context 'without keys' do
647
+ it 'renders static content' do
648
+ @pdf = EvalReport.new do
649
+ @sub = {foo: 'bar'}
650
+ water_rights
651
+ end
652
+ @water_rights_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
653
+ expect(@water_rights_content).to include('Source')
654
+ end
655
+ end
656
+ end
657
+
658
+ describe 'water_distribution' do
659
+ context 'with keys' do
660
+ before :each do
661
+ @pdf = EvalReport.new do
662
+ @sub = Sampler.get_eval1
663
+ water_distribution
664
+ end
665
+ page1 = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
666
+ page2 = PDF::Reader.new(StringIO.new(@pdf.render)).page(2).to_s
667
+ @water_distribution_content = page1 + page2
668
+ end
669
+
670
+ it 'renders static content' do
671
+ expect(@water_distribution_content).to include('Type')
672
+ end
673
+
674
+ it 'renders dynamic content from keys' do
675
+ expect(@water_distribution_content).to include('Pump')
676
+ end
677
+
678
+ end
679
+
680
+ context 'without keys' do
681
+ it 'renders static content' do
682
+ @pdf = EvalReport.new do
683
+ @sub = {foo: 'bar'}
684
+ water_distribution
685
+ end
686
+ @water_distribution_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
687
+ expect(@water_distribution_content).to include('Type')
688
+ end
689
+ end
690
+ end
691
+
692
+ describe 'crop_yield' do
693
+ context 'with keys' do
694
+ before :each do
695
+ @pdf = EvalReport.new do
696
+ @sub = Sampler.get_eval1
697
+ crop_yield
698
+ end
699
+ @crop_yield_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
700
+ end
701
+
702
+ it 'renders static content' do
703
+ expect(@crop_yield_content).to include('Commodity')
704
+ end
705
+
706
+ it 'renders dynamic content from keys' do
707
+ expect(@crop_yield_content).to include('2010')
708
+ end
709
+
710
+ end
711
+
712
+ context 'without keys' do
713
+ it 'renders static content' do
714
+ @pdf = EvalReport.new do
715
+ @sub = {foo: 'bar'}
716
+ crop_yield
717
+ end
718
+ @crop_yield_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
719
+ expect(@crop_yield_content).to include('Crop')
720
+ end
721
+ end
722
+ end
723
+
724
+ describe 'perm_plantings' do
725
+ context 'with keys' do
726
+ before :each do
727
+ @pdf = EvalReport.new do
728
+ @sub = Sampler.get_eval1
729
+ perm_plantings
730
+ end
731
+ @perm_plantings_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
732
+ end
733
+
734
+ it 'renders static content' do
735
+ expect(@perm_plantings_content).to include('Variety')
736
+ end
737
+
738
+ it 'renders dynamic content from keys' do
739
+ expect(@perm_plantings_content).to include('Apples')
740
+ end
741
+
742
+ end
743
+
744
+ context 'without keys' do
745
+ it 'renders static content' do
746
+ @pdf = EvalReport.new do
747
+ @sub = {foo: 'bar'}
748
+ perm_plantings
749
+ end
750
+ @perm_plantings_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
751
+ expect(@perm_plantings_content).to include('Variety')
752
+ end
753
+ end
754
+ end
755
+
756
+ describe 'externalities' do
757
+ context 'with keys' do
758
+ before :each do
759
+ @pdf = EvalReport.new do
760
+ @sub = Sampler.get_eval1
761
+ externalities
762
+ end
763
+ @externalities_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
764
+ end
765
+
766
+ it 'renders static content' do
767
+ expect(@externalities_content).to include('Are')
768
+ end
769
+
770
+ it 'renders dynamic content from keys' do
771
+ expect(@externalities_content).to include('No')
772
+ end
773
+
774
+ end
775
+
776
+ context 'without keys' do
777
+ it 'renders static content' do
778
+ @pdf = EvalReport.new do
779
+ @sub = {foo: 'bar'}
780
+ externalities
781
+ end
782
+ @externalities_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
783
+ expect(@externalities_content).to include('waste')
784
+ end
785
+ end
786
+ end
787
+
788
+ describe '#image_cap' do
789
+ it 'renders title text' do
790
+ @pdf = EvalReport.new do
791
+ @sub = {foo: 'bar'}
792
+ image_cap('Some Title')
793
+ end
794
+
795
+ @image_cap_content = PDF::Reader.new(StringIO.new(@pdf.render)).page(1).to_s
796
+ expect(@image_cap_content).to include('Some Title')
797
+ end
798
+ end
799
+ end