coverage/index.html in contentful-2.14.0 vs coverage/index.html in contentful-2.15.0

- old
+ new

@@ -3,40 +3,40 @@ <head> <title>Code coverage for Delivery.rb</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src='./assets/0.10.2/application.js' type='text/javascript'></script> <link href='./assets/0.10.2/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'> - <link rel="shortcut icon" type="image/png" href="./assets/0.10.2/favicon_green.png" /> + <link rel="shortcut icon" type="image/png" href="./assets/0.10.2/favicon_red.png" /> <link rel="icon" type="image/png" href="./assets/0.10.2/favicon.png" /> </head> <body> <div id="loading"> <img src="./assets/0.10.2/loading.gif" alt="loading"/> </div> <div id="wrapper" style="display:none;"> - <div class="timestamp">Generated <abbr class="timeago" title="2019-10-22T11:21:13+02:00">2019-10-22T11:21:13+02:00</abbr></div> + <div class="timestamp">Generated <abbr class="timeago" title="2019-11-15T11:37:02+01:00">2019-11-15T11:37:02+01:00</abbr></div> <ul class="group_tabs"></ul> <div id="content"> <div class="file_list_container" id="AllFiles"> <h2> <span class="group_name">All Files</span> - (<span class="covered_percent"><span class="green">99.07%</span></span> + (<span class="covered_percent"><span class="red">78.39%</span></span> covered at <span class="covered_strength"> <span class="green"> - 479.87 + 35.72 </span> </span> hits/line) </h2> <a name="AllFiles"></a> <div> - <b>51</b> files in total. - <b>2256</b> relevant lines. - <span class="green"><b>2235</b> lines covered</span> and - <span class="red"><b>21</b> lines missed </span> + <b>31</b> files in total. + <b>1032</b> relevant lines. + <span class="green"><b>809</b> lines covered</span> and + <span class="red"><b>223</b> lines missed </span> </div> <table class="file_list"> <thead> <tr> <th>File</th> @@ -61,85 +61,85 @@ </tr> <tr> <td class="strong"><a href="#1c9cd9f08977d8378a5d40be4bcddd0f07adc70d" class="src_link" title="lib/contentful/array.rb">lib/contentful/array.rb</a></td> <td class="green strong">100.0 %</td> - <td>78</td> - <td>34</td> - <td>34</td> + <td>83</td> + <td>36</td> + <td>36</td> <td>0</td> - <td>25.5</td> + <td>7.0</td> </tr> <tr> <td class="strong"><a href="#bc50260d115630bb3b54a3ab26a820be409e35fe" class="src_link" title="lib/contentful/array_like.rb">lib/contentful/array_like.rb</a></td> - <td class="yellow strong">82.35 %</td> + <td class="yellow strong">88.24 %</td> <td>51</td> <td>17</td> - <td>14</td> - <td>3</td> - <td>8.9</td> + <td>15</td> + <td>2</td> + <td>2.2</td> </tr> <tr> <td class="strong"><a href="#167545c06de91266c75254299e80bf4aa23830c5" class="src_link" title="lib/contentful/asset.rb">lib/contentful/asset.rb</a></td> - <td class="green strong">95.12 %</td> + <td class="yellow strong">87.8 %</td> <td>103</td> <td>41</td> - <td>39</td> - <td>2</td> - <td>438.8</td> + <td>36</td> + <td>5</td> + <td>14.0</td> </tr> <tr> <td class="strong"><a href="#c9e25d4e0351ac49d13d793c5d0d6e10c428977b" class="src_link" title="lib/contentful/base_resource.rb">lib/contentful/base_resource.rb</a></td> <td class="green strong">100.0 %</td> <td>97</td> <td>51</td> <td>51</td> <td>0</td> - <td>6056.1</td> + <td>263.6</td> </tr> <tr> <td class="strong"><a href="#b0e31f234acd83c871a193ce29ed6b38e9adc98e" class="src_link" title="lib/contentful/client.rb">lib/contentful/client.rb</a></td> - <td class="green strong">96.79 %</td> - <td>455</td> + <td class="red strong">77.56 %</td> + <td>457</td> <td>156</td> - <td>151</td> - <td>5</td> - <td>149.6</td> + <td>121</td> + <td>35</td> + <td>18.8</td> </tr> <tr> <td class="strong"><a href="#beb22ab5c60eaaa44a2cba4f526b8a2630d7a31a" class="src_link" title="lib/contentful/coercions.rb">lib/contentful/coercions.rb</a></td> - <td class="green strong">98.63 %</td> + <td class="red strong">53.42 %</td> <td>175</td> <td>73</td> - <td>72</td> - <td>1</td> - <td>379.3</td> + <td>39</td> + <td>34</td> + <td>1.5</td> </tr> <tr> <td class="strong"><a href="#14469a10a1dbe8c3a1825151ed33eb9240571afb" class="src_link" title="lib/contentful/content_type.rb">lib/contentful/content_type.rb</a></td> <td class="green strong">94.44 %</td> <td>33</td> <td>18</td> <td>17</td> <td>1</td> - <td>1472.9</td> + <td>35.3</td> </tr> <tr> <td class="strong"><a href="#a46b40f2e6381b7f2ac84d26e7bc008d4e6985eb" class="src_link" title="lib/contentful/content_type_cache.rb">lib/contentful/content_type_cache.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="green strong">91.67 %</td> <td>26</td> <td>12</td> - <td>12</td> - <td>0</td> - <td>724.0</td> + <td>11</td> + <td>1</td> + <td>12.8</td> </tr> <tr> <td class="strong"><a href="#1dea44e36966a52d67e8c4ee9f13f956e974f16f" class="src_link" title="lib/contentful/deleted_asset.rb">lib/contentful/deleted_asset.rb</a></td> <td class="green strong">100.0 %</td> @@ -160,418 +160,218 @@ <td>1.0</td> </tr> <tr> <td class="strong"><a href="#97df464094b50c0508a4a014acd1a9beace447a1" class="src_link" title="lib/contentful/entry.rb">lib/contentful/entry.rb</a></td> - <td class="green strong">98.28 %</td> + <td class="yellow strong">82.76 %</td> <td>128</td> <td>58</td> - <td>57</td> - <td>1</td> - <td>1451.0</td> + <td>48</td> + <td>10</td> + <td>22.8</td> </tr> <tr> <td class="strong"><a href="#98433a4cac96676bcf6b420f480c3d946ae0d0cb" class="src_link" title="lib/contentful/error.rb">lib/contentful/error.rb</a></td> - <td class="green strong">98.95 %</td> + <td class="red strong">51.58 %</td> <td>211</td> <td>95</td> - <td>94</td> - <td>1</td> - <td>12.6</td> + <td>49</td> + <td>46</td> + <td>0.5</td> </tr> <tr> <td class="strong"><a href="#4f89ce6a6221e537edb751b920a159e36a286ebd" class="src_link" title="lib/contentful/field.rb">lib/contentful/field.rb</a></td> <td class="green strong">100.0 %</td> <td>47</td> <td>21</td> <td>21</td> <td>0</td> - <td>1620.1</td> + <td>126.2</td> </tr> <tr> <td class="strong"><a href="#eecf0f806597fc4b233727ac4e855ef0a80b0ade" class="src_link" title="lib/contentful/fields_resource.rb">lib/contentful/fields_resource.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="red strong">75.38 %</td> <td>143</td> <td>65</td> - <td>65</td> - <td>0</td> - <td>1769.1</td> + <td>49</td> + <td>16</td> + <td>37.4</td> </tr> <tr> <td class="strong"><a href="#5ed9fab05507df717ba26956cbb2b69097c50f41" class="src_link" title="lib/contentful/file.rb">lib/contentful/file.rb</a></td> <td class="green strong">100.0 %</td> <td>20</td> <td>10</td> <td>10</td> <td>0</td> - <td>1082.5</td> + <td>29.3</td> </tr> <tr> <td class="strong"><a href="#f0b3585d50697809ca059b22b439d1c92b144124" class="src_link" title="lib/contentful/link.rb">lib/contentful/link.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="red strong">66.67 %</td> <td>17</td> <td>6</td> - <td>6</td> - <td>0</td> - <td>1.3</td> + <td>4</td> + <td>2</td> + <td>0.7</td> </tr> <tr> <td class="strong"><a href="#ce8ecf27b5e97b41247b7386680ee9aa0e670574" class="src_link" title="lib/contentful/locale.rb">lib/contentful/locale.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="red strong">55.56 %</td> <td>16</td> <td>9</td> - <td>9</td> - <td>0</td> - <td>9.9</td> + <td>5</td> + <td>4</td> + <td>0.6</td> </tr> <tr> <td class="strong"><a href="#0b0fac99f5d491e120b04db5fad4d156a78fc99e" class="src_link" title="lib/contentful/location.rb">lib/contentful/location.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="red strong">75.0 %</td> <td>14</td> <td>8</td> - <td>8</td> - <td>0</td> - <td>1.3</td> + <td>6</td> + <td>2</td> + <td>0.8</td> </tr> <tr> <td class="strong"><a href="#283a9b245e7a50ed1ed0ff2acf5bf3df054a6b05" class="src_link" title="lib/contentful/request.rb">lib/contentful/request.rb</a></td> <td class="green strong">96.0 %</td> <td>56</td> <td>25</td> <td>24</td> <td>1</td> - <td>112.9</td> + <td>13.5</td> </tr> <tr> <td class="strong"><a href="#ea1894a682921dc1a4b4d4255935538a0067cdfd" class="src_link" title="lib/contentful/resource_builder.rb">lib/contentful/resource_builder.rb</a></td> - <td class="green strong">96.74 %</td> - <td>166</td> - <td>92</td> - <td>89</td> - <td>3</td> - <td>1428.5</td> + <td class="green strong">93.55 %</td> + <td>168</td> + <td>93</td> + <td>87</td> + <td>6</td> + <td>51.4</td> </tr> <tr> <td class="strong"><a href="#e5da896cf0ec7b470de392efaedd4669444f03b9" class="src_link" title="lib/contentful/resource_references.rb">lib/contentful/resource_references.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="red strong">50.0 %</td> <td>18</td> <td>6</td> - <td>6</td> - <td>0</td> - <td>2.0</td> + <td>3</td> + <td>3</td> + <td>0.5</td> </tr> <tr> <td class="strong"><a href="#a54a8ab8e00230a5d92a5eb8a7e43f264a700db2" class="src_link" title="lib/contentful/response.rb">lib/contentful/response.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="red strong">60.0 %</td> <td>107</td> <td>55</td> - <td>55</td> - <td>0</td> - <td>69.0</td> + <td>33</td> + <td>22</td> + <td>7.1</td> </tr> <tr> <td class="strong"><a href="#42827798fb56cb87d145e81d9ae46dfe97e9818b" class="src_link" title="lib/contentful/space.rb">lib/contentful/space.rb</a></td> - <td class="yellow strong">83.33 %</td> + <td class="red strong">58.33 %</td> <td>24</td> <td>12</td> - <td>10</td> - <td>2</td> - <td>4.3</td> + <td>7</td> + <td>5</td> + <td>0.6</td> </tr> <tr> <td class="strong"><a href="#a300a2b740de48d4aa41783c879260ce3e4785ba" class="src_link" title="lib/contentful/support.rb">lib/contentful/support.rb</a></td> <td class="green strong">100.0 %</td> <td>87</td> <td>25</td> <td>25</td> <td>0</td> - <td>11253.1</td> + <td>248.7</td> </tr> <tr> <td class="strong"><a href="#84dd5a82215a9c45df06f943a5b88003a007c2e3" class="src_link" title="lib/contentful/sync.rb">lib/contentful/sync.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="red strong">52.63 %</td> <td>85</td> <td>38</td> - <td>38</td> - <td>0</td> - <td>15.4</td> + <td>20</td> + <td>18</td> + <td>0.5</td> </tr> <tr> <td class="strong"><a href="#99e7ff3ec5cef4c1f8a70725a19da05567b157fd" class="src_link" title="lib/contentful/sync_page.rb">lib/contentful/sync_page.rb</a></td> - <td class="green strong">94.74 %</td> + <td class="red strong">57.89 %</td> <td>50</td> <td>19</td> - <td>18</td> - <td>1</td> - <td>10.6</td> + <td>11</td> + <td>8</td> + <td>0.6</td> </tr> <tr> - <td class="strong"><a href="#26151d16243d86e4a0f5aa143518973c5fc190f5" class="src_link" title="spec/asset_spec.rb">spec/asset_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>192</td> - <td>104</td> - <td>104</td> - <td>0</td> - <td>1.4</td> - </tr> - - <tr> - <td class="strong"><a href="#f95dca85be477fbdc528fdb56a7e036b592793bf" class="src_link" title="spec/auto_includes_spec.rb">spec/auto_includes_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>12</td> - <td>7</td> - <td>7</td> - <td>0</td> - <td>1.3</td> - </tr> - - <tr> <td class="strong"><a href="#a5b449a98635efa082944faacae851b1dab9ab8c" class="src_link" title="spec/client_class_spec.rb">spec/client_class_spec.rb</a></td> <td class="green strong">100.0 %</td> <td>86</td> <td>51</td> <td>51</td> <td>0</td> <td>1.6</td> </tr> <tr> - <td class="strong"><a href="#d051f37597cb573fb8f2516b5cdf4009ca5c4e80" class="src_link" title="spec/client_configuration_spec.rb">spec/client_configuration_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>377</td> - <td>165</td> - <td>165</td> - <td>0</td> - <td>1.4</td> - </tr> - - <tr> - <td class="strong"><a href="#a13ad32dd6d5c02d3772a4dd1d1e6e305b77003e" class="src_link" title="spec/content_type_spec.rb">spec/content_type_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>49</td> - <td>26</td> - <td>26</td> - <td>0</td> - <td>1.5</td> - </tr> - - <tr> - <td class="strong"><a href="#4c609b9f8ef04e1d39a0e44d3e7df4e970ef32ed" class="src_link" title="spec/deleted_asset_spec.rb">spec/deleted_asset_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>38</td> - <td>20</td> - <td>20</td> - <td>0</td> - <td>1.3</td> - </tr> - - <tr> - <td class="strong"><a href="#363838f9765468206e180a5461c937dff2f2ee47" class="src_link" title="spec/deleted_entry_spec.rb">spec/deleted_entry_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>38</td> - <td>20</td> - <td>20</td> - <td>0</td> - <td>1.3</td> - </tr> - - <tr> - <td class="strong"><a href="#b9d994cc83de1652f7c9126b34ef4d10041b9da0" class="src_link" title="spec/entry_spec.rb">spec/entry_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>757</td> - <td>324</td> - <td>324</td> - <td>0</td> - <td>1.3</td> - </tr> - - <tr> - <td class="strong"><a href="#ba5ec4bdbf6ab50e064edb4d1e274e870b307f6e" class="src_link" title="spec/error_class_spec.rb">spec/error_class_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>327</td> - <td>151</td> - <td>151</td> - <td>0</td> - <td>1.0</td> - </tr> - - <tr> - <td class="strong"><a href="#a882eb4cc91a2c1702f2e5743aba55a06bbc06f0" class="src_link" title="spec/error_requests_spec.rb">spec/error_requests_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>87</td> - <td>44</td> - <td>44</td> - <td>0</td> - <td>1.7</td> - </tr> - - <tr> - <td class="strong"><a href="#60501d65433b1709942162aa7e81098ef5f8d6cc" class="src_link" title="spec/field_spec.rb">spec/field_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>95</td> - <td>53</td> - <td>53</td> - <td>0</td> - <td>2.1</td> - </tr> - - <tr> - <td class="strong"><a href="#f319b7711f92cae0e531bde60aaa88fa553e06cf" class="src_link" title="spec/file_spec.rb">spec/file_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>33</td> - <td>18</td> - <td>18</td> - <td>0</td> - <td>1.4</td> - </tr> - - <tr> - <td class="strong"><a href="#0e177320f9d9f1f1848788e038064e0e57e552dd" class="src_link" title="spec/link_spec.rb">spec/link_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>50</td> - <td>28</td> - <td>28</td> - <td>0</td> - <td>1.7</td> - </tr> - - <tr> - <td class="strong"><a href="#3087380aad15023264d655b41cb4b039f41d8e4d" class="src_link" title="spec/locale_spec.rb">spec/locale_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>37</td> - <td>18</td> - <td>18</td> - <td>0</td> - <td>1.3</td> - </tr> - - <tr> - <td class="strong"><a href="#05f5b25581a35a18308ada667027abe9591adca2" class="src_link" title="spec/location_spec.rb">spec/location_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>25</td> - <td>12</td> - <td>12</td> - <td>0</td> - <td>1.2</td> - </tr> - - <tr> - <td class="strong"><a href="#95ae9505ac5703f29dc61019198d16ca813935a2" class="src_link" title="spec/request_spec.rb">spec/request_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>57</td> - <td>31</td> - <td>31</td> - <td>0</td> - <td>1.1</td> - </tr> - - <tr> - <td class="strong"><a href="#9c14f2e925ace67d177e53f0129d77745bd3f83f" class="src_link" title="spec/resource_building_spec.rb">spec/resource_building_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>31</td> - <td>21</td> - <td>21</td> - <td>0</td> - <td>1.0</td> - </tr> - - <tr> - <td class="strong"><a href="#19ee8dac79d02390e73ed93191aa8c676874060e" class="src_link" title="spec/response_spec.rb">spec/response_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>62</td> - <td>35</td> - <td>35</td> - <td>0</td> - <td>1.3</td> - </tr> - - <tr> - <td class="strong"><a href="#af3edbfb21ba19158fe1a8aee1384a7e9b406807" class="src_link" title="spec/space_spec.rb">spec/space_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>31</td> - <td>17</td> - <td>17</td> - <td>0</td> - <td>1.6</td> - </tr> - - <tr> <td class="strong"><a href="#5eb25a1b26ae65158e1a7386a20084d608b4951d" class="src_link" title="spec/support/client.rb">spec/support/client.rb</a></td> <td class="green strong">100.0 %</td> <td>6</td> <td>2</td> <td>2</td> <td>0</td> - <td>121.0</td> + <td>15.5</td> </tr> <tr> <td class="strong"><a href="#a4ba320676b73b8644cffc9dbb12bbe8e19a9934" class="src_link" title="spec/support/json_responses.rb">spec/support/json_responses.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="green strong">90.91 %</td> <td>18</td> <td>11</td> - <td>11</td> - <td>0</td> - <td>64.9</td> + <td>10</td> + <td>1</td> + <td>3.9</td> </tr> <tr> <td class="strong"><a href="#027342a1ab3607ccd90fe9e5972948d26cbc8bed" class="src_link" title="spec/support/vcr.rb">spec/support/vcr.rb</a></td> - <td class="green strong">100.0 %</td> + <td class="yellow strong">90.0 %</td> <td>16</td> <td>10</td> - <td>10</td> - <td>0</td> - <td>22.7</td> + <td>9</td> + <td>1</td> + <td>3.1</td> </tr> - <tr> - <td class="strong"><a href="#95b8bb4afe6ed95b076be799979ae2c639fbab8f" class="src_link" title="spec/sync_page_spec.rb">spec/sync_page_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>103</td> - <td>54</td> - <td>54</td> - <td>0</td> - <td>1.7</td> - </tr> - - <tr> - <td class="strong"><a href="#f811ceb52b7a29eaa4e3dd16037352e742150ad6" class="src_link" title="spec/sync_spec.rb">spec/sync_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>180</td> - <td>79</td> - <td>79</td> - <td>0</td> - <td>1.7</td> - </tr> - </tbody> </table> </div> </div> <div id="footer"> - Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.16.1 + Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.17.1 and simplecov-html v0.10.2<br/> using RSpec </div> <div class="source_files"> @@ -616,12 +416,12 @@ <div class="source_table" id="1c9cd9f08977d8378a5d40be4bcddd0f07adc70d"> <div class="header"> <h3>lib/contentful/array.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>34</b> relevant lines. - <span class="green"><b>34</b> lines covered</span> and + <b>36</b> relevant lines. + <span class="green"><b>36</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -706,11 +506,11 @@ </li> <li class="covered" data-hits="1" data-linenumber="14"> <span class="hits">1</span> - <code class="ruby"> attr_reader :total, :limit, :skip, :items, :endpoint</code> + <code class="ruby"> attr_reader :total, :limit, :skip, :items, :endpoint, :query</code> </li> <li class="never" data-hits="" data-linenumber="15"> @@ -742,356 +542,386 @@ </li> <li class="never" data-hits="" data-linenumber="20"> - <code class="ruby"> endpoint = &#39;&#39;, *)</code> + <code class="ruby"> endpoint = &#39;&#39;,</code> </li> - <li class="covered" data-hits="131" data-linenumber="21"> - <span class="hits">131</span> + <li class="never" data-hits="" data-linenumber="21"> - <code class="ruby"> super(item, configuration)</code> + + <code class="ruby"> query = {},</code> </li> <li class="never" data-hits="" data-linenumber="22"> + <code class="ruby"> *)</code> + </li> + + <li class="covered" data-hits="23" data-linenumber="23"> + <span class="hits">23</span> + + <code class="ruby"> super(item, configuration)</code> + </li> + + <li class="never" data-hits="" data-linenumber="24"> + + <code class="ruby"></code> </li> - <li class="covered" data-hits="131" data-linenumber="23"> - <span class="hits">131</span> + <li class="covered" data-hits="23" data-linenumber="25"> + <span class="hits">23</span> <code class="ruby"> @endpoint = endpoint</code> </li> - <li class="covered" data-hits="131" data-linenumber="24"> - <span class="hits">131</span> + <li class="covered" data-hits="23" data-linenumber="26"> + <span class="hits">23</span> <code class="ruby"> @total = item.fetch(&#39;total&#39;, nil)</code> </li> - <li class="covered" data-hits="131" data-linenumber="25"> - <span class="hits">131</span> + <li class="covered" data-hits="23" data-linenumber="27"> + <span class="hits">23</span> <code class="ruby"> @limit = item.fetch(&#39;limit&#39;, nil)</code> </li> - <li class="covered" data-hits="131" data-linenumber="26"> - <span class="hits">131</span> + <li class="covered" data-hits="23" data-linenumber="28"> + <span class="hits">23</span> <code class="ruby"> @skip = item.fetch(&#39;skip&#39;, nil)</code> </li> - <li class="covered" data-hits="131" data-linenumber="27"> - <span class="hits">131</span> + <li class="covered" data-hits="23" data-linenumber="29"> + <span class="hits">23</span> <code class="ruby"> @items = item.fetch(&#39;items&#39;, [])</code> </li> - <li class="never" data-hits="" data-linenumber="28"> + <li class="covered" data-hits="23" data-linenumber="30"> + <span class="hits">23</span> + <code class="ruby"> @query = query</code> + </li> + + <li class="never" data-hits="" data-linenumber="31"> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="29"> + <li class="never" data-hits="" data-linenumber="32"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="30"> + <li class="never" data-hits="" data-linenumber="33"> <code class="ruby"> # @private</code> </li> - <li class="covered" data-hits="1" data-linenumber="31"> + <li class="covered" data-hits="1" data-linenumber="34"> <span class="hits">1</span> <code class="ruby"> def marshal_dump</code> </li> - <li class="covered" data-hits="5" data-linenumber="32"> + <li class="covered" data-hits="5" data-linenumber="35"> <span class="hits">5</span> - <code class="ruby"> super.merge(endpoint: endpoint)</code> + <code class="ruby"> super.merge(endpoint: endpoint, query: query)</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="36"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="34"> + <li class="never" data-hits="" data-linenumber="37"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="never" data-hits="" data-linenumber="38"> <code class="ruby"> # @private</code> </li> - <li class="covered" data-hits="1" data-linenumber="36"> + <li class="covered" data-hits="1" data-linenumber="39"> <span class="hits">1</span> <code class="ruby"> def marshal_load(raw_object)</code> </li> - <li class="covered" data-hits="5" data-linenumber="37"> + <li class="covered" data-hits="5" data-linenumber="40"> <span class="hits">5</span> <code class="ruby"> super</code> </li> - <li class="covered" data-hits="5" data-linenumber="38"> + <li class="covered" data-hits="5" data-linenumber="41"> <span class="hits">5</span> <code class="ruby"> @endpoint = raw_object[:endpoint]</code> </li> - <li class="covered" data-hits="5" data-linenumber="39"> + <li class="covered" data-hits="5" data-linenumber="42"> <span class="hits">5</span> <code class="ruby"> @total = raw.fetch(&#39;total&#39;, nil)</code> </li> - <li class="covered" data-hits="5" data-linenumber="40"> + <li class="covered" data-hits="5" data-linenumber="43"> <span class="hits">5</span> <code class="ruby"> @limit = raw.fetch(&#39;limit&#39;, nil)</code> </li> - <li class="covered" data-hits="5" data-linenumber="41"> + <li class="covered" data-hits="5" data-linenumber="44"> <span class="hits">5</span> <code class="ruby"> @skip = raw.fetch(&#39;skip&#39;, nil)</code> </li> - <li class="covered" data-hits="5" data-linenumber="42"> + <li class="covered" data-hits="5" data-linenumber="45"> <span class="hits">5</span> + <code class="ruby"> @query = raw_object[:query]</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="46"> + <span class="hits">5</span> + <code class="ruby"> @items = raw.fetch(&#39;items&#39;, []).map do |item|</code> </li> - <li class="covered" data-hits="9" data-linenumber="43"> + <li class="covered" data-hits="9" data-linenumber="47"> <span class="hits">9</span> <code class="ruby"> require_relative &#39;resource_builder&#39;</code> </li> - <li class="covered" data-hits="9" data-linenumber="44"> + <li class="covered" data-hits="9" data-linenumber="48"> <span class="hits">9</span> <code class="ruby"> ResourceBuilder.new(</code> </li> - <li class="never" data-hits="" data-linenumber="45"> + <li class="never" data-hits="" data-linenumber="49"> <code class="ruby"> item.raw,</code> </li> - <li class="never" data-hits="" data-linenumber="46"> + <li class="never" data-hits="" data-linenumber="50"> <code class="ruby"> raw_object[:configuration].merge(includes_for_single: Support.includes_from_response(raw, false)),</code> </li> - <li class="covered" data-hits="9" data-linenumber="47"> + <li class="covered" data-hits="9" data-linenumber="51"> <span class="hits">9</span> <code class="ruby"> item.respond_to?(:localized) ? item.localized : false,</code> </li> - <li class="never" data-hits="" data-linenumber="48"> + <li class="never" data-hits="" data-linenumber="52"> <code class="ruby"> 0,</code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="never" data-hits="" data-linenumber="53"> <code class="ruby"> raw_object[:configuration][:errors] || []</code> </li> - <li class="never" data-hits="" data-linenumber="50"> + <li class="never" data-hits="" data-linenumber="54"> <code class="ruby"> ).run</code> </li> - <li class="never" data-hits="" data-linenumber="51"> + <li class="never" data-hits="" data-linenumber="55"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="52"> + <li class="never" data-hits="" data-linenumber="56"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="53"> + <li class="never" data-hits="" data-linenumber="57"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="54"> + <li class="never" data-hits="" data-linenumber="58"> <code class="ruby"> # @private</code> </li> - <li class="covered" data-hits="1" data-linenumber="55"> + <li class="covered" data-hits="1" data-linenumber="59"> <span class="hits">1</span> <code class="ruby"> def inspect</code> </li> - <li class="covered" data-hits="2" data-linenumber="56"> + <li class="covered" data-hits="2" data-linenumber="60"> <span class="hits">2</span> <code class="ruby"> &quot;&lt;#{repr_name} total=#{total} skip=#{skip} limit=#{limit}&gt;&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="57"> + <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="58"> + <li class="never" data-hits="" data-linenumber="62"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="59"> + <li class="never" data-hits="" data-linenumber="63"> <code class="ruby"> # Simplifies pagination</code> </li> - <li class="never" data-hits="" data-linenumber="60"> + <li class="never" data-hits="" data-linenumber="64"> <code class="ruby"> #</code> </li> - <li class="never" data-hits="" data-linenumber="61"> + <li class="never" data-hits="" data-linenumber="65"> <code class="ruby"> # @return [Contentful::Array, false]</code> </li> - <li class="covered" data-hits="1" data-linenumber="62"> + <li class="covered" data-hits="1" data-linenumber="66"> <span class="hits">1</span> <code class="ruby"> def next_page(client = nil)</code> </li> - <li class="covered" data-hits="1" data-linenumber="63"> - <span class="hits">1</span> + <li class="covered" data-hits="2" data-linenumber="67"> + <span class="hits">2</span> <code class="ruby"> return false if client.nil?</code> </li> - <li class="covered" data-hits="1" data-linenumber="64"> - <span class="hits">1</span> + <li class="covered" data-hits="2" data-linenumber="68"> + <span class="hits">2</span> <code class="ruby"> return false if items.first.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="65"> + <li class="never" data-hits="" data-linenumber="69"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="66"> - <span class="hits">1</span> + <li class="covered" data-hits="2" data-linenumber="70"> + <span class="hits">2</span> <code class="ruby"> new_skip = (skip || 0) + (limit || DEFAULT_LIMIT)</code> </li> - <li class="never" data-hits="" data-linenumber="67"> + <li class="never" data-hits="" data-linenumber="71"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="68"> + <li class="never" data-hits="" data-linenumber="72"> <code class="ruby"> plurals = {</code> </li> - <li class="covered" data-hits="1" data-linenumber="69"> - <span class="hits">1</span> + <li class="covered" data-hits="2" data-linenumber="73"> + <span class="hits">2</span> <code class="ruby"> &#39;Space&#39; =&gt; &#39;spaces&#39;,</code> </li> - <li class="never" data-hits="" data-linenumber="70"> + <li class="never" data-hits="" data-linenumber="74"> <code class="ruby"> &#39;ContentType&#39; =&gt; &#39;content_types&#39;,</code> </li> - <li class="never" data-hits="" data-linenumber="71"> + <li class="never" data-hits="" data-linenumber="75"> <code class="ruby"> &#39;Entry&#39; =&gt; &#39;entries&#39;,</code> </li> - <li class="never" data-hits="" data-linenumber="72"> + <li class="never" data-hits="" data-linenumber="76"> <code class="ruby"> &#39;Asset&#39; =&gt; &#39;assets&#39;,</code> </li> - <li class="never" data-hits="" data-linenumber="73"> + <li class="never" data-hits="" data-linenumber="77"> <code class="ruby"> &#39;Locale&#39; =&gt; &#39;locales&#39;</code> </li> - <li class="never" data-hits="" data-linenumber="74"> + <li class="never" data-hits="" data-linenumber="78"> <code class="ruby"> }</code> </li> - <li class="covered" data-hits="1" data-linenumber="75"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="79"> - <code class="ruby"> client.public_send(plurals[items.first.type], limit: limit, skip: new_skip)</code> + + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="76"> + <li class="covered" data-hits="2" data-linenumber="80"> + <span class="hits">2</span> + <code class="ruby"> client.public_send(plurals[items.first.type], query.merge(limit: limit, skip: new_skip))</code> + </li> + + <li class="never" data-hits="" data-linenumber="81"> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="77"> + <li class="never" data-hits="" data-linenumber="82"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="78"> + <li class="never" data-hits="" data-linenumber="83"> <code class="ruby">end</code> </li> @@ -1101,15 +931,15 @@ <div class="source_table" id="bc50260d115630bb3b54a3ab26a820be409e35fe"> <div class="header"> <h3>lib/contentful/array_like.rb</h3> - <h4><span class="yellow">82.35 %</span> covered</h4> + <h4><span class="yellow">88.24 %</span> covered</h4> <div> <b>17</b> relevant lines. - <span class="green"><b>14</b> lines covered</span> and - <span class="red"><b>3</b> lines missed.</span> + <span class="green"><b>15</b> lines covered</span> and + <span class="red"><b>2</b> lines missed.</span> </div> </div> <pre> <ol> @@ -1214,12 +1044,12 @@ <span class="hits">1</span> <code class="ruby"> def each_item(&amp;block)</code> </li> - <li class="covered" data-hits="132" data-linenumber="18"> - <span class="hits">132</span> + <li class="covered" data-hits="16" data-linenumber="18"> + <span class="hits">16</span> <code class="ruby"> items.each(&amp;block)</code> </li> <li class="never" data-hits="" data-linenumber="19"> @@ -1262,13 +1092,13 @@ <span class="hits">1</span> <code class="ruby"> def empty?</code> </li> - <li class="covered" data-hits="5" data-linenumber="26"> - <span class="hits">5</span> + <li class="missed" data-hits="0" data-linenumber="26"> + <code class="ruby"> items.empty?</code> </li> <li class="never" data-hits="" data-linenumber="27"> @@ -1304,13 +1134,13 @@ <span class="hits">1</span> <code class="ruby"> def size</code> </li> - <li class="missed" data-hits="0" data-linenumber="33"> + <li class="covered" data-hits="2" data-linenumber="33"> + <span class="hits">2</span> - <code class="ruby"> items.size</code> </li> <li class="never" data-hits="" data-linenumber="34"> @@ -1352,13 +1182,13 @@ <span class="hits">1</span> <code class="ruby"> def [](index)</code> </li> - <li class="missed" data-hits="0" data-linenumber="41"> + <li class="covered" data-hits="4" data-linenumber="41"> + <span class="hits">4</span> - <code class="ruby"> items[index]</code> </li> <li class="never" data-hits="" data-linenumber="42"> @@ -1426,15 +1256,15 @@ <div class="source_table" id="167545c06de91266c75254299e80bf4aa23830c5"> <div class="header"> <h3>lib/contentful/asset.rb</h3> - <h4><span class="green">95.12 %</span> covered</h4> + <h4><span class="yellow">87.8 %</span> covered</h4> <div> <b>41</b> relevant lines. - <span class="green"><b>39</b> lines covered</span> and - <span class="red"><b>2</b> lines missed.</span> + <span class="green"><b>36</b> lines covered</span> and + <span class="red"><b>5</b> lines missed.</span> </div> </div> <pre> <ol> @@ -1515,12 +1345,12 @@ <code class="ruby"> {</code> </li> - <li class="covered" data-hits="19" data-linenumber="14"> - <span class="hits">19</span> + <li class="covered" data-hits="8" data-linenumber="14"> + <span class="hits">8</span> <code class="ruby"> configuration: @configuration,</code> </li> <li class="never" data-hits="" data-linenumber="15"> @@ -1557,24 +1387,24 @@ <span class="hits">1</span> <code class="ruby"> def marshal_load(raw_object)</code> </li> - <li class="covered" data-hits="19" data-linenumber="21"> - <span class="hits">19</span> + <li class="covered" data-hits="8" data-linenumber="21"> + <span class="hits">8</span> <code class="ruby"> super(raw_object)</code> </li> - <li class="covered" data-hits="19" data-linenumber="22"> - <span class="hits">19</span> + <li class="covered" data-hits="8" data-linenumber="22"> + <span class="hits">8</span> <code class="ruby"> create_files!</code> </li> - <li class="covered" data-hits="19" data-linenumber="23"> - <span class="hits">19</span> + <li class="covered" data-hits="8" data-linenumber="23"> + <span class="hits">8</span> <code class="ruby"> define_asset_methods!</code> </li> <li class="never" data-hits="" data-linenumber="24"> @@ -1623,24 +1453,24 @@ <span class="hits">1</span> <code class="ruby"> def initialize(*)</code> </li> - <li class="covered" data-hits="1524" data-linenumber="32"> - <span class="hits">1524</span> + <li class="covered" data-hits="32" data-linenumber="32"> + <span class="hits">32</span> <code class="ruby"> super</code> </li> - <li class="covered" data-hits="1524" data-linenumber="33"> - <span class="hits">1524</span> + <li class="covered" data-hits="32" data-linenumber="33"> + <span class="hits">32</span> <code class="ruby"> create_files!</code> </li> - <li class="covered" data-hits="1524" data-linenumber="34"> - <span class="hits">1524</span> + <li class="covered" data-hits="32" data-linenumber="34"> + <span class="hits">32</span> <code class="ruby"> define_asset_methods!</code> </li> <li class="never" data-hits="" data-linenumber="35"> @@ -1743,43 +1573,43 @@ <span class="hits">1</span> <code class="ruby"> def image_url(options = {})</code> </li> - <li class="covered" data-hits="17" data-linenumber="52"> - <span class="hits">17</span> + <li class="covered" data-hits="8" data-linenumber="52"> + <span class="hits">8</span> <code class="ruby"> query = build_query(options)</code> </li> <li class="never" data-hits="" data-linenumber="53"> <code class="ruby"></code> </li> - <li class="covered" data-hits="17" data-linenumber="54"> - <span class="hits">17</span> + <li class="covered" data-hits="8" data-linenumber="54"> + <span class="hits">8</span> <code class="ruby"> if query.empty?</code> </li> - <li class="covered" data-hits="15" data-linenumber="55"> - <span class="hits">15</span> + <li class="covered" data-hits="8" data-linenumber="55"> + <span class="hits">8</span> <code class="ruby"> file.url</code> </li> <li class="never" data-hits="" data-linenumber="56"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="2" data-linenumber="57"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="57"> + <code class="ruby"> &quot;#{file.url}?#{URI.encode_www_form(query)}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="58"> @@ -1833,12 +1663,12 @@ <code class="ruby"> {</code> </li> - <li class="covered" data-hits="17" data-linenumber="67"> - <span class="hits">17</span> + <li class="covered" data-hits="8" data-linenumber="67"> + <span class="hits">8</span> <code class="ruby"> w: options[:w] || options[:width],</code> </li> <li class="never" data-hits="" data-linenumber="68"> @@ -1887,12 +1717,12 @@ <code class="ruby"> fl: options[:fl]</code> </li> - <li class="covered" data-hits="153" data-linenumber="76"> - <span class="hits">153</span> + <li class="covered" data-hits="72" data-linenumber="76"> + <span class="hits">72</span> <code class="ruby"> }.reject { |_k, v| v.nil? }</code> </li> <li class="never" data-hits="" data-linenumber="77"> @@ -1911,49 +1741,49 @@ <span class="hits">1</span> <code class="ruby"> def create_files!</code> </li> - <li class="covered" data-hits="1543" data-linenumber="80"> - <span class="hits">1543</span> + <li class="covered" data-hits="40" data-linenumber="80"> + <span class="hits">40</span> <code class="ruby"> file_json = raw.fetch(&#39;fields&#39;, {}).fetch(&#39;file&#39;, nil)</code> </li> - <li class="covered" data-hits="1543" data-linenumber="81"> - <span class="hits">1543</span> + <li class="covered" data-hits="40" data-linenumber="81"> + <span class="hits">40</span> <code class="ruby"> return if file_json.nil?</code> </li> <li class="never" data-hits="" data-linenumber="82"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3078" data-linenumber="83"> - <span class="hits">3078</span> + <li class="covered" data-hits="80" data-linenumber="83"> + <span class="hits">80</span> <code class="ruby"> is_localized = file_json.keys.none? { |f| %w[fileName contentType details url].include? f }</code> </li> - <li class="covered" data-hits="1538" data-linenumber="84"> - <span class="hits">1538</span> + <li class="covered" data-hits="40" data-linenumber="84"> + <span class="hits">40</span> <code class="ruby"> if is_localized</code> </li> - <li class="covered" data-hits="737" data-linenumber="85"> - <span class="hits">737</span> + <li class="missed" data-hits="0" data-linenumber="85"> + <code class="ruby"> locales.each do |locale|</code> </li> - <li class="covered" data-hits="739" data-linenumber="86"> - <span class="hits">739</span> + <li class="missed" data-hits="0" data-linenumber="86"> + <code class="ruby"> @fields[locale][:file] = ::Contentful::File.new(file_json[locale.to_s] || {}, @configuration)</code> </li> <li class="never" data-hits="" data-linenumber="87"> @@ -1965,12 +1795,12 @@ <code class="ruby"> else</code> </li> - <li class="covered" data-hits="801" data-linenumber="89"> - <span class="hits">801</span> + <li class="covered" data-hits="40" data-linenumber="89"> + <span class="hits">40</span> <code class="ruby"> @fields[internal_resource_locale][:file] = ::Contentful::File.new(file_json, @configuration)</code> </li> <li class="never" data-hits="" data-linenumber="90"> @@ -1995,12 +1825,12 @@ <span class="hits">1</span> <code class="ruby"> def define_asset_methods!</code> </li> - <li class="covered" data-hits="1543" data-linenumber="94"> - <span class="hits">1543</span> + <li class="covered" data-hits="40" data-linenumber="94"> + <span class="hits">40</span> <code class="ruby"> define_singleton_method :description do</code> </li> <li class="missed" data-hits="0" data-linenumber="95"> @@ -2019,18 +1849,18 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="1543" data-linenumber="98"> - <span class="hits">1543</span> + <li class="covered" data-hits="40" data-linenumber="98"> + <span class="hits">40</span> <code class="ruby"> define_singleton_method :file do |wanted_locale = nil|</code> </li> - <li class="covered" data-hits="41" data-linenumber="99"> - <span class="hits">41</span> + <li class="covered" data-hits="8" data-linenumber="99"> + <span class="hits">8</span> <code class="ruby"> fields(wanted_locale)[:file]</code> </li> <li class="never" data-hits="" data-linenumber="100"> @@ -2140,54 +1970,54 @@ <span class="hits">1</span> <code class="ruby"> def initialize(item, configuration = {}, _localized = false, _includes = [], entries = {}, depth = 0, _errors = [])</code> </li> - <li class="covered" data-hits="9118" data-linenumber="12"> - <span class="hits">9118</span> + <li class="covered" data-hits="402" data-linenumber="12"> + <span class="hits">402</span> <code class="ruby"> entries[&quot;#{item[&#39;sys&#39;][&#39;type&#39;]}:#{item[&#39;sys&#39;][&#39;id&#39;]}&quot;] = self if entries &amp;&amp; item.key?(&#39;sys&#39;)</code> </li> - <li class="covered" data-hits="9118" data-linenumber="13"> - <span class="hits">9118</span> + <li class="covered" data-hits="402" data-linenumber="13"> + <span class="hits">402</span> <code class="ruby"> @raw = item</code> </li> - <li class="covered" data-hits="9118" data-linenumber="14"> - <span class="hits">9118</span> + <li class="covered" data-hits="402" data-linenumber="14"> + <span class="hits">402</span> <code class="ruby"> @default_locale = configuration[:default_locale]</code> </li> - <li class="covered" data-hits="9118" data-linenumber="15"> - <span class="hits">9118</span> + <li class="covered" data-hits="402" data-linenumber="15"> + <span class="hits">402</span> <code class="ruby"> @depth = depth</code> </li> - <li class="covered" data-hits="9118" data-linenumber="16"> - <span class="hits">9118</span> + <li class="covered" data-hits="402" data-linenumber="16"> + <span class="hits">402</span> <code class="ruby"> @configuration = configuration</code> </li> - <li class="covered" data-hits="9118" data-linenumber="17"> - <span class="hits">9118</span> + <li class="covered" data-hits="402" data-linenumber="17"> + <span class="hits">402</span> <code class="ruby"> @sys = hydrate_sys</code> </li> <li class="never" data-hits="" data-linenumber="18"> <code class="ruby"></code> </li> - <li class="covered" data-hits="9118" data-linenumber="19"> - <span class="hits">9118</span> + <li class="covered" data-hits="402" data-linenumber="19"> + <span class="hits">402</span> <code class="ruby"> define_sys_methods!</code> </li> <li class="never" data-hits="" data-linenumber="20"> @@ -2242,12 +2072,12 @@ <span class="hits">1</span> <code class="ruby"> def ==(other)</code> </li> - <li class="covered" data-hits="5" data-linenumber="29"> - <span class="hits">5</span> + <li class="covered" data-hits="4" data-linenumber="29"> + <span class="hits">4</span> <code class="ruby"> self.class == other.class &amp;&amp; sys[:id] == other.sys[:id]</code> </li> <li class="never" data-hits="" data-linenumber="30"> @@ -2320,42 +2150,42 @@ <span class="hits">1</span> <code class="ruby"> def marshal_load(raw_object)</code> </li> - <li class="covered" data-hits="60" data-linenumber="42"> - <span class="hits">60</span> + <li class="covered" data-hits="25" data-linenumber="42"> + <span class="hits">25</span> <code class="ruby"> @raw = raw_object[:raw]</code> </li> - <li class="covered" data-hits="60" data-linenumber="43"> - <span class="hits">60</span> + <li class="covered" data-hits="25" data-linenumber="43"> + <span class="hits">25</span> <code class="ruby"> @configuration = raw_object[:configuration]</code> </li> - <li class="covered" data-hits="60" data-linenumber="44"> - <span class="hits">60</span> + <li class="covered" data-hits="25" data-linenumber="44"> + <span class="hits">25</span> <code class="ruby"> @default_locale = @configuration[:default_locale]</code> </li> - <li class="covered" data-hits="60" data-linenumber="45"> - <span class="hits">60</span> + <li class="covered" data-hits="25" data-linenumber="45"> + <span class="hits">25</span> <code class="ruby"> @sys = hydrate_sys</code> </li> - <li class="covered" data-hits="60" data-linenumber="46"> - <span class="hits">60</span> + <li class="covered" data-hits="25" data-linenumber="46"> + <span class="hits">25</span> <code class="ruby"> @depth = 0</code> </li> - <li class="covered" data-hits="60" data-linenumber="47"> - <span class="hits">60</span> + <li class="covered" data-hits="25" data-linenumber="47"> + <span class="hits">25</span> <code class="ruby"> define_sys_methods!</code> </li> <li class="never" data-hits="" data-linenumber="48"> @@ -2434,18 +2264,18 @@ <span class="hits">1</span> <code class="ruby"> def define_sys_methods!</code> </li> - <li class="covered" data-hits="9178" data-linenumber="61"> - <span class="hits">9178</span> + <li class="covered" data-hits="427" data-linenumber="61"> + <span class="hits">427</span> <code class="ruby"> @sys.each do |k, v|</code> </li> - <li class="covered" data-hits="58437" data-linenumber="62"> - <span class="hits">58437</span> + <li class="covered" data-hits="2136" data-linenumber="62"> + <span class="hits">2136</span> <code class="ruby"> define_singleton_method(k) { v } unless self.class.method_defined?(k)</code> </li> <li class="never" data-hits="" data-linenumber="63"> @@ -2488,66 +2318,66 @@ <span class="hits">1</span> <code class="ruby"> def hydrate_sys</code> </li> - <li class="covered" data-hits="9178" data-linenumber="70"> - <span class="hits">9178</span> + <li class="covered" data-hits="427" data-linenumber="70"> + <span class="hits">427</span> <code class="ruby"> result = {}</code> </li> - <li class="covered" data-hits="9178" data-linenumber="71"> - <span class="hits">9178</span> + <li class="covered" data-hits="427" data-linenumber="71"> + <span class="hits">427</span> <code class="ruby"> raw.fetch(&#39;sys&#39;, {}).each do |k, v|</code> </li> - <li class="covered" data-hits="41247" data-linenumber="72"> - <span class="hits">41247</span> + <li class="covered" data-hits="1851" data-linenumber="72"> + <span class="hits">1851</span> <code class="ruby"> if LINKS.include?(k)</code> </li> - <li class="covered" data-hits="5335" data-linenumber="73"> - <span class="hits">5335</span> + <li class="covered" data-hits="246" data-linenumber="73"> + <span class="hits">246</span> <code class="ruby"> v = build_link(v)</code> </li> - <li class="covered" data-hits="35912" data-linenumber="74"> - <span class="hits">35912</span> + <li class="covered" data-hits="1605" data-linenumber="74"> + <span class="hits">1605</span> <code class="ruby"> elsif TIMESTAMPS.include?(k)</code> </li> - <li class="covered" data-hits="7012" data-linenumber="75"> - <span class="hits">7012</span> + <li class="covered" data-hits="298" data-linenumber="75"> + <span class="hits">298</span> <code class="ruby"> v = DateTime.parse(v)</code> </li> <li class="never" data-hits="" data-linenumber="76"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="41247" data-linenumber="77"> - <span class="hits">41247</span> + <li class="covered" data-hits="1851" data-linenumber="77"> + <span class="hits">1851</span> <code class="ruby"> result[Support.snakify(k, @configuration[:use_camel_case]).to_sym] = v</code> </li> <li class="never" data-hits="" data-linenumber="78"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="9178" data-linenumber="79"> - <span class="hits">9178</span> + <li class="covered" data-hits="427" data-linenumber="79"> + <span class="hits">427</span> <code class="ruby"> result</code> </li> <li class="never" data-hits="" data-linenumber="80"> @@ -2602,12 +2432,12 @@ <span class="hits">1</span> <code class="ruby"> def internal_resource_locale</code> </li> - <li class="covered" data-hits="7736" data-linenumber="89"> - <span class="hits">7736</span> + <li class="covered" data-hits="245" data-linenumber="89"> + <span class="hits">245</span> <code class="ruby"> sys.fetch(:locale, nil) || default_locale</code> </li> <li class="never" data-hits="" data-linenumber="90"> @@ -2626,18 +2456,18 @@ <span class="hits">1</span> <code class="ruby"> def build_link(item)</code> </li> - <li class="covered" data-hits="5499" data-linenumber="93"> - <span class="hits">5499</span> + <li class="covered" data-hits="250" data-linenumber="93"> + <span class="hits">250</span> <code class="ruby"> require_relative &#39;link&#39;</code> </li> - <li class="covered" data-hits="5499" data-linenumber="94"> - <span class="hits">5499</span> + <li class="covered" data-hits="250" data-linenumber="94"> + <span class="hits">250</span> <code class="ruby"> ::Contentful::Link.new(item, @configuration)</code> </li> <li class="never" data-hits="" data-linenumber="95"> @@ -2664,15 +2494,15 @@ <div class="source_table" id="b0e31f234acd83c871a193ce29ed6b38e9adc98e"> <div class="header"> <h3>lib/contentful/client.rb</h3> - <h4><span class="green">96.79 %</span> covered</h4> + <h4><span class="red">77.56 %</span> covered</h4> <div> <b>156</b> relevant lines. - <span class="green"><b>151</b> lines covered</span> and - <span class="red"><b>5</b> lines missed.</span> + <span class="green"><b>121</b> lines covered</span> and + <span class="red"><b>35</b> lines missed.</span> </div> </div> <pre> <ol> @@ -3005,24 +2835,24 @@ <span class="hits">1</span> <code class="ruby"> def self.get_http(url, query, headers = {}, proxy = {}, timeout = {})</code> </li> - <li class="covered" data-hits="243" data-linenumber="56"> - <span class="hits">243</span> + <li class="covered" data-hits="28" data-linenumber="56"> + <span class="hits">28</span> <code class="ruby"> http = HTTP[headers]</code> </li> - <li class="covered" data-hits="243" data-linenumber="57"> - <span class="hits">243</span> + <li class="covered" data-hits="28" data-linenumber="57"> + <span class="hits">28</span> <code class="ruby"> http = http.timeout(timeout) if timeout.any?</code> </li> - <li class="covered" data-hits="243" data-linenumber="58"> - <span class="hits">243</span> + <li class="covered" data-hits="28" data-linenumber="58"> + <span class="hits">28</span> <code class="ruby"> if proxy[:host]</code> </li> <li class="missed" data-hits="0" data-linenumber="59"> @@ -3035,12 +2865,12 @@ <code class="ruby"> else</code> </li> - <li class="covered" data-hits="243" data-linenumber="61"> - <span class="hits">243</span> + <li class="covered" data-hits="28" data-linenumber="61"> + <span class="hits">28</span> <code class="ruby"> http.get(url, params: query)</code> </li> <li class="never" data-hits="" data-linenumber="62"> @@ -3251,42 +3081,42 @@ <span class="hits">1</span> <code class="ruby"> def initialize(given_configuration = {})</code> </li> - <li class="covered" data-hits="251" data-linenumber="97"> - <span class="hits">251</span> + <li class="covered" data-hits="30" data-linenumber="97"> + <span class="hits">30</span> <code class="ruby"> @configuration = default_configuration.merge(given_configuration)</code> </li> - <li class="covered" data-hits="251" data-linenumber="98"> - <span class="hits">251</span> + <li class="covered" data-hits="30" data-linenumber="98"> + <span class="hits">30</span> <code class="ruby"> normalize_configuration!</code> </li> - <li class="covered" data-hits="251" data-linenumber="99"> - <span class="hits">251</span> + <li class="covered" data-hits="30" data-linenumber="99"> + <span class="hits">30</span> <code class="ruby"> validate_configuration!</code> </li> - <li class="covered" data-hits="243" data-linenumber="100"> - <span class="hits">243</span> + <li class="covered" data-hits="30" data-linenumber="100"> + <span class="hits">30</span> <code class="ruby"> setup_logger</code> </li> <li class="never" data-hits="" data-linenumber="101"> <code class="ruby"></code> </li> - <li class="covered" data-hits="243" data-linenumber="102"> - <span class="hits">243</span> + <li class="covered" data-hits="30" data-linenumber="102"> + <span class="hits">30</span> <code class="ruby"> update_dynamic_entry_cache! if configuration[:dynamic_entries] == :auto</code> </li> <li class="never" data-hits="" data-linenumber="103"> @@ -3311,18 +3141,18 @@ <span class="hits">1</span> <code class="ruby"> def setup_logger</code> </li> - <li class="covered" data-hits="243" data-linenumber="107"> - <span class="hits">243</span> + <li class="covered" data-hits="30" data-linenumber="107"> + <span class="hits">30</span> <code class="ruby"> @logger = configuration[:logger]</code> </li> - <li class="covered" data-hits="243" data-linenumber="108"> - <span class="hits">243</span> + <li class="covered" data-hits="30" data-linenumber="108"> + <span class="hits">30</span> <code class="ruby"> logger.level = configuration[:log_level] if logger</code> </li> <li class="never" data-hits="" data-linenumber="109"> @@ -3353,12 +3183,12 @@ <code class="ruby"> {</code> </li> - <li class="covered" data-hits="253" data-linenumber="114"> - <span class="hits">253</span> + <li class="covered" data-hits="38" data-linenumber="114"> + <span class="hits">38</span> <code class="ruby"> host: configuration[:proxy_host],</code> </li> <li class="never" data-hits="" data-linenumber="115"> @@ -3413,12 +3243,12 @@ <code class="ruby"> {</code> </li> - <li class="covered" data-hits="512" data-linenumber="124"> - <span class="hits">512</span> + <li class="covered" data-hits="71" data-linenumber="124"> + <span class="hits">71</span> <code class="ruby"> connect: configuration[:timeout_connect],</code> </li> <li class="never" data-hits="" data-linenumber="125"> @@ -3431,12 +3261,12 @@ <code class="ruby"> write: configuration[:timeout_write]</code> </li> - <li class="covered" data-hits="1536" data-linenumber="127"> - <span class="hits">1536</span> + <li class="covered" data-hits="213" data-linenumber="127"> + <span class="hits">213</span> <code class="ruby"> }.reject { |_, value| value.nil? }</code> </li> <li class="never" data-hits="" data-linenumber="128"> @@ -3467,12 +3297,12 @@ <span class="hits">1</span> <code class="ruby"> def default_configuration</code> </li> - <li class="covered" data-hits="251" data-linenumber="133"> - <span class="hits">251</span> + <li class="covered" data-hits="30" data-linenumber="133"> + <span class="hits">30</span> <code class="ruby"> DEFAULT_CONFIGURATION.dup</code> </li> <li class="never" data-hits="" data-linenumber="134"> @@ -3521,13 +3351,13 @@ <span class="hits">1</span> <code class="ruby"> def space(query = {})</code> </li> - <li class="covered" data-hits="9" data-linenumber="142"> - <span class="hits">9</span> + <li class="missed" data-hits="0" data-linenumber="142"> + <code class="ruby"> Request.new(self, &#39;&#39;, query).get</code> </li> <li class="never" data-hits="" data-linenumber="143"> @@ -3581,13 +3411,13 @@ <span class="hits">1</span> <code class="ruby"> def content_type(id, query = {})</code> </li> - <li class="covered" data-hits="23" data-linenumber="152"> - <span class="hits">23</span> + <li class="missed" data-hits="0" data-linenumber="152"> + <code class="ruby"> Request.new(self, environment_url(&#39;/content_types&#39;), query, id).get</code> </li> <li class="never" data-hits="" data-linenumber="153"> @@ -3635,12 +3465,12 @@ <span class="hits">1</span> <code class="ruby"> def content_types(query = {})</code> </li> - <li class="covered" data-hits="42" data-linenumber="161"> - <span class="hits">42</span> + <li class="covered" data-hits="16" data-linenumber="161"> + <span class="hits">16</span> <code class="ruby"> Request.new(self, environment_url(&#39;/content_types&#39;), query).get</code> </li> <li class="never" data-hits="" data-linenumber="162"> @@ -3695,49 +3525,49 @@ <span class="hits">1</span> <code class="ruby"> def entry(id, query = {})</code> </li> - <li class="covered" data-hits="56" data-linenumber="171"> - <span class="hits">56</span> + <li class="missed" data-hits="0" data-linenumber="171"> + <code class="ruby"> normalize_select!(query)</code> </li> - <li class="covered" data-hits="56" data-linenumber="172"> - <span class="hits">56</span> + <li class="missed" data-hits="0" data-linenumber="172"> + <code class="ruby"> query[&#39;sys.id&#39;] = id</code> </li> - <li class="covered" data-hits="56" data-linenumber="173"> - <span class="hits">56</span> + <li class="missed" data-hits="0" data-linenumber="173"> + <code class="ruby"> entries = Request.new(self, environment_url(&#39;/entries&#39;), query).get</code> </li> <li class="never" data-hits="" data-linenumber="174"> <code class="ruby"></code> </li> - <li class="covered" data-hits="53" data-linenumber="175"> - <span class="hits">53</span> + <li class="missed" data-hits="0" data-linenumber="175"> + <code class="ruby"> return entries if configuration[:raw_mode]</code> </li> <li class="never" data-hits="" data-linenumber="176"> <code class="ruby"></code> </li> - <li class="covered" data-hits="52" data-linenumber="177"> - <span class="hits">52</span> + <li class="missed" data-hits="0" data-linenumber="177"> + <code class="ruby"> entries.first</code> </li> <li class="never" data-hits="" data-linenumber="178"> @@ -3785,18 +3615,18 @@ <span class="hits">1</span> <code class="ruby"> def entries(query = {})</code> </li> - <li class="covered" data-hits="26" data-linenumber="186"> - <span class="hits">26</span> + <li class="covered" data-hits="6" data-linenumber="186"> + <span class="hits">6</span> <code class="ruby"> normalize_select!(query)</code> </li> - <li class="covered" data-hits="26" data-linenumber="187"> - <span class="hits">26</span> + <li class="covered" data-hits="6" data-linenumber="187"> + <span class="hits">6</span> <code class="ruby"> Request.new(self, environment_url(&#39;/entries&#39;), query).get</code> </li> <li class="never" data-hits="" data-linenumber="188"> @@ -3851,13 +3681,13 @@ <span class="hits">1</span> <code class="ruby"> def asset(id, query = {})</code> </li> - <li class="covered" data-hits="23" data-linenumber="197"> - <span class="hits">23</span> + <li class="missed" data-hits="0" data-linenumber="197"> + <code class="ruby"> Request.new(self, environment_url(&#39;/assets&#39;), query, id).get</code> </li> <li class="never" data-hits="" data-linenumber="198"> @@ -3905,19 +3735,19 @@ <span class="hits">1</span> <code class="ruby"> def assets(query = {})</code> </li> - <li class="covered" data-hits="9" data-linenumber="206"> - <span class="hits">9</span> + <li class="missed" data-hits="0" data-linenumber="206"> + <code class="ruby"> normalize_select!(query)</code> </li> - <li class="covered" data-hits="9" data-linenumber="207"> - <span class="hits">9</span> + <li class="missed" data-hits="0" data-linenumber="207"> + <code class="ruby"> Request.new(self, environment_url(&#39;/assets&#39;), query).get</code> </li> <li class="never" data-hits="" data-linenumber="208"> @@ -3965,13 +3795,13 @@ <span class="hits">1</span> <code class="ruby"> def locales(query = {})</code> </li> - <li class="covered" data-hits="1" data-linenumber="216"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="216"> + <code class="ruby"> Request.new(self, environment_url(&#39;/locales&#39;), query).get</code> </li> <li class="never" data-hits="" data-linenumber="217"> @@ -4001,12 +3831,12 @@ <span class="hits">1</span> <code class="ruby"> def base_url</code> </li> - <li class="covered" data-hits="237" data-linenumber="222"> - <span class="hits">237</span> + <li class="covered" data-hits="36" data-linenumber="222"> + <span class="hits">36</span> <code class="ruby"> &quot;http#{configuration[:secure] ? &#39;s&#39; : &#39;&#39;}://#{configuration[:api_url]}/spaces/#{configuration[:space]}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="223"> @@ -4037,12 +3867,12 @@ <span class="hits">1</span> <code class="ruby"> def environment_url(path)</code> </li> - <li class="covered" data-hits="220" data-linenumber="228"> - <span class="hits">220</span> + <li class="covered" data-hits="32" data-linenumber="228"> + <span class="hits">32</span> <code class="ruby"> &quot;/environments/#{configuration[:environment]}#{path}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="229"> @@ -4073,24 +3903,24 @@ <span class="hits">1</span> <code class="ruby"> def format_user_agent_header(key, values)</code> </li> - <li class="covered" data-hits="915" data-linenumber="234"> - <span class="hits">915</span> + <li class="covered" data-hits="108" data-linenumber="234"> + <span class="hits">108</span> <code class="ruby"> header = &quot;#{key} #{values[:name]}&quot;</code> </li> - <li class="covered" data-hits="915" data-linenumber="235"> - <span class="hits">915</span> + <li class="covered" data-hits="108" data-linenumber="235"> + <span class="hits">108</span> <code class="ruby"> header = &quot;#{header}/#{values[:version]}&quot; if values[:version]</code> </li> - <li class="covered" data-hits="915" data-linenumber="236"> - <span class="hits">915</span> + <li class="covered" data-hits="108" data-linenumber="236"> + <span class="hits">108</span> <code class="ruby"> &quot;#{header};&quot;</code> </li> <li class="never" data-hits="" data-linenumber="237"> @@ -4121,12 +3951,12 @@ <span class="hits">1</span> <code class="ruby"> def sdk_info</code> </li> - <li class="covered" data-hits="295" data-linenumber="242"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="242"> + <span class="hits">36</span> <code class="ruby"> { name: &#39;contentful.rb&#39;, version: ::Contentful::VERSION }</code> </li> <li class="never" data-hits="" data-linenumber="243"> @@ -4157,12 +3987,12 @@ <span class="hits">1</span> <code class="ruby"> def app_info</code> </li> - <li class="covered" data-hits="295" data-linenumber="248"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="248"> + <span class="hits">36</span> <code class="ruby"> { name: configuration[:application_name], version: configuration[:application_version] }</code> </li> <li class="never" data-hits="" data-linenumber="249"> @@ -4193,12 +4023,12 @@ <span class="hits">1</span> <code class="ruby"> def integration_info</code> </li> - <li class="covered" data-hits="295" data-linenumber="254"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="254"> + <span class="hits">36</span> <code class="ruby"> { name: configuration[:integration_name], version: configuration[:integration_version] }</code> </li> <li class="never" data-hits="" data-linenumber="255"> @@ -4229,12 +4059,12 @@ <span class="hits">1</span> <code class="ruby"> def platform_info</code> </li> - <li class="covered" data-hits="295" data-linenumber="260"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="260"> + <span class="hits">36</span> <code class="ruby"> { name: &#39;ruby&#39;, version: RUBY_VERSION }</code> </li> <li class="never" data-hits="" data-linenumber="261"> @@ -4265,24 +4095,24 @@ <span class="hits">1</span> <code class="ruby"> def os_info</code> </li> - <li class="covered" data-hits="295" data-linenumber="266"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="266"> + <span class="hits">36</span> <code class="ruby"> os_name = case ::RbConfig::CONFIG[&#39;host_os&#39;]</code> </li> <li class="missed" data-hits="0" data-linenumber="267"> <code class="ruby"> when /(cygwin|mingw|mswin|windows)/i then &#39;Windows&#39;</code> </li> - <li class="covered" data-hits="295" data-linenumber="268"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="268"> + <span class="hits">36</span> <code class="ruby"> when /(darwin|macruby|mac os)/i then &#39;macOS&#39;</code> </li> <li class="missed" data-hits="0" data-linenumber="269"> @@ -4295,12 +4125,12 @@ <code class="ruby"> end</code> </li> - <li class="covered" data-hits="295" data-linenumber="271"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="271"> + <span class="hits">36</span> <code class="ruby"> { name: os_name, version: Gem::Platform.local.version }</code> </li> <li class="never" data-hits="" data-linenumber="272"> @@ -4337,12 +4167,12 @@ <code class="ruby"> header = {</code> </li> - <li class="covered" data-hits="295" data-linenumber="278"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="278"> + <span class="hits">36</span> <code class="ruby"> &#39;sdk&#39; =&gt; sdk_info,</code> </li> <li class="never" data-hits="" data-linenumber="279"> @@ -4379,42 +4209,42 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="295" data-linenumber="285"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="285"> + <span class="hits">36</span> <code class="ruby"> result = []</code> </li> - <li class="covered" data-hits="295" data-linenumber="286"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="286"> + <span class="hits">36</span> <code class="ruby"> header.each do |key, values|</code> </li> - <li class="covered" data-hits="1475" data-linenumber="287"> - <span class="hits">1475</span> + <li class="covered" data-hits="180" data-linenumber="287"> + <span class="hits">180</span> <code class="ruby"> next unless values[:name]</code> </li> - <li class="covered" data-hits="915" data-linenumber="288"> - <span class="hits">915</span> + <li class="covered" data-hits="108" data-linenumber="288"> + <span class="hits">108</span> <code class="ruby"> result &lt;&lt; format_user_agent_header(key, values)</code> </li> <li class="never" data-hits="" data-linenumber="289"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="295" data-linenumber="290"> - <span class="hits">295</span> + <li class="covered" data-hits="36" data-linenumber="290"> + <span class="hits">36</span> <code class="ruby"> result.join(&#39; &#39;)</code> </li> <li class="never" data-hits="" data-linenumber="291"> @@ -4445,36 +4275,36 @@ <span class="hits">1</span> <code class="ruby"> def request_headers</code> </li> - <li class="covered" data-hits="259" data-linenumber="296"> - <span class="hits">259</span> + <li class="covered" data-hits="36" data-linenumber="296"> + <span class="hits">36</span> <code class="ruby"> headers = { &#39;X-Contentful-User-Agent&#39; =&gt; contentful_user_agent }</code> </li> - <li class="covered" data-hits="259" data-linenumber="297"> - <span class="hits">259</span> + <li class="covered" data-hits="36" data-linenumber="297"> + <span class="hits">36</span> <code class="ruby"> headers[&#39;Authorization&#39;] = &quot;Bearer #{configuration[:access_token]}&quot; if configuration[:authentication_mechanism] == :header</code> </li> - <li class="covered" data-hits="259" data-linenumber="298"> - <span class="hits">259</span> + <li class="covered" data-hits="36" data-linenumber="298"> + <span class="hits">36</span> <code class="ruby"> headers[&#39;Content-Type&#39;] = &quot;application/vnd.contentful.delivery.v#{configuration[:api_version].to_i}+json&quot; if configuration[:api_version]</code> </li> - <li class="covered" data-hits="259" data-linenumber="299"> - <span class="hits">259</span> + <li class="covered" data-hits="36" data-linenumber="299"> + <span class="hits">36</span> <code class="ruby"> headers[&#39;Accept-Encoding&#39;] = &#39;gzip&#39; if configuration[:gzip_encoded]</code> </li> - <li class="covered" data-hits="259" data-linenumber="300"> - <span class="hits">259</span> + <li class="covered" data-hits="36" data-linenumber="300"> + <span class="hits">36</span> <code class="ruby"> headers</code> </li> <li class="never" data-hits="" data-linenumber="301"> @@ -4505,30 +4335,30 @@ <span class="hits">1</span> <code class="ruby"> def request_query(query)</code> </li> - <li class="covered" data-hits="249" data-linenumber="306"> - <span class="hits">249</span> + <li class="covered" data-hits="32" data-linenumber="306"> + <span class="hits">32</span> <code class="ruby"> if configuration[:authentication_mechanism] == :query_string</code> </li> - <li class="covered" data-hits="1" data-linenumber="307"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="307"> + <code class="ruby"> query[&#39;access_token&#39;] = configuration[:access_token]</code> </li> <li class="never" data-hits="" data-linenumber="308"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="249" data-linenumber="309"> - <span class="hits">249</span> + <li class="covered" data-hits="32" data-linenumber="309"> + <span class="hits">32</span> <code class="ruby"> query</code> </li> <li class="never" data-hits="" data-linenumber="310"> @@ -4577,66 +4407,66 @@ <span class="hits">1</span> <code class="ruby"> def get(request, build_resource = true)</code> </li> - <li class="covered" data-hits="246" data-linenumber="318"> - <span class="hits">246</span> + <li class="covered" data-hits="32" data-linenumber="318"> + <span class="hits">32</span> <code class="ruby"> retries_left = configuration[:max_rate_limit_retries]</code> </li> - <li class="covered" data-hits="246" data-linenumber="319"> - <span class="hits">246</span> + <li class="covered" data-hits="32" data-linenumber="319"> + <span class="hits">32</span> <code class="ruby"> result = nil</code> </li> <li class="never" data-hits="" data-linenumber="320"> <code class="ruby"> begin</code> </li> - <li class="covered" data-hits="247" data-linenumber="321"> - <span class="hits">247</span> + <li class="covered" data-hits="32" data-linenumber="321"> + <span class="hits">32</span> <code class="ruby"> response = run_request(request)</code> </li> <li class="never" data-hits="" data-linenumber="322"> <code class="ruby"></code> </li> - <li class="covered" data-hits="247" data-linenumber="323"> - <span class="hits">247</span> + <li class="covered" data-hits="32" data-linenumber="323"> + <span class="hits">32</span> <code class="ruby"> return response if !build_resource || configuration[:raw_mode]</code> </li> <li class="never" data-hits="" data-linenumber="324"> <code class="ruby"></code> </li> - <li class="covered" data-hits="242" data-linenumber="325"> - <span class="hits">242</span> + <li class="covered" data-hits="31" data-linenumber="325"> + <span class="hits">31</span> <code class="ruby"> return fail_response(response) if response.status != :ok</code> </li> <li class="never" data-hits="" data-linenumber="326"> <code class="ruby"></code> </li> - <li class="covered" data-hits="233" data-linenumber="327"> - <span class="hits">233</span> + <li class="covered" data-hits="31" data-linenumber="327"> + <span class="hits">31</span> <code class="ruby"> result = do_build_resource(response)</code> </li> <li class="never" data-hits="" data-linenumber="328"> @@ -4661,43 +4491,43 @@ <code class="ruby"> rescue Contentful::RateLimitExceeded =&gt; rate_limit_error</code> </li> - <li class="covered" data-hits="2" data-linenumber="332"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="332"> + <code class="ruby"> reset_time = rate_limit_error.reset_time.to_i</code> </li> - <li class="covered" data-hits="2" data-linenumber="333"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="333"> + <code class="ruby"> if should_retry(retries_left, reset_time, configuration[:max_rate_limit_wait])</code> </li> - <li class="covered" data-hits="1" data-linenumber="334"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="334"> + <code class="ruby"> retries_left -= 1</code> </li> - <li class="covered" data-hits="1" data-linenumber="335"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="335"> + <code class="ruby"> logger.info(retry_message(retries_left, reset_time)) if logger</code> </li> - <li class="covered" data-hits="1" data-linenumber="336"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="336"> + <code class="ruby"> sleep(reset_time * Random.new.rand(1.0..1.2))</code> </li> - <li class="covered" data-hits="1" data-linenumber="337"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="337"> + <code class="ruby"> retry</code> </li> <li class="never" data-hits="" data-linenumber="338"> @@ -4709,13 +4539,13 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="340"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="340"> + <code class="ruby"> raise</code> </li> <li class="never" data-hits="" data-linenumber="341"> @@ -4727,12 +4557,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="233" data-linenumber="343"> - <span class="hits">233</span> + <li class="covered" data-hits="31" data-linenumber="343"> + <span class="hits">31</span> <code class="ruby"> result</code> </li> <li class="never" data-hits="" data-linenumber="344"> @@ -4757,31 +4587,31 @@ <span class="hits">1</span> <code class="ruby"> def retry_message(retries_left, reset_time)</code> </li> - <li class="covered" data-hits="1" data-linenumber="348"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="348"> + <code class="ruby"> message = &#39;Contentful API Rate Limit Hit! &#39;</code> </li> - <li class="covered" data-hits="1" data-linenumber="349"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="349"> + <code class="ruby"> message += &quot;Retrying - Retries left: #{retries_left}&quot;</code> </li> - <li class="covered" data-hits="1" data-linenumber="350"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="350"> + <code class="ruby"> message += &quot;- Time until reset (seconds): #{reset_time}&quot;</code> </li> - <li class="covered" data-hits="1" data-linenumber="351"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="351"> + <code class="ruby"> message</code> </li> <li class="never" data-hits="" data-linenumber="352"> @@ -4805,19 +4635,19 @@ <span class="hits">1</span> <code class="ruby"> def fail_response(response)</code> </li> - <li class="covered" data-hits="9" data-linenumber="356"> - <span class="hits">9</span> + <li class="missed" data-hits="0" data-linenumber="356"> + <code class="ruby"> fail response.object if configuration[:raise_errors]</code> </li> - <li class="covered" data-hits="1" data-linenumber="357"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="357"> + <code class="ruby"> response.object</code> </li> <li class="never" data-hits="" data-linenumber="358"> @@ -4841,13 +4671,13 @@ <span class="hits">1</span> <code class="ruby"> def should_retry(retries_left, reset_time, max_wait)</code> </li> - <li class="covered" data-hits="2" data-linenumber="362"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="362"> + <code class="ruby"> retries_left &gt; 0 &amp;&amp; max_wait &gt; reset_time</code> </li> <li class="never" data-hits="" data-linenumber="363"> @@ -4877,24 +4707,24 @@ <span class="hits">1</span> <code class="ruby"> def run_request(request)</code> </li> - <li class="covered" data-hits="247" data-linenumber="368"> - <span class="hits">247</span> + <li class="covered" data-hits="32" data-linenumber="368"> + <span class="hits">32</span> <code class="ruby"> url = request.absolute? ? request.url : base_url + request.url</code> </li> - <li class="covered" data-hits="247" data-linenumber="369"> - <span class="hits">247</span> + <li class="covered" data-hits="32" data-linenumber="369"> + <span class="hits">32</span> <code class="ruby"> logger.info(request: { url: url, query: request.query, header: request_headers }) if logger</code> </li> - <li class="covered" data-hits="247" data-linenumber="370"> - <span class="hits">247</span> + <li class="covered" data-hits="32" data-linenumber="370"> + <span class="hits">32</span> <code class="ruby"> Response.new(</code> </li> <li class="never" data-hits="" data-linenumber="371"> @@ -4973,18 +4803,18 @@ <span class="hits">1</span> <code class="ruby"> def do_build_resource(response)</code> </li> - <li class="covered" data-hits="233" data-linenumber="384"> - <span class="hits">233</span> + <li class="covered" data-hits="31" data-linenumber="384"> + <span class="hits">31</span> <code class="ruby"> logger.debug(response: response) if logger</code> </li> - <li class="covered" data-hits="233" data-linenumber="385"> - <span class="hits">233</span> + <li class="covered" data-hits="31" data-linenumber="385"> + <span class="hits">31</span> <code class="ruby"> configuration[:resource_builder].new(</code> </li> <li class="never" data-hits="" data-linenumber="386"> @@ -4997,413 +4827,425 @@ <code class="ruby"> configuration.merge(endpoint: response.request.endpoint),</code> </li> - <li class="covered" data-hits="233" data-linenumber="388"> - <span class="hits">233</span> + <li class="covered" data-hits="31" data-linenumber="388"> + <span class="hits">31</span> <code class="ruby"> (response.request.query || {}).fetch(:locale, nil) == &#39;*&#39;,</code> </li> <li class="never" data-hits="" data-linenumber="389"> - <code class="ruby"> 0</code> + <code class="ruby"> 0,</code> </li> <li class="never" data-hits="" data-linenumber="390"> - <code class="ruby"> ).run</code> + <code class="ruby"> [],</code> </li> <li class="never" data-hits="" data-linenumber="391"> - <code class="ruby"> end</code> + <code class="ruby"> response.request.query || {}</code> </li> <li class="never" data-hits="" data-linenumber="392"> - <code class="ruby"></code> + <code class="ruby"> ).run</code> </li> <li class="never" data-hits="" data-linenumber="393"> - <code class="ruby"> # Use this method together with the client&#39;s :dynamic_entries configuration.</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="394"> - <code class="ruby"> # See README for details.</code> + <code class="ruby"></code> </li> <li class="never" data-hits="" data-linenumber="395"> + <code class="ruby"> # Use this method together with the client&#39;s :dynamic_entries configuration.</code> + </li> + + <li class="never" data-hits="" data-linenumber="396"> + + + <code class="ruby"> # See README for details.</code> + </li> + + <li class="never" data-hits="" data-linenumber="397"> + + <code class="ruby"> # @private</code> </li> - <li class="covered" data-hits="1" data-linenumber="396"> + <li class="covered" data-hits="1" data-linenumber="398"> <span class="hits">1</span> <code class="ruby"> def update_dynamic_entry_cache!</code> </li> - <li class="covered" data-hits="31" data-linenumber="397"> - <span class="hits">31</span> + <li class="covered" data-hits="4" data-linenumber="399"> + <span class="hits">4</span> <code class="ruby"> return if configuration[:raw_mode]</code> </li> - <li class="covered" data-hits="31" data-linenumber="398"> - <span class="hits">31</span> + <li class="covered" data-hits="4" data-linenumber="400"> + <span class="hits">4</span> <code class="ruby"> content_types(limit: 1000).map do |ct|</code> </li> - <li class="covered" data-hits="67" data-linenumber="399"> - <span class="hits">67</span> + <li class="covered" data-hits="8" data-linenumber="401"> + <span class="hits">8</span> <code class="ruby"> ContentTypeCache.cache_set(configuration[:space], ct.id, ct)</code> </li> - <li class="never" data-hits="" data-linenumber="400"> + <li class="never" data-hits="" data-linenumber="402"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="401"> + <li class="never" data-hits="" data-linenumber="403"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="402"> + <li class="never" data-hits="" data-linenumber="404"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="403"> + <li class="never" data-hits="" data-linenumber="405"> <code class="ruby"> # Use this method to manually register a dynamic entry</code> </li> - <li class="never" data-hits="" data-linenumber="404"> + <li class="never" data-hits="" data-linenumber="406"> <code class="ruby"> # See examples/dynamic_entries.rb</code> </li> - <li class="never" data-hits="" data-linenumber="405"> + <li class="never" data-hits="" data-linenumber="407"> <code class="ruby"> # @private</code> </li> - <li class="covered" data-hits="1" data-linenumber="406"> + <li class="covered" data-hits="1" data-linenumber="408"> <span class="hits">1</span> <code class="ruby"> def register_dynamic_entry(key, klass)</code> </li> - <li class="covered" data-hits="1" data-linenumber="407"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="409"> + <code class="ruby"> ContentTypeCache.cache_set(configuration[:space], key, klass)</code> </li> - <li class="never" data-hits="" data-linenumber="408"> + <li class="never" data-hits="" data-linenumber="410"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="409"> + <li class="never" data-hits="" data-linenumber="411"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="410"> + <li class="never" data-hits="" data-linenumber="412"> <code class="ruby"> # Create a new synchronisation object</code> </li> - <li class="never" data-hits="" data-linenumber="411"> + <li class="never" data-hits="" data-linenumber="413"> <code class="ruby"> #</code> </li> - <li class="never" data-hits="" data-linenumber="412"> + <li class="never" data-hits="" data-linenumber="414"> <code class="ruby"> # @param [Hash, String] options Options or Sync URL</code> </li> - <li class="never" data-hits="" data-linenumber="413"> + <li class="never" data-hits="" data-linenumber="415"> <code class="ruby"> #</code> </li> - <li class="never" data-hits="" data-linenumber="414"> + <li class="never" data-hits="" data-linenumber="416"> <code class="ruby"> # @note You will need to call #each_page or #first_page on it</code> </li> - <li class="never" data-hits="" data-linenumber="415"> + <li class="never" data-hits="" data-linenumber="417"> <code class="ruby"> #</code> </li> - <li class="never" data-hits="" data-linenumber="416"> + <li class="never" data-hits="" data-linenumber="418"> <code class="ruby"> # @return [Contentful::Sync]</code> </li> - <li class="covered" data-hits="1" data-linenumber="417"> + <li class="covered" data-hits="1" data-linenumber="419"> <span class="hits">1</span> <code class="ruby"> def sync(options = { initial: true })</code> </li> - <li class="covered" data-hits="43" data-linenumber="418"> - <span class="hits">43</span> + <li class="covered" data-hits="1" data-linenumber="420"> + <span class="hits">1</span> <code class="ruby"> Sync.new(self, options)</code> </li> - <li class="never" data-hits="" data-linenumber="419"> + <li class="never" data-hits="" data-linenumber="421"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="420"> + <li class="never" data-hits="" data-linenumber="422"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="421"> + <li class="covered" data-hits="1" data-linenumber="423"> <span class="hits">1</span> <code class="ruby"> private</code> </li> - <li class="never" data-hits="" data-linenumber="422"> + <li class="never" data-hits="" data-linenumber="424"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="423"> + <li class="never" data-hits="" data-linenumber="425"> <code class="ruby"> # If the query contains the :select operator, we enforce :sys properties.</code> </li> - <li class="never" data-hits="" data-linenumber="424"> + <li class="never" data-hits="" data-linenumber="426"> <code class="ruby"> # The SDK requires sys.type to function properly, but as other of our SDKs</code> </li> - <li class="never" data-hits="" data-linenumber="425"> + <li class="never" data-hits="" data-linenumber="427"> <code class="ruby"> # require more parts of the :sys properties, we decided that every SDK should</code> </li> - <li class="never" data-hits="" data-linenumber="426"> + <li class="never" data-hits="" data-linenumber="428"> <code class="ruby"> # include the complete :sys block to provide consistency accross our SDKs.</code> </li> - <li class="covered" data-hits="1" data-linenumber="427"> + <li class="covered" data-hits="1" data-linenumber="429"> <span class="hits">1</span> <code class="ruby"> def normalize_select!(query)</code> </li> - <li class="covered" data-hits="91" data-linenumber="428"> - <span class="hits">91</span> + <li class="covered" data-hits="6" data-linenumber="430"> + <span class="hits">6</span> <code class="ruby"> return unless query.key?(:select)</code> </li> - <li class="never" data-hits="" data-linenumber="429"> + <li class="never" data-hits="" data-linenumber="431"> <code class="ruby"></code> </li> - <li class="covered" data-hits="10" data-linenumber="430"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="432"> + <code class="ruby"> query[:select] = query[:select].split(&#39;,&#39;).map(&amp;:strip) if query[:select].is_a? String</code> </li> - <li class="covered" data-hits="21" data-linenumber="431"> - <span class="hits">21</span> + <li class="missed" data-hits="0" data-linenumber="433"> + <code class="ruby"> query[:select] = query[:select].reject { |p| p.start_with?(&#39;sys.&#39;) }</code> </li> - <li class="covered" data-hits="10" data-linenumber="432"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="434"> + <code class="ruby"> query[:select] &lt;&lt; &#39;sys&#39; unless query[:select].include?(&#39;sys&#39;)</code> </li> - <li class="never" data-hits="" data-linenumber="433"> + <li class="never" data-hits="" data-linenumber="435"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="434"> + <li class="never" data-hits="" data-linenumber="436"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="435"> + <li class="covered" data-hits="1" data-linenumber="437"> <span class="hits">1</span> <code class="ruby"> def normalize_configuration!</code> </li> - <li class="covered" data-hits="1255" data-linenumber="436"> - <span class="hits">1255</span> + <li class="covered" data-hits="150" data-linenumber="438"> + <span class="hits">150</span> <code class="ruby"> %i[space access_token api_url default_locale].each { |s| configuration[s] = configuration[s].to_s }</code> </li> - <li class="covered" data-hits="251" data-linenumber="437"> - <span class="hits">251</span> + <li class="covered" data-hits="30" data-linenumber="439"> + <span class="hits">30</span> <code class="ruby"> configuration[:authentication_mechanism] = configuration[:authentication_mechanism].to_sym</code> </li> - <li class="never" data-hits="" data-linenumber="438"> + <li class="never" data-hits="" data-linenumber="440"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="439"> + <li class="never" data-hits="" data-linenumber="441"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="440"> + <li class="covered" data-hits="1" data-linenumber="442"> <span class="hits">1</span> <code class="ruby"> def validate_configuration!</code> </li> - <li class="covered" data-hits="251" data-linenumber="441"> - <span class="hits">251</span> + <li class="covered" data-hits="30" data-linenumber="443"> + <span class="hits">30</span> <code class="ruby"> fail ArgumentError, &#39;You will need to initialize a client with a :space&#39; if configuration[:space].empty?</code> </li> - <li class="covered" data-hits="250" data-linenumber="442"> - <span class="hits">250</span> + <li class="covered" data-hits="30" data-linenumber="444"> + <span class="hits">30</span> <code class="ruby"> fail ArgumentError, &#39;You will need to initialize a client with an :access_token&#39; if configuration[:access_token].empty?</code> </li> - <li class="covered" data-hits="249" data-linenumber="443"> - <span class="hits">249</span> + <li class="covered" data-hits="30" data-linenumber="445"> + <span class="hits">30</span> <code class="ruby"> fail ArgumentError, &#39;The client configuration needs to contain an :api_url&#39; if configuration[:api_url].empty?</code> </li> - <li class="covered" data-hits="249" data-linenumber="444"> - <span class="hits">249</span> + <li class="covered" data-hits="30" data-linenumber="446"> + <span class="hits">30</span> <code class="ruby"> fail ArgumentError, &#39;The client configuration needs to contain a :default_locale&#39; if configuration[:default_locale].empty?</code> </li> - <li class="covered" data-hits="249" data-linenumber="445"> - <span class="hits">249</span> + <li class="covered" data-hits="30" data-linenumber="447"> + <span class="hits">30</span> <code class="ruby"> fail ArgumentError, &#39;The :api_version must be a positive number or nil&#39; unless configuration[:api_version].to_i &gt;= 0</code> </li> - <li class="covered" data-hits="249" data-linenumber="446"> - <span class="hits">249</span> + <li class="covered" data-hits="30" data-linenumber="448"> + <span class="hits">30</span> <code class="ruby"> fail ArgumentError, &#39;The authentication mechanism must be :header or :query_string&#39; unless %i[header query_string].include?(</code> </li> - <li class="never" data-hits="" data-linenumber="447"> + <li class="never" data-hits="" data-linenumber="449"> <code class="ruby"> configuration[:authentication_mechanism]</code> </li> - <li class="never" data-hits="" data-linenumber="448"> + <li class="never" data-hits="" data-linenumber="450"> <code class="ruby"> )</code> </li> - <li class="covered" data-hits="249" data-linenumber="449"> - <span class="hits">249</span> + <li class="covered" data-hits="30" data-linenumber="451"> + <span class="hits">30</span> <code class="ruby"> fail ArgumentError, &#39;The :dynamic_entries mode must be :auto or :manual&#39; unless %i[auto manual].include?(</code> </li> - <li class="never" data-hits="" data-linenumber="450"> + <li class="never" data-hits="" data-linenumber="452"> <code class="ruby"> configuration[:dynamic_entries]</code> </li> - <li class="never" data-hits="" data-linenumber="451"> + <li class="never" data-hits="" data-linenumber="453"> <code class="ruby"> )</code> </li> - <li class="covered" data-hits="249" data-linenumber="452"> - <span class="hits">249</span> + <li class="covered" data-hits="30" data-linenumber="454"> + <span class="hits">30</span> <code class="ruby"> fail ArgumentError, &#39;Timeout parameters must be all omitted or all present&#39; unless timeout_params.empty? || timeout_params.length == 3</code> </li> - <li class="never" data-hits="" data-linenumber="453"> + <li class="never" data-hits="" data-linenumber="455"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="454"> + <li class="never" data-hits="" data-linenumber="456"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="455"> + <li class="never" data-hits="" data-linenumber="457"> <code class="ruby">end</code> </li> @@ -5413,15 +5255,15 @@ <div class="source_table" id="beb22ab5c60eaaa44a2cba4f526b8a2630d7a31a"> <div class="header"> <h3>lib/contentful/coercions.rb</h3> - <h4><span class="green">98.63 %</span> covered</h4> + <h4><span class="red">53.42 %</span> covered</h4> <div> <b>73</b> relevant lines. - <span class="green"><b>72</b> lines covered</span> and - <span class="red"><b>1</b> lines missed.</span> + <span class="green"><b>39</b> lines covered</span> and + <span class="red"><b>34</b> lines missed.</span> </div> </div> <pre> <ol> @@ -5472,18 +5314,18 @@ <span class="hits">1</span> <code class="ruby"> def initialize(value, options = {})</code> </li> - <li class="covered" data-hits="7283" data-linenumber="9"> - <span class="hits">7283</span> + <li class="covered" data-hits="24" data-linenumber="9"> + <span class="hits">24</span> <code class="ruby"> @value = value</code> </li> - <li class="covered" data-hits="7283" data-linenumber="10"> - <span class="hits">7283</span> + <li class="covered" data-hits="24" data-linenumber="10"> + <span class="hits">24</span> <code class="ruby"> @options = options</code> </li> <li class="never" data-hits="" data-linenumber="11"> @@ -5508,12 +5350,12 @@ <span class="hits">1</span> <code class="ruby"> def coerce(*)</code> </li> - <li class="covered" data-hits="29" data-linenumber="15"> - <span class="hits">29</span> + <li class="covered" data-hits="12" data-linenumber="15"> + <span class="hits">12</span> <code class="ruby"> value</code> </li> <li class="never" data-hits="" data-linenumber="16"> @@ -5556,12 +5398,12 @@ <span class="hits">1</span> <code class="ruby"> def coerce(*)</code> </li> - <li class="covered" data-hits="4098" data-linenumber="23"> - <span class="hits">4098</span> + <li class="covered" data-hits="8" data-linenumber="23"> + <span class="hits">8</span> <code class="ruby"> value.to_s</code> </li> <li class="never" data-hits="" data-linenumber="24"> @@ -5640,13 +5482,13 @@ <span class="hits">1</span> <code class="ruby"> def coerce(*)</code> </li> - <li class="covered" data-hits="1040" data-linenumber="37"> - <span class="hits">1040</span> + <li class="missed" data-hits="0" data-linenumber="37"> + <code class="ruby"> value.to_i</code> </li> <li class="never" data-hits="" data-linenumber="38"> @@ -5688,13 +5530,13 @@ <span class="hits">1</span> <code class="ruby"> def coerce(*)</code> </li> - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="45"> + <code class="ruby"> value.to_f</code> </li> <li class="never" data-hits="" data-linenumber="46"> @@ -5796,31 +5638,31 @@ <span class="hits">1</span> <code class="ruby"> def coerce(*)</code> </li> - <li class="covered" data-hits="1045" data-linenumber="63"> - <span class="hits">1045</span> + <li class="missed" data-hits="0" data-linenumber="63"> + <code class="ruby"> return nil if value.nil?</code> </li> - <li class="covered" data-hits="1044" data-linenumber="64"> - <span class="hits">1044</span> + <li class="missed" data-hits="0" data-linenumber="64"> + <code class="ruby"> return value if value.is_a?(Date)</code> </li> <li class="never" data-hits="" data-linenumber="65"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1043" data-linenumber="66"> - <span class="hits">1043</span> + <li class="missed" data-hits="0" data-linenumber="66"> + <code class="ruby"> DateTime.parse(value)</code> </li> <li class="never" data-hits="" data-linenumber="67"> @@ -5862,13 +5704,13 @@ <span class="hits">1</span> <code class="ruby"> def coerce(*)</code> </li> - <li class="covered" data-hits="2" data-linenumber="74"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="74"> + <code class="ruby"> Location.new(value)</code> </li> <li class="never" data-hits="" data-linenumber="75"> @@ -5910,13 +5752,13 @@ <span class="hits">1</span> <code class="ruby"> def coerce(*)</code> </li> - <li class="covered" data-hits="7" data-linenumber="82"> - <span class="hits">7</span> + <li class="missed" data-hits="0" data-linenumber="82"> + <code class="ruby"> JSON.parse(JSON.dump(value), symbolize_names: true)</code> </li> <li class="never" data-hits="" data-linenumber="83"> @@ -5994,18 +5836,18 @@ <span class="hits">1</span> <code class="ruby"> def coerce(*)</code> </li> - <li class="covered" data-hits="1054" data-linenumber="96"> - <span class="hits">1054</span> + <li class="covered" data-hits="4" data-linenumber="96"> + <span class="hits">4</span> <code class="ruby"> value.map do |e|</code> </li> - <li class="covered" data-hits="1596" data-linenumber="97"> - <span class="hits">1596</span> + <li class="covered" data-hits="6" data-linenumber="97"> + <span class="hits">6</span> <code class="ruby"> options[:coercion_class].new(e).coerce</code> </li> <li class="never" data-hits="" data-linenumber="98"> @@ -6054,13 +5896,13 @@ <span class="hits">1</span> <code class="ruby"> def coerce(configuration)</code> </li> - <li class="covered" data-hits="7" data-linenumber="106"> - <span class="hits">7</span> + <li class="missed" data-hits="0" data-linenumber="106"> + <code class="ruby"> coerce_block(value, configuration)</code> </li> <li class="never" data-hits="" data-linenumber="107"> @@ -6090,13 +5932,13 @@ <span class="hits">1</span> <code class="ruby"> def link?(node)</code> </li> - <li class="covered" data-hits="226" data-linenumber="112"> - <span class="hits">226</span> + <li class="missed" data-hits="0" data-linenumber="112"> + <code class="ruby"> !node[&#39;data&#39;].is_a?(::Contentful::Entry) &amp;&amp;</code> </li> <li class="never" data-hits="" data-linenumber="113"> @@ -6126,13 +5968,13 @@ <span class="hits">1</span> <code class="ruby"> def content_block?(node)</code> </li> - <li class="covered" data-hits="211" data-linenumber="118"> - <span class="hits">211</span> + <li class="missed" data-hits="0" data-linenumber="118"> + <code class="ruby"> !node.fetch(&#39;content&#39;, []).empty?</code> </li> <li class="never" data-hits="" data-linenumber="119"> @@ -6150,97 +5992,97 @@ <span class="hits">1</span> <code class="ruby"> def coerce_block(block, configuration)</code> </li> - <li class="covered" data-hits="125" data-linenumber="122"> - <span class="hits">125</span> + <li class="missed" data-hits="0" data-linenumber="122"> + <code class="ruby"> return block unless block.is_a?(Hash) &amp;&amp; block.key?(&#39;content&#39;)</code> </li> <li class="never" data-hits="" data-linenumber="123"> <code class="ruby"></code> </li> - <li class="covered" data-hits="125" data-linenumber="124"> - <span class="hits">125</span> + <li class="missed" data-hits="0" data-linenumber="124"> + <code class="ruby"> invalid_nodes = []</code> </li> - <li class="covered" data-hits="125" data-linenumber="125"> - <span class="hits">125</span> + <li class="missed" data-hits="0" data-linenumber="125"> + <code class="ruby"> coerced_nodes = {}</code> </li> - <li class="covered" data-hits="125" data-linenumber="126"> - <span class="hits">125</span> + <li class="missed" data-hits="0" data-linenumber="126"> + <code class="ruby"> block[&#39;content&#39;].each_with_index do |node, index|</code> </li> - <li class="covered" data-hits="226" data-linenumber="127"> - <span class="hits">226</span> + <li class="missed" data-hits="0" data-linenumber="127"> + <code class="ruby"> if link?(node)</code> </li> - <li class="covered" data-hits="15" data-linenumber="128"> - <span class="hits">15</span> + <li class="missed" data-hits="0" data-linenumber="128"> + <code class="ruby"> link = coerce_link(node, configuration)</code> </li> <li class="never" data-hits="" data-linenumber="129"> <code class="ruby"></code> </li> - <li class="covered" data-hits="15" data-linenumber="130"> - <span class="hits">15</span> + <li class="missed" data-hits="0" data-linenumber="130"> + <code class="ruby"> if !link.nil?</code> </li> - <li class="covered" data-hits="14" data-linenumber="131"> - <span class="hits">14</span> + <li class="missed" data-hits="0" data-linenumber="131"> + <code class="ruby"> node[&#39;data&#39;][&#39;target&#39;] = link</code> </li> <li class="never" data-hits="" data-linenumber="132"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="1" data-linenumber="133"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="133"> + <code class="ruby"> invalid_nodes &lt;&lt; index</code> </li> <li class="never" data-hits="" data-linenumber="134"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="211" data-linenumber="135"> - <span class="hits">211</span> + <li class="missed" data-hits="0" data-linenumber="135"> + <code class="ruby"> elsif content_block?(node)</code> </li> - <li class="covered" data-hits="118" data-linenumber="136"> - <span class="hits">118</span> + <li class="missed" data-hits="0" data-linenumber="136"> + <code class="ruby"> coerced_nodes[index] = coerce_block(node, configuration)</code> </li> <li class="never" data-hits="" data-linenumber="137"> @@ -6258,19 +6100,19 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="125" data-linenumber="140"> - <span class="hits">125</span> + <li class="missed" data-hits="0" data-linenumber="140"> + <code class="ruby"> coerced_nodes.each do |index, coerced_node|</code> </li> - <li class="covered" data-hits="118" data-linenumber="141"> - <span class="hits">118</span> + <li class="missed" data-hits="0" data-linenumber="141"> + <code class="ruby"> block[&#39;content&#39;][index] = coerced_node</code> </li> <li class="never" data-hits="" data-linenumber="142"> @@ -6282,19 +6124,19 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="125" data-linenumber="144"> - <span class="hits">125</span> + <li class="missed" data-hits="0" data-linenumber="144"> + <code class="ruby"> invalid_nodes.each do |index|</code> </li> - <li class="covered" data-hits="1" data-linenumber="145"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="145"> + <code class="ruby"> block[&#39;content&#39;].delete_at(index)</code> </li> <li class="never" data-hits="" data-linenumber="146"> @@ -6306,13 +6148,13 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="125" data-linenumber="148"> - <span class="hits">125</span> + <li class="missed" data-hits="0" data-linenumber="148"> + <code class="ruby"> block</code> </li> <li class="never" data-hits="" data-linenumber="149"> @@ -6330,49 +6172,49 @@ <span class="hits">1</span> <code class="ruby"> def coerce_link(node, configuration)</code> </li> - <li class="covered" data-hits="15" data-linenumber="152"> - <span class="hits">15</span> + <li class="missed" data-hits="0" data-linenumber="152"> + <code class="ruby"> return node unless node.key?(&#39;data&#39;) &amp;&amp; node[&#39;data&#39;].key?(&#39;target&#39;)</code> </li> - <li class="covered" data-hits="15" data-linenumber="153"> - <span class="hits">15</span> + <li class="missed" data-hits="0" data-linenumber="153"> + <code class="ruby"> return node[&#39;data&#39;][&#39;target&#39;] unless node[&#39;data&#39;][&#39;target&#39;].is_a?(::Hash)</code> </li> - <li class="covered" data-hits="14" data-linenumber="154"> - <span class="hits">14</span> + <li class="missed" data-hits="0" data-linenumber="154"> + <code class="ruby"> return node unless node[&#39;data&#39;][&#39;target&#39;][&#39;sys&#39;][&#39;type&#39;] == &#39;Link&#39;</code> </li> <li class="never" data-hits="" data-linenumber="155"> <code class="ruby"></code> </li> - <li class="covered" data-hits="14" data-linenumber="156"> - <span class="hits">14</span> + <li class="missed" data-hits="0" data-linenumber="156"> + <code class="ruby"> return nil if Support.unresolvable?(node[&#39;data&#39;][&#39;target&#39;], configuration[:errors])</code> </li> <li class="never" data-hits="" data-linenumber="157"> <code class="ruby"></code> </li> - <li class="covered" data-hits="13" data-linenumber="158"> - <span class="hits">13</span> + <li class="missed" data-hits="0" data-linenumber="158"> + <code class="ruby"> resource = Support.resource_for_link(</code> </li> <li class="never" data-hits="" data-linenumber="159"> @@ -6402,25 +6244,25 @@ <code class="ruby"> # Resource is valid but unreachable</code> </li> - <li class="covered" data-hits="13" data-linenumber="164"> - <span class="hits">13</span> + <li class="missed" data-hits="0" data-linenumber="164"> + <code class="ruby"> return Link.new(node[&#39;data&#39;][&#39;target&#39;], configuration) if resource.nil?</code> </li> <li class="never" data-hits="" data-linenumber="165"> <code class="ruby"></code> </li> - <li class="covered" data-hits="8" data-linenumber="166"> - <span class="hits">8</span> + <li class="missed" data-hits="0" data-linenumber="166"> + <code class="ruby"> ResourceBuilder.new(</code> </li> <li class="never" data-hits="" data-linenumber="167"> @@ -6559,42 +6401,42 @@ <span class="hits">1</span> <code class="ruby"> def initialize(item, *)</code> </li> - <li class="covered" data-hits="141" data-linenumber="12"> - <span class="hits">141</span> + <li class="covered" data-hits="62" data-linenumber="12"> + <span class="hits">62</span> <code class="ruby"> super</code> </li> <li class="never" data-hits="" data-linenumber="13"> <code class="ruby"></code> </li> - <li class="covered" data-hits="141" data-linenumber="14"> - <span class="hits">141</span> + <li class="covered" data-hits="62" data-linenumber="14"> + <span class="hits">62</span> <code class="ruby"> @name = item.fetch(&#39;name&#39;, nil)</code> </li> - <li class="covered" data-hits="141" data-linenumber="15"> - <span class="hits">141</span> + <li class="covered" data-hits="62" data-linenumber="15"> + <span class="hits">62</span> <code class="ruby"> @description = item.fetch(&#39;description&#39;, nil)</code> </li> - <li class="covered" data-hits="750" data-linenumber="16"> - <span class="hits">750</span> + <li class="covered" data-hits="335" data-linenumber="16"> + <span class="hits">335</span> <code class="ruby"> @fields = item.fetch(&#39;fields&#39;, []).map { |field| Field.new(field) }</code> </li> - <li class="covered" data-hits="141" data-linenumber="17"> - <span class="hits">141</span> + <li class="covered" data-hits="62" data-linenumber="17"> + <span class="hits">62</span> <code class="ruby"> @display_field = item.fetch(&#39;displayField&#39;, nil)</code> </li> <li class="never" data-hits="" data-linenumber="18"> @@ -6619,12 +6461,12 @@ <span class="hits">1</span> <code class="ruby"> def field_for(field_id)</code> </li> - <li class="covered" data-hits="25188" data-linenumber="22"> - <span class="hits">25188</span> + <li class="covered" data-hits="41" data-linenumber="22"> + <span class="hits">41</span> <code class="ruby"> fields.detect { |f| Support.snakify(f.id) == Support.snakify(field_id) }</code> </li> <li class="never" data-hits="" data-linenumber="23"> @@ -6699,15 +6541,15 @@ <div class="source_table" id="a46b40f2e6381b7f2ac84d26e7bc008d4e6985eb"> <div class="header"> <h3>lib/contentful/content_type_cache.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="green">91.67 %</span> covered</h4> <div> <b>12</b> relevant lines. - <span class="green"><b>12</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>11</b> lines covered</span> and + <span class="red"><b>1</b> lines missed.</span> </div> </div> <pre> <ol> @@ -6776,13 +6618,13 @@ <span class="hits">1</span> <code class="ruby"> def self.clear!</code> </li> - <li class="covered" data-hits="20" data-linenumber="12"> - <span class="hits">20</span> + <li class="missed" data-hits="0" data-linenumber="12"> + <code class="ruby"> @cache = {}</code> </li> <li class="never" data-hits="" data-linenumber="13"> @@ -6806,12 +6648,12 @@ <span class="hits">1</span> <code class="ruby"> def self.cache_get(space_id, content_type_id)</code> </li> - <li class="covered" data-hits="8524" data-linenumber="17"> - <span class="hits">8524</span> + <li class="covered" data-hits="129" data-linenumber="17"> + <span class="hits">129</span> <code class="ruby"> @cache.fetch(space_id, {}).fetch(content_type_id.to_sym, nil)</code> </li> <li class="never" data-hits="" data-linenumber="18"> @@ -6836,18 +6678,18 @@ <span class="hits">1</span> <code class="ruby"> def self.cache_set(space_id, content_type_id, klass)</code> </li> - <li class="covered" data-hits="68" data-linenumber="22"> - <span class="hits">68</span> + <li class="covered" data-hits="8" data-linenumber="22"> + <span class="hits">8</span> <code class="ruby"> @cache[space_id] ||= {}</code> </li> - <li class="covered" data-hits="68" data-linenumber="23"> - <span class="hits">68</span> + <li class="covered" data-hits="8" data-linenumber="23"> + <span class="hits">8</span> <code class="ruby"> @cache[space_id][content_type_id.to_sym] = klass</code> </li> <li class="never" data-hits="" data-linenumber="24"> @@ -6996,15 +6838,15 @@ <div class="source_table" id="97df464094b50c0508a4a014acd1a9beace447a1"> <div class="header"> <h3>lib/contentful/entry.rb</h3> - <h4><span class="green">98.28 %</span> covered</h4> + <h4><span class="yellow">82.76 %</span> covered</h4> <div> <b>58</b> relevant lines. - <span class="green"><b>57</b> lines covered</span> and - <span class="red"><b>1</b> lines missed.</span> + <span class="green"><b>48</b> lines covered</span> and + <span class="red"><b>10</b> lines missed.</span> </div> </div> <pre> <ol> @@ -7085,13 +6927,13 @@ <span class="hits">1</span> <code class="ruby"> def entry?</code> </li> - <li class="covered" data-hits="4" data-linenumber="14"> - <span class="hits">4</span> + <li class="missed" data-hits="0" data-linenumber="14"> + <code class="ruby"> true</code> </li> <li class="never" data-hits="" data-linenumber="15"> @@ -7121,72 +6963,72 @@ <span class="hits">1</span> <code class="ruby"> def coerce(field_id, value, includes, errors, entries = {})</code> </li> - <li class="covered" data-hits="11555" data-linenumber="20"> - <span class="hits">11555</span> + <li class="covered" data-hits="190" data-linenumber="20"> + <span class="hits">190</span> <code class="ruby"> if Support.link?(value) &amp;&amp; !Support.unresolvable?(value, errors)</code> </li> - <li class="covered" data-hits="3003" data-linenumber="21"> - <span class="hits">3003</span> + <li class="covered" data-hits="56" data-linenumber="21"> + <span class="hits">56</span> <code class="ruby"> return build_nested_resource(value, includes, entries, errors)</code> </li> <li class="never" data-hits="" data-linenumber="22"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="8552" data-linenumber="23"> - <span class="hits">8552</span> + <li class="covered" data-hits="134" data-linenumber="23"> + <span class="hits">134</span> <code class="ruby"> return coerce_link_array(value, includes, errors, entries) if Support.link_array?(value)</code> </li> <li class="never" data-hits="" data-linenumber="24"> <code class="ruby"></code> </li> - <li class="covered" data-hits="8518" data-linenumber="25"> - <span class="hits">8518</span> + <li class="covered" data-hits="129" data-linenumber="25"> + <span class="hits">129</span> <code class="ruby"> content_type_key = Support.snakify(&#39;contentType&#39;, @configuration[:use_camel_case])</code> </li> - <li class="covered" data-hits="8518" data-linenumber="26"> - <span class="hits">8518</span> + <li class="covered" data-hits="129" data-linenumber="26"> + <span class="hits">129</span> <code class="ruby"> content_type = ContentTypeCache.cache_get(sys[:space].id, sys[content_type_key.to_sym].id)</code> </li> <li class="never" data-hits="" data-linenumber="27"> <code class="ruby"></code> </li> - <li class="covered" data-hits="8518" data-linenumber="28"> - <span class="hits">8518</span> + <li class="covered" data-hits="129" data-linenumber="28"> + <span class="hits">129</span> <code class="ruby"> unless content_type.nil?</code> </li> - <li class="covered" data-hits="5690" data-linenumber="29"> - <span class="hits">5690</span> + <li class="covered" data-hits="18" data-linenumber="29"> + <span class="hits">18</span> <code class="ruby"> content_type_field = content_type.field_for(field_id)</code> </li> - <li class="covered" data-hits="5690" data-linenumber="30"> - <span class="hits">5690</span> + <li class="covered" data-hits="18" data-linenumber="30"> + <span class="hits">18</span> <code class="ruby"> coercion_configuration = @configuration.merge(</code> </li> <li class="never" data-hits="" data-linenumber="31"> @@ -7229,12 +7071,12 @@ <code class="ruby"> )</code> </li> - <li class="covered" data-hits="5690" data-linenumber="38"> - <span class="hits">5690</span> + <li class="covered" data-hits="18" data-linenumber="38"> + <span class="hits">18</span> <code class="ruby"> return content_type_field.coerce(value, coercion_configuration) unless content_type_field.nil?</code> </li> <li class="never" data-hits="" data-linenumber="39"> @@ -7247,12 +7089,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="2831" data-linenumber="41"> - <span class="hits">2831</span> + <li class="covered" data-hits="111" data-linenumber="41"> + <span class="hits">111</span> <code class="ruby"> super(field_id, value, includes, errors, entries)</code> </li> <li class="never" data-hits="" data-linenumber="42"> @@ -7271,30 +7113,30 @@ <span class="hits">1</span> <code class="ruby"> def coerce_link_array(value, includes, errors, entries)</code> </li> - <li class="covered" data-hits="34" data-linenumber="45"> - <span class="hits">34</span> + <li class="covered" data-hits="5" data-linenumber="45"> + <span class="hits">5</span> <code class="ruby"> items = []</code> </li> - <li class="covered" data-hits="34" data-linenumber="46"> - <span class="hits">34</span> + <li class="covered" data-hits="5" data-linenumber="46"> + <span class="hits">5</span> <code class="ruby"> value.each do |link|</code> </li> - <li class="covered" data-hits="52" data-linenumber="47"> - <span class="hits">52</span> + <li class="covered" data-hits="6" data-linenumber="47"> + <span class="hits">6</span> <code class="ruby"> nested_resource = build_nested_resource(link, includes, entries, errors) unless Support.unresolvable?(link, errors)</code> </li> - <li class="covered" data-hits="52" data-linenumber="48"> - <span class="hits">52</span> + <li class="covered" data-hits="6" data-linenumber="48"> + <span class="hits">6</span> <code class="ruby"> items &lt;&lt; nested_resource unless nested_resource.nil?</code> </li> <li class="never" data-hits="" data-linenumber="49"> @@ -7307,12 +7149,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="34" data-linenumber="51"> - <span class="hits">34</span> + <li class="covered" data-hits="5" data-linenumber="51"> + <span class="hits">5</span> <code class="ruby"> items</code> </li> <li class="never" data-hits="" data-linenumber="52"> @@ -7355,24 +7197,24 @@ <span class="hits">1</span> <code class="ruby"> def build_nested_resource(value, includes, entries, errors)</code> </li> - <li class="covered" data-hits="3048" data-linenumber="59"> - <span class="hits">3048</span> + <li class="covered" data-hits="59" data-linenumber="59"> + <span class="hits">59</span> <code class="ruby"> if @depth &lt; @configuration.fetch(:max_include_resolution_depth, 20)</code> </li> - <li class="covered" data-hits="2892" data-linenumber="60"> - <span class="hits">2892</span> + <li class="covered" data-hits="57" data-linenumber="60"> + <span class="hits">57</span> <code class="ruby"> resource = Support.resource_for_link(value, includes)</code> </li> - <li class="covered" data-hits="2892" data-linenumber="61"> - <span class="hits">2892</span> + <li class="covered" data-hits="57" data-linenumber="61"> + <span class="hits">57</span> <code class="ruby"> return resolve_include(resource, includes, entries, errors) unless resource.nil?</code> </li> <li class="never" data-hits="" data-linenumber="62"> @@ -7385,12 +7227,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="164" data-linenumber="64"> - <span class="hits">164</span> + <li class="covered" data-hits="4" data-linenumber="64"> + <span class="hits">4</span> <code class="ruby"> build_link(value)</code> </li> <li class="never" data-hits="" data-linenumber="65"> @@ -7409,24 +7251,24 @@ <span class="hits">1</span> <code class="ruby"> def resolve_include(resource, includes, entries, errors)</code> </li> - <li class="covered" data-hits="2884" data-linenumber="68"> - <span class="hits">2884</span> + <li class="covered" data-hits="55" data-linenumber="68"> + <span class="hits">55</span> <code class="ruby"> require_relative &#39;resource_builder&#39;</code> </li> <li class="never" data-hits="" data-linenumber="69"> <code class="ruby"></code> </li> - <li class="covered" data-hits="2884" data-linenumber="70"> - <span class="hits">2884</span> + <li class="covered" data-hits="55" data-linenumber="70"> + <span class="hits">55</span> <code class="ruby"> ResourceBuilder.new(</code> </li> <li class="never" data-hits="" data-linenumber="71"> @@ -7505,24 +7347,24 @@ <span class="hits">1</span> <code class="ruby"> def known_link?(name)</code> </li> - <li class="covered" data-hits="127" data-linenumber="84"> - <span class="hits">127</span> + <li class="covered" data-hits="14" data-linenumber="84"> + <span class="hits">14</span> <code class="ruby"> field_name = name.to_sym</code> </li> - <li class="covered" data-hits="127" data-linenumber="85"> - <span class="hits">127</span> + <li class="covered" data-hits="14" data-linenumber="85"> + <span class="hits">14</span> <code class="ruby"> return true if known_contentful_object?(fields[field_name])</code> </li> - <li class="covered" data-hits="138" data-linenumber="86"> - <span class="hits">138</span> + <li class="covered" data-hits="8" data-linenumber="86"> + <span class="hits">8</span> <code class="ruby"> fields[field_name].is_a?(Enumerable) &amp;&amp; fields[field_name].any? { |object| known_contentful_object?(object) }</code> </li> <li class="never" data-hits="" data-linenumber="87"> @@ -7541,12 +7383,12 @@ <span class="hits">1</span> <code class="ruby"> def known_contentful_object?(object)</code> </li> - <li class="covered" data-hits="166" data-linenumber="90"> - <span class="hits">166</span> + <li class="covered" data-hits="16" data-linenumber="90"> + <span class="hits">16</span> <code class="ruby"> (object.is_a?(Contentful::Entry) || object.is_a?(Contentful::Asset))</code> </li> <li class="never" data-hits="" data-linenumber="91"> @@ -7565,25 +7407,25 @@ <span class="hits">1</span> <code class="ruby"> def method_missing(name, *args, &amp;block)</code> </li> - <li class="covered" data-hits="6" data-linenumber="94"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="94"> + <code class="ruby"> return empty_field_error(name) if content_type_field?(name)</code> </li> <li class="never" data-hits="" data-linenumber="95"> <code class="ruby"></code> </li> - <li class="covered" data-hits="2" data-linenumber="96"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="96"> + <code class="ruby"> super</code> </li> <li class="never" data-hits="" data-linenumber="97"> @@ -7637,25 +7479,25 @@ <span class="hits">1</span> <code class="ruby"> def content_type_field?(name)</code> </li> - <li class="covered" data-hits="6" data-linenumber="106"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="106"> + <code class="ruby"> content_type_key = Support.snakify(&#39;contentType&#39;, @configuration[:use_camel_case])</code> </li> <li class="never" data-hits="" data-linenumber="107"> <code class="ruby"></code> </li> - <li class="covered" data-hits="6" data-linenumber="108"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="108"> + <code class="ruby"> content_type = ContentTypeCache.cache_get(</code> </li> <li class="never" data-hits="" data-linenumber="109"> @@ -7679,25 +7521,25 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="6" data-linenumber="113"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="113"> + <code class="ruby"> return false if content_type.nil?</code> </li> <li class="never" data-hits="" data-linenumber="114"> <code class="ruby"></code> </li> - <li class="covered" data-hits="6" data-linenumber="115"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="115"> + <code class="ruby"> !content_type.field_for(name).nil?</code> </li> <li class="never" data-hits="" data-linenumber="116"> @@ -7715,19 +7557,19 @@ <span class="hits">1</span> <code class="ruby"> def empty_field_error(name)</code> </li> - <li class="covered" data-hits="4" data-linenumber="119"> - <span class="hits">4</span> + <li class="missed" data-hits="0" data-linenumber="119"> + <code class="ruby"> return nil unless @configuration[:raise_for_empty_fields]</code> </li> - <li class="covered" data-hits="2" data-linenumber="120"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="120"> + <code class="ruby"> fail EmptyFieldError, name</code> </li> <li class="never" data-hits="" data-linenumber="121"> @@ -7783,15 +7625,15 @@ <div class="source_table" id="98433a4cac96676bcf6b420f480c3d946ae0d0cb"> <div class="header"> <h3>lib/contentful/error.rb</h3> - <h4><span class="green">98.95 %</span> covered</h4> + <h4><span class="red">51.58 %</span> covered</h4> <div> <b>95</b> relevant lines. - <span class="green"><b>94</b> lines covered</span> and - <span class="red"><b>1</b> lines missed.</span> + <span class="green"><b>49</b> lines covered</span> and + <span class="red"><b>46</b> lines missed.</span> </div> </div> <pre> <ol> @@ -7836,19 +7678,19 @@ <span class="hits">1</span> <code class="ruby"> def initialize(response)</code> </li> - <li class="covered" data-hits="65" data-linenumber="8"> - <span class="hits">65</span> + <li class="missed" data-hits="0" data-linenumber="8"> + <code class="ruby"> @response = response</code> </li> - <li class="covered" data-hits="65" data-linenumber="9"> - <span class="hits">65</span> + <li class="missed" data-hits="0" data-linenumber="9"> + <code class="ruby"> super best_available_message</code> </li> <li class="never" data-hits="" data-linenumber="10"> @@ -7884,13 +7726,13 @@ <code class="ruby"> errors = {</code> </li> - <li class="covered" data-hits="66" data-linenumber="16"> - <span class="hits">66</span> + <li class="missed" data-hits="0" data-linenumber="16"> + <code class="ruby"> 400 =&gt; BadRequest,</code> </li> <li class="never" data-hits="" data-linenumber="17"> @@ -7944,13 +7786,13 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="66" data-linenumber="26"> - <span class="hits">66</span> + <li class="missed" data-hits="0" data-linenumber="26"> + <code class="ruby"> errors.key?(error_status_code) ? errors[error_status_code] : Error</code> </li> <li class="never" data-hits="" data-linenumber="27"> @@ -7980,13 +7822,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="13" data-linenumber="32"> - <span class="hits">13</span> + <li class="missed" data-hits="0" data-linenumber="32"> + <code class="ruby"> &quot;The following error was received: #{@response.raw.body}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="33"> @@ -8004,13 +7846,13 @@ <span class="hits">1</span> <code class="ruby"> def handle_details(details)</code> </li> - <li class="covered" data-hits="10" data-linenumber="36"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="36"> + <code class="ruby"> details.to_s</code> </li> <li class="never" data-hits="" data-linenumber="37"> @@ -8028,13 +7870,13 @@ <span class="hits">1</span> <code class="ruby"> def additional_info?</code> </li> - <li class="covered" data-hits="59" data-linenumber="40"> - <span class="hits">59</span> + <li class="missed" data-hits="0" data-linenumber="40"> + <code class="ruby"> false</code> </li> <li class="never" data-hits="" data-linenumber="41"> @@ -8082,13 +7924,13 @@ <code class="ruby"> error_message = [</code> </li> - <li class="covered" data-hits="65" data-linenumber="49"> - <span class="hits">65</span> + <li class="missed" data-hits="0" data-linenumber="49"> + <code class="ruby"> &quot;HTTP status code: #{@response.raw.status}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="50"> @@ -8106,67 +7948,67 @@ <code class="ruby"> begin</code> </li> - <li class="covered" data-hits="65" data-linenumber="53"> - <span class="hits">65</span> + <li class="missed" data-hits="0" data-linenumber="53"> + <code class="ruby"> response_json = @response.load_json</code> </li> - <li class="covered" data-hits="61" data-linenumber="54"> - <span class="hits">61</span> + <li class="missed" data-hits="0" data-linenumber="54"> + <code class="ruby"> message = response_json.fetch(&#39;message&#39;, default_error_message)</code> </li> - <li class="covered" data-hits="61" data-linenumber="55"> - <span class="hits">61</span> + <li class="missed" data-hits="0" data-linenumber="55"> + <code class="ruby"> details = response_json.fetch(&#39;details&#39;, nil)</code> </li> - <li class="covered" data-hits="61" data-linenumber="56"> - <span class="hits">61</span> + <li class="missed" data-hits="0" data-linenumber="56"> + <code class="ruby"> request_id = response_json.fetch(&#39;requestId&#39;, nil)</code> </li> <li class="never" data-hits="" data-linenumber="57"> <code class="ruby"></code> </li> - <li class="covered" data-hits="61" data-linenumber="58"> - <span class="hits">61</span> + <li class="missed" data-hits="0" data-linenumber="58"> + <code class="ruby"> error_message &lt;&lt; &quot;Message: #{message}&quot;</code> </li> - <li class="covered" data-hits="61" data-linenumber="59"> - <span class="hits">61</span> + <li class="missed" data-hits="0" data-linenumber="59"> + <code class="ruby"> error_message &lt;&lt; &quot;Details: #{handle_details(details)}&quot; if details</code> </li> - <li class="covered" data-hits="61" data-linenumber="60"> - <span class="hits">61</span> + <li class="missed" data-hits="0" data-linenumber="60"> + <code class="ruby"> error_message &lt;&lt; &quot;Request ID: #{request_id}&quot; if request_id</code> </li> <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"> rescue</code> </li> - <li class="covered" data-hits="4" data-linenumber="62"> - <span class="hits">4</span> + <li class="missed" data-hits="0" data-linenumber="62"> + <code class="ruby"> error_message &lt;&lt; &quot;Message: #{default_error_message}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="63"> @@ -8178,25 +8020,25 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="65" data-linenumber="65"> - <span class="hits">65</span> + <li class="missed" data-hits="0" data-linenumber="65"> + <code class="ruby"> error_message &lt;&lt; additional_info if additional_info?</code> </li> <li class="never" data-hits="" data-linenumber="66"> <code class="ruby"></code> </li> - <li class="covered" data-hits="65" data-linenumber="67"> - <span class="hits">65</span> + <li class="missed" data-hits="0" data-linenumber="67"> + <code class="ruby"> error_message.join(&quot;\n&quot;)</code> </li> <li class="never" data-hits="" data-linenumber="68"> @@ -8244,13 +8086,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="10" data-linenumber="76"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="76"> + <code class="ruby"> &#39;The request was malformed or missing a required parameter.&#39;</code> </li> <li class="never" data-hits="" data-linenumber="77"> @@ -8268,37 +8110,37 @@ <span class="hits">1</span> <code class="ruby"> def handle_details(details)</code> </li> - <li class="covered" data-hits="7" data-linenumber="80"> - <span class="hits">7</span> + <li class="missed" data-hits="0" data-linenumber="80"> + <code class="ruby"> return details if details.is_a?(String)</code> </li> <li class="never" data-hits="" data-linenumber="81"> <code class="ruby"></code> </li> - <li class="covered" data-hits="5" data-linenumber="82"> - <span class="hits">5</span> + <li class="missed" data-hits="0" data-linenumber="82"> + <code class="ruby"> handle_detail = proc do |detail|</code> </li> - <li class="covered" data-hits="5" data-linenumber="83"> - <span class="hits">5</span> + <li class="missed" data-hits="0" data-linenumber="83"> + <code class="ruby"> return detail if detail.is_a?(String)</code> </li> - <li class="covered" data-hits="3" data-linenumber="84"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="84"> + <code class="ruby"> detail.fetch(&#39;details&#39;, nil)</code> </li> <li class="never" data-hits="" data-linenumber="85"> @@ -8310,19 +8152,19 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="10" data-linenumber="87"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="87"> + <code class="ruby"> inner_details = details[&#39;errors&#39;].map { |detail| handle_detail[detail] }.reject(&amp;:nil?)</code> </li> - <li class="covered" data-hits="3" data-linenumber="88"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="88"> + <code class="ruby"> inner_details.join(&quot;\n\t&quot;)</code> </li> <li class="never" data-hits="" data-linenumber="89"> @@ -8370,13 +8212,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="3" data-linenumber="97"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="97"> + <code class="ruby"> &#39;The authorization token was invalid.&#39;</code> </li> <li class="never" data-hits="" data-linenumber="98"> @@ -8424,13 +8266,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="4" data-linenumber="106"> - <span class="hits">4</span> + <li class="missed" data-hits="0" data-linenumber="106"> + <code class="ruby"> &#39;The specified token does not have access to the requested resource.&#39;</code> </li> <li class="never" data-hits="" data-linenumber="107"> @@ -8448,13 +8290,13 @@ <span class="hits">1</span> <code class="ruby"> def handle_details(details)</code> </li> - <li class="covered" data-hits="2" data-linenumber="110"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="110"> + <code class="ruby"> &quot;\n\tReasons:\n\t\t#{details[&#39;reasons&#39;].join(&quot;\n\t\t&quot;)}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="111"> @@ -8502,13 +8344,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="17" data-linenumber="119"> - <span class="hits">17</span> + <li class="missed" data-hits="0" data-linenumber="119"> + <code class="ruby"> &#39;The requested resource or endpoint could not be found.&#39;</code> </li> <li class="never" data-hits="" data-linenumber="120"> @@ -8526,61 +8368,61 @@ <span class="hits">1</span> <code class="ruby"> def handle_details(details)</code> </li> - <li class="covered" data-hits="12" data-linenumber="123"> - <span class="hits">12</span> + <li class="missed" data-hits="0" data-linenumber="123"> + <code class="ruby"> return details if details.is_a?(String)</code> </li> <li class="never" data-hits="" data-linenumber="124"> <code class="ruby"></code> </li> - <li class="covered" data-hits="10" data-linenumber="125"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="125"> + <code class="ruby"> type = details[&#39;type&#39;] || (details[&#39;sys&#39;] || {})[&#39;type&#39;]</code> </li> - <li class="covered" data-hits="10" data-linenumber="126"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="126"> + <code class="ruby"> message = &quot;The requested #{type} could not be found.&quot;</code> </li> <li class="never" data-hits="" data-linenumber="127"> <code class="ruby"></code> </li> - <li class="covered" data-hits="10" data-linenumber="128"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="128"> + <code class="ruby"> resource_id = details.fetch(&#39;id&#39;, nil)</code> </li> - <li class="covered" data-hits="10" data-linenumber="129"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="129"> + <code class="ruby"> message += &quot; ID: #{resource_id}.&quot; if resource_id</code> </li> <li class="never" data-hits="" data-linenumber="130"> <code class="ruby"></code> </li> - <li class="covered" data-hits="10" data-linenumber="131"> - <span class="hits">10</span> + <li class="missed" data-hits="0" data-linenumber="131"> + <code class="ruby"> message</code> </li> <li class="never" data-hits="" data-linenumber="132"> @@ -8640,13 +8482,13 @@ <code class="ruby"> # rubocop:disable Style/DoubleNegation</code> </li> - <li class="covered" data-hits="6" data-linenumber="142"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="142"> + <code class="ruby"> !!reset_time</code> </li> <li class="never" data-hits="" data-linenumber="143"> @@ -8676,13 +8518,13 @@ <span class="hits">1</span> <code class="ruby"> def reset_time</code> </li> - <li class="covered" data-hits="11" data-linenumber="148"> - <span class="hits">11</span> + <li class="missed" data-hits="0" data-linenumber="148"> + <code class="ruby"> @reset_time ||= @response.raw[RATE_LIMIT_RESET_HEADER_KEY]</code> </li> <li class="never" data-hits="" data-linenumber="149"> @@ -8712,13 +8554,13 @@ <span class="hits">1</span> <code class="ruby"> def additional_info?</code> </li> - <li class="covered" data-hits="6" data-linenumber="154"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="154"> + <code class="ruby"> reset_time?</code> </li> <li class="never" data-hits="" data-linenumber="155"> @@ -8736,13 +8578,13 @@ <span class="hits">1</span> <code class="ruby"> def additional_info</code> </li> - <li class="covered" data-hits="3" data-linenumber="158"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="158"> + <code class="ruby"> [&quot;Time until reset (seconds): #{reset_time}&quot;]</code> </li> <li class="never" data-hits="" data-linenumber="159"> @@ -8760,13 +8602,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="6" data-linenumber="162"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="162"> + <code class="ruby"> &#39;Rate limit exceeded. Too many requests.&#39;</code> </li> <li class="never" data-hits="" data-linenumber="163"> @@ -8814,13 +8656,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="2" data-linenumber="171"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="171"> + <code class="ruby"> &#39;Internal server error.&#39;</code> </li> <li class="never" data-hits="" data-linenumber="172"> @@ -8868,13 +8710,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="2" data-linenumber="180"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="180"> + <code class="ruby"> &#39;The requested space is hibernated.&#39;</code> </li> <li class="never" data-hits="" data-linenumber="181"> @@ -8922,13 +8764,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="4" data-linenumber="189"> - <span class="hits">4</span> + <li class="missed" data-hits="0" data-linenumber="189"> + <code class="ruby"> &#39;The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.&#39;</code> </li> <li class="never" data-hits="" data-linenumber="190"> @@ -8976,13 +8818,13 @@ <span class="hits">1</span> <code class="ruby"> def default_error_message</code> </li> - <li class="covered" data-hits="4" data-linenumber="198"> - <span class="hits">4</span> + <li class="missed" data-hits="0" data-linenumber="198"> + <code class="ruby"> @response.error_message</code> </li> <li class="never" data-hits="" data-linenumber="199"> @@ -9036,13 +8878,13 @@ <span class="hits">1</span> <code class="ruby"> def initialize(name)</code> </li> - <li class="covered" data-hits="2" data-linenumber="208"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="208"> + <code class="ruby"> super(&quot;The field &#39;#{name}&#39; is empty and unavailable in the response&quot;)</code> </li> <li class="never" data-hits="" data-linenumber="209"> @@ -9235,54 +9077,54 @@ <span class="hits">1</span> <code class="ruby"> def initialize(json)</code> </li> - <li class="covered" data-hits="700" data-linenumber="27"> - <span class="hits">700</span> + <li class="covered" data-hits="319" data-linenumber="27"> + <span class="hits">319</span> <code class="ruby"> @raw = json</code> </li> - <li class="covered" data-hits="700" data-linenumber="28"> - <span class="hits">700</span> + <li class="covered" data-hits="319" data-linenumber="28"> + <span class="hits">319</span> <code class="ruby"> @id = json.fetch(&#39;id&#39;, nil)</code> </li> - <li class="covered" data-hits="700" data-linenumber="29"> - <span class="hits">700</span> + <li class="covered" data-hits="319" data-linenumber="29"> + <span class="hits">319</span> <code class="ruby"> @name = json.fetch(&#39;name&#39;, nil)</code> </li> - <li class="covered" data-hits="700" data-linenumber="30"> - <span class="hits">700</span> + <li class="covered" data-hits="319" data-linenumber="30"> + <span class="hits">319</span> <code class="ruby"> @type = json.fetch(&#39;type&#39;, nil)</code> </li> - <li class="covered" data-hits="700" data-linenumber="31"> - <span class="hits">700</span> + <li class="covered" data-hits="319" data-linenumber="31"> + <span class="hits">319</span> <code class="ruby"> @link_type = json.fetch(&#39;linkType&#39;, nil)</code> </li> - <li class="covered" data-hits="700" data-linenumber="32"> - <span class="hits">700</span> + <li class="covered" data-hits="319" data-linenumber="32"> + <span class="hits">319</span> <code class="ruby"> @items = json.key?(&#39;items&#39;) ? Field.new(json.fetch(&#39;items&#39;, {})) : nil</code> </li> - <li class="covered" data-hits="700" data-linenumber="33"> - <span class="hits">700</span> + <li class="covered" data-hits="319" data-linenumber="33"> + <span class="hits">319</span> <code class="ruby"> @required = json.fetch(&#39;required&#39;, false)</code> </li> - <li class="covered" data-hits="700" data-linenumber="34"> - <span class="hits">700</span> + <li class="covered" data-hits="319" data-linenumber="34"> + <span class="hits">319</span> <code class="ruby"> @localized = json.fetch(&#39;localized&#39;, false)</code> </li> <li class="never" data-hits="" data-linenumber="35"> @@ -9307,42 +9149,42 @@ <span class="hits">1</span> <code class="ruby"> def coerce(value, configuration)</code> </li> - <li class="covered" data-hits="5687" data-linenumber="39"> - <span class="hits">5687</span> + <li class="covered" data-hits="18" data-linenumber="39"> + <span class="hits">18</span> <code class="ruby"> return value if type.nil?</code> </li> - <li class="covered" data-hits="5687" data-linenumber="40"> - <span class="hits">5687</span> + <li class="covered" data-hits="18" data-linenumber="40"> + <span class="hits">18</span> <code class="ruby"> return value if value.nil?</code> </li> <li class="never" data-hits="" data-linenumber="41"> <code class="ruby"></code> </li> - <li class="covered" data-hits="5680" data-linenumber="42"> - <span class="hits">5680</span> + <li class="covered" data-hits="18" data-linenumber="42"> + <span class="hits">18</span> <code class="ruby"> options = {}</code> </li> - <li class="covered" data-hits="5680" data-linenumber="43"> - <span class="hits">5680</span> + <li class="covered" data-hits="18" data-linenumber="43"> + <span class="hits">18</span> <code class="ruby"> options[:coercion_class] = KNOWN_TYPES[items.type] unless items.nil?</code> </li> - <li class="covered" data-hits="5680" data-linenumber="44"> - <span class="hits">5680</span> + <li class="covered" data-hits="18" data-linenumber="44"> + <span class="hits">18</span> <code class="ruby"> KNOWN_TYPES[type].new(value, options).coerce(configuration)</code> </li> <li class="never" data-hits="" data-linenumber="45"> @@ -9369,15 +9211,15 @@ <div class="source_table" id="eecf0f806597fc4b233727ac4e855ef0a80b0ade"> <div class="header"> <h3>lib/contentful/fields_resource.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="red">75.38 %</span> covered</h4> <div> <b>65</b> relevant lines. - <span class="green"><b>65</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>49</b> lines covered</span> and + <span class="red"><b>16</b> lines missed.</span> </div> </div> <pre> <ol> @@ -9452,42 +9294,42 @@ <span class="hits">1</span> <code class="ruby"> def initialize(item, _configuration, localized = false, includes = [], entries = {}, depth = 0, errors = [])</code> </li> - <li class="covered" data-hits="3247" data-linenumber="13"> - <span class="hits">3247</span> + <li class="covered" data-hits="67" data-linenumber="13"> + <span class="hits">67</span> <code class="ruby"> super</code> </li> <li class="never" data-hits="" data-linenumber="14"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3247" data-linenumber="15"> - <span class="hits">3247</span> + <li class="covered" data-hits="67" data-linenumber="15"> + <span class="hits">67</span> <code class="ruby"> @configuration[:errors] = errors</code> </li> - <li class="covered" data-hits="3247" data-linenumber="16"> - <span class="hits">3247</span> + <li class="covered" data-hits="67" data-linenumber="16"> + <span class="hits">67</span> <code class="ruby"> @localized = localized</code> </li> - <li class="covered" data-hits="3247" data-linenumber="17"> - <span class="hits">3247</span> + <li class="covered" data-hits="67" data-linenumber="17"> + <span class="hits">67</span> <code class="ruby"> @fields = hydrate_fields(includes, entries, errors)</code> </li> - <li class="covered" data-hits="3247" data-linenumber="18"> - <span class="hits">3247</span> + <li class="covered" data-hits="67" data-linenumber="18"> + <span class="hits">67</span> <code class="ruby"> define_fields_methods!</code> </li> <li class="never" data-hits="" data-linenumber="19"> @@ -9524,18 +9366,18 @@ <span class="hits">1</span> <code class="ruby"> def fields(wanted_locale = nil)</code> </li> - <li class="covered" data-hits="3666" data-linenumber="25"> - <span class="hits">3666</span> + <li class="covered" data-hits="122" data-linenumber="25"> + <span class="hits">122</span> <code class="ruby"> wanted_locale = internal_resource_locale if wanted_locale.nil?</code> </li> - <li class="covered" data-hits="3666" data-linenumber="26"> - <span class="hits">3666</span> + <li class="covered" data-hits="122" data-linenumber="26"> + <span class="hits">122</span> <code class="ruby"> @fields.fetch(wanted_locale.to_s, {})</code> </li> <li class="never" data-hits="" data-linenumber="27"> @@ -9572,37 +9414,37 @@ <span class="hits">1</span> <code class="ruby"> def fields_with_locales</code> </li> - <li class="covered" data-hits="5" data-linenumber="33"> - <span class="hits">5</span> + <li class="missed" data-hits="0" data-linenumber="33"> + <code class="ruby"> remapped_fields = {}</code> </li> - <li class="covered" data-hits="5" data-linenumber="34"> - <span class="hits">5</span> + <li class="missed" data-hits="0" data-linenumber="34"> + <code class="ruby"> locales.each do |locale|</code> </li> - <li class="covered" data-hits="8" data-linenumber="35"> - <span class="hits">8</span> + <li class="missed" data-hits="0" data-linenumber="35"> + <code class="ruby"> fields(locale).each do |name, value|</code> </li> - <li class="covered" data-hits="38" data-linenumber="36"> - <span class="hits">38</span> + <li class="missed" data-hits="0" data-linenumber="36"> + <code class="ruby"> remapped_fields[name] ||= {}</code> </li> - <li class="covered" data-hits="38" data-linenumber="37"> - <span class="hits">38</span> + <li class="missed" data-hits="0" data-linenumber="37"> + <code class="ruby"> remapped_fields[name][locale.to_sym] = value</code> </li> <li class="never" data-hits="" data-linenumber="38"> @@ -9620,13 +9462,13 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="5" data-linenumber="41"> - <span class="hits">5</span> + <li class="missed" data-hits="0" data-linenumber="41"> + <code class="ruby"> remapped_fields</code> </li> <li class="never" data-hits="" data-linenumber="42"> @@ -9650,13 +9492,13 @@ <span class="hits">1</span> <code class="ruby"> def locales</code> </li> - <li class="covered" data-hits="743" data-linenumber="46"> - <span class="hits">743</span> + <li class="missed" data-hits="0" data-linenumber="46"> + <code class="ruby"> @fields.keys</code> </li> <li class="never" data-hits="" data-linenumber="47"> @@ -9686,12 +9528,12 @@ <code class="ruby"> {</code> </li> - <li class="covered" data-hits="32" data-linenumber="52"> - <span class="hits">32</span> + <li class="covered" data-hits="8" data-linenumber="52"> + <span class="hits">8</span> <code class="ruby"> configuration: @configuration,</code> </li> <li class="never" data-hits="" data-linenumber="53"> @@ -9734,24 +9576,24 @@ <span class="hits">1</span> <code class="ruby"> def marshal_load(raw_object)</code> </li> - <li class="covered" data-hits="51" data-linenumber="60"> - <span class="hits">51</span> + <li class="covered" data-hits="16" data-linenumber="60"> + <span class="hits">16</span> <code class="ruby"> super(raw_object)</code> </li> - <li class="covered" data-hits="51" data-linenumber="61"> - <span class="hits">51</span> + <li class="covered" data-hits="16" data-linenumber="61"> + <span class="hits">16</span> <code class="ruby"> @localized = raw_object[:localized]</code> </li> - <li class="covered" data-hits="51" data-linenumber="62"> - <span class="hits">51</span> + <li class="covered" data-hits="16" data-linenumber="62"> + <span class="hits">16</span> <code class="ruby"> @fields = hydrate_fields(</code> </li> <li class="never" data-hits="" data-linenumber="63"> @@ -9776,12 +9618,12 @@ <code class="ruby"> )</code> </li> - <li class="covered" data-hits="51" data-linenumber="67"> - <span class="hits">51</span> + <li class="covered" data-hits="16" data-linenumber="67"> + <span class="hits">16</span> <code class="ruby"> define_fields_methods!</code> </li> <li class="never" data-hits="" data-linenumber="68"> @@ -9806,36 +9648,36 @@ <span class="hits">1</span> <code class="ruby"> def raw_with_links</code> </li> - <li class="covered" data-hits="159" data-linenumber="72"> - <span class="hits">159</span> + <li class="covered" data-hits="22" data-linenumber="72"> + <span class="hits">22</span> <code class="ruby"> links = fields.keys.select { |property| known_link?(property) }</code> </li> - <li class="covered" data-hits="32" data-linenumber="73"> - <span class="hits">32</span> + <li class="covered" data-hits="8" data-linenumber="73"> + <span class="hits">8</span> <code class="ruby"> processed_raw = raw.clone</code> </li> - <li class="covered" data-hits="32" data-linenumber="74"> - <span class="hits">32</span> + <li class="covered" data-hits="8" data-linenumber="74"> + <span class="hits">8</span> <code class="ruby"> raw[&#39;fields&#39;].each do |k, v|</code> </li> - <li class="covered" data-hits="141" data-linenumber="75"> - <span class="hits">141</span> + <li class="covered" data-hits="14" data-linenumber="75"> + <span class="hits">14</span> <code class="ruby"> links_key = Support.snakify(k, @configuration[:use_camel_case])</code> </li> - <li class="covered" data-hits="141" data-linenumber="76"> - <span class="hits">141</span> + <li class="covered" data-hits="14" data-linenumber="76"> + <span class="hits">14</span> <code class="ruby"> processed_raw[&#39;fields&#39;][k] = links.include?(links_key.to_sym) ? send(links_key) : v</code> </li> <li class="never" data-hits="" data-linenumber="77"> @@ -9848,12 +9690,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="32" data-linenumber="79"> - <span class="hits">32</span> + <li class="covered" data-hits="8" data-linenumber="79"> + <span class="hits">8</span> <code class="ruby"> processed_raw</code> </li> <li class="never" data-hits="" data-linenumber="80"> @@ -9884,18 +9726,18 @@ <span class="hits">1</span> <code class="ruby"> def define_fields_methods!</code> </li> - <li class="covered" data-hits="3298" data-linenumber="85"> - <span class="hits">3298</span> + <li class="covered" data-hits="83" data-linenumber="85"> + <span class="hits">83</span> <code class="ruby"> fields.each do |k, v|</code> </li> - <li class="covered" data-hits="14269" data-linenumber="86"> - <span class="hits">14269</span> + <li class="covered" data-hits="292" data-linenumber="86"> + <span class="hits">292</span> <code class="ruby"> define_singleton_method(k) { v } unless self.class.method_defined?(k)</code> </li> <li class="never" data-hits="" data-linenumber="87"> @@ -9920,49 +9762,49 @@ <span class="hits">1</span> <code class="ruby"> def hydrate_localized_fields(includes, errors, entries)</code> </li> - <li class="covered" data-hits="1562" data-linenumber="91"> - <span class="hits">1562</span> + <li class="missed" data-hits="0" data-linenumber="91"> + <code class="ruby"> locale = internal_resource_locale</code> </li> - <li class="covered" data-hits="1562" data-linenumber="92"> - <span class="hits">1562</span> + <li class="missed" data-hits="0" data-linenumber="92"> + <code class="ruby"> result = { locale =&gt; {} }</code> </li> - <li class="covered" data-hits="1562" data-linenumber="93"> - <span class="hits">1562</span> + <li class="missed" data-hits="0" data-linenumber="93"> + <code class="ruby"> raw[&#39;fields&#39;].each do |name, locales|</code> </li> - <li class="covered" data-hits="6614" data-linenumber="94"> - <span class="hits">6614</span> + <li class="missed" data-hits="0" data-linenumber="94"> + <code class="ruby"> locales.each do |loc, value|</code> </li> - <li class="covered" data-hits="7295" data-linenumber="95"> - <span class="hits">7295</span> + <li class="missed" data-hits="0" data-linenumber="95"> + <code class="ruby"> result[loc] ||= {}</code> </li> - <li class="covered" data-hits="7295" data-linenumber="96"> - <span class="hits">7295</span> + <li class="missed" data-hits="0" data-linenumber="96"> + <code class="ruby"> name = Support.snakify(name, @configuration[:use_camel_case])</code> </li> - <li class="covered" data-hits="7295" data-linenumber="97"> - <span class="hits">7295</span> + <li class="missed" data-hits="0" data-linenumber="97"> + <code class="ruby"> result[loc][name.to_sym] = coerce(</code> </li> <li class="never" data-hits="" data-linenumber="98"> @@ -10016,13 +9858,13 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="1562" data-linenumber="107"> - <span class="hits">1562</span> + <li class="missed" data-hits="0" data-linenumber="107"> + <code class="ruby"> result</code> </li> <li class="never" data-hits="" data-linenumber="108"> @@ -10040,36 +9882,36 @@ <span class="hits">1</span> <code class="ruby"> def hydrate_nonlocalized_fields(includes, errors, entries)</code> </li> - <li class="covered" data-hits="1729" data-linenumber="111"> - <span class="hits">1729</span> + <li class="covered" data-hits="83" data-linenumber="111"> + <span class="hits">83</span> <code class="ruby"> locale = internal_resource_locale</code> </li> - <li class="covered" data-hits="1729" data-linenumber="112"> - <span class="hits">1729</span> + <li class="covered" data-hits="83" data-linenumber="112"> + <span class="hits">83</span> <code class="ruby"> result = { locale =&gt; {} }</code> </li> - <li class="covered" data-hits="1729" data-linenumber="113"> - <span class="hits">1729</span> + <li class="covered" data-hits="83" data-linenumber="113"> + <span class="hits">83</span> <code class="ruby"> raw[&#39;fields&#39;].each do |name, value|</code> </li> - <li class="covered" data-hits="7370" data-linenumber="114"> - <span class="hits">7370</span> + <li class="covered" data-hits="270" data-linenumber="114"> + <span class="hits">270</span> <code class="ruby"> name = Support.snakify(name, @configuration[:use_camel_case])</code> </li> - <li class="covered" data-hits="7370" data-linenumber="115"> - <span class="hits">7370</span> + <li class="covered" data-hits="270" data-linenumber="115"> + <span class="hits">270</span> <code class="ruby"> result[locale][name.to_sym] = coerce(</code> </li> <li class="never" data-hits="" data-linenumber="116"> @@ -10118,12 +9960,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="1729" data-linenumber="124"> - <span class="hits">1729</span> + <li class="covered" data-hits="83" data-linenumber="124"> + <span class="hits">83</span> <code class="ruby"> result</code> </li> <li class="never" data-hits="" data-linenumber="125"> @@ -10142,42 +9984,42 @@ <span class="hits">1</span> <code class="ruby"> def hydrate_fields(includes, entries, errors)</code> </li> - <li class="covered" data-hits="3298" data-linenumber="128"> - <span class="hits">3298</span> + <li class="covered" data-hits="83" data-linenumber="128"> + <span class="hits">83</span> <code class="ruby"> return {} unless raw.key?(&#39;fields&#39;)</code> </li> <li class="never" data-hits="" data-linenumber="129"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3291" data-linenumber="130"> - <span class="hits">3291</span> + <li class="covered" data-hits="83" data-linenumber="130"> + <span class="hits">83</span> <code class="ruby"> if localized</code> </li> - <li class="covered" data-hits="1562" data-linenumber="131"> - <span class="hits">1562</span> + <li class="missed" data-hits="0" data-linenumber="131"> + <code class="ruby"> hydrate_localized_fields(includes, errors, entries)</code> </li> <li class="never" data-hits="" data-linenumber="132"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="1729" data-linenumber="133"> - <span class="hits">1729</span> + <li class="covered" data-hits="83" data-linenumber="133"> + <span class="hits">83</span> <code class="ruby"> hydrate_nonlocalized_fields(includes, errors, entries)</code> </li> <li class="never" data-hits="" data-linenumber="134"> @@ -10214,12 +10056,12 @@ <span class="hits">1</span> <code class="ruby"> def coerce(_field_id, value, _includes, _errors, _entries)</code> </li> - <li class="covered" data-hits="5941" data-linenumber="140"> - <span class="hits">5941</span> + <li class="covered" data-hits="191" data-linenumber="140"> + <span class="hits">191</span> <code class="ruby"> value</code> </li> <li class="never" data-hits="" data-linenumber="141"> @@ -10281,24 +10123,24 @@ <span class="hits">1</span> <code class="ruby"> def initialize(json, configuration)</code> </li> - <li class="covered" data-hits="1540" data-linenumber="5"> - <span class="hits">1540</span> + <li class="covered" data-hits="40" data-linenumber="5"> + <span class="hits">40</span> <code class="ruby"> @configuration = configuration</code> </li> <li class="never" data-hits="" data-linenumber="6"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1540" data-linenumber="7"> - <span class="hits">1540</span> + <li class="covered" data-hits="40" data-linenumber="7"> + <span class="hits">40</span> <code class="ruby"> define_fields!(json)</code> </li> <li class="never" data-hits="" data-linenumber="8"> @@ -10329,24 +10171,24 @@ <span class="hits">1</span> <code class="ruby"> def define_fields!(json)</code> </li> - <li class="covered" data-hits="1540" data-linenumber="13"> - <span class="hits">1540</span> + <li class="covered" data-hits="40" data-linenumber="13"> + <span class="hits">40</span> <code class="ruby"> json.each do |k, v|</code> </li> - <li class="covered" data-hits="6160" data-linenumber="14"> - <span class="hits">6160</span> + <li class="covered" data-hits="160" data-linenumber="14"> + <span class="hits">160</span> <code class="ruby"> define_singleton_method Support.snakify(k, @configuration[:use_camel_case]) do</code> </li> - <li class="covered" data-hits="40" data-linenumber="15"> - <span class="hits">40</span> + <li class="covered" data-hits="8" data-linenumber="15"> + <span class="hits">8</span> <code class="ruby"> v</code> </li> <li class="never" data-hits="" data-linenumber="16"> @@ -10385,15 +10227,15 @@ <div class="source_table" id="f0b3585d50697809ca059b22b439d1c92b144124"> <div class="header"> <h3>lib/contentful/link.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="red">66.67 %</span> covered</h4> <div> <b>6</b> relevant lines. - <span class="green"><b>6</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>4</b> lines covered</span> and + <span class="red"><b>2</b> lines missed.</span> </div> </div> <pre> <ol> @@ -10450,19 +10292,19 @@ <span class="hits">1</span> <code class="ruby"> def resolve(client, query = {})</code> </li> - <li class="covered" data-hits="2" data-linenumber="10"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="10"> + <code class="ruby"> id_and_query = [(id unless link_type == &#39;Space&#39;)].compact + [query]</code> </li> - <li class="covered" data-hits="2" data-linenumber="11"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="11"> + <code class="ruby"> client.public_send(</code> </li> <li class="never" data-hits="" data-linenumber="12"> @@ -10506,15 +10348,15 @@ <div class="source_table" id="ce8ecf27b5e97b41247b7386680ee9aa0e670574"> <div class="header"> <h3>lib/contentful/locale.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="red">55.56 %</span> covered</h4> <div> <b>9</b> relevant lines. - <span class="green"><b>9</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>5</b> lines covered</span> and + <span class="red"><b>4</b> lines missed.</span> </div> </div> <pre> <ol> @@ -10571,31 +10413,31 @@ <span class="hits">1</span> <code class="ruby"> def initialize(item, *)</code> </li> - <li class="covered" data-hits="21" data-linenumber="10"> - <span class="hits">21</span> + <li class="missed" data-hits="0" data-linenumber="10"> + <code class="ruby"> @code = item.fetch(&#39;code&#39;, nil)</code> </li> - <li class="covered" data-hits="21" data-linenumber="11"> - <span class="hits">21</span> + <li class="missed" data-hits="0" data-linenumber="11"> + <code class="ruby"> @name = item.fetch(&#39;name&#39;, nil)</code> </li> - <li class="covered" data-hits="21" data-linenumber="12"> - <span class="hits">21</span> + <li class="missed" data-hits="0" data-linenumber="12"> + <code class="ruby"> @default = item.fetch(&#39;default&#39;, false)</code> </li> - <li class="covered" data-hits="21" data-linenumber="13"> - <span class="hits">21</span> + <li class="missed" data-hits="0" data-linenumber="13"> + <code class="ruby"> @fallback_code = item.fetch(&#39;fallbackCode&#39;, nil)</code> </li> <li class="never" data-hits="" data-linenumber="14"> @@ -10621,15 +10463,15 @@ <div class="source_table" id="0b0fac99f5d491e120b04db5fad4d156a78fc99e"> <div class="header"> <h3>lib/contentful/location.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="red">75.0 %</span> covered</h4> <div> <b>8</b> relevant lines. - <span class="green"><b>8</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>6</b> lines covered</span> and + <span class="red"><b>2</b> lines missed.</span> </div> </div> <pre> <ol> @@ -10686,19 +10528,19 @@ <span class="hits">1</span> <code class="ruby"> def initialize(json)</code> </li> - <li class="covered" data-hits="2" data-linenumber="10"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="10"> + <code class="ruby"> @lat = json.fetch(&#39;lat&#39;, nil)</code> </li> - <li class="covered" data-hits="2" data-linenumber="11"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="11"> + <code class="ruby"> @lon = json.fetch(&#39;lon&#39;, nil)</code> </li> <li class="never" data-hits="" data-linenumber="12"> @@ -10783,72 +10625,72 @@ <span class="hits">1</span> <code class="ruby"> def initialize(client, endpoint, query = {}, id = nil)</code> </li> - <li class="covered" data-hits="259" data-linenumber="9"> - <span class="hits">259</span> + <li class="covered" data-hits="32" data-linenumber="9"> + <span class="hits">32</span> <code class="ruby"> @client = client</code> </li> - <li class="covered" data-hits="259" data-linenumber="10"> - <span class="hits">259</span> + <li class="covered" data-hits="32" data-linenumber="10"> + <span class="hits">32</span> <code class="ruby"> @endpoint = endpoint</code> </li> <li class="never" data-hits="" data-linenumber="11"> <code class="ruby"></code> </li> - <li class="covered" data-hits="259" data-linenumber="12"> - <span class="hits">259</span> + <li class="covered" data-hits="32" data-linenumber="12"> + <span class="hits">32</span> <code class="ruby"> @query = (normalize_query(query) if query &amp;&amp; !query.empty?)</code> </li> <li class="never" data-hits="" data-linenumber="13"> <code class="ruby"></code> </li> - <li class="covered" data-hits="259" data-linenumber="14"> - <span class="hits">259</span> + <li class="covered" data-hits="32" data-linenumber="14"> + <span class="hits">32</span> <code class="ruby"> if id</code> </li> - <li class="covered" data-hits="63" data-linenumber="15"> - <span class="hits">63</span> + <li class="covered" data-hits="10" data-linenumber="15"> + <span class="hits">10</span> <code class="ruby"> @type = :single</code> </li> - <li class="covered" data-hits="63" data-linenumber="16"> - <span class="hits">63</span> + <li class="covered" data-hits="10" data-linenumber="16"> + <span class="hits">10</span> <code class="ruby"> @id = URI.escape(id)</code> </li> <li class="never" data-hits="" data-linenumber="17"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="196" data-linenumber="18"> - <span class="hits">196</span> + <li class="covered" data-hits="22" data-linenumber="18"> + <span class="hits">22</span> <code class="ruby"> @type = :multi</code> </li> - <li class="covered" data-hits="196" data-linenumber="19"> - <span class="hits">196</span> + <li class="covered" data-hits="22" data-linenumber="19"> + <span class="hits">22</span> <code class="ruby"> @id = nil</code> </li> <li class="never" data-hits="" data-linenumber="20"> @@ -10879,12 +10721,12 @@ <span class="hits">1</span> <code class="ruby"> def url</code> </li> - <li class="covered" data-hits="254" data-linenumber="25"> - <span class="hits">254</span> + <li class="covered" data-hits="36" data-linenumber="25"> + <span class="hits">36</span> <code class="ruby"> &quot;#{@endpoint}#{@type == :single ? &quot;/#{id}&quot; : &#39;&#39;}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="26"> @@ -10909,12 +10751,12 @@ <span class="hits">1</span> <code class="ruby"> def get</code> </li> - <li class="covered" data-hits="237" data-linenumber="30"> - <span class="hits">237</span> + <li class="covered" data-hits="22" data-linenumber="30"> + <span class="hits">22</span> <code class="ruby"> client.get(self)</code> </li> <li class="never" data-hits="" data-linenumber="31"> @@ -10939,12 +10781,12 @@ <span class="hits">1</span> <code class="ruby"> def absolute?</code> </li> - <li class="covered" data-hits="247" data-linenumber="35"> - <span class="hits">247</span> + <li class="covered" data-hits="32" data-linenumber="35"> + <span class="hits">32</span> <code class="ruby"> @endpoint.start_with?(&#39;http&#39;)</code> </li> <li class="never" data-hits="" data-linenumber="36"> @@ -11005,12 +10847,12 @@ <span class="hits">1</span> <code class="ruby"> def normalize_query(query)</code> </li> - <li class="covered" data-hits="148" data-linenumber="46"> - <span class="hits">148</span> + <li class="covered" data-hits="12" data-linenumber="46"> + <span class="hits">12</span> <code class="ruby"> Hash[</code> </li> <li class="never" data-hits="" data-linenumber="47"> @@ -11023,18 +10865,18 @@ <code class="ruby"> [</code> </li> - <li class="covered" data-hits="186" data-linenumber="49"> - <span class="hits">186</span> + <li class="covered" data-hits="17" data-linenumber="49"> + <span class="hits">17</span> <code class="ruby"> key.to_sym,</code> </li> - <li class="covered" data-hits="186" data-linenumber="50"> - <span class="hits">186</span> + <li class="covered" data-hits="17" data-linenumber="50"> + <span class="hits">17</span> <code class="ruby"> value.is_a?(::Array) ? value.join(&#39;,&#39;) : value</code> </li> <li class="never" data-hits="" data-linenumber="51"> @@ -11079,15 +10921,15 @@ <div class="source_table" id="ea1894a682921dc1a4b4d4255935538a0067cdfd"> <div class="header"> <h3>lib/contentful/resource_builder.rb</h3> - <h4><span class="green">96.74 %</span> covered</h4> + <h4><span class="green">93.55 %</span> covered</h4> <div> - <b>92</b> relevant lines. - <span class="green"><b>89</b> lines covered</span> and - <span class="red"><b>3</b> lines missed.</span> + <b>93</b> relevant lines. + <span class="green"><b>87</b> lines covered</span> and + <span class="red"><b>6</b> lines missed.</span> </div> </div> <pre> <ol> @@ -11276,815 +11118,827 @@ <span class="hits">1</span> <code class="ruby"> DEFAULT_ENTRY_MAPPING = {}.freeze</code> </li> - <li class="covered" data-hits="1" data-linenumber="32"> + <li class="never" data-hits="" data-linenumber="32"> + + + <code class="ruby"> # Buildable Resources</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="33"> <span class="hits">1</span> <code class="ruby"> BUILDABLES = %w[Entry Asset ContentType Space DeletedEntry DeletedAsset Locale].freeze</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="34"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="34"> + <li class="covered" data-hits="1" data-linenumber="35"> <span class="hits">1</span> - <code class="ruby"> attr_reader :json, :default_locale, :endpoint, :depth, :localized, :resource_mapping, :entry_mapping, :resource</code> + <code class="ruby"> attr_reader :json, :default_locale, :endpoint, :depth, :localized, :resource_mapping, :entry_mapping, :resource, :query</code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="never" data-hits="" data-linenumber="36"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="36"> + <li class="covered" data-hits="1" data-linenumber="37"> <span class="hits">1</span> - <code class="ruby"> def initialize(json, configuration = {}, localized = false, depth = 0, errors = [])</code> + <code class="ruby"> def initialize(json, configuration = {}, localized = false, depth = 0, errors = [], query = {})</code> </li> - <li class="covered" data-hits="3137" data-linenumber="37"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="38"> + <span class="hits">95</span> <code class="ruby"> @json = json</code> </li> - <li class="covered" data-hits="3137" data-linenumber="38"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="39"> + <span class="hits">95</span> <code class="ruby"> @default_locale = configuration.fetch(:default_locale, ::Contentful::Client::DEFAULT_CONFIGURATION[:default_locale])</code> </li> - <li class="covered" data-hits="3137" data-linenumber="39"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="40"> + <span class="hits">95</span> <code class="ruby"> @resource_mapping = default_resource_mapping.merge(configuration.fetch(:resource_mapping, {}))</code> </li> - <li class="covered" data-hits="3137" data-linenumber="40"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="41"> + <span class="hits">95</span> <code class="ruby"> @entry_mapping = default_entry_mapping.merge(configuration.fetch(:entry_mapping, {}))</code> </li> - <li class="covered" data-hits="3137" data-linenumber="41"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="42"> + <span class="hits">95</span> <code class="ruby"> @includes_for_single = configuration.fetch(:includes_for_single, [])</code> </li> - <li class="covered" data-hits="3137" data-linenumber="42"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="43"> + <span class="hits">95</span> <code class="ruby"> @localized = localized</code> </li> - <li class="covered" data-hits="3137" data-linenumber="43"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="44"> + <span class="hits">95</span> <code class="ruby"> @depth = depth</code> </li> - <li class="covered" data-hits="3137" data-linenumber="44"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="45"> + <span class="hits">95</span> <code class="ruby"> @endpoint = configuration.fetch(:endpoint, nil)</code> </li> - <li class="covered" data-hits="3137" data-linenumber="45"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="46"> + <span class="hits">95</span> <code class="ruby"> @configuration = configuration</code> </li> - <li class="covered" data-hits="3137" data-linenumber="46"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="47"> + <span class="hits">95</span> <code class="ruby"> @resource_cache = configuration[:_entries_cache] || {}</code> </li> - <li class="covered" data-hits="3137" data-linenumber="47"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="48"> + <span class="hits">95</span> <code class="ruby"> @errors = errors</code> </li> - <li class="never" data-hits="" data-linenumber="48"> + <li class="covered" data-hits="95" data-linenumber="49"> + <span class="hits">95</span> + <code class="ruby"> @query = query</code> + </li> + + <li class="never" data-hits="" data-linenumber="50"> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="never" data-hits="" data-linenumber="51"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="50"> + <li class="never" data-hits="" data-linenumber="52"> <code class="ruby"> # Starts the parsing process.</code> </li> - <li class="never" data-hits="" data-linenumber="51"> + <li class="never" data-hits="" data-linenumber="53"> <code class="ruby"> #</code> </li> - <li class="never" data-hits="" data-linenumber="52"> + <li class="never" data-hits="" data-linenumber="54"> <code class="ruby"> # @return [Contentful::Resource, Contentful::Error]</code> </li> - <li class="covered" data-hits="1" data-linenumber="53"> + <li class="covered" data-hits="1" data-linenumber="55"> <span class="hits">1</span> <code class="ruby"> def run</code> </li> - <li class="covered" data-hits="3137" data-linenumber="54"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="56"> + <span class="hits">95</span> <code class="ruby"> return build_array if array?</code> </li> - <li class="covered" data-hits="2963" data-linenumber="55"> - <span class="hits">2963</span> + <li class="covered" data-hits="73" data-linenumber="57"> + <span class="hits">73</span> <code class="ruby"> build_single</code> </li> - <li class="never" data-hits="" data-linenumber="56"> + <li class="never" data-hits="" data-linenumber="58"> <code class="ruby"> rescue UnparsableResource =&gt; error</code> </li> - <li class="missed" data-hits="0" data-linenumber="57"> + <li class="missed" data-hits="0" data-linenumber="59"> <code class="ruby"> error</code> </li> - <li class="never" data-hits="" data-linenumber="58"> + <li class="never" data-hits="" data-linenumber="60"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="59"> + <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="60"> + <li class="covered" data-hits="1" data-linenumber="62"> <span class="hits">1</span> <code class="ruby"> private</code> </li> - <li class="never" data-hits="" data-linenumber="61"> + <li class="never" data-hits="" data-linenumber="63"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="62"> + <li class="covered" data-hits="1" data-linenumber="64"> <span class="hits">1</span> <code class="ruby"> def build_array</code> </li> - <li class="covered" data-hits="174" data-linenumber="63"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="65"> + <span class="hits">22</span> <code class="ruby"> includes = fetch_includes || @includes_for_single</code> </li> - <li class="covered" data-hits="174" data-linenumber="64"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="66"> + <span class="hits">22</span> <code class="ruby"> errors = fetch_errors || @errors</code> </li> - <li class="never" data-hits="" data-linenumber="65"> + <li class="never" data-hits="" data-linenumber="67"> <code class="ruby"></code> </li> - <li class="covered" data-hits="174" data-linenumber="66"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="68"> + <span class="hits">22</span> <code class="ruby"> result = json[&#39;items&#39;].map do |item|</code> </li> - <li class="covered" data-hits="479" data-linenumber="67"> - <span class="hits">479</span> + <li class="covered" data-hits="56" data-linenumber="69"> + <span class="hits">56</span> <code class="ruby"> next if Support.unresolvable?(item, errors)</code> </li> - <li class="covered" data-hits="479" data-linenumber="68"> - <span class="hits">479</span> + <li class="covered" data-hits="56" data-linenumber="70"> + <span class="hits">56</span> <code class="ruby"> build_item(item, includes, errors)</code> </li> - <li class="never" data-hits="" data-linenumber="69"> + <li class="never" data-hits="" data-linenumber="71"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="174" data-linenumber="70"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="72"> + <span class="hits">22</span> <code class="ruby"> array_class = fetch_array_class</code> </li> - <li class="covered" data-hits="174" data-linenumber="71"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="73"> + <span class="hits">22</span> - <code class="ruby"> array_class.new(json.merge(&#39;items&#39; =&gt; result), @configuration, endpoint)</code> + <code class="ruby"> array_class.new(json.merge(&#39;items&#39; =&gt; result), @configuration, endpoint, query)</code> </li> - <li class="never" data-hits="" data-linenumber="72"> + <li class="never" data-hits="" data-linenumber="74"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="73"> + <li class="never" data-hits="" data-linenumber="75"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="74"> + <li class="covered" data-hits="1" data-linenumber="76"> <span class="hits">1</span> <code class="ruby"> def build_single</code> </li> - <li class="covered" data-hits="2963" data-linenumber="75"> - <span class="hits">2963</span> + <li class="covered" data-hits="73" data-linenumber="77"> + <span class="hits">73</span> <code class="ruby"> return if Support.unresolvable?(json, @errors)</code> </li> - <li class="covered" data-hits="2963" data-linenumber="76"> - <span class="hits">2963</span> + <li class="covered" data-hits="73" data-linenumber="78"> + <span class="hits">73</span> <code class="ruby"> includes = @includes_for_single</code> </li> - <li class="covered" data-hits="2963" data-linenumber="77"> - <span class="hits">2963</span> + <li class="covered" data-hits="73" data-linenumber="79"> + <span class="hits">73</span> <code class="ruby"> build_item(json, includes, @errors)</code> </li> - <li class="never" data-hits="" data-linenumber="78"> + <li class="never" data-hits="" data-linenumber="80"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="79"> + <li class="never" data-hits="" data-linenumber="81"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="80"> + <li class="covered" data-hits="1" data-linenumber="82"> <span class="hits">1</span> <code class="ruby"> def build_item(item, includes = [], errors = [])</code> </li> - <li class="covered" data-hits="8939" data-linenumber="81"> - <span class="hits">8939</span> + <li class="covered" data-hits="414" data-linenumber="83"> + <span class="hits">414</span> <code class="ruby"> item_type = BUILDABLES.detect { |b| b == item[&#39;sys&#39;][&#39;type&#39;] }</code> </li> - <li class="covered" data-hits="3442" data-linenumber="82"> - <span class="hits">3442</span> + <li class="covered" data-hits="129" data-linenumber="84"> + <span class="hits">129</span> <code class="ruby"> fail UnparsableResource, &#39;Item type is not known, could not parse&#39; if item_type.nil?</code> </li> - <li class="covered" data-hits="3442" data-linenumber="83"> - <span class="hits">3442</span> + <li class="covered" data-hits="129" data-linenumber="85"> + <span class="hits">129</span> <code class="ruby"> item_class = resource_class(item)</code> </li> - <li class="never" data-hits="" data-linenumber="84"> + <li class="never" data-hits="" data-linenumber="86"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3442" data-linenumber="85"> - <span class="hits">3442</span> + <li class="covered" data-hits="129" data-linenumber="87"> + <span class="hits">129</span> <code class="ruby"> reuse_entries = @configuration.fetch(:reuse_entries, false)</code> </li> - <li class="covered" data-hits="3442" data-linenumber="86"> - <span class="hits">3442</span> + <li class="covered" data-hits="129" data-linenumber="88"> + <span class="hits">129</span> <code class="ruby"> resource_cache = @resource_cache ? @resource_cache : {}</code> </li> - <li class="never" data-hits="" data-linenumber="87"> + <li class="never" data-hits="" data-linenumber="89"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3442" data-linenumber="88"> - <span class="hits">3442</span> + <li class="covered" data-hits="129" data-linenumber="90"> + <span class="hits">129</span> <code class="ruby"> id = &quot;#{item[&#39;sys&#39;][&#39;type&#39;]}:#{item[&#39;sys&#39;][&#39;id&#39;]}&quot;</code> </li> - <li class="covered" data-hits="3442" data-linenumber="89"> - <span class="hits">3442</span> + <li class="covered" data-hits="129" data-linenumber="91"> + <span class="hits">129</span> <code class="ruby"> resource = if reuse_entries &amp;&amp; resource_cache.key?(id)</code> </li> - <li class="covered" data-hits="2" data-linenumber="90"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="92"> + <code class="ruby"> resource_cache[id]</code> </li> - <li class="never" data-hits="" data-linenumber="91"> + <li class="never" data-hits="" data-linenumber="93"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="3440" data-linenumber="92"> - <span class="hits">3440</span> + <li class="covered" data-hits="129" data-linenumber="94"> + <span class="hits">129</span> <code class="ruby"> item_class.new(item, @configuration, localized?, includes, resource_cache, depth, errors)</code> </li> - <li class="never" data-hits="" data-linenumber="93"> + <li class="never" data-hits="" data-linenumber="95"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="94"> + <li class="never" data-hits="" data-linenumber="96"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3442" data-linenumber="95"> - <span class="hits">3442</span> + <li class="covered" data-hits="129" data-linenumber="97"> + <span class="hits">129</span> <code class="ruby"> resource</code> </li> - <li class="never" data-hits="" data-linenumber="96"> + <li class="never" data-hits="" data-linenumber="98"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="97"> + <li class="never" data-hits="" data-linenumber="99"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="98"> + <li class="covered" data-hits="1" data-linenumber="100"> <span class="hits">1</span> <code class="ruby"> def fetch_includes</code> </li> - <li class="covered" data-hits="174" data-linenumber="99"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="101"> + <span class="hits">22</span> <code class="ruby"> Support.includes_from_response(json)</code> </li> - <li class="never" data-hits="" data-linenumber="100"> + <li class="never" data-hits="" data-linenumber="102"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="101"> + <li class="never" data-hits="" data-linenumber="103"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="102"> + <li class="covered" data-hits="1" data-linenumber="104"> <span class="hits">1</span> <code class="ruby"> def fetch_errors</code> </li> - <li class="covered" data-hits="174" data-linenumber="103"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="105"> + <span class="hits">22</span> <code class="ruby"> json.fetch(&#39;errors&#39;, [])</code> </li> - <li class="never" data-hits="" data-linenumber="104"> + <li class="never" data-hits="" data-linenumber="106"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="105"> + <li class="never" data-hits="" data-linenumber="107"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="106"> + <li class="covered" data-hits="1" data-linenumber="108"> <span class="hits">1</span> <code class="ruby"> def resource_class(item)</code> </li> - <li class="covered" data-hits="3442" data-linenumber="107"> - <span class="hits">3442</span> + <li class="covered" data-hits="129" data-linenumber="109"> + <span class="hits">129</span> <code class="ruby"> return fetch_custom_resource_class(item) if %w[Entry DeletedEntry Asset DeletedAsset].include?(item[&#39;sys&#39;][&#39;type&#39;])</code> </li> - <li class="covered" data-hits="153" data-linenumber="108"> - <span class="hits">153</span> + <li class="covered" data-hits="62" data-linenumber="110"> + <span class="hits">62</span> <code class="ruby"> resource_mapping[item[&#39;sys&#39;][&#39;type&#39;]]</code> </li> - <li class="never" data-hits="" data-linenumber="109"> + <li class="never" data-hits="" data-linenumber="111"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="110"> + <li class="never" data-hits="" data-linenumber="112"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="111"> + <li class="covered" data-hits="1" data-linenumber="113"> <span class="hits">1</span> <code class="ruby"> def fetch_custom_resource_class(item)</code> </li> - <li class="covered" data-hits="3289" data-linenumber="112"> - <span class="hits">3289</span> + <li class="covered" data-hits="67" data-linenumber="114"> + <span class="hits">67</span> <code class="ruby"> case item[&#39;sys&#39;][&#39;type&#39;]</code> </li> - <li class="never" data-hits="" data-linenumber="113"> + <li class="never" data-hits="" data-linenumber="115"> <code class="ruby"> when &#39;Entry&#39;</code> </li> - <li class="covered" data-hits="1723" data-linenumber="114"> - <span class="hits">1723</span> + <li class="covered" data-hits="35" data-linenumber="116"> + <span class="hits">35</span> <code class="ruby"> resource_class = entry_mapping[item[&#39;sys&#39;][&#39;contentType&#39;][&#39;sys&#39;][&#39;id&#39;]]</code> </li> - <li class="covered" data-hits="1723" data-linenumber="115"> - <span class="hits">1723</span> + <li class="covered" data-hits="35" data-linenumber="117"> + <span class="hits">35</span> <code class="ruby"> return resource_class unless resource_class.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="116"> + <li class="never" data-hits="" data-linenumber="118"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1700" data-linenumber="117"> - <span class="hits">1700</span> + <li class="covered" data-hits="33" data-linenumber="119"> + <span class="hits">33</span> <code class="ruby"> fetch_custom_resource_mapping(item, &#39;Entry&#39;, Entry)</code> </li> - <li class="never" data-hits="" data-linenumber="118"> + <li class="never" data-hits="" data-linenumber="120"> <code class="ruby"> when &#39;Asset&#39;</code> </li> - <li class="covered" data-hits="1524" data-linenumber="119"> - <span class="hits">1524</span> + <li class="covered" data-hits="32" data-linenumber="121"> + <span class="hits">32</span> <code class="ruby"> fetch_custom_resource_mapping(item, &#39;Asset&#39;, Asset)</code> </li> - <li class="never" data-hits="" data-linenumber="120"> + <li class="never" data-hits="" data-linenumber="122"> <code class="ruby"> when &#39;DeletedEntry&#39;</code> </li> - <li class="covered" data-hits="6" data-linenumber="121"> - <span class="hits">6</span> + <li class="missed" data-hits="0" data-linenumber="123"> + <code class="ruby"> fetch_custom_resource_mapping(item, &#39;DeletedEntry&#39;, DeletedEntry)</code> </li> - <li class="never" data-hits="" data-linenumber="122"> + <li class="never" data-hits="" data-linenumber="124"> <code class="ruby"> when &#39;DeletedAsset&#39;</code> </li> - <li class="covered" data-hits="36" data-linenumber="123"> - <span class="hits">36</span> + <li class="missed" data-hits="0" data-linenumber="125"> + <code class="ruby"> fetch_custom_resource_mapping(item, &#39;DeletedAsset&#39;, DeletedAsset)</code> </li> - <li class="never" data-hits="" data-linenumber="124"> + <li class="never" data-hits="" data-linenumber="126"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="125"> + <li class="never" data-hits="" data-linenumber="127"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="126"> + <li class="never" data-hits="" data-linenumber="128"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="127"> + <li class="covered" data-hits="1" data-linenumber="129"> <span class="hits">1</span> <code class="ruby"> def fetch_custom_resource_mapping(item, type, default_class)</code> </li> - <li class="covered" data-hits="3266" data-linenumber="128"> - <span class="hits">3266</span> + <li class="covered" data-hits="65" data-linenumber="130"> + <span class="hits">65</span> <code class="ruby"> resources = resource_mapping[type]</code> </li> - <li class="covered" data-hits="3266" data-linenumber="129"> - <span class="hits">3266</span> + <li class="covered" data-hits="65" data-linenumber="131"> + <span class="hits">65</span> <code class="ruby"> return default_class if resources.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="130"> + <li class="never" data-hits="" data-linenumber="132"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3266" data-linenumber="131"> - <span class="hits">3266</span> + <li class="covered" data-hits="65" data-linenumber="133"> + <span class="hits">65</span> <code class="ruby"> return resources if resources.is_a?(Class)</code> </li> - <li class="missed" data-hits="0" data-linenumber="132"> + <li class="missed" data-hits="0" data-linenumber="134"> <code class="ruby"> return resources[item] if resources.respond_to?(:call)</code> </li> - <li class="never" data-hits="" data-linenumber="133"> + <li class="never" data-hits="" data-linenumber="135"> <code class="ruby"></code> </li> - <li class="missed" data-hits="0" data-linenumber="134"> + <li class="missed" data-hits="0" data-linenumber="136"> <code class="ruby"> default_class</code> </li> - <li class="never" data-hits="" data-linenumber="135"> + <li class="never" data-hits="" data-linenumber="137"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="136"> + <li class="never" data-hits="" data-linenumber="138"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="137"> + <li class="covered" data-hits="1" data-linenumber="139"> <span class="hits">1</span> <code class="ruby"> def fetch_array_class</code> </li> - <li class="covered" data-hits="174" data-linenumber="138"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="140"> + <span class="hits">22</span> <code class="ruby"> return SyncPage if sync?</code> </li> - <li class="covered" data-hits="130" data-linenumber="139"> - <span class="hits">130</span> + <li class="covered" data-hits="22" data-linenumber="141"> + <span class="hits">22</span> <code class="ruby"> ::Contentful::Array</code> </li> - <li class="never" data-hits="" data-linenumber="140"> + <li class="never" data-hits="" data-linenumber="142"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="141"> + <li class="never" data-hits="" data-linenumber="143"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="142"> + <li class="covered" data-hits="1" data-linenumber="144"> <span class="hits">1</span> <code class="ruby"> def localized?</code> </li> - <li class="covered" data-hits="3440" data-linenumber="143"> - <span class="hits">3440</span> + <li class="covered" data-hits="129" data-linenumber="145"> + <span class="hits">129</span> <code class="ruby"> return true if @localized</code> </li> - <li class="covered" data-hits="2104" data-linenumber="144"> - <span class="hits">2104</span> + <li class="covered" data-hits="129" data-linenumber="146"> + <span class="hits">129</span> <code class="ruby"> return true if array? &amp;&amp; sync?</code> </li> - <li class="covered" data-hits="1836" data-linenumber="145"> - <span class="hits">1836</span> + <li class="covered" data-hits="129" data-linenumber="147"> + <span class="hits">129</span> <code class="ruby"> false</code> </li> - <li class="never" data-hits="" data-linenumber="146"> + <li class="never" data-hits="" data-linenumber="148"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="147"> + <li class="never" data-hits="" data-linenumber="149"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="148"> + <li class="covered" data-hits="1" data-linenumber="150"> <span class="hits">1</span> <code class="ruby"> def array?</code> </li> - <li class="covered" data-hits="5241" data-linenumber="149"> - <span class="hits">5241</span> + <li class="covered" data-hits="224" data-linenumber="151"> + <span class="hits">224</span> <code class="ruby"> json.fetch(&#39;sys&#39;, {}).fetch(&#39;type&#39;, &#39;&#39;) == &#39;Array&#39;</code> </li> - <li class="never" data-hits="" data-linenumber="150"> + <li class="never" data-hits="" data-linenumber="152"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="151"> + <li class="never" data-hits="" data-linenumber="153"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="152"> + <li class="covered" data-hits="1" data-linenumber="154"> <span class="hits">1</span> <code class="ruby"> def sync?</code> </li> - <li class="covered" data-hits="648" data-linenumber="153"> - <span class="hits">648</span> + <li class="covered" data-hits="78" data-linenumber="155"> + <span class="hits">78</span> <code class="ruby"> json.fetch(&#39;nextSyncUrl&#39;, nil) || json.fetch(&#39;nextPageUrl&#39;, nil)</code> </li> - <li class="never" data-hits="" data-linenumber="154"> + <li class="never" data-hits="" data-linenumber="156"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="155"> + <li class="never" data-hits="" data-linenumber="157"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="156"> + <li class="never" data-hits="" data-linenumber="158"> <code class="ruby"> # The default mapping for #detect_resource_class</code> </li> - <li class="covered" data-hits="1" data-linenumber="157"> + <li class="covered" data-hits="1" data-linenumber="159"> <span class="hits">1</span> <code class="ruby"> def default_resource_mapping</code> </li> - <li class="covered" data-hits="3137" data-linenumber="158"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="160"> + <span class="hits">95</span> <code class="ruby"> DEFAULT_RESOURCE_MAPPING</code> </li> - <li class="never" data-hits="" data-linenumber="159"> + <li class="never" data-hits="" data-linenumber="161"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="160"> + <li class="never" data-hits="" data-linenumber="162"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="161"> + <li class="never" data-hits="" data-linenumber="163"> <code class="ruby"> # The default entry mapping</code> </li> - <li class="covered" data-hits="1" data-linenumber="162"> + <li class="covered" data-hits="1" data-linenumber="164"> <span class="hits">1</span> <code class="ruby"> def default_entry_mapping</code> </li> - <li class="covered" data-hits="3137" data-linenumber="163"> - <span class="hits">3137</span> + <li class="covered" data-hits="95" data-linenumber="165"> + <span class="hits">95</span> <code class="ruby"> DEFAULT_ENTRY_MAPPING</code> </li> - <li class="never" data-hits="" data-linenumber="164"> + <li class="never" data-hits="" data-linenumber="166"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="165"> + <li class="never" data-hits="" data-linenumber="167"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="166"> + <li class="never" data-hits="" data-linenumber="168"> <code class="ruby">end</code> </li> @@ -12094,15 +11948,15 @@ <div class="source_table" id="e5da896cf0ec7b470de392efaedd4669444f03b9"> <div class="header"> <h3>lib/contentful/resource_references.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="red">50.0 %</span> covered</h4> <div> <b>6</b> relevant lines. - <span class="green"><b>6</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>3</b> lines covered</span> and + <span class="red"><b>3</b> lines missed.</span> </div> </div> <pre> <ol> @@ -12165,37 +12019,37 @@ <span class="hits">1</span> <code class="ruby"> def incoming_references(client = nil, query = {})</code> </li> - <li class="covered" data-hits="3" data-linenumber="11"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="11"> + <code class="ruby"> return false unless client</code> </li> <li class="never" data-hits="" data-linenumber="12"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3" data-linenumber="13"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="13"> + <code class="ruby"> query = is_a?(Contentful::Entry) ? query.merge(links_to_entry: id) : query.merge(links_to_asset: id)</code> </li> <li class="never" data-hits="" data-linenumber="14"> <code class="ruby"></code> </li> - <li class="covered" data-hits="3" data-linenumber="15"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="15"> + <code class="ruby"> client.entries(query)</code> </li> <li class="never" data-hits="" data-linenumber="16"> @@ -12221,15 +12075,15 @@ <div class="source_table" id="a54a8ab8e00230a5d92a5eb8a7e43f264a700db2"> <div class="header"> <h3>lib/contentful/response.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="red">60.0 %</span> covered</h4> <div> <b>55</b> relevant lines. - <span class="green"><b>55</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>33</b> lines covered</span> and + <span class="red"><b>22</b> lines missed.</span> </div> </div> <pre> <ol> @@ -12388,91 +12242,91 @@ <span class="hits">1</span> <code class="ruby"> def initialize(raw, request = nil)</code> </li> - <li class="covered" data-hits="285" data-linenumber="27"> - <span class="hits">285</span> + <li class="covered" data-hits="32" data-linenumber="27"> + <span class="hits">32</span> <code class="ruby"> @raw = raw</code> </li> - <li class="covered" data-hits="285" data-linenumber="28"> - <span class="hits">285</span> + <li class="covered" data-hits="32" data-linenumber="28"> + <span class="hits">32</span> <code class="ruby"> @request = request</code> </li> - <li class="covered" data-hits="285" data-linenumber="29"> - <span class="hits">285</span> + <li class="covered" data-hits="32" data-linenumber="29"> + <span class="hits">32</span> <code class="ruby"> @status = :ok</code> </li> <li class="never" data-hits="" data-linenumber="30"> <code class="ruby"></code> </li> - <li class="covered" data-hits="285" data-linenumber="31"> - <span class="hits">285</span> + <li class="covered" data-hits="32" data-linenumber="31"> + <span class="hits">32</span> <code class="ruby"> if valid_http_response?</code> </li> - <li class="covered" data-hits="248" data-linenumber="32"> - <span class="hits">248</span> + <li class="covered" data-hits="32" data-linenumber="32"> + <span class="hits">32</span> <code class="ruby"> parse_json!</code> </li> - <li class="covered" data-hits="37" data-linenumber="33"> - <span class="hits">37</span> + <li class="missed" data-hits="0" data-linenumber="33"> + <code class="ruby"> elsif no_content_response?</code> </li> - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="34"> + <code class="ruby"> @status = :no_content</code> </li> - <li class="covered" data-hits="36" data-linenumber="35"> - <span class="hits">36</span> + <li class="missed" data-hits="0" data-linenumber="35"> + <code class="ruby"> elsif invalid_response?</code> </li> - <li class="covered" data-hits="18" data-linenumber="36"> - <span class="hits">18</span> + <li class="missed" data-hits="0" data-linenumber="36"> + <code class="ruby"> parse_contentful_error</code> </li> - <li class="covered" data-hits="18" data-linenumber="37"> - <span class="hits">18</span> + <li class="missed" data-hits="0" data-linenumber="37"> + <code class="ruby"> elsif service_unavailable_response?</code> </li> - <li class="covered" data-hits="3" data-linenumber="38"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="38"> + <code class="ruby"> service_unavailable_error</code> </li> <li class="never" data-hits="" data-linenumber="39"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="15" data-linenumber="40"> - <span class="hits">15</span> + <li class="missed" data-hits="0" data-linenumber="40"> + <code class="ruby"> parse_http_error</code> </li> <li class="never" data-hits="" data-linenumber="41"> @@ -12502,12 +12356,12 @@ <span class="hits">1</span> <code class="ruby"> def load_json</code> </li> - <li class="covered" data-hits="331" data-linenumber="46"> - <span class="hits">331</span> + <li class="covered" data-hits="32" data-linenumber="46"> + <span class="hits">32</span> <code class="ruby"> MultiJson.load(unzip_response(raw))</code> </li> <li class="never" data-hits="" data-linenumber="47"> @@ -12538,13 +12392,13 @@ <span class="hits">1</span> <code class="ruby"> def error_object?</code> </li> - <li class="covered" data-hits="18" data-linenumber="52"> - <span class="hits">18</span> + <li class="missed" data-hits="0" data-linenumber="52"> + <code class="ruby"> object[&#39;sys&#39;][&#39;type&#39;] == &#39;Error&#39;</code> </li> <li class="never" data-hits="" data-linenumber="53"> @@ -12562,25 +12416,25 @@ <span class="hits">1</span> <code class="ruby"> def parse_contentful_error</code> </li> - <li class="covered" data-hits="18" data-linenumber="56"> - <span class="hits">18</span> + <li class="missed" data-hits="0" data-linenumber="56"> + <code class="ruby"> @object = load_json</code> </li> - <li class="covered" data-hits="18" data-linenumber="57"> - <span class="hits">18</span> + <li class="missed" data-hits="0" data-linenumber="57"> + <code class="ruby"> @error_message = object[&#39;message&#39;] if error_object?</code> </li> - <li class="covered" data-hits="18" data-linenumber="58"> - <span class="hits">18</span> + <li class="missed" data-hits="0" data-linenumber="58"> + <code class="ruby"> parse_http_error</code> </li> <li class="never" data-hits="" data-linenumber="59"> @@ -12598,12 +12452,12 @@ <span class="hits">1</span> <code class="ruby"> def valid_http_response?</code> </li> - <li class="covered" data-hits="285" data-linenumber="62"> - <span class="hits">285</span> + <li class="covered" data-hits="32" data-linenumber="62"> + <span class="hits">32</span> <code class="ruby"> [200, 201].include?(raw.status)</code> </li> <li class="never" data-hits="" data-linenumber="63"> @@ -12622,13 +12476,13 @@ <span class="hits">1</span> <code class="ruby"> def service_unavailable_response?</code> </li> - <li class="covered" data-hits="18" data-linenumber="66"> - <span class="hits">18</span> + <li class="missed" data-hits="0" data-linenumber="66"> + <code class="ruby"> @raw.status == 503</code> </li> <li class="never" data-hits="" data-linenumber="67"> @@ -12646,25 +12500,25 @@ <span class="hits">1</span> <code class="ruby"> def service_unavailable_error</code> </li> - <li class="covered" data-hits="3" data-linenumber="70"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="70"> + <code class="ruby"> @status = :error</code> </li> - <li class="covered" data-hits="3" data-linenumber="71"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="71"> + <code class="ruby"> @error_message = &#39;503 - Service Unavailable&#39;</code> </li> - <li class="covered" data-hits="3" data-linenumber="72"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="72"> + <code class="ruby"> @object = Error[@raw.status].new(self)</code> </li> <li class="never" data-hits="" data-linenumber="73"> @@ -12682,19 +12536,19 @@ <span class="hits">1</span> <code class="ruby"> def parse_http_error</code> </li> - <li class="covered" data-hits="33" data-linenumber="76"> - <span class="hits">33</span> + <li class="missed" data-hits="0" data-linenumber="76"> + <code class="ruby"> @status = :error</code> </li> - <li class="covered" data-hits="33" data-linenumber="77"> - <span class="hits">33</span> + <li class="missed" data-hits="0" data-linenumber="77"> + <code class="ruby"> @object = Error[raw.status].new(self)</code> </li> <li class="never" data-hits="" data-linenumber="78"> @@ -12712,13 +12566,13 @@ <span class="hits">1</span> <code class="ruby"> def invalid_response?</code> </li> - <li class="covered" data-hits="36" data-linenumber="81"> - <span class="hits">36</span> + <li class="missed" data-hits="0" data-linenumber="81"> + <code class="ruby"> [400, 404].include?(raw.status)</code> </li> <li class="never" data-hits="" data-linenumber="82"> @@ -12736,13 +12590,13 @@ <span class="hits">1</span> <code class="ruby"> def no_content_response?</code> </li> - <li class="covered" data-hits="37" data-linenumber="85"> - <span class="hits">37</span> + <li class="missed" data-hits="0" data-linenumber="85"> + <code class="ruby"> raw.to_s == &#39;&#39; &amp;&amp; raw.status == 204</code> </li> <li class="never" data-hits="" data-linenumber="86"> @@ -12760,37 +12614,37 @@ <span class="hits">1</span> <code class="ruby"> def parse_json!</code> </li> - <li class="covered" data-hits="248" data-linenumber="89"> - <span class="hits">248</span> + <li class="covered" data-hits="32" data-linenumber="89"> + <span class="hits">32</span> <code class="ruby"> @object = load_json</code> </li> <li class="never" data-hits="" data-linenumber="90"> <code class="ruby"> rescue MultiJson::LoadError =&gt; error</code> </li> - <li class="covered" data-hits="3" data-linenumber="91"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="91"> + <code class="ruby"> @error_message = error.message</code> </li> - <li class="covered" data-hits="3" data-linenumber="92"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="92"> + <code class="ruby"> @status = :error</code> </li> - <li class="covered" data-hits="3" data-linenumber="93"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="93"> + <code class="ruby"> UnparsableJson.new(self)</code> </li> <li class="never" data-hits="" data-linenumber="94"> @@ -12808,48 +12662,48 @@ <span class="hits">1</span> <code class="ruby"> def unzip_response(response)</code> </li> - <li class="covered" data-hits="331" data-linenumber="97"> - <span class="hits">331</span> + <li class="covered" data-hits="32" data-linenumber="97"> + <span class="hits">32</span> <code class="ruby"> parsed_response = response.to_s</code> </li> - <li class="covered" data-hits="331" data-linenumber="98"> - <span class="hits">331</span> + <li class="covered" data-hits="32" data-linenumber="98"> + <span class="hits">32</span> <code class="ruby"> if response.headers[&#39;Content-Encoding&#39;].eql?(&#39;gzip&#39;)</code> </li> - <li class="covered" data-hits="79" data-linenumber="99"> - <span class="hits">79</span> + <li class="covered" data-hits="10" data-linenumber="99"> + <span class="hits">10</span> <code class="ruby"> sio = StringIO.new(parsed_response)</code> </li> - <li class="covered" data-hits="79" data-linenumber="100"> - <span class="hits">79</span> + <li class="covered" data-hits="10" data-linenumber="100"> + <span class="hits">10</span> <code class="ruby"> gz = Zlib::GzipReader.new(sio)</code> </li> - <li class="covered" data-hits="79" data-linenumber="101"> - <span class="hits">79</span> + <li class="covered" data-hits="10" data-linenumber="101"> + <span class="hits">10</span> <code class="ruby"> gz.read</code> </li> <li class="never" data-hits="" data-linenumber="102"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="252" data-linenumber="103"> - <span class="hits">252</span> + <li class="covered" data-hits="22" data-linenumber="103"> + <span class="hits">22</span> <code class="ruby"> parsed_response</code> </li> <li class="never" data-hits="" data-linenumber="104"> @@ -12882,15 +12736,15 @@ <div class="source_table" id="42827798fb56cb87d145e81d9ae46dfe97e9818b"> <div class="header"> <h3>lib/contentful/space.rb</h3> - <h4><span class="yellow">83.33 %</span> covered</h4> + <h4><span class="red">58.33 %</span> covered</h4> <div> <b>12</b> relevant lines. - <span class="green"><b>10</b> lines covered</span> and - <span class="red"><b>2</b> lines missed.</span> + <span class="green"><b>7</b> lines covered</span> and + <span class="red"><b>5</b> lines missed.</span> </div> </div> <pre> <ol> @@ -12953,31 +12807,31 @@ <span class="hits">1</span> <code class="ruby"> def initialize(item, *)</code> </li> - <li class="covered" data-hits="9" data-linenumber="11"> - <span class="hits">9</span> + <li class="missed" data-hits="0" data-linenumber="11"> + <code class="ruby"> super</code> </li> <li class="never" data-hits="" data-linenumber="12"> <code class="ruby"></code> </li> - <li class="covered" data-hits="9" data-linenumber="13"> - <span class="hits">9</span> + <li class="missed" data-hits="0" data-linenumber="13"> + <code class="ruby"> @name = item.fetch(&#39;name&#39;, nil)</code> </li> - <li class="covered" data-hits="27" data-linenumber="14"> - <span class="hits">27</span> + <li class="missed" data-hits="0" data-linenumber="14"> + <code class="ruby"> @locales = item.fetch(&#39;locales&#39;, []).map { |locale| Locale.new(locale) }</code> </li> <li class="never" data-hits="" data-linenumber="15"> @@ -13134,24 +12988,24 @@ <span class="hits">1</span> <code class="ruby"> def snakify(object, skip = false)</code> </li> - <li class="covered" data-hits="109725" data-linenumber="14"> - <span class="hits">109725</span> + <li class="covered" data-hits="2472" data-linenumber="14"> + <span class="hits">2472</span> <code class="ruby"> return object if skip</code> </li> <li class="never" data-hits="" data-linenumber="15"> <code class="ruby"></code> </li> - <li class="covered" data-hits="107764" data-linenumber="16"> - <span class="hits">107764</span> + <li class="covered" data-hits="2472" data-linenumber="16"> + <span class="hits">2472</span> <code class="ruby"> String(object)</code> </li> <li class="never" data-hits="" data-linenumber="17"> @@ -13200,24 +13054,24 @@ <span class="hits">1</span> <code class="ruby"> def unresolvable?(value, errors)</code> </li> - <li class="covered" data-hits="6511" data-linenumber="25"> - <span class="hits">6511</span> + <li class="covered" data-hits="191" data-linenumber="25"> + <span class="hits">191</span> <code class="ruby"> return true if value.nil?</code> </li> <li class="never" data-hits="" data-linenumber="26"> <code class="ruby"></code> </li> - <li class="covered" data-hits="6890" data-linenumber="27"> - <span class="hits">6890</span> + <li class="covered" data-hits="196" data-linenumber="27"> + <span class="hits">196</span> <code class="ruby"> errors.any? { |i| i.fetch(&#39;details&#39;, {}).fetch(&#39;id&#39;, nil) == value[&#39;sys&#39;][&#39;id&#39;] }</code> </li> <li class="never" data-hits="" data-linenumber="28"> @@ -13266,12 +13120,12 @@ <span class="hits">1</span> <code class="ruby"> def link?(value)</code> </li> - <li class="covered" data-hits="13092" data-linenumber="36"> - <span class="hits">13092</span> + <li class="covered" data-hits="221" data-linenumber="36"> + <span class="hits">221</span> <code class="ruby"> value.is_a?(::Hash) &amp;&amp;</code> </li> <li class="never" data-hits="" data-linenumber="37"> @@ -13326,24 +13180,24 @@ <span class="hits">1</span> <code class="ruby"> def link_array?(value)</code> </li> - <li class="covered" data-hits="8552" data-linenumber="46"> - <span class="hits">8552</span> + <li class="covered" data-hits="134" data-linenumber="46"> + <span class="hits">134</span> <code class="ruby"> return link?(value[0]) if value.is_a?(::Array) &amp;&amp; !value.empty?</code> </li> <li class="never" data-hits="" data-linenumber="47"> <code class="ruby"></code> </li> - <li class="covered" data-hits="7015" data-linenumber="48"> - <span class="hits">7015</span> + <li class="covered" data-hits="103" data-linenumber="48"> + <span class="hits">103</span> <code class="ruby"> false</code> </li> <li class="never" data-hits="" data-linenumber="49"> @@ -13398,18 +13252,18 @@ <span class="hits">1</span> <code class="ruby"> def resource_for_link(link, includes)</code> </li> - <li class="covered" data-hits="2905" data-linenumber="58"> - <span class="hits">2905</span> + <li class="covered" data-hits="57" data-linenumber="58"> + <span class="hits">57</span> <code class="ruby"> includes.detect do |i|</code> </li> - <li class="covered" data-hits="17657" data-linenumber="59"> - <span class="hits">17657</span> + <li class="covered" data-hits="165" data-linenumber="59"> + <span class="hits">165</span> <code class="ruby"> i[&#39;sys&#39;][&#39;id&#39;] == link[&#39;sys&#39;][&#39;id&#39;] &amp;&amp;</code> </li> <li class="never" data-hits="" data-linenumber="60"> @@ -13476,18 +13330,18 @@ <span class="hits">1</span> <code class="ruby"> def includes_from_response(json, raw = true)</code> </li> - <li class="covered" data-hits="183" data-linenumber="71"> - <span class="hits">183</span> + <li class="covered" data-hits="31" data-linenumber="71"> + <span class="hits">31</span> <code class="ruby"> includes = if raw</code> </li> - <li class="covered" data-hits="174" data-linenumber="72"> - <span class="hits">174</span> + <li class="covered" data-hits="22" data-linenumber="72"> + <span class="hits">22</span> <code class="ruby"> json[&#39;items&#39;].dup</code> </li> <li class="never" data-hits="" data-linenumber="73"> @@ -13512,24 +13366,24 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="183" data-linenumber="77"> - <span class="hits">183</span> + <li class="covered" data-hits="31" data-linenumber="77"> + <span class="hits">31</span> <code class="ruby"> %w[Entry Asset].each do |type|</code> </li> - <li class="covered" data-hits="366" data-linenumber="78"> - <span class="hits">366</span> + <li class="covered" data-hits="62" data-linenumber="78"> + <span class="hits">62</span> <code class="ruby"> if json.fetch(&#39;includes&#39;, {}).key?(type)</code> </li> - <li class="covered" data-hits="110" data-linenumber="79"> - <span class="hits">110</span> + <li class="covered" data-hits="11" data-linenumber="79"> + <span class="hits">11</span> <code class="ruby"> includes.concat(json[&#39;includes&#39;].fetch(type, []))</code> </li> <li class="never" data-hits="" data-linenumber="80"> @@ -13548,12 +13402,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="183" data-linenumber="83"> - <span class="hits">183</span> + <li class="covered" data-hits="31" data-linenumber="83"> + <span class="hits">31</span> <code class="ruby"> includes</code> </li> <li class="never" data-hits="" data-linenumber="84"> @@ -13586,15 +13440,15 @@ <div class="source_table" id="84dd5a82215a9c45df06f943a5b88003a007c2e3"> <div class="header"> <h3>lib/contentful/sync.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="red">52.63 %</span> covered</h4> <div> <b>38</b> relevant lines. - <span class="green"><b>38</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>20</b> lines covered</span> and + <span class="red"><b>18</b> lines missed.</span> </div> </div> <pre> <ol> @@ -13669,24 +13523,24 @@ <span class="hits">1</span> <code class="ruby"> def initialize(client, options_or_url)</code> </li> - <li class="covered" data-hits="43" data-linenumber="13"> - <span class="hits">43</span> + <li class="covered" data-hits="1" data-linenumber="13"> + <span class="hits">1</span> <code class="ruby"> @client = client</code> </li> - <li class="covered" data-hits="43" data-linenumber="14"> - <span class="hits">43</span> + <li class="covered" data-hits="1" data-linenumber="14"> + <span class="hits">1</span> <code class="ruby"> @next_sync_url = nil</code> </li> - <li class="covered" data-hits="43" data-linenumber="15"> - <span class="hits">43</span> + <li class="covered" data-hits="1" data-linenumber="15"> + <span class="hits">1</span> <code class="ruby"> @first_page_options_or_url = options_or_url</code> </li> <li class="never" data-hits="" data-linenumber="16"> @@ -13735,43 +13589,43 @@ <span class="hits">1</span> <code class="ruby"> def each_page</code> </li> - <li class="covered" data-hits="2" data-linenumber="24"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="24"> + <code class="ruby"> page = first_page</code> </li> - <li class="covered" data-hits="2" data-linenumber="25"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="25"> + <code class="ruby"> yield page if block_given?</code> </li> <li class="never" data-hits="" data-linenumber="26"> <code class="ruby"></code> </li> - <li class="covered" data-hits="2" data-linenumber="27"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="27"> + <code class="ruby"> until completed?</code> </li> - <li class="covered" data-hits="2" data-linenumber="28"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="28"> + <code class="ruby"> page = page.next_page</code> </li> - <li class="covered" data-hits="2" data-linenumber="29"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="29"> + <code class="ruby"> yield page if block_given?</code> </li> <li class="never" data-hits="" data-linenumber="30"> @@ -13813,13 +13667,13 @@ <span class="hits">1</span> <code class="ruby"> def first_page</code> </li> - <li class="covered" data-hits="31" data-linenumber="37"> - <span class="hits">31</span> + <li class="missed" data-hits="0" data-linenumber="37"> + <code class="ruby"> get(@first_page_options_or_url)</code> </li> <li class="never" data-hits="" data-linenumber="38"> @@ -13861,13 +13715,13 @@ <code class="ruby"> # rubocop:disable Style/DoubleNegation</code> </li> - <li class="covered" data-hits="4" data-linenumber="45"> - <span class="hits">4</span> + <li class="missed" data-hits="0" data-linenumber="45"> + <code class="ruby"> !!next_sync_url</code> </li> <li class="never" data-hits="" data-linenumber="46"> @@ -13909,19 +13763,19 @@ <span class="hits">1</span> <code class="ruby"> def each_item(&amp;block)</code> </li> - <li class="covered" data-hits="1" data-linenumber="53"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="53"> + <code class="ruby"> each_page do |page|</code> </li> - <li class="covered" data-hits="2" data-linenumber="54"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="54"> + <code class="ruby"> page.each_item(&amp;block)</code> </li> <li class="never" data-hits="" data-linenumber="55"> @@ -13951,55 +13805,55 @@ <span class="hits">1</span> <code class="ruby"> def get(options_or_url)</code> </li> - <li class="covered" data-hits="47" data-linenumber="60"> - <span class="hits">47</span> + <li class="missed" data-hits="0" data-linenumber="60"> + <code class="ruby"> page = fetch_page(options_or_url)</code> </li> <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"></code> </li> - <li class="covered" data-hits="47" data-linenumber="62"> - <span class="hits">47</span> + <li class="missed" data-hits="0" data-linenumber="62"> + <code class="ruby"> return page if @client.configuration[:raw_mode]</code> </li> <li class="never" data-hits="" data-linenumber="63"> <code class="ruby"></code> </li> - <li class="covered" data-hits="44" data-linenumber="64"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="64"> + <code class="ruby"> link_page_to_sync! page</code> </li> - <li class="covered" data-hits="44" data-linenumber="65"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="65"> + <code class="ruby"> update_sync_state_from! page</code> </li> <li class="never" data-hits="" data-linenumber="66"> <code class="ruby"></code> </li> - <li class="covered" data-hits="44" data-linenumber="67"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="67"> + <code class="ruby"> page</code> </li> <li class="never" data-hits="" data-linenumber="68"> @@ -14029,19 +13883,19 @@ <span class="hits">1</span> <code class="ruby"> def fetch_page(options_or_url)</code> </li> - <li class="covered" data-hits="47" data-linenumber="73"> - <span class="hits">47</span> + <li class="missed" data-hits="0" data-linenumber="73"> + <code class="ruby"> return Request.new(@client, options_or_url).get if options_or_url.is_a? String</code> </li> - <li class="covered" data-hits="30" data-linenumber="74"> - <span class="hits">30</span> + <li class="missed" data-hits="0" data-linenumber="74"> + <code class="ruby"> Request.new(@client, @client.environment_url(&#39;/sync&#39;), options_or_url).get</code> </li> <li class="never" data-hits="" data-linenumber="75"> @@ -14059,13 +13913,13 @@ <span class="hits">1</span> <code class="ruby"> def link_page_to_sync!(page)</code> </li> - <li class="covered" data-hits="44" data-linenumber="78"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="78"> + <code class="ruby"> page.instance_variable_set :@sync, self</code> </li> <li class="never" data-hits="" data-linenumber="79"> @@ -14083,13 +13937,13 @@ <span class="hits">1</span> <code class="ruby"> def update_sync_state_from!(page)</code> </li> - <li class="covered" data-hits="44" data-linenumber="82"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="82"> + <code class="ruby"> @next_sync_url = page.next_sync_url</code> </li> <li class="never" data-hits="" data-linenumber="83"> @@ -14115,15 +13969,15 @@ <div class="source_table" id="99e7ff3ec5cef4c1f8a70725a19da05567b157fd"> <div class="header"> <h3>lib/contentful/sync_page.rb</h3> - <h4><span class="green">94.74 %</span> covered</h4> + <h4><span class="red">57.89 %</span> covered</h4> <div> <b>19</b> relevant lines. - <span class="green"><b>18</b> lines covered</span> and - <span class="red"><b>1</b> lines missed.</span> + <span class="green"><b>11</b> lines covered</span> and + <span class="red"><b>8</b> lines missed.</span> </div> </div> <pre> <ol> @@ -14210,37 +14064,37 @@ <code class="ruby"> }, *)</code> </li> - <li class="covered" data-hits="44" data-linenumber="15"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="15"> + <code class="ruby"> super(item, configuration, true)</code> </li> <li class="never" data-hits="" data-linenumber="16"> <code class="ruby"></code> </li> - <li class="covered" data-hits="44" data-linenumber="17"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="17"> + <code class="ruby"> @items = item.fetch(&#39;items&#39;, [])</code> </li> - <li class="covered" data-hits="44" data-linenumber="18"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="18"> + <code class="ruby"> @next_sync_url = item.fetch(&#39;nextSyncUrl&#39;, nil)</code> </li> - <li class="covered" data-hits="44" data-linenumber="19"> - <span class="hits">44</span> + <li class="missed" data-hits="0" data-linenumber="19"> + <code class="ruby"> @next_page_url = item.fetch(&#39;nextPageUrl&#39;, nil)</code> </li> <li class="never" data-hits="" data-linenumber="20"> @@ -14306,13 +14160,13 @@ <span class="hits">1</span> <code class="ruby"> def next_page</code> </li> - <li class="covered" data-hits="5" data-linenumber="31"> - <span class="hits">5</span> + <li class="missed" data-hits="0" data-linenumber="31"> + <code class="ruby"> sync.get(next_page_url) if next_page?</code> </li> <li class="never" data-hits="" data-linenumber="32"> @@ -14354,13 +14208,13 @@ <code class="ruby"> # rubocop:disable Style/DoubleNegation</code> </li> - <li class="covered" data-hits="7" data-linenumber="39"> - <span class="hits">7</span> + <li class="missed" data-hits="0" data-linenumber="39"> + <code class="ruby"> !!next_page_url</code> </li> <li class="never" data-hits="" data-linenumber="40"> @@ -14402,13 +14256,13 @@ <span class="hits">1</span> <code class="ruby"> def last_page?</code> </li> - <li class="covered" data-hits="2" data-linenumber="47"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="47"> + <code class="ruby"> !next_page_url</code> </li> <li class="never" data-hits="" data-linenumber="48"> @@ -14431,1272 +14285,10 @@ </ol> </pre> </div> - <div class="source_table" id="26151d16243d86e4a0f5aa143518973c5fc190f5"> - <div class="header"> - <h3>spec/asset_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>104</b> relevant lines. - <span class="green"><b>104</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Asset do</code> - </li> - - <li class="covered" data-hits="33" data-linenumber="4"> - <span class="hits">33</span> - - <code class="ruby"> let(:asset) { vcr(&#39;asset&#39;) { create_client.asset(&#39;nyancat&#39;) } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="5"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;SystemProperties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #sys getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.id).to eq &#39;nyancat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.type).to eq &#39;Asset&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #space&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.space).to be_a Contentful::Link</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #created_at&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.created_at).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #updated_at&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.updated_at).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #revision&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="33"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.revision).to eq 1</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="37"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="38"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #title&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="39"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.title).to eq &#39;Nyan Cat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="40"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="41"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;could have #description&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="43"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset).to respond_to :description</code> - </li> - - <li class="never" data-hits="" data-linenumber="44"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="45"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #file&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="47"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file).to be_a Contentful::File</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="50"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="51"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#image_url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="52"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns #url of #file without parameter&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="53"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.image_url).to eq asset.file.url</code> - </li> - - <li class="never" data-hits="" data-linenumber="54"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="55"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;adds image options if given&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="57"> - <span class="hits">1</span> - - <code class="ruby"> url = asset.image_url(width: 100, format: &#39;jpg&#39;, quality: 50, focus: &#39;top_right&#39;, fit: &#39;thumb&#39;, fl: &#39;progressive&#39;, background: &#39;rgb:ff0000&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="58"> - <span class="hits">1</span> - - <code class="ruby"> expect(url).to include asset.file.url</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="59"> - <span class="hits">1</span> - - <code class="ruby"> expect(url).to include &#39;?w=100&amp;fm=jpg&amp;q=50&amp;f=top_right&amp;bg=rgb%3Aff0000&amp;fit=thumb&amp;fl=progressive&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="60"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="61"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="62"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="63"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="64"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns #url of #file without parameter&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="65"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.url).to eq asset.file.url</code> - </li> - - <li class="never" data-hits="" data-linenumber="66"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="67"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="68"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;adds image options if given&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="69"> - <span class="hits">1</span> - - <code class="ruby"> url = asset.url(width: 100, format: &#39;jpg&#39;, quality: 50, focus: &#39;top_right&#39;, fit: &#39;thumb&#39;, fl: &#39;progressive&#39;, background: &#39;rgb:ff0000&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="70"> - <span class="hits">1</span> - - <code class="ruby"> expect(url).to include asset.file.url</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="71"> - <span class="hits">1</span> - - <code class="ruby"> expect(url).to include &#39;?w=100&amp;fm=jpg&amp;q=50&amp;f=top_right&amp;bg=rgb%3Aff0000&amp;fit=thumb&amp;fl=progressive&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="72"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="73"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="74"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="75"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can be marshalled&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="76"> - <span class="hits">1</span> - - <code class="ruby"> marshalled = Marshal.dump(asset)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="77"> - <span class="hits">1</span> - - <code class="ruby"> unmarshalled = Marshal.load(marshalled)</code> - </li> - - <li class="never" data-hits="" data-linenumber="78"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="79"> - <span class="hits">1</span> - - <code class="ruby"> expect(unmarshalled.title).to eq &#39;Nyan Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="80"> - <span class="hits">1</span> - - <code class="ruby"> expect(unmarshalled.file).to be_a Contentful::File</code> - </li> - - <li class="never" data-hits="" data-linenumber="81"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="82"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="83"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="84"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;incoming links&#39; do</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="85"> - <span class="hits">3</span> - - <code class="ruby"> let(:client) { create_client }</code> - </li> - - <li class="never" data-hits="" data-linenumber="86"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="87"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will fetch entries referencing the asset using a query&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="88"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/search_link_to_asset&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="89"> - <span class="hits">1</span> - - <code class="ruby"> entries = client.entries(links_to_asset: &#39;nyancat&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="90"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries).not_to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="91"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.count).to eq 1</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="92"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.first.id).to eq &#39;nyancat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="93"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="94"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="95"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="96"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will fetch entries referencing the entry using instance method&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="97"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/search_link_to_asset&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="98"> - <span class="hits">1</span> - - <code class="ruby"> entries = asset.incoming_references client</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="99"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries).not_to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="100"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.count).to eq 1</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="101"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.first.id).to eq &#39;nyancat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="102"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="103"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="104"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="105"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="106"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="107"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;select operator&#39; do</code> - </li> - - <li class="covered" data-hits="5" data-linenumber="108"> - <span class="hits">5</span> - - <code class="ruby"> let(:client) { create_client }</code> - </li> - - <li class="never" data-hits="" data-linenumber="109"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="110"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;with sys sent&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="111"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;properly creates an entry&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="112"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;asset/select_only_sys&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="113"> - <span class="hits">1</span> - - <code class="ruby"> asset = client.assets(select: [&#39;sys&#39;]).first</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="114"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.fields).to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="115"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.sys).not_to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="116"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="117"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="118"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="119"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can contain only one field&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="120"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;asset/select_one_field&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="121"> - <span class="hits">1</span> - - <code class="ruby"> asset = client.assets(select: [&#39;sys&#39;, &#39;fields.file&#39;]).first</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="122"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.fields.keys).to eq([:file])</code> - </li> - - <li class="never" data-hits="" data-linenumber="123"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="124"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="125"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="126"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="127"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;without sys sent&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="128"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will enforce sys anyway&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="129"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;asset/select_no_sys&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="130"> - <span class="hits">1</span> - - <code class="ruby"> asset = client.assets(select: [&#39;fields&#39;], &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="131"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="132"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.id).to eq &#39;nyancat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="133"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.sys).not_to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="134"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="135"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="136"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="137"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;works with empty array as well, as sys is enforced&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="138"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;asset/select_empty_array&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="139"> - <span class="hits">1</span> - - <code class="ruby"> asset = client.assets(select: [], &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="140"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="141"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.id).to eq &#39;nyancat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="142"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.sys).not_to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="143"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="144"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="145"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="146"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="147"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="148"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;issues&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="149"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;serializes files correctly for every locale - #129&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="150"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;assets/issues_129&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="151"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="152"> - - - <code class="ruby"> space: &#39;bht13amj0fva&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="153"> - - - <code class="ruby"> access_token: &#39;bb703a05e107148bed6ee246a9f6b3678c63fed7335632eb68fe1b689c801534&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="154"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="155"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="156"> - <span class="hits">1</span> - - <code class="ruby"> asset = client.assets(&#39;sys.id&#39; =&gt; &#39;14bZJKTr6AoaGyeg4kYiWq&#39;, locale: &#39;*&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="157"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="158"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file).to be_a ::Contentful::File</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="159"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.file_name).to eq &#39;Flag_of_the_United_States.svg&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="160"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="161"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.fields[:file]).to be_a ::Contentful::File</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="162"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.fields[:file].file_name).to eq &#39;Flag_of_the_United_States.svg&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="163"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="164"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.fields(&#39;es&#39;)[:file]).to be_a ::Contentful::File</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="165"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.fields(&#39;es&#39;)[:file].file_name).to eq &#39;Flag_of_Spain.svg&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="166"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="167"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="168"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="169"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;properly serializes files for non-default locales on localized requests - jekyll-contentful-data-import #46&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="170"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;assets/issues_jekyll_46&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="171"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="172"> - - - <code class="ruby"> space: &#39;bht13amj0fva&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="173"> - - - <code class="ruby"> access_token: &#39;bb703a05e107148bed6ee246a9f6b3678c63fed7335632eb68fe1b689c801534&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="174"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="175"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="176"> - <span class="hits">1</span> - - <code class="ruby"> asset = client.assets(&#39;sys.id&#39; =&gt; &#39;14bZJKTr6AoaGyeg4kYiWq&#39;, locale: &#39;es&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="177"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="178"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file).to be_a ::Contentful::File</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="179"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.file_name).to eq &#39;Flag_of_Spain.svg&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="180"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="181"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="182"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="183"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="184"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;camelCase&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="185"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;properties now are accessed with camelcase&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="186"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;asset&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="187"> - <span class="hits">1</span> - - <code class="ruby"> asset = create_client(use_camel_case: true).asset(&#39;nyancat&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="188"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.fileName).to eq &#39;Nyan_cat_250px_frame.png&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="189"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="190"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="191"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="192"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="f95dca85be477fbdc528fdb56a7e036b592793bf"> - <div class="header"> - <h3>spec/auto_includes_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>7</b> relevant lines. - <span class="green"><b>7</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe &#39;Auto-include resources&#39; do</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="4"> - <span class="hits">3</span> - - <code class="ruby"> let(:entries) { vcr(&#39;entries&#39;) { create_client.entries } } # entries come with asset includes</code> - </li> - - <li class="never" data-hits="" data-linenumber="5"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;replaces Contentful::Links which are actually included with the resource&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> asset = entries.items[1].fields[:image]</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset).not_to be_a Contentful::Link</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset).to be_a Contentful::Asset</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - <div class="source_table" id="a5b449a98635efa082944faacae851b1dab9ab8c"> <div class="header"> <h3>spec/client_class_spec.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> @@ -15890,11 +14482,11 @@ </li> <li class="covered" data-hits="1" data-linenumber="31"> <span class="hits">1</span> - <code class="ruby"> expect(request).to receive(:query).twice.and_call_original</code> + <code class="ruby"> expect(request).to receive(:query).thrice.and_call_original</code> </li> <li class="covered" data-hits="2" data-linenumber="32"> <span class="hits">2</span> @@ -16228,12878 +14820,10 @@ </ol> </pre> </div> - <div class="source_table" id="d051f37597cb573fb8f2516b5cdf4009ca5c4e80"> - <div class="header"> - <h3>spec/client_configuration_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>165</b> relevant lines. - <span class="green"><b>165</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe &#39;Client Configuration Options&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:space&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="5"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;is required&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> expect do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> Contentful::Client.new(access_token: &#39;b4c0n73n7fu1&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"> end.to raise_error(ArgumentError)</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:access_token&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;is required&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - - <code class="ruby"> expect do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> Contentful::Client.new(space: &#39;cfexampleapi&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="16"> - - - <code class="ruby"> end.to raise_error(ArgumentError)</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:secure&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will use https [default]&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"> create_client.base_url</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"> ).to start_with &#39;https://&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="25"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will use http when secure set to false&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"> create_client(secure: false).base_url</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> ).to start_with &#39;http://&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="32"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:raise_errors&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="35"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will raise response errors if set to true [default]&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="36"> - <span class="hits">1</span> - - <code class="ruby"> expect_vcr(&#39;not found&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="37"> - <span class="hits">1</span> - - <code class="ruby"> create_client.content_type &#39;not found&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby"> end.to raise_error Contentful::NotFound</code> - </li> - - <li class="never" data-hits="" data-linenumber="39"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="40"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will not raise response errors if set to false&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> res = nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="43"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="44"> - <span class="hits">1</span> - - <code class="ruby"> expect_vcr(&#39;not found&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> res = create_client(raise_errors: false).content_type &#39;not found&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="46"> - - - <code class="ruby"> end.not_to raise_error</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="47"> - <span class="hits">1</span> - - <code class="ruby"> expect(res).to be_instance_of Contentful::NotFound</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="50"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="51"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:dynamic_entries&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="52"> - <span class="hits">1</span> - - <code class="ruby"> before :each do</code> - </li> - - <li class="covered" data-hits="6" data-linenumber="53"> - <span class="hits">6</span> - - <code class="ruby"> Contentful::ContentTypeCache.clear!</code> - </li> - - <li class="never" data-hits="" data-linenumber="54"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="55"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will create dynamic entries if dynamic_entry_cache is not empty&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="57"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(dynamic_entries: :manual)</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="58"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;entry_cache&#39;) { client.update_dynamic_entry_cache! }</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="59"> - <span class="hits">2</span> - - <code class="ruby"> entry = vcr(&#39;nyancat&#39;) { client.entry(&#39;nyancat&#39;) }</code> - </li> - - <li class="never" data-hits="" data-linenumber="60"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="61"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry).to be_a Contentful::Entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="62"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="63"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="64"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;:auto&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="65"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will call update dynamic_entry_cache on start-up&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="66"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry_cache&#39;) do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="67"> - <span class="hits">1</span> - - <code class="ruby"> create_client(dynamic_entries: :auto)</code> - </li> - - <li class="never" data-hits="" data-linenumber="68"> - - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="69"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::ContentTypeCache.cache).not_to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="70"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="71"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="72"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="73"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;:manual&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="74"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will not call #update_dynamic_entry_cache! on start-up&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="75"> - <span class="hits">1</span> - - <code class="ruby"> create_client(dynamic_entries: :manual)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="76"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::ContentTypeCache.cache).to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="77"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="78"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="79"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="80"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#update_dynamic_entry_cache!&#39; do</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="81"> - <span class="hits">3</span> - - <code class="ruby"> let(:client) { create_client(dynamic_entries: :manual) }</code> - </li> - - <li class="never" data-hits="" data-linenumber="82"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="83"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will fetch all content_types&#39; do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="84"> - <span class="hits">2</span> - - <code class="ruby"> expect(client).to receive(:content_types).with(limit: 1000) { {} }</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="85"> - <span class="hits">1</span> - - <code class="ruby"> client.update_dynamic_entry_cache!</code> - </li> - - <li class="never" data-hits="" data-linenumber="86"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="87"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="88"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will save dynamic entries in @dynamic_entry_cache&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="89"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry_cache&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="90"> - <span class="hits">1</span> - - <code class="ruby"> client.update_dynamic_entry_cache!</code> - </li> - - <li class="never" data-hits="" data-linenumber="91"> - - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="92"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::ContentTypeCache.cache).not_to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="93"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="94"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="95"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="96"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#register_dynamic_entry&#39; do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="97"> - <span class="hits">2</span> - - <code class="ruby"> let(:client) { create_client(dynamic_entries: :manual) }</code> - </li> - - <li class="never" data-hits="" data-linenumber="98"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="99"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can be used to register a dynamic entry manually&#39; do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="100"> - <span class="hits">2</span> - - <code class="ruby"> cat = vcr(&#39;content_type&#39;) { client.content_type &#39;cat&#39; }</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="101"> - <span class="hits">1</span> - - <code class="ruby"> client.register_dynamic_entry &#39;cat&#39;, cat</code> - </li> - - <li class="never" data-hits="" data-linenumber="102"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="103"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::ContentTypeCache.cache).not_to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="104"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="105"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="106"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="107"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="108"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:api_url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="109"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;is &quot;cdn.contentful.com&quot; [default]&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="110"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="111"> - - - <code class="ruby"> create_client.configuration[:api_url]</code> - </li> - - <li class="never" data-hits="" data-linenumber="112"> - - - <code class="ruby"> ).to eq &#39;cdn.contentful.com&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="113"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="114"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="115"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will be used as base url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="116"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="117"> - - - <code class="ruby"> create_client(api_url: &#39;cdn2.contentful.com&#39;).base_url</code> - </li> - - <li class="never" data-hits="" data-linenumber="118"> - - - <code class="ruby"> ).to start_with &#39;https://cdn2.contentful.com&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="119"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="120"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="121"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="122"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:api_version&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="123"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;is 1 [default]&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="124"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="125"> - - - <code class="ruby"> create_client.configuration[:api_version]</code> - </li> - - <li class="never" data-hits="" data-linenumber="126"> - - - <code class="ruby"> ).to eq 1</code> - </li> - - <li class="never" data-hits="" data-linenumber="127"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="128"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="129"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will used for the http content type request header&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="130"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="131"> - - - <code class="ruby"> create_client(api_version: 2).request_headers[&#39;Content-Type&#39;]</code> - </li> - - <li class="never" data-hits="" data-linenumber="132"> - - - <code class="ruby"> ).to eq &#39;application/vnd.contentful.delivery.v2+json&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="133"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="134"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="135"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="136"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:authentication_mechanism&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="137"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:header [default]&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="138"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will add the :access_token as authorization bearer token request header&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="139"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="140"> - - - <code class="ruby"> create_client.request_headers[&#39;Authorization&#39;]</code> - </li> - - <li class="never" data-hits="" data-linenumber="141"> - - - <code class="ruby"> ).to eq &#39;Bearer b4c0n73n7fu1&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="142"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="143"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="144"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will not add :access_token to query&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="145"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="146"> - - - <code class="ruby"> create_client.request_query({})[&#39;access_token&#39;]</code> - </li> - - <li class="never" data-hits="" data-linenumber="147"> - - - <code class="ruby"> ).to be_nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="148"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="149"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="150"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="151"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:query_string&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="152"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will add the :access_token to query&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="153"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="154"> - - - <code class="ruby"> create_client(authentication_mechanism: :query_string).</code> - </li> - - <li class="never" data-hits="" data-linenumber="155"> - - - <code class="ruby"> request_query({})[&#39;access_token&#39;]</code> - </li> - - <li class="never" data-hits="" data-linenumber="156"> - - - <code class="ruby"> ).to eq &#39;b4c0n73n7fu1&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="157"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="158"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="159"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will not add the :access_token as authorization bearer token request header&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="160"> - <span class="hits">1</span> - - <code class="ruby"> expect(</code> - </li> - - <li class="never" data-hits="" data-linenumber="161"> - - - <code class="ruby"> create_client(authentication_mechanism: :query_string).</code> - </li> - - <li class="never" data-hits="" data-linenumber="162"> - - - <code class="ruby"> request_headers[&#39;Authorization&#39;]</code> - </li> - - <li class="never" data-hits="" data-linenumber="163"> - - - <code class="ruby"> ).to be_nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="164"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="165"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="166"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="167"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="168"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:resource_mapping&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="169"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;lets you register your own resource classes for certain response types&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="170"> - <span class="hits">1</span> - - <code class="ruby"> class MyBetterAsset &lt; Contentful::Asset</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="171"> - <span class="hits">1</span> - - <code class="ruby"> def https_image_url</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="172"> - <span class="hits">1</span> - - <code class="ruby"> image_url.sub %r{\A//}, &#39;https://&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="173"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="174"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="175"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="176"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="177"> - - - <code class="ruby"> resource_mapping: {</code> - </li> - - <li class="never" data-hits="" data-linenumber="178"> - - - <code class="ruby"> &#39;Asset&#39; =&gt; MyBetterAsset,</code> - </li> - - <li class="never" data-hits="" data-linenumber="179"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="180"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="181"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="2" data-linenumber="182"> - <span class="hits">2</span> - - <code class="ruby"> nyancat = vcr(&#39;asset&#39;) { client.asset &#39;nyancat&#39; }</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="183"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat).to be_a MyBetterAsset</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="184"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.https_image_url).to start_with &#39;https&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="185"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="186"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="187"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="188"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;:entry_mapping&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="189"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;lets you register your own entry classes for certain entry types&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="190"> - <span class="hits">1</span> - - <code class="ruby"> class Cat &lt; Contentful::Entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="191"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="192"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="193"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="194"> - - - <code class="ruby"> entry_mapping: {</code> - </li> - - <li class="never" data-hits="" data-linenumber="195"> - - - <code class="ruby"> &#39;cat&#39; =&gt; Cat</code> - </li> - - <li class="never" data-hits="" data-linenumber="196"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="197"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="198"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="2" data-linenumber="199"> - <span class="hits">2</span> - - <code class="ruby"> nyancat = vcr(&#39;entry&#39;) { client.entry &#39;nyancat&#39; }</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="200"> - <span class="hits">2</span> - - <code class="ruby"> finn = vcr(&#39;human&#39;) { client.entry &#39;finn&#39; }</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="201"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat).to be_a Cat</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="202"> - <span class="hits">1</span> - - <code class="ruby"> expect(finn).to be_a Contentful::Entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="203"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="204"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="205"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="206"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;X-Contentful-User-Agent headers&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="207"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;default values&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="208"> - - - <code class="ruby"> expected = [</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="209"> - <span class="hits">1</span> - - <code class="ruby"> &quot;sdk contentful.rb/#{Contentful::VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="210"> - - - <code class="ruby"> &quot;platform ruby/#{RUBY_VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="211"> - - - <code class="ruby"> ]</code> - </li> - - <li class="never" data-hits="" data-linenumber="212"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="213"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="214"> - <span class="hits">1</span> - - <code class="ruby"> expected.each do |h|</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="215"> - <span class="hits">2</span> - - <code class="ruby"> expect(client.contentful_user_agent).to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="216"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="217"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="218"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).to match(/os (Windows|macOS|Linux)(\/.*)?;/i)</code> - </li> - - <li class="never" data-hits="" data-linenumber="219"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="220"> - <span class="hits">1</span> - - <code class="ruby"> [&#39;integration&#39;, &#39;app&#39;].each do |h|</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="221"> - <span class="hits">2</span> - - <code class="ruby"> expect(client.contentful_user_agent).not_to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="222"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="223"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="224"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="225"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;with integration name only&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="226"> - - - <code class="ruby"> expected = [</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="227"> - <span class="hits">1</span> - - <code class="ruby"> &quot;sdk contentful.rb/#{Contentful::VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="228"> - - - <code class="ruby"> &quot;platform ruby/#{RUBY_VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="229"> - - - <code class="ruby"> &quot;integration foobar;&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="230"> - - - <code class="ruby"> ]</code> - </li> - - <li class="never" data-hits="" data-linenumber="231"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="232"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(integration_name: &#39;foobar&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="233"> - <span class="hits">1</span> - - <code class="ruby"> expected.each do |h|</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="234"> - <span class="hits">3</span> - - <code class="ruby"> expect(client.contentful_user_agent).to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="235"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="236"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="237"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).to match(/os (Windows|macOS|Linux)(\/.*)?;/i)</code> - </li> - - <li class="never" data-hits="" data-linenumber="238"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="239"> - <span class="hits">1</span> - - <code class="ruby"> [&#39;app&#39;].each do |h|</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="240"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).not_to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="241"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="242"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="243"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="244"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;with integration&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="245"> - - - <code class="ruby"> expected = [</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="246"> - <span class="hits">1</span> - - <code class="ruby"> &quot;sdk contentful.rb/#{Contentful::VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="247"> - - - <code class="ruby"> &quot;platform ruby/#{RUBY_VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="248"> - - - <code class="ruby"> &quot;integration foobar/0.1.0;&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="249"> - - - <code class="ruby"> ]</code> - </li> - - <li class="never" data-hits="" data-linenumber="250"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="251"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(integration_name: &#39;foobar&#39;, integration_version: &#39;0.1.0&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="252"> - <span class="hits">1</span> - - <code class="ruby"> expected.each do |h|</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="253"> - <span class="hits">3</span> - - <code class="ruby"> expect(client.contentful_user_agent).to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="254"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="255"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="256"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).to match(/os (Windows|macOS|Linux)(\/.*)?;/i)</code> - </li> - - <li class="never" data-hits="" data-linenumber="257"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="258"> - <span class="hits">1</span> - - <code class="ruby"> [&#39;app&#39;].each do |h|</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="259"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).not_to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="260"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="261"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="262"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="263"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;with application name only&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="264"> - - - <code class="ruby"> expected = [</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="265"> - <span class="hits">1</span> - - <code class="ruby"> &quot;sdk contentful.rb/#{Contentful::VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="266"> - - - <code class="ruby"> &quot;platform ruby/#{RUBY_VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="267"> - - - <code class="ruby"> &quot;app fooapp;&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="268"> - - - <code class="ruby"> ]</code> - </li> - - <li class="never" data-hits="" data-linenumber="269"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="270"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(application_name: &#39;fooapp&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="271"> - <span class="hits">1</span> - - <code class="ruby"> expected.each do |h|</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="272"> - <span class="hits">3</span> - - <code class="ruby"> expect(client.contentful_user_agent).to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="273"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="274"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="275"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).to match(/os (Windows|macOS|Linux)(\/.*)?;/i)</code> - </li> - - <li class="never" data-hits="" data-linenumber="276"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="277"> - <span class="hits">1</span> - - <code class="ruby"> [&#39;integration&#39;].each do |h|</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="278"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).not_to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="279"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="280"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="281"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="282"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;with application&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="283"> - - - <code class="ruby"> expected = [</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="284"> - <span class="hits">1</span> - - <code class="ruby"> &quot;sdk contentful.rb/#{Contentful::VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="285"> - - - <code class="ruby"> &quot;platform ruby/#{RUBY_VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="286"> - - - <code class="ruby"> &quot;app fooapp/1.0.0;&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="287"> - - - <code class="ruby"> ]</code> - </li> - - <li class="never" data-hits="" data-linenumber="288"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="289"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(application_name: &#39;fooapp&#39;, application_version: &#39;1.0.0&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="290"> - <span class="hits">1</span> - - <code class="ruby"> expected.each do |h|</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="291"> - <span class="hits">3</span> - - <code class="ruby"> expect(client.contentful_user_agent).to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="292"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="293"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="294"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).to match(/os (Windows|macOS|Linux)(\/.*)?;/i)</code> - </li> - - <li class="never" data-hits="" data-linenumber="295"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="296"> - <span class="hits">1</span> - - <code class="ruby"> [&#39;integration&#39;].each do |h|</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="297"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).not_to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="298"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="299"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="300"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="301"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;with all&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="302"> - - - <code class="ruby"> expected = [</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="303"> - <span class="hits">1</span> - - <code class="ruby"> &quot;sdk contentful.rb/#{Contentful::VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="304"> - - - <code class="ruby"> &quot;platform ruby/#{RUBY_VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="305"> - - - <code class="ruby"> &quot;integration foobar/0.1.0;&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="306"> - - - <code class="ruby"> &quot;app fooapp/1.0.0;&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="307"> - - - <code class="ruby"> ]</code> - </li> - - <li class="never" data-hits="" data-linenumber="308"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="309"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="310"> - - - <code class="ruby"> integration_name: &#39;foobar&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="311"> - - - <code class="ruby"> integration_version: &#39;0.1.0&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="312"> - - - <code class="ruby"> application_name: &#39;fooapp&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="313"> - - - <code class="ruby"> application_version: &#39;1.0.0&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="314"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="315"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="316"> - <span class="hits">1</span> - - <code class="ruby"> expected.each do |h|</code> - </li> - - <li class="covered" data-hits="4" data-linenumber="317"> - <span class="hits">4</span> - - <code class="ruby"> expect(client.contentful_user_agent).to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="318"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="319"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="320"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).to match(/os (Windows|macOS|Linux)(\/.*)?;/i)</code> - </li> - - <li class="never" data-hits="" data-linenumber="321"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="322"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="323"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;when only version numbers, skips header&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="324"> - - - <code class="ruby"> expected = [</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="325"> - <span class="hits">1</span> - - <code class="ruby"> &quot;sdk contentful.rb/#{Contentful::VERSION};&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="326"> - - - <code class="ruby"> &quot;platform ruby/#{RUBY_VERSION};&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="327"> - - - <code class="ruby"> ]</code> - </li> - - <li class="never" data-hits="" data-linenumber="328"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="329"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="330"> - - - <code class="ruby"> integration_version: &#39;0.1.0&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="331"> - - - <code class="ruby"> application_version: &#39;1.0.0&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="332"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="333"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="334"> - <span class="hits">1</span> - - <code class="ruby"> expected.each do |h|</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="335"> - <span class="hits">2</span> - - <code class="ruby"> expect(client.contentful_user_agent).to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="336"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="337"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="338"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.contentful_user_agent).to match(/os (Windows|macOS|Linux)(\/.*)?;/i)</code> - </li> - - <li class="never" data-hits="" data-linenumber="339"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="340"> - <span class="hits">1</span> - - <code class="ruby"> [&#39;integration&#39;, &#39;app&#39;].each do |h|</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="341"> - <span class="hits">2</span> - - <code class="ruby"> expect(client.contentful_user_agent).not_to include(h)</code> - </li> - - <li class="never" data-hits="" data-linenumber="342"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="343"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="344"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="345"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;headers include X-Contentful-User-Agent&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="346"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="347"> - <span class="hits">1</span> - - <code class="ruby"> expect(client.request_headers[&#39;X-Contentful-User-Agent&#39;]).to eq client.contentful_user_agent</code> - </li> - - <li class="never" data-hits="" data-linenumber="348"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="349"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="350"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="351"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;timeout options&#39; do</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="352"> - <span class="hits">3</span> - - <code class="ruby"> let(:full_options) { { timeout_connect: 1, timeout_read: 2, timeout_write: 3 } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="353"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="354"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;allows the three options to be present together&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="355"> - <span class="hits">1</span> - - <code class="ruby"> expect do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="356"> - <span class="hits">1</span> - - <code class="ruby"> create_client(full_options)</code> - </li> - - <li class="never" data-hits="" data-linenumber="357"> - - - <code class="ruby"> end.not_to raise_error</code> - </li> - - <li class="never" data-hits="" data-linenumber="358"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="359"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="360"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;allows the three options to be omitted&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="361"> - <span class="hits">1</span> - - <code class="ruby"> expect do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="362"> - <span class="hits">1</span> - - <code class="ruby"> create_client()</code> - </li> - - <li class="never" data-hits="" data-linenumber="363"> - - - <code class="ruby"> end.not_to raise_error</code> - </li> - - <li class="never" data-hits="" data-linenumber="364"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="365"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="366"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;does not allow only some options to be set&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="367"> - - - <code class="ruby"> # Test that any combination of 1 or 2 keys is rejected</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="368"> - <span class="hits">1</span> - - <code class="ruby"> 1.upto(2) do |options_count|</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="369"> - <span class="hits">2</span> - - <code class="ruby"> full_options.keys.combination(options_count).each do |option_keys|</code> - </li> - - <li class="covered" data-hits="6" data-linenumber="370"> - <span class="hits">6</span> - - <code class="ruby"> expect do</code> - </li> - - <li class="covered" data-hits="24" data-linenumber="371"> - <span class="hits">24</span> - - <code class="ruby"> create_client(full_options.select { |key, _| option_keys.include?(key) })</code> - </li> - - <li class="never" data-hits="" data-linenumber="372"> - - - <code class="ruby"> end.to raise_error(ArgumentError)</code> - </li> - - <li class="never" data-hits="" data-linenumber="373"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="374"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="375"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="376"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="377"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="a13ad32dd6d5c02d3772a4dd1d1e6e305b77003e"> - <div class="header"> - <h3>spec/content_type_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>26</b> relevant lines. - <span class="green"><b>26</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::ContentType do</code> - </li> - - <li class="covered" data-hits="15" data-linenumber="4"> - <span class="hits">15</span> - - <code class="ruby"> let(:content_type) { vcr(&#39;content_type&#39;) { create_client.content_type &#39;cat&#39; } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="5"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;SystemProperties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #sys getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.id).to eq &#39;cat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.type).to eq &#39;ContentType&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="20"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #name&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="23"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.name).to eq &#39;Cat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="25"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #description&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.description).to eq &#39;Meow.&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="28"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="30"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.fields).to be_a Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.fields.first).to be_a Contentful::Field</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="35"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;could have #display_field&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="36"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type).to respond_to :display_field</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="39"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="40"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;supports camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;content_type&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="43"> - <span class="hits">1</span> - - <code class="ruby"> content_type = create_client(use_camel_case: true).content_type &#39;cat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="44"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type.displayField).to eq &#39;name&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="46"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="47"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="4c609b9f8ef04e1d39a0e44d3e7df4e970ef32ed"> - <div class="header"> - <h3>spec/deleted_asset_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>20</b> relevant lines. - <span class="green"><b>20</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe &#39;DeletedAsset&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> - - <code class="ruby"> let(:deleted_asset)do</code> - </li> - - <li class="covered" data-hits="4" data-linenumber="5"> - <span class="hits">4</span> - - <code class="ruby"> vcr(&#39;sync_deleted_asset&#39;)do</code> - </li> - - <li class="covered" data-hits="4" data-linenumber="6"> - <span class="hits">4</span> - - <code class="ruby"> create_client.sync(initial: true, type: &#39;DeletedAsset&#39;).first_page.items[0]</code> - </li> - - <li class="never" data-hits="" data-linenumber="7"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;SystemProperties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #sys getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_asset.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_asset.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_asset.id).to eq &#39;5c6VY0gWg0gwaIeYkUUiqG&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_asset.type).to eq &#39;DeletedAsset&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #deleted_at&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_asset.created_at).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="28"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="30"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;supports camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;sync_deleted_asset&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> deleted_asset = create_client(use_camel_case: true).sync(initial: true, type: &#39;DeletedAsset&#39;).first_page.items[0]</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_asset.createdAt).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="363838f9765468206e180a5461c937dff2f2ee47"> - <div class="header"> - <h3>spec/deleted_entry_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>20</b> relevant lines. - <span class="green"><b>20</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe &#39;DeletedEntry&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> - - <code class="ruby"> let(:deleted_entry)do</code> - </li> - - <li class="covered" data-hits="4" data-linenumber="5"> - <span class="hits">4</span> - - <code class="ruby"> vcr(&#39;sync_deleted_entry&#39;)do</code> - </li> - - <li class="covered" data-hits="4" data-linenumber="6"> - <span class="hits">4</span> - - <code class="ruby"> create_client.sync(initial: true, type: &#39;DeletedEntry&#39;).first_page.items[0]</code> - </li> - - <li class="never" data-hits="" data-linenumber="7"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;SystemProperties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #sys getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_entry.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_entry.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_entry.id).to eq &#39;CVebBDcQsSsu6yKKIayy&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_entry.type).to eq &#39;DeletedEntry&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #deleted_at&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_entry.created_at).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="28"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="30"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;supports camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;sync_deleted_entry&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> deleted_entry = create_client(use_camel_case: true).sync(initial: true, type: &#39;DeletedEntry&#39;).first_page.items[0]</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> - - <code class="ruby"> expect(deleted_entry.createdAt).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="b9d994cc83de1652f7c9126b34ef4d10041b9da0"> - <div class="header"> - <h3>spec/entry_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>324</b> relevant lines. - <span class="green"><b>324</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Entry do</code> - </li> - - <li class="covered" data-hits="29" data-linenumber="4"> - <span class="hits">29</span> - - <code class="ruby"> let(:entry) { vcr(&#39;entry&#39;) { create_client.entry &#39;nyancat&#39; } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="5"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> let(:subclass) do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="7"> - <span class="hits">2</span> - - <code class="ruby"> Class.new(described_class) do</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"> # An overridden sys method:</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="9"> - <span class="hits">3</span> - - <code class="ruby"> def created_at; &#39;yesterday&#39;; end</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> # An overridden field method:</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="12"> - <span class="hits">3</span> - - <code class="ruby"> def best_friend; &#39;octocat&#39;; end</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="3" data-linenumber="16"> - <span class="hits">3</span> - - <code class="ruby"> let(:raw) { entry.raw }</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="17"> - <span class="hits">3</span> - - <code class="ruby"> let(:subclassed_entry) { subclass.new(raw, create_client.configuration) }</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;SystemProperties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #sys getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.id).to eq &#39;nyancat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="28"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="30"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.type).to eq &#39;Entry&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="32"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="33"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #space&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.space).to be_a Contentful::Link</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="37"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #content_type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="38"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.content_type).to be_a Contentful::Link</code> - </li> - - <li class="never" data-hits="" data-linenumber="39"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="40"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #created_at&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.created_at).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="43"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="44"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #updated_at&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.updated_at).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="47"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="49"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #revision&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="50"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.revision).to eq 5</code> - </li> - - <li class="never" data-hits="" data-linenumber="51"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="52"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="53"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;when subclassed&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="54"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;does not redefine existing methods&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="55"> - <span class="hits">1</span> - - <code class="ruby"> expect(subclassed_entry.created_at).to eq &#39;yesterday&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="56"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="57"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="58"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="59"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="60"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="61"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #fields getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="62"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="63"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="64"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="65"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="66"> - <span class="hits">1</span> - - <code class="ruby"> it &quot;contains the entry&#39;s fields&quot; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="67"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields[:color]).to eq &#39;rainbow&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="68"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields[:best_friend]).to be_a Contentful::Entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="69"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="70"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="71"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;when subclassed&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="72"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;does not redefine existing methods&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="73"> - <span class="hits">1</span> - - <code class="ruby"> expect(subclassed_entry.best_friend).to eq &#39;octocat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="74"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="75"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="76"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="77"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="78"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;multiple locales&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="79"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can handle multiple locales&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="80"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry_locales&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="81"> - <span class="hits">1</span> - - <code class="ruby"> nyancat = create_client.entries(locale: &quot;*&quot;, &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).items.first</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="82"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields(&#39;en-US&#39;)[:name]).to eq &quot;Nyan Cat&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="83"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields(&#39;tlh&#39;)[:name]).to eq &quot;Nyan vIghro&#39;&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="84"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="85"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="86"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields(:&#39;en-US&#39;)[:name]).to eq &quot;Nyan Cat&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="87"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields(:tlh)[:name]).to eq &quot;Nyan vIghro&#39;&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="88"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="89"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="90"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="91"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#fields_with_locales&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="92"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can handle entries with just 1 locale&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="93"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="94"> - <span class="hits">1</span> - - <code class="ruby"> nyancat = create_client.entry(&#39;nyancat&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="95"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields_with_locales[:name].size).to eq(1)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="96"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields_with_locales[:name][:&#39;en-US&#39;]).to eq(&quot;Nyan Cat&quot;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="97"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="98"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="99"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="100"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can handle entries with multiple locales&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="101"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry_locales&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="102"> - <span class="hits">1</span> - - <code class="ruby"> nyancat = create_client.entries(locale: &quot;*&quot;, &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).items.first</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="103"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields_with_locales[:name].size).to eq(2)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="104"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields_with_locales[:name][:&#39;en-US&#39;]).to eq(&quot;Nyan Cat&quot;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="105"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.fields_with_locales[:name][:tlh]).to eq(&quot;Nyan vIghro&#39;&quot;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="106"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="107"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="108"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="109"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can have references in multiple locales and they are properly solved&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="110"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;multi_locale_reference&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="111"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="112"> - - - <code class="ruby"> space: &#39;1sjfpsn7l90g&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="113"> - - - <code class="ruby"> access_token: &#39;e451a3cdfced9000220be41ed9c899866e8d52aa430eaf7c35b09df8fc6326f9&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="114"> - - - <code class="ruby"> dynamic_entries: :auto</code> - </li> - - <li class="never" data-hits="" data-linenumber="115"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="116"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="117"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entries(locale: &#39;*&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="118"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="119"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.image).to be_a ::Contentful::Asset</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="120"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields(&#39;zh&#39;)[:image]).to be_a ::Contentful::Asset</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="121"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields(&#39;es&#39;)[:image]).to be_a ::Contentful::Asset</code> - </li> - - <li class="never" data-hits="" data-linenumber="122"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="123"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.image.id).not_to eq entry.fields(&#39;zh&#39;)[:image].id</code> - </li> - - <li class="never" data-hits="" data-linenumber="124"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="125"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="126"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="127"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can have references with arrays in multiple locales and have them properly solved&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="128"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;multi_locale_array_reference&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="129"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="130"> - - - <code class="ruby"> space: &#39;cma9f9g4dxvs&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="131"> - - - <code class="ruby"> access_token: &#39;3e4560614990c9ac47343b9eea762bdaaebd845766f619660d7230787fd545e1&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="132"> - - - <code class="ruby"> dynamic_entries: :auto</code> - </li> - - <li class="never" data-hits="" data-linenumber="133"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="134"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="135"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entries(content_type: &#39;test&#39;, locale: &#39;*&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="136"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="137"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.files).to be_a ::Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="138"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.references).to be_a ::Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="139"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.files.first).to be_a ::Contentful::Asset</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="140"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.references.first.entry?).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="141"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="142"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields(&#39;zh&#39;)[:files]).to be_a ::Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="143"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields(&#39;zh&#39;)[:references]).to be_a ::Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="144"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields(&#39;zh&#39;)[:files].first).to be_a ::Contentful::Asset</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="145"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields(&#39;zh&#39;)[:references].first.entry?).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="146"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="147"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.files.first.id).not_to eq entry.fields(&#39;zh&#39;)[:files].first.id</code> - </li> - - <li class="never" data-hits="" data-linenumber="148"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="149"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="150"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="151"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="152"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="153"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;#raw&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="154"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/raw&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="155"> - <span class="hits">1</span> - - <code class="ruby"> nyancat = create_client.entry(&#39;nyancat&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="156"> - <span class="hits">1</span> - - <code class="ruby"> expect(nyancat.raw).to eq(create_client(raw_mode: true).entry(&#39;nyancat&#39;).object[&#39;items&#39;].first)</code> - </li> - - <li class="never" data-hits="" data-linenumber="157"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="158"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="159"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="160"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;can be marshalled&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="161"> - <span class="hits">1</span> - - <code class="ruby"> def test_dump(nyancat)</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="162"> - <span class="hits">2</span> - - <code class="ruby"> dump = Marshal.dump(nyancat)</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="163"> - <span class="hits">2</span> - - <code class="ruby"> new_cat = Marshal.load(dump)</code> - </li> - - <li class="never" data-hits="" data-linenumber="164"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="165"> - - - <code class="ruby"> # Attributes</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="166"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat).to be_a Contentful::Entry</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="167"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.name).to eq &quot;Nyan Cat&quot;</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="168"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.lives).to eq 1337</code> - </li> - - <li class="never" data-hits="" data-linenumber="169"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="170"> - - - <code class="ruby"> # Single linked objects</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="171"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.best_friend).to be_a Contentful::Entry</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="172"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.best_friend.name).to eq &quot;Happy Cat&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="173"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="174"> - - - <code class="ruby"> # Array of linked objects</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="175"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.cat_pack.count).to eq 2</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="176"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.cat_pack[0].name).to eq &quot;Happy Cat&quot;</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="177"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.cat_pack[1].name).to eq &quot;Worried Cat&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="178"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="179"> - - - <code class="ruby"> # Nested Links</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="180"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.best_friend.best_friend).to be_a Contentful::Entry</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="181"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.best_friend.best_friend.name).to eq &quot;Nyan Cat&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="182"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="183"> - - - <code class="ruby"> # Asset</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="184"> - <span class="hits">2</span> - - <code class="ruby"> expect(new_cat.image.file.url).to eq &quot;//images.contentful.com/cfexampleapi/4gp6taAwW4CmSgumq2ekUm/9da0cd1936871b8d72343e895a00d611/Nyan_cat_250px_frame.png&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="185"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="186"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="187"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;marshals properly&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="188"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/marshall&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="189"> - <span class="hits">1</span> - - <code class="ruby"> nyancat = create_client(gzip_encoded: false, max_include_resolution_depth: 2).entries(include: 2, &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).first</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="190"> - <span class="hits">1</span> - - <code class="ruby"> test_dump(nyancat)</code> - </li> - - <li class="never" data-hits="" data-linenumber="191"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="192"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="193"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="194"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can remarshall an unmarshalled object&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="195"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/marshall&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="196"> - <span class="hits">1</span> - - <code class="ruby"> nyancat = create_client(max_include_resolution_depth: 2).entries(include: 2, &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="197"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="198"> - - - <code class="ruby"> # The double load/dump is on purpose</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="199"> - <span class="hits">1</span> - - <code class="ruby"> test_dump(Marshal.load(Marshal.dump(nyancat)))</code> - </li> - - <li class="never" data-hits="" data-linenumber="200"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="201"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="202"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="203"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can properly marshal multiple level nested resources - #138&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="204"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/marshal_138&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="205"> - <span class="hits">1</span> - - <code class="ruby"> parent = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="206"> - - - <code class="ruby"> space: &#39;j8tb59fszch7&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="207"> - - - <code class="ruby"> access_token: &#39;5f711401f965951eb724ac72ac905e13d892294ba209268f13a9b32e896c8694&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="208"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="209"> - - - <code class="ruby"> max_include_resolution_depth: 5</code> - </li> - - <li class="never" data-hits="" data-linenumber="210"> - - - <code class="ruby"> ).entry(&#39;5aV3O0l5jU0cwQ2OkyYsyU&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="211"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="212"> - <span class="hits">1</span> - - <code class="ruby"> rehydrated = Marshal.load(Marshal.dump(parent))</code> - </li> - - <li class="never" data-hits="" data-linenumber="213"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="214"> - <span class="hits">1</span> - - <code class="ruby"> expect(rehydrated.childs.first.image1.url).to eq &#39;//images.contentful.com/j8tb59fszch7/7FjliblAmAoGMwU62MeQ6k/62509df90ef4bed38c0701bb9aa8c74c/Funny-Cat-Pictures-with-Captions-25.jpg&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="215"> - <span class="hits">1</span> - - <code class="ruby"> expect(rehydrated.childs.first.image2.url).to eq &#39;//images.contentful.com/j8tb59fszch7/1pbGuWZ27O6GMO0OGemgcA/a4185036a3640ad4491f38d8926003ab/Funny-Cat-Pictures-with-Captions-1.jpg&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="216"> - <span class="hits">1</span> - - <code class="ruby"> expect(rehydrated.childs.last.image1.url).to eq &#39;//images.contentful.com/j8tb59fszch7/4SXVTr0KEUyWiMMCOaUeUU/c9fa2246d5529a9c8e1ec6f5387dc4f6/e0194eca1c8135636ce0e014341548c3.jpg&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="217"> - <span class="hits">1</span> - - <code class="ruby"> expect(rehydrated.childs.last.image2.url).to eq &#39;//images.contentful.com/j8tb59fszch7/1NU1YcNQJGIA22gAKmKqWo/56fa672bb17a7b7ae2773d08e101d059/57ee64921c25faa649fc79288197c313.jpg&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="218"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="219"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="220"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="221"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;filters out unpublished resources after rehydration&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="222"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/marshal_unpublished&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="223"> - <span class="hits">1</span> - - <code class="ruby"> parent = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="224"> - - - <code class="ruby"> space: &#39;z3eix6mwjid2&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="225"> - - - <code class="ruby"> access_token: &#39;9047c4394a2130dff8e9dc544a7a3ec299703fdac8e52575eb5a6678be06c468&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="226"> - - - <code class="ruby"> dynamic_entries: :auto</code> - </li> - - <li class="never" data-hits="" data-linenumber="227"> - - - <code class="ruby"> ).entry(&#39;5Etc0jWzIWwMeSu4W0SCi8&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="228"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="229"> - <span class="hits">1</span> - - <code class="ruby"> rehydrated = Marshal.load(Marshal.dump(parent))</code> - </li> - - <li class="never" data-hits="" data-linenumber="230"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="231"> - <span class="hits">1</span> - - <code class="ruby"> expect(rehydrated.children).to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="232"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="233"> - <span class="hits">1</span> - - <code class="ruby"> preview_parent = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="234"> - - - <code class="ruby"> space: &#39;z3eix6mwjid2&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="235"> - - - <code class="ruby"> access_token: &#39;38153b942011a70b5482fda61c6a3a9d22f5e8a512662dac00fcf7eb344b75f4&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="236"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="237"> - - - <code class="ruby"> api_url: &#39;preview.contentful.com&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="238"> - - - <code class="ruby"> ).entry(&#39;5Etc0jWzIWwMeSu4W0SCi8&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="239"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="240"> - <span class="hits">1</span> - - <code class="ruby"> preview_rehydrated = Marshal.load(Marshal.dump(preview_parent))</code> - </li> - - <li class="never" data-hits="" data-linenumber="241"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="242"> - <span class="hits">1</span> - - <code class="ruby"> expect(preview_rehydrated.children).not_to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="243"> - <span class="hits">1</span> - - <code class="ruby"> expect(preview_rehydrated.children.first.title).to eq &#39;Child&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="244"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="245"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="246"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="247"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="248"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;incoming links&#39; do</code> - </li> - - <li class="covered" data-hits="4" data-linenumber="249"> - <span class="hits">4</span> - - <code class="ruby"> let(:client) { create_client }</code> - </li> - - <li class="never" data-hits="" data-linenumber="250"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="251"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will fetch entries referencing the entry using a query&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="252"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/search_link_to_entry&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="253"> - <span class="hits">1</span> - - <code class="ruby"> entries = client.entries(links_to_entry: &#39;nyancat&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="254"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries).not_to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="255"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.count).to eq 1</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="256"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.first.id).to eq &#39;happycat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="257"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="258"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="259"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="260"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will fetch entries referencing the entry using instance method&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="261"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/search_link_to_entry&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="262"> - <span class="hits">1</span> - - <code class="ruby"> entries = entry.incoming_references client</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="263"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries).not_to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="264"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.count).to eq 1</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="265"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.first.id).to eq &#39;happycat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="266"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="267"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="268"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="269"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will fetch entries referencing the entry using instance method + query&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="270"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/search_link_to_entry_with_custom_query&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="271"> - <span class="hits">1</span> - - <code class="ruby"> entries = entry.incoming_references(client, { content_type: &#39;cat&#39;, select: [&#39;fields.name&#39;] })</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="272"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries).not_to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="273"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.count).to eq 1</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="274"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.first.id).to eq &#39;happycat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="275"> - <span class="hits">1</span> - - <code class="ruby"> expect(entries.first.fields.keys).to eq([:name])</code> - </li> - - <li class="never" data-hits="" data-linenumber="276"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="277"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="278"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="279"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="280"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="281"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;select operator&#39; do</code> - </li> - - <li class="covered" data-hits="6" data-linenumber="282"> - <span class="hits">6</span> - - <code class="ruby"> let(:client) { create_client }</code> - </li> - - <li class="never" data-hits="" data-linenumber="283"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="284"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;with sys sent&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="285"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;properly creates an entry&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="286"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/select_only_sys&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="287"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entries(select: [&#39;sys&#39;], &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).first</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="288"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields).to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="289"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.entry?).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="290"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="291"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="292"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="293"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;can contain only one field&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="294"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;with content_type sent&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="295"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will properly create the entry with one field&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="296"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/select_one_field_proper&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="297"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entries(content_type: &#39;cat&#39;, select: [&#39;sys&#39;, &#39;fields.name&#39;], &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).first</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="298"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields).not_to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="299"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.entry?).to be_truthy</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="300"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields[:name]).to eq &#39;Nyan Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="301"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.fields).to eq({name: &#39;Nyan Cat&#39;})</code> - </li> - - <li class="never" data-hits="" data-linenumber="302"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="303"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="304"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="305"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="306"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;without content_type sent&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="307"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will raise an error&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="308"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/select_one_field&#39;) {</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="309"> - <span class="hits">2</span> - - <code class="ruby"> expect { client.entries(select: [&#39;sys&#39;, &#39;fields.name&#39;], &#39;sys.id&#39; =&gt; &#39;nyancat&#39;) }.to raise_error Contentful::BadRequest</code> - </li> - - <li class="never" data-hits="" data-linenumber="310"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="311"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="312"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="313"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="314"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="315"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="316"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;without sys sent&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="317"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will enforce sys anyway&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="318"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/select_no_sys&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="319"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entries(select: [&#39;fields&#39;], &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="320"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="321"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.id).to eq &#39;nyancat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="322"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.sys).not_to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="323"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="324"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="325"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="326"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;works with empty array as well, as sys is enforced&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="327"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/select_empty_array&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="328"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entries(select: [], &#39;sys.id&#39; =&gt; &#39;nyancat&#39;).first</code> - </li> - - <li class="never" data-hits="" data-linenumber="329"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="330"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.id).to eq &#39;nyancat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="331"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.sys).not_to be_empty</code> - </li> - - <li class="never" data-hits="" data-linenumber="332"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="333"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="334"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="335"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="336"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="337"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;reuse objects&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="338"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;should handle recursion as well as not reusing&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="339"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/include_resolution&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="340"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(reuse_objects: true).entry(&#39;nyancat&#39;, include: 2)</code> - </li> - - <li class="never" data-hits="" data-linenumber="341"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="342"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.best_friend.name).to eq &#39;Happy Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="343"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="344"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="345"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="346"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="347"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="348"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="349"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="350"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="351"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="352"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="353"> - - - <code class="ruby"> .best_friend.best_friend.name).to eq &#39;Nyan Cat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="354"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="355"> - - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="356"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;should use the same object for the same entry&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="357"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/include_resolution&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="358"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(reuse_entries: true).entry(&#39;nyancat&#39;, include: 2)</code> - </li> - - <li class="never" data-hits="" data-linenumber="359"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="360"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.best_friend.name).to eq &#39;Happy Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="361"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.best_friend.best_friend).to be(entry)</code> - </li> - - <li class="never" data-hits="" data-linenumber="362"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="363"> - - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="364"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;works on nested structures with unique objects&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="365"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/include_resolution_uniques&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="366"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="367"> - - - <code class="ruby"> space: &#39;v7cxgyxt0w5x&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="368"> - - - <code class="ruby"> access_token: &#39;96e5d256e9a5349ce30e84356597e409f8f1bb485cb4719285b555e0f78aa27e&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="369"> - - - <code class="ruby"> reuse_entries: true</code> - </li> - - <li class="never" data-hits="" data-linenumber="370"> - - - <code class="ruby"> ).entry(&#39;1nLXjjWvk4MEeWeQCWmymc&#39;, include: 10)</code> - </li> - - <li class="never" data-hits="" data-linenumber="371"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="372"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.title).to eq &#39;1&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="373"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="374"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="375"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="376"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="377"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="378"> - - - <code class="ruby"> .child.title).to eq &#39;10&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="379"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="380"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="381"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="382"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="383"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="384"> - - - <code class="ruby"> .child.child.title).to eq &#39;1&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="385"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="386"> - - - <code class="ruby"> .child.child.child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="387"> - - - <code class="ruby"> .child.child.child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="388"> - - - <code class="ruby"> .child.child.child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="389"> - - - <code class="ruby"> .child.child.child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="390"> - - - <code class="ruby"> .child.child.child.child.title).to eq &#39;1&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="391"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="392"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="393"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="394"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="395"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;include resolution&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="396"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;should not reuse objects by default&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="397"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/include_resolution&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="398"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client.entry(&#39;nyancat&#39;, include: 2)</code> - </li> - - <li class="never" data-hits="" data-linenumber="399"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="400"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.best_friend.name).to eq &#39;Happy Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="401"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.best_friend.best_friend).not_to be(entry)</code> - </li> - - <li class="never" data-hits="" data-linenumber="402"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="403"> - - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="404"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;defaults to 20 depth&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="405"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/include_resolution&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="406"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client.entry(&#39;nyancat&#39;, include: 2)</code> - </li> - - <li class="never" data-hits="" data-linenumber="407"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="408"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.best_friend.name).to eq &#39;Happy Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="409"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="410"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="411"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="412"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="413"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="414"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="415"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="416"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="417"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="418"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="419"> - - - <code class="ruby"> .best_friend.best_friend.name).to eq &#39;Nyan Cat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="420"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="421"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="422"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="423"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="424"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="425"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="426"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="427"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="428"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="429"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="430"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="431"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="432"> - - - <code class="ruby"> .best_friend).to be_a ::Contentful::Link</code> - </li> - - <li class="never" data-hits="" data-linenumber="433"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="434"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="435"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="436"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can be configured arbitrarily&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="437"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/include_resolution&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="438"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(max_include_resolution_depth: 3).entry(&#39;nyancat&#39;, include: 2)</code> - </li> - - <li class="never" data-hits="" data-linenumber="439"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="440"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.best_friend.name).to eq &#39;Happy Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="441"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="442"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="443"> - - - <code class="ruby"> .best_friend.name).to eq &#39;Happy Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="444"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="445"> - - - <code class="ruby"> .best_friend.best_friend</code> - </li> - - <li class="never" data-hits="" data-linenumber="446"> - - - <code class="ruby"> .best_friend.best_friend).to be_a ::Contentful::Link</code> - </li> - - <li class="never" data-hits="" data-linenumber="447"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="448"> - - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="449"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;works on nested structures with unique objects&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="450"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry/include_resolution_uniques&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="451"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="452"> - - - <code class="ruby"> space: &#39;v7cxgyxt0w5x&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="453"> - - - <code class="ruby"> access_token: &#39;96e5d256e9a5349ce30e84356597e409f8f1bb485cb4719285b555e0f78aa27e&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="454"> - - - <code class="ruby"> ).entry(&#39;1nLXjjWvk4MEeWeQCWmymc&#39;, include: 10)</code> - </li> - - <li class="never" data-hits="" data-linenumber="455"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="456"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.title).to eq &#39;1&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="457"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="458"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="459"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="460"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="461"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="462"> - - - <code class="ruby"> .child.title).to eq &#39;10&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="463"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="464"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="465"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="466"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="467"> - - - <code class="ruby"> .child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="468"> - - - <code class="ruby"> .child.child.title).to eq &#39;1&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="469"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="470"> - - - <code class="ruby"> .child.child.child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="471"> - - - <code class="ruby"> .child.child.child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="472"> - - - <code class="ruby"> .child.child.child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="473"> - - - <code class="ruby"> .child.child.child.child</code> - </li> - - <li class="never" data-hits="" data-linenumber="474"> - - - <code class="ruby"> .child.child.child.child.title).to eq &#39;1&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="475"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="476"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="477"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="478"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="479"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;issues&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="480"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;Symbol/Text field with null values should be serialized as nil - #117&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="481"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/issue_117&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="482"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(space: &#39;8jbbayggj9gj&#39;, access_token: &#39;4ce0108f04e55c76476ba84ab0e6149734db73d67cd1b429323ef67f00977e07&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="483"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entries.first</code> - </li> - - <li class="never" data-hits="" data-linenumber="484"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="485"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.nil).to be_nil</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="486"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.nil).not_to eq &#39;&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="487"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="488"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="489"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="490"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;JSON Fields should not be treated as locale data - #96&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="491"> - <span class="hits">1</span> - - <code class="ruby"> before do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="492"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;entry/json_objects_client&#39;) {</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="493"> - <span class="hits">2</span> - - <code class="ruby"> @client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="494"> - - - <code class="ruby"> space: &#39;h425t6gef30p&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="495"> - - - <code class="ruby"> access_token: &#39;278f7aa72f2eb90c0e002d60f85bf2144c925acd2d37dd990d3ca274f25076cf&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="496"> - - - <code class="ruby"> dynamic_entries: :auto</code> - </li> - - <li class="never" data-hits="" data-linenumber="497"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="498"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="499"> - - - <code class="ruby"> }</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="500"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;entry/json_objects&#39;) {</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="501"> - <span class="hits">2</span> - - <code class="ruby"> @entry = @client.entries.first</code> - </li> - - <li class="never" data-hits="" data-linenumber="502"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="503"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="504"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="505"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;only has default locale&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="506"> - <span class="hits">1</span> - - <code class="ruby"> expect(@entry.locales).to eq [&#39;en-US&#39;]</code> - </li> - - <li class="never" data-hits="" data-linenumber="507"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="508"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="509"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can obtain all values properly&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="510"> - <span class="hits">1</span> - - <code class="ruby"> expect(@entry.name).to eq(&#39;Test&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="511"> - <span class="hits">1</span> - - <code class="ruby"> expect(@entry.object_test).to eq({</code> - </li> - - <li class="never" data-hits="" data-linenumber="512"> - - - <code class="ruby"> null: nil,</code> - </li> - - <li class="never" data-hits="" data-linenumber="513"> - - - <code class="ruby"> text: &#39;some text&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="514"> - - - <code class="ruby"> array: [1, 2, 3],</code> - </li> - - <li class="never" data-hits="" data-linenumber="515"> - - - <code class="ruby"> number: 123,</code> - </li> - - <li class="never" data-hits="" data-linenumber="516"> - - - <code class="ruby"> boolean: true,</code> - </li> - - <li class="never" data-hits="" data-linenumber="517"> - - - <code class="ruby"> object: {</code> - </li> - - <li class="never" data-hits="" data-linenumber="518"> - - - <code class="ruby"> null: nil,</code> - </li> - - <li class="never" data-hits="" data-linenumber="519"> - - - <code class="ruby"> text: &#39;bar&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="520"> - - - <code class="ruby"> array: [1, 2, 3],</code> - </li> - - <li class="never" data-hits="" data-linenumber="521"> - - - <code class="ruby"> number: 123,</code> - </li> - - <li class="never" data-hits="" data-linenumber="522"> - - - <code class="ruby"> boolean: false,</code> - </li> - - <li class="never" data-hits="" data-linenumber="523"> - - - <code class="ruby"> object: {foo: &#39;bar&#39;}</code> - </li> - - <li class="never" data-hits="" data-linenumber="524"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="525"> - - - <code class="ruby"> })</code> - </li> - - <li class="never" data-hits="" data-linenumber="526"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="527"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="528"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="529"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;Number (Integer and Decimal) values get properly serialized - #125&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="530"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/issue_125&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="531"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(space: &#39;zui87wsu8q80&#39;, access_token: &#39;64ff902c58cd14ea063d3ded810d1111a0266537e9aba283bad3319b1762c302&#39;, dynamic_entries: :auto)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="532"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entries.first</code> - </li> - - <li class="never" data-hits="" data-linenumber="533"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="534"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.integer).to eq 123</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="535"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.decimal).to eq 12.3</code> - </li> - - <li class="never" data-hits="" data-linenumber="536"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="537"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="538"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="539"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;unresolvable entries get filtered from results&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="540"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/unresolvable_filter&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="541"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(space: &#39;011npgaszg5o&#39;, access_token: &#39;42c9d93410a7319e9a735671fc1e415348f65e94a99fc768b70a7c649859d4fd&#39;, dynamic_entries: :auto)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="542"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entry(&#39;1HR1QvURo4MoSqO0eqmUeO&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="543"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="544"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.modules.size).to eq 2</code> - </li> - - <li class="never" data-hits="" data-linenumber="545"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="546"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="547"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="548"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;unresolvable entries get filtered from results in deeply nested objects - #177&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="549"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/unresolvable_filter_deeply_nested&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="550"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(space: &#39;z471hdso7l1a&#39;, access_token: &#39;8a0e09fe71f1cb41e8788ace86a8c8d9d084599fe43a40070f232045014d2585&#39;, dynamic_entries: :auto)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="551"> - <span class="hits">1</span> - - <code class="ruby"> entry = client.entry(&#39;1hb8sipClkQ8ggeGaeSQWm&#39;, include: 3)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="552"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.should_published.first.should_unpublished.size).to eq 0</code> - </li> - - <li class="never" data-hits="" data-linenumber="553"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="554"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="555"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="556"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="557"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="558"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;supports camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="559"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="560"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(use_camel_case: true).entry &#39;nyancat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="561"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="562"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.bestFriend.name).to eq &#39;Happy Cat&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="563"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.createdAt).to be_a DateTime</code> - </li> - - <li class="never" data-hits="" data-linenumber="564"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="565"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="566"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="567"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="568"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;empty fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="569"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;when default configuration&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="570"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;raises an exception by default&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="571"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/empty_fields&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="572"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="573"> - - - <code class="ruby"> space: &#39;z4ssexir3p93&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="574"> - - - <code class="ruby"> access_token: &#39;e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="575"> - - - <code class="ruby"> dynamic_entries: :auto</code> - </li> - - <li class="never" data-hits="" data-linenumber="576"> - - - <code class="ruby"> ).entry(&#39;2t1x77MgUA4SM2gMiaUcsy&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="577"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="2" data-linenumber="578"> - <span class="hits">2</span> - - <code class="ruby"> expect { entry.title }.to raise_error Contentful::EmptyFieldError</code> - </li> - - <li class="never" data-hits="" data-linenumber="579"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="580"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="581"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="582"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns nil if raise_for_empty_fields is false&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="583"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/empty_fields&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="584"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="585"> - - - <code class="ruby"> space: &#39;z4ssexir3p93&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="586"> - - - <code class="ruby"> access_token: &#39;e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="587"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="588"> - - - <code class="ruby"> raise_for_empty_fields: false</code> - </li> - - <li class="never" data-hits="" data-linenumber="589"> - - - <code class="ruby"> ).entry(&#39;2t1x77MgUA4SM2gMiaUcsy&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="590"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="591"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.title).to be_nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="592"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="593"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="594"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="595"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will properly raise NoMethodError for non-fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="596"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/empty_fields&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="597"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="598"> - - - <code class="ruby"> space: &#39;z4ssexir3p93&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="599"> - - - <code class="ruby"> access_token: &#39;e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="600"> - - - <code class="ruby"> dynamic_entries: :auto</code> - </li> - - <li class="never" data-hits="" data-linenumber="601"> - - - <code class="ruby"> ).entry(&#39;2t1x77MgUA4SM2gMiaUcsy&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="602"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="2" data-linenumber="603"> - <span class="hits">2</span> - - <code class="ruby"> expect { entry.unexisting_field }.to raise_error NoMethodError</code> - </li> - - <li class="never" data-hits="" data-linenumber="604"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="605"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="606"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="607"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="608"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;when use_camel_case is true it should still work&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="609"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;raises an exception by default&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="610"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/empty_fields&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="611"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="612"> - - - <code class="ruby"> space: &#39;z4ssexir3p93&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="613"> - - - <code class="ruby"> access_token: &#39;e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="614"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="615"> - - - <code class="ruby"> use_camel_case: true</code> - </li> - - <li class="never" data-hits="" data-linenumber="616"> - - - <code class="ruby"> ).entry(&#39;2t1x77MgUA4SM2gMiaUcsy&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="617"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="2" data-linenumber="618"> - <span class="hits">2</span> - - <code class="ruby"> expect { entry.title }.to raise_error Contentful::EmptyFieldError</code> - </li> - - <li class="never" data-hits="" data-linenumber="619"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="620"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="621"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="622"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns nil if raise_for_empty_fields is false&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="623"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/empty_fields&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="624"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="625"> - - - <code class="ruby"> space: &#39;z4ssexir3p93&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="626"> - - - <code class="ruby"> access_token: &#39;e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="627"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="628"> - - - <code class="ruby"> raise_for_empty_fields: false,</code> - </li> - - <li class="never" data-hits="" data-linenumber="629"> - - - <code class="ruby"> use_camel_case: true</code> - </li> - - <li class="never" data-hits="" data-linenumber="630"> - - - <code class="ruby"> ).entry(&#39;2t1x77MgUA4SM2gMiaUcsy&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="631"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="632"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.title).to be_nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="633"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="634"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="635"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="636"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will properly raise NoMethodError for non-fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="637"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/empty_fields&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="638"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="639"> - - - <code class="ruby"> space: &#39;z4ssexir3p93&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="640"> - - - <code class="ruby"> access_token: &#39;e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="641"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="642"> - - - <code class="ruby"> use_camel_case: true</code> - </li> - - <li class="never" data-hits="" data-linenumber="643"> - - - <code class="ruby"> ).entry(&#39;2t1x77MgUA4SM2gMiaUcsy&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="644"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="2" data-linenumber="645"> - <span class="hits">2</span> - - <code class="ruby"> expect { entry.unexisting_field }.to raise_error NoMethodError</code> - </li> - - <li class="never" data-hits="" data-linenumber="646"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="647"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="648"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="649"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="650"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="651"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;rich text support&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="652"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;properly serializes and resolves includes&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="653"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/rich_text&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="654"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="655"> - - - <code class="ruby"> space: &#39;jd7yc4wnatx3&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="656"> - - - <code class="ruby"> access_token: &#39;6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="657"> - - - <code class="ruby"> raise_errors: true,</code> - </li> - - <li class="never" data-hits="" data-linenumber="658"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="659"> - - - <code class="ruby"> gzip_encoded: false</code> - </li> - - <li class="never" data-hits="" data-linenumber="660"> - - - <code class="ruby"> ).entry(&#39;4BupPSmi4M02m0U48AQCSM&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="661"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="662"> - <span class="hits">1</span> - - <code class="ruby"> expected_entry_occurrances = 2</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="663"> - <span class="hits">1</span> - - <code class="ruby"> embedded_entry_index = 1</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="664"> - <span class="hits">1</span> - - <code class="ruby"> entry.body[&#39;content&#39;].each do |content|</code> - </li> - - <li class="covered" data-hits="24" data-linenumber="665"> - <span class="hits">24</span> - - <code class="ruby"> if content[&#39;nodeType&#39;] == &#39;embedded-entry-block&#39;</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="666"> - <span class="hits">2</span> - - <code class="ruby"> expect(content[&#39;data&#39;][&#39;target&#39;]).to be_a Contentful::Entry</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="667"> - <span class="hits">2</span> - - <code class="ruby"> expect(content[&#39;data&#39;][&#39;target&#39;].body).to eq &quot;Embedded #{embedded_entry_index}&quot;</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="668"> - <span class="hits">2</span> - - <code class="ruby"> expected_entry_occurrances -= 1</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="669"> - <span class="hits">2</span> - - <code class="ruby"> embedded_entry_index += 1</code> - </li> - - <li class="never" data-hits="" data-linenumber="670"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="671"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="672"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="673"> - <span class="hits">1</span> - - <code class="ruby"> expect(expected_entry_occurrances).to eq 0</code> - </li> - - <li class="never" data-hits="" data-linenumber="674"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="675"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="676"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="677"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;doesnt hydrate the same entry twice - #194&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="678"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/rich_text_hydration_issue&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="679"> - <span class="hits">1</span> - - <code class="ruby"> entry = nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="680"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="681"> - <span class="hits">1</span> - - <code class="ruby"> expect {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="682"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="683"> - - - <code class="ruby"> space: &#39;fds721b88p6b&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="684"> - - - <code class="ruby"> access_token: &#39;45ba81cc69423fcd2e3f0a4779de29481bb5c11495bc7e14649a996cf984e98e&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="685"> - - - <code class="ruby"> raise_errors: true,</code> - </li> - - <li class="never" data-hits="" data-linenumber="686"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="687"> - - - <code class="ruby"> gzip_encoded: false</code> - </li> - - <li class="never" data-hits="" data-linenumber="688"> - - - <code class="ruby"> ).entry(&#39;1tBAu0wP9qAQEg6qCqMics&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="689"> - - - <code class="ruby"> }.not_to raise_error</code> - </li> - - <li class="never" data-hits="" data-linenumber="690"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="691"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.children[0].id).to eq entry.children[1].id</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="692"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.children[0].body).to eq entry.children[1].body</code> - </li> - - <li class="never" data-hits="" data-linenumber="693"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="694"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="695"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="696"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;respects content in data attribute if its not a Link&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="697"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/rich_text_nested_fields&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="698"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="699"> - - - <code class="ruby"> space: &#39;jd7yc4wnatx3&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="700"> - - - <code class="ruby"> access_token: &#39;6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="701"> - - - <code class="ruby"> raise_errors: true,</code> - </li> - - <li class="never" data-hits="" data-linenumber="702"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="703"> - - - <code class="ruby"> gzip_encoded: false</code> - </li> - - <li class="never" data-hits="" data-linenumber="704"> - - - <code class="ruby"> ).entry(&#39;6NGLswCREsGA28kGouScyY&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="705"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="706"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.body[&#39;content&#39;][0]).to eq({</code> - </li> - - <li class="never" data-hits="" data-linenumber="707"> - - - <code class="ruby"> &#39;data&#39; =&gt; {},</code> - </li> - - <li class="never" data-hits="" data-linenumber="708"> - - - <code class="ruby"> &#39;content&#39; =&gt; [</code> - </li> - - <li class="never" data-hits="" data-linenumber="709"> - - - <code class="ruby"> {&#39;marks&#39; =&gt; [], &#39;value&#39; =&gt; &#39;A link to &#39;, &#39;nodeType&#39; =&gt; &#39;text&#39;, &#39;nodeClass&#39; =&gt; &#39;text&#39;},</code> - </li> - - <li class="never" data-hits="" data-linenumber="710"> - - - <code class="ruby"> {</code> - </li> - - <li class="never" data-hits="" data-linenumber="711"> - - - <code class="ruby"> &#39;data&#39; =&gt; {&#39;uri&#39; =&gt; &#39;https://google.com&#39;},</code> - </li> - - <li class="never" data-hits="" data-linenumber="712"> - - - <code class="ruby"> &#39;content&#39; =&gt; [{&#39;marks&#39; =&gt; [], &#39;value&#39; =&gt; &#39;google&#39;, &#39;nodeType&#39; =&gt; &#39;text&#39;, &#39;nodeClass&#39; =&gt; &#39;text&#39;}],</code> - </li> - - <li class="never" data-hits="" data-linenumber="713"> - - - <code class="ruby"> &#39;nodeType&#39; =&gt; &#39;hyperlink&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="714"> - - - <code class="ruby"> &#39;nodeClass&#39; =&gt; &#39;inline&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="715"> - - - <code class="ruby"> },</code> - </li> - - <li class="never" data-hits="" data-linenumber="716"> - - - <code class="ruby"> {&#39;marks&#39; =&gt; [], &#39;value&#39; =&gt; &#39;&#39;, &#39;nodeType&#39; =&gt; &#39;text&#39;, &#39;nodeClass&#39; =&gt; &#39;text&#39;}</code> - </li> - - <li class="never" data-hits="" data-linenumber="717"> - - - <code class="ruby"> ],</code> - </li> - - <li class="never" data-hits="" data-linenumber="718"> - - - <code class="ruby"> &#39;nodeType&#39; =&gt; &#39;paragraph&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="719"> - - - <code class="ruby"> &#39;nodeClass&#39; =&gt; &#39;block&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="720"> - - - <code class="ruby"> })</code> - </li> - - <li class="never" data-hits="" data-linenumber="721"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="722"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="723"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="724"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;supports includes in nested fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="725"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/rich_text_nested_fields&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="726"> - <span class="hits">1</span> - - <code class="ruby"> entry = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="727"> - - - <code class="ruby"> space: &#39;jd7yc4wnatx3&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="728"> - - - <code class="ruby"> access_token: &#39;6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="729"> - - - <code class="ruby"> raise_errors: true,</code> - </li> - - <li class="never" data-hits="" data-linenumber="730"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="731"> - - - <code class="ruby"> gzip_encoded: false</code> - </li> - - <li class="never" data-hits="" data-linenumber="732"> - - - <code class="ruby"> ).entry(&#39;6NGLswCREsGA28kGouScyY&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="733"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="734"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.body[&#39;content&#39;][3][&#39;nodeType&#39;]).to eq(&#39;unordered-list&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="735"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.body[&#39;content&#39;][3][&#39;content&#39;][2][&#39;content&#39;][0][&#39;data&#39;][&#39;target&#39;].is_a?(Contentful::Entry)).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="736"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="737"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.body[&#39;content&#39;][4][&#39;nodeType&#39;]).to eq(&#39;ordered-list&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="738"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.body[&#39;content&#39;][4][&#39;content&#39;][2][&#39;content&#39;][0][&#39;data&#39;][&#39;target&#39;].is_a?(Contentful::Entry)).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="739"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="740"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="741"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="742"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns a link when resource is valid but unreachable&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="743"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entries/rich_text_unresolved_relationships&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="744"> - <span class="hits">1</span> - - <code class="ruby"> parent = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="745"> - - - <code class="ruby"> space: &#39;jd7yc4wnatx3&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="746"> - - - <code class="ruby"> access_token: &#39;6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="747"> - - - <code class="ruby"> raise_errors: true,</code> - </li> - - <li class="never" data-hits="" data-linenumber="748"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="749"> - - - <code class="ruby"> gzip_encoded: false</code> - </li> - - <li class="never" data-hits="" data-linenumber="750"> - - - <code class="ruby"> ).entry(&#39;4fvSwl5Ob6UEWKg6MQicuC&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="751"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="752"> - <span class="hits">1</span> - - <code class="ruby"> entry = parent.rich_text_child</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="753"> - <span class="hits">1</span> - - <code class="ruby"> expect(entry.body[&#39;content&#39;][19][&#39;data&#39;][&#39;target&#39;].is_a?(Contentful::Link)).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="754"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="755"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="756"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="757"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="ba5ec4bdbf6ab50e064edb4d1e274e870b307f6e"> - <div class="header"> - <h3>spec/error_class_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>151</b> relevant lines. - <span class="green"><b>151</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Error do</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="4"> - <span class="hits">3</span> - - <code class="ruby"> let(:r) { Contentful::Response.new raw_fixture(&#39;not_found&#39;, 404) }</code> - </li> - - <li class="never" data-hits="" data-linenumber="5"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#response&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns the response the error has been initialized with&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error.new(r).response).to be r</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#message&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns the message found in the response json&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 404\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"> &quot;Message: The resource could not be found.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="16"> - - - <code class="ruby"> &quot;Details: {\&quot;type\&quot;=&gt;\&quot;Entry\&quot;, \&quot;space\&quot;=&gt;\&quot;cfexampleapi\&quot;, \&quot;id\&quot;=&gt;\&quot;not found\&quot;}\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="18"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error.new(r).message).not_to be_nil</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error.new(r).message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="20"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="21"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;message types&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="23"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;default messages&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;400&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_400&#39;, 400)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 400\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"> &quot;Message: The request was malformed or missing a required parameter.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="32"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;401&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="35"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_401&#39;, 401)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="36"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="38"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 401\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="39"> - - - <code class="ruby"> &quot;Message: The authorization token was invalid.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="40"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="42"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="43"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="44"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;403&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_403&#39;, 403)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="47"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="48"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 403\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby"> &quot;Message: The specified token does not have access to the requested resource.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="50"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="51"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="52"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="53"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="54"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;404&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="55"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_404&#39;, 404)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="57"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="58"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 404\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="59"> - - - <code class="ruby"> &quot;Message: The requested resource or endpoint could not be found.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="60"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="61"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="62"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="63"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="64"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;429&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="65"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_429&#39;, 429)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="66"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="67"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="68"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 429\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="69"> - - - <code class="ruby"> &quot;Message: Rate limit exceeded. Too many requests.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="70"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="71"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="72"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="73"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="74"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;500&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="75"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_500&#39;, 500)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="76"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="77"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="78"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 500\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="79"> - - - <code class="ruby"> &quot;Message: Internal server error.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="80"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="81"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="82"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="83"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="84"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;502&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="85"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_502&#39;, 502)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="86"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="87"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="88"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 502\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="89"> - - - <code class="ruby"> &quot;Message: The requested space is hibernated.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="90"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="91"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="92"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="93"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="94"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;503&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="95"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_503&#39;, 503)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="96"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="97"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="98"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 503\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="99"> - - - <code class="ruby"> &quot;Message: The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="100"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="101"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="102"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="103"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="104"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="105"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;special cases&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="106"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;400&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="107"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;details is a string&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="108"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;400_details_string&#39;, 400)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="109"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="110"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="111"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 400\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="112"> - - - <code class="ruby"> &quot;Message: The request was malformed or missing a required parameter.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="113"> - - - <code class="ruby"> &quot;Details: some error\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="114"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="115"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="116"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="117"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="118"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;details is an object, internal errors are strings&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="119"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;400_details_errors_string&#39;, 400)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="120"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="121"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="122"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 400\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="123"> - - - <code class="ruby"> &quot;Message: The request was malformed or missing a required parameter.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="124"> - - - <code class="ruby"> &quot;Details: some error\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="125"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="126"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="127"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="128"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="129"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;details is an object, internal errors are objects which have details&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="130"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;400_details_errors_object&#39;, 400)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="131"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="132"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="133"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 400\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="134"> - - - <code class="ruby"> &quot;Message: The request was malformed or missing a required parameter.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="135"> - - - <code class="ruby"> &quot;Details: some error\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="136"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="137"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="138"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="139"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="140"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="141"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;403&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="142"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has an array of reasons&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="143"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;403_reasons&#39;, 403)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="144"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="145"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="146"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 403\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="147"> - - - <code class="ruby"> &quot;Message: The specified token does not have access to the requested resource.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="148"> - - - <code class="ruby"> &quot;Details: \n\tReasons:\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="149"> - - - <code class="ruby"> &quot;\t\tfoo\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="150"> - - - <code class="ruby"> &quot;\t\tbar\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="151"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="152"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="153"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="154"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="155"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="156"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;404&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="157"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;details is a string&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="158"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;404_details_string&#39;, 404)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="159"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="160"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="161"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 404\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="162"> - - - <code class="ruby"> &quot;Message: The requested resource or endpoint could not be found.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="163"> - - - <code class="ruby"> &quot;Details: The resource could not be found\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="164"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="165"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="166"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="167"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="168"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;has a type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="169"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;type is on the top level&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="170"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;404_type&#39;, 404)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="171"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="172"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="173"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 404\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="174"> - - - <code class="ruby"> &quot;Message: The requested resource or endpoint could not be found.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="175"> - - - <code class="ruby"> &quot;Details: The requested Asset could not be found.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="176"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="177"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="178"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="179"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="180"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;type is not on the top level&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="181"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;404_sys_type&#39;, 404)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="182"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="183"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="184"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 404\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="185"> - - - <code class="ruby"> &quot;Message: The requested resource or endpoint could not be found.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="186"> - - - <code class="ruby"> &quot;Details: The requested Space could not be found.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="187"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="188"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="189"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="190"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="191"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="192"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can specify the resource id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="193"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;404_id&#39;, 404)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="194"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="195"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="196"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 404\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="197"> - - - <code class="ruby"> &quot;Message: The requested resource or endpoint could not be found.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="198"> - - - <code class="ruby"> &quot;Details: The requested Asset could not be found. ID: foobar.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="199"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="200"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="201"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="202"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="203"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="204"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;429&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="205"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can show the time until reset&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="206"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;default_429&#39;, 429, false, {&#39;x-contentful-ratelimit-reset&#39; =&gt; 60})</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="207"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="208"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="209"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 429\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="210"> - - - <code class="ruby"> &quot;Message: Rate limit exceeded. Too many requests.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="211"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="212"> - - - <code class="ruby"> &quot;Time until reset (seconds): 60&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="213"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="214"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="215"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="216"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="217"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="218"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;generic error&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="219"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;with everything&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="220"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;other_error&#39;, 512)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="221"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="222"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="223"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 512\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="224"> - - - <code class="ruby"> &quot;Message: Some error occurred.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="225"> - - - <code class="ruby"> &quot;Details: some text\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="226"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="227"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="228"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="229"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="230"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;no details&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="231"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;other_error_no_details&#39;, 512)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="232"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="233"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="234"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 512\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="235"> - - - <code class="ruby"> &quot;Message: Some error occurred.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="236"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="237"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="238"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="239"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="240"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;no request id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="241"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;other_error_no_request_id&#39;, 512)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="242"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="243"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="244"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 512\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="245"> - - - <code class="ruby"> &quot;Message: Some error occurred.\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="246"> - - - <code class="ruby"> &quot;Details: some text&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="247"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="248"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="249"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="250"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;no message&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="251"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;other_error_no_message&#39;, 512)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="252"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="253"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="254"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 512\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="255"> - - - <code class="ruby"> &quot;Message: The following error was received: {\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="256"> - - - <code class="ruby"> &quot; \&quot;sys\&quot;: {\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="257"> - - - <code class="ruby"> &quot; \&quot;type\&quot;: \&quot;Error\&quot;,\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="258"> - - - <code class="ruby"> &quot; \&quot;id\&quot;: \&quot;SomeError\&quot;\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="259"> - - - <code class="ruby"> &quot; },\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="260"> - - - <code class="ruby"> &quot; \&quot;details\&quot;: \&quot;some text\&quot;,\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="261"> - - - <code class="ruby"> &quot; \&quot;requestId\&quot;: \&quot;85f-351076632\&quot;\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="262"> - - - <code class="ruby"> &quot;}\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="263"> - - - <code class="ruby"> &quot;\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="264"> - - - <code class="ruby"> &quot;Details: some text\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="265"> - - - <code class="ruby"> &quot;Request ID: 85f-351076632&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="266"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="267"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="268"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="269"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;nothing&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="270"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new raw_fixture(&#39;other_error_nothing&#39;, 512)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="271"> - <span class="hits">1</span> - - <code class="ruby"> error = Contentful::Error[response.raw.status].new(response)</code> - </li> - - <li class="never" data-hits="" data-linenumber="272"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="273"> - <span class="hits">1</span> - - <code class="ruby"> message = &quot;HTTP status code: 512\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="274"> - - - <code class="ruby"> &quot;Message: The following error was received: {\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="275"> - - - <code class="ruby"> &quot; \&quot;sys\&quot;: {\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="276"> - - - <code class="ruby"> &quot; \&quot;type\&quot;: \&quot;Error\&quot;,\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="277"> - - - <code class="ruby"> &quot; \&quot;id\&quot;: \&quot;SomeError\&quot;\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="278"> - - - <code class="ruby"> &quot; }\n&quot;\</code> - </li> - - <li class="never" data-hits="" data-linenumber="279"> - - - <code class="ruby"> &quot;}\n&quot;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="280"> - <span class="hits">1</span> - - <code class="ruby"> expect(error.message).to eq message</code> - </li> - - <li class="never" data-hits="" data-linenumber="281"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="282"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="283"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="284"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="285"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="286"> - <span class="hits">1</span> - - <code class="ruby"> describe Contentful::UnparsableJson do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="287"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#message&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="288"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns the json parser\&#39;s message&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="289"> - <span class="hits">1</span> - - <code class="ruby"> uj = Contentful::Response.new raw_fixture(&#39;unparsable&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="290"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::UnparsableJson.new(uj).message).to \</code> - </li> - - <li class="never" data-hits="" data-linenumber="291"> - - - <code class="ruby"> include &#39;unexpected token&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="292"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="293"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="294"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="295"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="296"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;.[]&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="297"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns BadRequest error class for 400&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="298"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error[400]).to eq Contentful::BadRequest</code> - </li> - - <li class="never" data-hits="" data-linenumber="299"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="300"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="301"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns Unauthorized error class for 401&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="302"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error[401]).to eq Contentful::Unauthorized</code> - </li> - - <li class="never" data-hits="" data-linenumber="303"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="304"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="305"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns AccessDenied error class for 403&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="306"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error[403]).to eq Contentful::AccessDenied</code> - </li> - - <li class="never" data-hits="" data-linenumber="307"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="308"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="309"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns NotFound error class for 404&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="310"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error[404]).to eq Contentful::NotFound</code> - </li> - - <li class="never" data-hits="" data-linenumber="311"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="312"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="313"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns ServerError error class for 500&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="314"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error[500]).to eq Contentful::ServerError</code> - </li> - - <li class="never" data-hits="" data-linenumber="315"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="316"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="317"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns ServiceUnavailable error class for 503&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="318"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error[503]).to eq Contentful::ServiceUnavailable</code> - </li> - - <li class="never" data-hits="" data-linenumber="319"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="320"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="321"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns generic error class for any other value&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="322"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error[nil]).to eq Contentful::Error</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="323"> - <span class="hits">1</span> - - <code class="ruby"> expect(Contentful::Error[200]).to eq Contentful::Error</code> - </li> - - <li class="never" data-hits="" data-linenumber="324"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="325"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="326"> - - - <code class="ruby"></code> - </li> - - <li class="never" data-hits="" data-linenumber="327"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="a882eb4cc91a2c1702f2e5743aba55a06bbc06f0"> - <div class="header"> - <h3>spec/error_requests_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>44</b> relevant lines. - <span class="green"><b>44</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">class NonCachingClient &lt; Contentful::Client</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> - - <code class="ruby"> def request_headers</code> - </li> - - <li class="covered" data-hits="8" data-linenumber="5"> - <span class="hits">8</span> - - <code class="ruby"> headers = super</code> - </li> - - <li class="covered" data-hits="8" data-linenumber="6"> - <span class="hits">8</span> - - <code class="ruby"> headers[&#39;Cf-No-Cache&#39;] = &#39;foobar&#39;</code> - </li> - - <li class="covered" data-hits="8" data-linenumber="7"> - <span class="hits">8</span> - - <code class="ruby"> headers</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby">end</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> - - <code class="ruby">class RetryLoggerMock &lt; Logger</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> attr_reader :retry_attempts</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - - <code class="ruby"> def initialize(*)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> super</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> @retry_attempts = 0</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> - - <code class="ruby"> def info(message)</code> - </li> - - <li class="covered" data-hits="5" data-linenumber="20"> - <span class="hits">5</span> - - <code class="ruby"> super</code> - </li> - - <li class="covered" data-hits="5" data-linenumber="21"> - <span class="hits">5</span> - - <code class="ruby"> @retry_attempts += 1 if message.include?(&#39;Contentful API Rate Limit Hit! Retrying&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby">end</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby">describe &#39;Error Requests&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return 404 (Unauthorized) if resource not found&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> expect_vcr(&#39;not found&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> create_client.content_type &#39;not found&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"> end.to raise_error(Contentful::NotFound)</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return 400 (BadRequest) if invalid parameters have been passed&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="33"> - <span class="hits">1</span> - - <code class="ruby"> expect_vcr(&#39;bad request&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> - - <code class="ruby"> create_client.entries(some: &#39;parameter&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"> end.to raise_error(Contentful::BadRequest)</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="38"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return 403 (AccessDenied) if ...&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="39"> - <span class="hits">1</span> - - <code class="ruby"> skip</code> - </li> - - <li class="never" data-hits="" data-linenumber="40"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="41"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return 401 (Unauthorized) if wrong credentials are given&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="43"> - <span class="hits">1</span> - - <code class="ruby"> client = Contentful::Client.new(space: &#39;wrong&#39;, access_token: &#39;credentials&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="44"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> expect_vcr(&#39;unauthorized&#39;){</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> client.entry(&#39;nyancat&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="47"> - - - <code class="ruby"> }.to raise_error(Contentful::Unauthorized)</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="50"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return 500 (ServerError) if ...&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="51"> - <span class="hits">1</span> - - <code class="ruby"> skip</code> - </li> - - <li class="never" data-hits="" data-linenumber="52"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="53"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="54"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return a 429 if the ratelimit is reached and is not set to retry&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="55"> - <span class="hits">1</span> - - <code class="ruby"> client = Contentful::Client.new(space: &#39;wrong&#39;, access_token: &#39;credentials&#39;, max_rate_limit_retries: 0)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> - - <code class="ruby"> expect_vcr(&#39;ratelimit&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="57"> - <span class="hits">1</span> - - <code class="ruby"> client.entry(&#39;nyancat&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="58"> - - - <code class="ruby"> }.to raise_error(Contentful::RateLimitExceeded)</code> - </li> - - <li class="never" data-hits="" data-linenumber="59"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="60"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="61"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will retry on 429 by default&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="62"> - <span class="hits">1</span> - - <code class="ruby"> logger = RetryLoggerMock.new(STDOUT)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="63"> - <span class="hits">1</span> - - <code class="ruby"> client = NonCachingClient.new(</code> - </li> - - <li class="never" data-hits="" data-linenumber="64"> - - - <code class="ruby"> api_url: &#39;cdnorigin.flinkly.com&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="65"> - - - <code class="ruby"> space: &#39;164vhtp008kz&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="66"> - - - <code class="ruby"> access_token: &#39;7699b6c6f6cee9b6abaa216c71fbcb3eee56cb6f082f57b5e21b2b50f86bdea0&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="67"> - - - <code class="ruby"> raise_errors: true,</code> - </li> - - <li class="never" data-hits="" data-linenumber="68"> - - - <code class="ruby"> logger: logger</code> - </li> - - <li class="never" data-hits="" data-linenumber="69"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="70"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="71"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;ratelimit_retry&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="72"> - <span class="hits">1</span> - - <code class="ruby"> 3.times {</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="73"> - <span class="hits">3</span> - - <code class="ruby"> client.assets</code> - </li> - - <li class="never" data-hits="" data-linenumber="74"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="75"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="76"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="77"> - <span class="hits">1</span> - - <code class="ruby"> expect(logger.retry_attempts).to eq 1</code> - </li> - - <li class="never" data-hits="" data-linenumber="78"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="79"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="80"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return 503 (ServiceUnavailable) when the service is unavailable&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="81"> - <span class="hits">1</span> - - <code class="ruby"> client = Contentful::Client.new(space: &#39;wrong&#39;, access_token: &#39;credentials&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="82"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="83"> - <span class="hits">1</span> - - <code class="ruby"> expect_vcr(&#39;unavailable&#39;){</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="84"> - <span class="hits">1</span> - - <code class="ruby"> client.entry(&#39;nyancat&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="85"> - - - <code class="ruby"> }.to raise_error(Contentful::ServiceUnavailable)</code> - </li> - - <li class="never" data-hits="" data-linenumber="86"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="87"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="60501d65433b1709942162aa7e81098ef5f8d6cc"> - <div class="header"> - <h3>spec/field_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>53</b> relevant lines. - <span class="green"><b>53</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Field do</code> - </li> - - <li class="covered" data-hits="13" data-linenumber="4"> - <span class="hits">13</span> - - <code class="ruby"> let(:field) { vcr(&#39;field&#39;) { create_client.content_type(&#39;cat&#39;).fields.first } }</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="5"> - <span class="hits">3</span> - - <code class="ruby"> let(:linkField) { vcr(&#39;linkField&#39;) {</code> - </li> - - <li class="covered" data-hits="18" data-linenumber="6"> - <span class="hits">18</span> - - <code class="ruby"> create_client.content_type(&#39;cat&#39;).fields.select { |f| f.id == &#39;image&#39; }.first</code> - </li> - - <li class="never" data-hits="" data-linenumber="7"> - - - <code class="ruby"> } }</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="8"> - <span class="hits">3</span> - - <code class="ruby"> let(:arrayField) { vcr(&#39;arrayField&#39;) {</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="9"> - <span class="hits">2</span> - - <code class="ruby"> Contentful::Client.new(</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> space: &#39;wl1z0pal05vy&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> access_token: &#39;9b76e1bbc29eb513611a66b9fc5fb7acd8d95e83b0f7d6bacfe7ec926c819806&#39;</code> - </li> - - <li class="covered" data-hits="24" data-linenumber="12"> - <span class="hits">24</span> - - <code class="ruby"> ).content_type(&#39;2PqfXUJwE8qSYKuM0U6w8M&#39;).fields.select { |f| f.id == &#39;categories&#39; }.first</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"> } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> - - <code class="ruby"> expect(field.id).to eq &#39;name&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #name&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> expect(field.name).to eq &#39;Name&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> expect(field.type).to eq &#39;Text&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;could have #items&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> expect(field).to respond_to :items</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #required&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="33"> - <span class="hits">1</span> - - <code class="ruby"> expect(field.required).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="36"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #localized&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="37"> - <span class="hits">1</span> - - <code class="ruby"> expect(field.required).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="39"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="40"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Link field properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="43"> - <span class="hits">1</span> - - <code class="ruby"> expect(linkField.type).to eq &#39;Link&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="44"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="45"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #linkType&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="47"> - <span class="hits">1</span> - - <code class="ruby"> expect(linkField.link_type).to eq &#39;Asset&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="50"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="51"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Array field properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="52"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="53"> - <span class="hits">1</span> - - <code class="ruby"> expect(arrayField.type).to eq &#39;Array&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="54"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="55"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #items&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="57"> - <span class="hits">1</span> - - <code class="ruby"> expect(arrayField.items.type).to eq &#39;Link&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="58"> - <span class="hits">1</span> - - <code class="ruby"> expect(arrayField.items.link_type).to eq &#39;Entry&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="59"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="60"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="61"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="62"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;issues&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="63"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;json field&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="64"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can coerce properly when top level is not object&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="65"> - <span class="hits">1</span> - - <code class="ruby"> coercion = Contentful::ObjectCoercion.new([{foo: 123}])</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="66"> - <span class="hits">1</span> - - <code class="ruby"> expect(coercion.coerce).to eq [{foo: 123}]</code> - </li> - - <li class="never" data-hits="" data-linenumber="67"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="68"> - <span class="hits">1</span> - - <code class="ruby"> coercion = Contentful::ObjectCoercion.new(&#39;foobar&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="69"> - <span class="hits">1</span> - - <code class="ruby"> expect(coercion.coerce).to eq &#39;foobar&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="70"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="71"> - <span class="hits">1</span> - - <code class="ruby"> coercion = Contentful::ObjectCoercion.new(true)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="72"> - <span class="hits">1</span> - - <code class="ruby"> expect(coercion.coerce).to eq true</code> - </li> - - <li class="never" data-hits="" data-linenumber="73"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="74"> - <span class="hits">1</span> - - <code class="ruby"> coercion = Contentful::ObjectCoercion.new(123)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="75"> - <span class="hits">1</span> - - <code class="ruby"> expect(coercion.coerce).to eq 123</code> - </li> - - <li class="never" data-hits="" data-linenumber="76"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="77"> - <span class="hits">1</span> - - <code class="ruby"> coercion = Contentful::ObjectCoercion.new({foo: 123})</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="78"> - <span class="hits">1</span> - - <code class="ruby"> expect(coercion.coerce).to eq(foo: 123)</code> - </li> - - <li class="never" data-hits="" data-linenumber="79"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="80"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="81"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="82"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;datetime field&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="83"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can coerce properly when value is nil&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="84"> - <span class="hits">1</span> - - <code class="ruby"> coercion = Contentful::DateCoercion.new(nil)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="85"> - <span class="hits">1</span> - - <code class="ruby"> expect(coercion.coerce).to eq(nil)</code> - </li> - - <li class="never" data-hits="" data-linenumber="86"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="87"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="88"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can coerce properly when value is already datetime&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="89"> - <span class="hits">1</span> - - <code class="ruby"> value = DateTime.new</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="90"> - <span class="hits">1</span> - - <code class="ruby"> coercion = Contentful::DateCoercion.new(value)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="91"> - <span class="hits">1</span> - - <code class="ruby"> expect(coercion.coerce).to eq value</code> - </li> - - <li class="never" data-hits="" data-linenumber="92"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="93"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="94"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="95"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="f319b7711f92cae0e531bde60aaa88fa553e06cf"> - <div class="header"> - <h3>spec/file_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>18</b> relevant lines. - <span class="green"><b>18</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::File do</code> - </li> - - <li class="covered" data-hits="9" data-linenumber="4"> - <span class="hits">9</span> - - <code class="ruby"> let(:file) { vcr(&#39;asset&#39;) { create_client.asset(&#39;nyancat&#39;).file } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="5"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #file_name&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> expect(file.file_name).to eq &#39;Nyan_cat_250px_frame.png&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #content_type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> expect(file.content_type).to eq &#39;image/png&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> expect(file.url).to eq &#39;//images.contentful.com/cfexampleapi/4gp6taAwW4CmSgumq2ekUm/9da0cd1936871b8d72343e895a00d611/Nyan_cat_250px_frame.png&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #details&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> expect(file.details).to be_instance_of Hash</code> - </li> - - <li class="never" data-hits="" data-linenumber="21"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;supports camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;asset&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> file = create_client(use_camel_case: true).asset(&#39;nyancat&#39;).file</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> expect(file.contentType).to eq &#39;image/png&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> expect(file.fileName).to eq &#39;Nyan_cat_250px_frame.png&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="32"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="0e177320f9d9f1f1848788e038064e0e57e552dd"> - <div class="header"> - <h3>spec/link_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>28</b> relevant lines. - <span class="green"><b>28</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Link do</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="4"> - <span class="hits">3</span> - - <code class="ruby"> let(:client) { create_client }</code> - </li> - - <li class="covered" data-hits="13" data-linenumber="5"> - <span class="hits">13</span> - - <code class="ruby"> let(:entry) { vcr(&#39;entry&#39;) { create_client.entry(&#39;nyancat&#39;) } }</code> - </li> - - <li class="covered" data-hits="6" data-linenumber="6"> - <span class="hits">6</span> - - <code class="ruby"> let(:link) { entry.space }</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="7"> - <span class="hits">2</span> - - <code class="ruby"> let(:content_type_link) { entry.content_type }</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;SystemProperties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #sys getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> - - <code class="ruby"> expect(link.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> expect(link.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> expect(link.id).to eq &#39;cfexampleapi&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> expect(link.type).to eq &#39;Link&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="21"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="23"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #link_type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> expect(link.link_type).to eq &#39;Space&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="25"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#resolve&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;queries the api for the resource&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="30"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;space&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> - - <code class="ruby"> expect(link.resolve(client)).to be_a Contentful::Space</code> - </li> - - <li class="never" data-hits="" data-linenumber="32"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="35"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;queries the api for the resource (different link object)&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="36"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;content_type&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="37"> - <span class="hits">1</span> - - <code class="ruby"> expect(content_type_link.resolve(client)).to be_a Contentful::ContentType</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="39"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="40"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="41"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="43"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;supports camel case&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="44"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;entry&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> space_link = create_client(use_camel_case: true).entry(&#39;nyancat&#39;).space</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> expect(space_link.linkType).to eq &#39;Space&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="47"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="50"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="3087380aad15023264d655b41cb4b039f41d8e4d"> - <div class="header"> - <h3>spec/locale_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>18</b> relevant lines. - <span class="green"><b>18</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Locale do</code> - </li> - - <li class="covered" data-hits="7" data-linenumber="4"> - <span class="hits">7</span> - - <code class="ruby"> let(:locale) { vcr(&#39;locale&#39;) { create_client.space.locales.first } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="5"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #code&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> expect(locale.code).to eq &#39;en-US&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #name&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> expect(locale.name).to eq &#39;English&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #default&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> expect(locale.default).to eq true</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;locales endpoint&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;locales can be fetched from environments&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;locale_from_environment&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="23"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"> space: &#39;facgnwwgj5fe&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="25"> - - - <code class="ruby"> access_token: &#39;&lt;ACCESS_TOKEN&gt;&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"> environment: &#39;testing&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"> )</code> - </li> - - <li class="never" data-hits="" data-linenumber="28"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> locales = client.locales</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> - - <code class="ruby"> expect(locales).to be_a ::Contentful::Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> expect(locales.first).to be_a ::Contentful::Locale</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="33"> - <span class="hits">1</span> - - <code class="ruby"> expect(locales.first.code).to eq &#39;en-US&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="05f5b25581a35a18308ada667027abe9591adca2"> - <div class="header"> - <h3>spec/location_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>12</b> relevant lines. - <span class="green"><b>12</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Location do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> - - <code class="ruby"> let(:location)do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="5"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;location&#39;)do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="6"> - <span class="hits">2</span> - - <code class="ruby"> Contentful::Client.new(</code> - </li> - - <li class="never" data-hits="" data-linenumber="7"> - - - <code class="ruby"> space: &#39;lzjz8hygvfgu&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"> access_token: &#39;0c6ef483524b5e46b3bafda1bf355f38f5f40b4830f7599f790a410860c7c271&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"> dynamic_entries: :auto,</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> ).entry(&#39;3f6fq5ylFCi4kIYAQKsAYG&#39;).location</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #lat&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> expect(location.lat).to be_a Float</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> - - <code class="ruby"> expect(location.lat.to_i).to eq 36</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #lon&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> expect(location.lon).to be_a Float</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> expect(location.lon.to_i).to eq(-94)</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="25"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="95ae9505ac5703f29dc61019198d16ca813935a2"> - <div class="header"> - <h3>spec/request_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>31</b> relevant lines. - <span class="green"><b>31</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Request do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#get&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="5"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;calls client&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> request = Contentful::Request.new(client, &#39;/content_types&#39;, nil, &#39;nyancat&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> expect(client).to receive(:get).with(request)</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> - - <code class="ruby"> request.get</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#query&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;converts arrays given in query to comma strings&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> - - <code class="ruby"> client = create_client</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="18"> - <span class="hits">1</span> - - <code class="ruby"> request = Contentful::Request.new(client, &#39;/entries&#39;, &#39;fields.likes[in]&#39; =&gt; %w(jake finn))</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> - - <code class="ruby"> expect(request.query[:&#39;fields.likes[in]&#39;]).to eq &#39;jake,finn&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="20"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="21"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="23"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;[single resource]&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> let(:request)do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="25"> - <span class="hits">2</span> - - <code class="ruby"> Contentful::Request.new(create_client, &#39;/content_types&#39;, nil, &#39;nyancat&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="27"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;contais endpoint&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="30"> - <span class="hits">1</span> - - <code class="ruby"> expect(request.url).to include &#39;content_types&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="32"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="33"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;contains id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> - - <code class="ruby"> expect(request.url).to include &#39;nyancat&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="39"> - <span class="hits">1</span> - - <code class="ruby"> context &#39;[multi resource]&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="40"> - <span class="hits">1</span> - - <code class="ruby"> let(:request)do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="41"> - <span class="hits">2</span> - - <code class="ruby"> Contentful::Request.new(create_client, &#39;/content_types&#39;, &#39;something&#39; =&gt; &#39;requested&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="42"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="43"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="44"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#query&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;contains query&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> expect(request.query).not_to be_empty</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="47"> - <span class="hits">1</span> - - <code class="ruby"> expect(request.query[:something]).to eq &#39;requested&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="50"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="51"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="52"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;contais endpoint&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="53"> - <span class="hits">1</span> - - <code class="ruby"> expect(request.url).to include &#39;content_types&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="54"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="55"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="56"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="57"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="9c14f2e925ace67d177e53f0129d77745bd3f83f"> - <div class="header"> - <h3>spec/resource_building_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>21</b> relevant lines. - <span class="green"><b>21</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe &#39;Resource Building Examples&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can deal with arrays&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="5"> - <span class="hits">1</span> - - <code class="ruby"> request = Contentful::Request.new(nil, &#39;entries&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new(raw_fixture(&#39;link_array&#39;), request)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> resource = Contentful::ResourceBuilder.new(response.object).run</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> expect(resource.fields[:links]).to be_a Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> - - <code class="ruby"> expect(resource.fields[:links].first).to be_a Contentful::Link</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;replaces links with included versions if present&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - - <code class="ruby"> request = Contentful::Request.new(nil, &#39;entries&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new(raw_fixture(&#39;includes&#39;), request)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> resource = Contentful::ResourceBuilder.new(response.object).run.first</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="18"> - <span class="hits">1</span> - - <code class="ruby"> expect(resource.fields[:links]).to be_a Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> - - <code class="ruby"> expect(resource.fields[:links].first).to be_a Contentful::Entry</code> - </li> - - <li class="never" data-hits="" data-linenumber="20"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="21"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;can also reference itself&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="23"> - <span class="hits">1</span> - - <code class="ruby"> request = Contentful::Request.new(nil, &#39;entries&#39;)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> response = Contentful::Response.new(raw_fixture(&#39;self_link&#39;), request)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> resource = Contentful::ResourceBuilder.new(response.object).run.first</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> other_resource = resource.fields[:e]</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> expect(other_resource).to be_a Contentful::Entry</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> - - <code class="ruby"> expect(other_resource.fields[:e]).to eq resource</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="19ee8dac79d02390e73ed93191aa8c676874060e"> - <div class="header"> - <h3>spec/response_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>35</b> relevant lines. - <span class="green"><b>35</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Response do</code> - </li> - - <li class="covered" data-hits="5" data-linenumber="4"> - <span class="hits">5</span> - - <code class="ruby"> let(:successful_response) { Contentful::Response.new raw_fixture(&#39;nyancat&#39;), Contentful::Request.new(nil, &#39;/entries&#39;, nil, &#39;nyancat&#39;) }</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="5"> - <span class="hits">3</span> - - <code class="ruby"> let(:error_response) { Contentful::Response.new raw_fixture(&#39;not_found&#39;, 404) }</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="6"> - <span class="hits">3</span> - - <code class="ruby"> let(:unparsable_response) { Contentful::Response.new raw_fixture(&#39;unparsable&#39;) }</code> - </li> - - <li class="never" data-hits="" data-linenumber="7"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#raw&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns the raw response it has been initalized with&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> - - <code class="ruby"> expect(successful_response.raw.to_s).to eql raw_fixture(&#39;nyancat&#39;).to_s</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#object&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> - - <code class="ruby"> it &quot;returns the repsonse&#39;s parsed json&quot; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> expect(successful_response.object).to eq json_fixture(&#39;nyancat&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#request&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns the request the response has been initalized with&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> expect(successful_response.request).to be_a Contentful::Request</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="25"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#status&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns :ok for normal responses&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> expect(successful_response.status).to eq :ok</code> - </li> - - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns :error for error responses&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> expect(error_response.status).to eq :error</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="35"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns :error for unparsable json responses&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="36"> - <span class="hits">1</span> - - <code class="ruby"> expect(unparsable_response.status).to eq :error</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="39"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns :error for responses without content&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="40"> - <span class="hits">1</span> - - <code class="ruby"> raw_response = &#39;&#39;</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="41"> - <span class="hits">3</span> - - <code class="ruby"> allow(raw_response).to receive(:status) { 204 }</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> no_content_response = Contentful::Response.new raw_response</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="43"> - <span class="hits">1</span> - - <code class="ruby"> expect(no_content_response.status).to eq :no_content</code> - </li> - - <li class="never" data-hits="" data-linenumber="44"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="45"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="46"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="47"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#error_message&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="48"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns contentful error message for contentful errors&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="49"> - <span class="hits">1</span> - - <code class="ruby"> expect(error_response.error_message).to eq &#39;The resource could not be found.&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="50"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="51"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="52"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns json parser error message for json parse errors&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="53"> - <span class="hits">1</span> - - <code class="ruby"> expect(unparsable_response.error_message).to include &#39;unexpected token&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="54"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="55"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns a ServiceUnavailable error on a 503&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="57"> - <span class="hits">1</span> - - <code class="ruby"> error_response = Contentful::Response.new raw_fixture(&#39;not_found&#39;, 503)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="58"> - <span class="hits">1</span> - - <code class="ruby"> expect(error_response.status).to eql :error</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="59"> - <span class="hits">1</span> - - <code class="ruby"> expect(error_response.object).to be_kind_of Contentful::ServiceUnavailable</code> - </li> - - <li class="never" data-hits="" data-linenumber="60"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="61"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="62"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="af3edbfb21ba19158fe1a8aee1384a7e9b406807"> - <div class="header"> - <h3>spec/space_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>17</b> relevant lines. - <span class="green"><b>17</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Space do</code> - </li> - - <li class="covered" data-hits="11" data-linenumber="4"> - <span class="hits">11</span> - - <code class="ruby"> let(:space) { vcr(&#39;space&#39;) { create_client.space } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="5"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="6"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;SystemProperties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #sys getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> expect(space.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> expect(space.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #id&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> expect(space.id).to eq &#39;cfexampleapi&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="14"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> - - <code class="ruby"> expect(space.type).to eq &#39;Space&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="20"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #name&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="23"> - <span class="hits">1</span> - - <code class="ruby"> expect(space.name).to eq &#39;Contentful Example API&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="25"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #locales&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> expect(space.locales).to be_a Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> - - <code class="ruby"> expect(space.locales.first).to be_a Contentful::Locale</code> - </li> - - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - <div class="source_table" id="5eb25a1b26ae65158e1a7386a20084d608b4951d"> <div class="header"> <h3>spec/support/client.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> @@ -29116,12 +14840,12 @@ <span class="hits">1</span> <code class="ruby">def create_client(options = {})</code> </li> - <li class="covered" data-hits="241" data-linenumber="2"> - <span class="hits">241</span> + <li class="covered" data-hits="30" data-linenumber="2"> + <span class="hits">30</span> <code class="ruby"> Contentful::Client.new({</code> </li> <li class="never" data-hits="" data-linenumber="3"> @@ -29154,15 +14878,15 @@ <div class="source_table" id="a4ba320676b73b8644cffc9dbb12bbe8e19a9934"> <div class="header"> <h3>spec/support/json_responses.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="green">90.91 %</span> covered</h4> <div> <b>11</b> relevant lines. - <span class="green"><b>11</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>10</b> lines covered</span> and + <span class="red"><b>1</b> lines missed.</span> </div> </div> <pre> <ol> @@ -29183,54 +14907,54 @@ <span class="hits">1</span> <code class="ruby">def raw_fixture(which, status = 200, _as_json = false, headers = {})</code> </li> - <li class="covered" data-hits="42" data-linenumber="4"> - <span class="hits">42</span> + <li class="covered" data-hits="4" data-linenumber="4"> + <span class="hits">4</span> <code class="ruby"> object = Object.new</code> </li> - <li class="covered" data-hits="229" data-linenumber="5"> - <span class="hits">229</span> + <li class="covered" data-hits="8" data-linenumber="5"> + <span class="hits">8</span> <code class="ruby"> allow(object).to receive(:status) { status }</code> </li> - <li class="covered" data-hits="129" data-linenumber="6"> - <span class="hits">129</span> + <li class="covered" data-hits="8" data-linenumber="6"> + <span class="hits">8</span> <code class="ruby"> allow(object).to receive(:headers) { headers }</code> </li> - <li class="covered" data-hits="167" data-linenumber="7"> - <span class="hits">167</span> + <li class="covered" data-hits="8" data-linenumber="7"> + <span class="hits">8</span> <code class="ruby"> allow(object).to receive(:to_s) { File.read File.dirname(__FILE__) + &quot;/../fixtures/json_responses/#{which}.json&quot; }</code> </li> - <li class="covered" data-hits="55" data-linenumber="8"> - <span class="hits">55</span> + <li class="covered" data-hits="4" data-linenumber="8"> + <span class="hits">4</span> <code class="ruby"> allow(object).to receive(:body) { object.to_s }</code> </li> - <li class="covered" data-hits="46" data-linenumber="9"> - <span class="hits">46</span> + <li class="covered" data-hits="4" data-linenumber="9"> + <span class="hits">4</span> <code class="ruby"> allow(object).to receive(:[]) { |key| object.headers[key] }</code> </li> <li class="never" data-hits="" data-linenumber="10"> <code class="ruby"></code> </li> - <li class="covered" data-hits="42" data-linenumber="11"> - <span class="hits">42</span> + <li class="covered" data-hits="4" data-linenumber="11"> + <span class="hits">4</span> <code class="ruby"> object</code> </li> <li class="never" data-hits="" data-linenumber="12"> @@ -29249,13 +14973,13 @@ <span class="hits">1</span> <code class="ruby">def json_fixture(which, _as_json = false)</code> </li> - <li class="covered" data-hits="1" data-linenumber="15"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="15"> + <code class="ruby"> MultiJson.load(</code> </li> <li class="never" data-hits="" data-linenumber="16"> @@ -29281,15 +15005,15 @@ <div class="source_table" id="027342a1ab3607ccd90fe9e5972948d26cbc8bed"> <div class="header"> <h3>spec/support/vcr.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> + <h4><span class="yellow">90.0 %</span> covered</h4> <div> <b>10</b> relevant lines. - <span class="green"><b>10</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> + <span class="green"><b>9</b> lines covered</span> and + <span class="red"><b>1</b> lines missed.</span> </div> </div> <pre> <ol> @@ -29352,12 +15076,12 @@ <span class="hits">1</span> <code class="ruby">def vcr(name, &amp;block)</code> </li> - <li class="covered" data-hits="205" data-linenumber="11"> - <span class="hits">205</span> + <li class="covered" data-hits="23" data-linenumber="11"> + <span class="hits">23</span> <code class="ruby"> VCR.use_cassette(name, &amp;block)</code> </li> <li class="never" data-hits="" data-linenumber="12"> @@ -29376,1752 +15100,16 @@ <span class="hits">1</span> <code class="ruby">def expect_vcr(name, &amp;block)</code> </li> - <li class="covered" data-hits="14" data-linenumber="15"> - <span class="hits">14</span> + <li class="missed" data-hits="0" data-linenumber="15"> + <code class="ruby"> expect { VCR.use_cassette(name, &amp;block) }</code> </li> <li class="never" data-hits="" data-linenumber="16"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="95b8bb4afe6ed95b076be799979ae2c639fbab8f"> - <div class="header"> - <h3>spec/sync_page_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>54</b> relevant lines. - <span class="green"><b>54</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::SyncPage do</code> - </li> - - <li class="covered" data-hits="15" data-linenumber="4"> - <span class="hits">15</span> - - <code class="ruby"> let(:page_with_more) { vcr(&#39;sync_page&#39;) { create_client.sync(initial: true).first_page } }</code> - </li> - - <li class="covered" data-hits="23" data-linenumber="5"> - <span class="hits">23</span> - - <code class="ruby"> let(:page) { vcr(&#39;sync_page_2&#39;) { create_client.sync.get(&#39;https://cdn.contentful.com/spaces/cfexampleapi/environments/master/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCr8Okw6AYwqbDksO3ehvDpUPCgcKsKXbCiAwPC8K2w4LDvsOkw6nCjhPDpcOQADElWsOoU8KGR3HCtsOAwqd6wp_Dulp8w6LDsF_CtsK7Kk05wrMvwrLClMOgG2_Dn2sGPg&#39;) } }</code> - </li> - - <li class="never" data-hits="" data-linenumber="6"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;SystemProperties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has a #sys getter returning a hash with symbol keys&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.sys).to be_a Hash</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.sys.keys.sample).to be_a Symbol</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #type&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.type).to eq &#39;Array&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="16"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="18"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Properties&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;has #items which contain resources&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> - - <code class="ruby"> expect(page_with_more.items).to be_a Array</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> - - <code class="ruby"> expect(page_with_more.items.sample).to be_a Contentful::BaseResource</code> - </li> - - <li class="never" data-hits="" data-linenumber="22"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;properly deals with nested locale fields&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> expect(page_with_more.items.first.fields[:name]).to eq &#39;London&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="28"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#each&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="32"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;is an Enumerator&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="33"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.each).to be_a Enumerator</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="36"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;iterates over items&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="37"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.each.to_a).to eq page.items</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="39"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="40"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;includes Enumerable&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.map { |r| r.type }).to eq page.items.map { |r| r.type }</code> - </li> - - <li class="never" data-hits="" data-linenumber="42"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="43"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="44"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#next_sync_url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return the next_sync_url if there is one&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="47"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.next_sync_url).to be_a String</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="49"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="50"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return nil if note last page, yet&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="51"> - <span class="hits">1</span> - - <code class="ruby"> expect(page_with_more.next_sync_url).to be_nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="52"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="53"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="54"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="55"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#next_page_url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return the next_page_url if there is one&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="57"> - <span class="hits">1</span> - - <code class="ruby"> expect(page_with_more.next_page_url).to be_a String</code> - </li> - - <li class="never" data-hits="" data-linenumber="58"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="59"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="60"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return nil if on last page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="61"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.next_page_url).to be_nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="62"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="63"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="64"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="65"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#next_page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="66"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;requests the next page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="67"> - <span class="hits">1</span> - - <code class="ruby"> next_page = vcr(&#39;sync_page_2&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="68"> - <span class="hits">1</span> - - <code class="ruby"> page_with_more.next_page</code> - </li> - - <li class="never" data-hits="" data-linenumber="69"> - - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="70"> - <span class="hits">1</span> - - <code class="ruby"> expect(next_page).to be_a Contentful::SyncPage</code> - </li> - - <li class="never" data-hits="" data-linenumber="71"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="72"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="73"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return nil if last page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="74"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.next_page_url).to be_nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="75"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="76"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="77"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="78"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#next_page?&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="79"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return true if there is a next page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="80"> - <span class="hits">1</span> - - <code class="ruby"> expect(page_with_more.next_page?).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="81"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="82"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="83"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return false if last page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="84"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.next_page?).to be_falsey</code> - </li> - - <li class="never" data-hits="" data-linenumber="85"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="86"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="87"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="88"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#last_page?&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="89"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return true if no more pages available&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="90"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.last_page?).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="91"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="92"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="93"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return false if more pages available&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="94"> - <span class="hits">1</span> - - <code class="ruby"> expect(page_with_more.last_page?).to be_falsey</code> - </li> - - <li class="never" data-hits="" data-linenumber="95"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="96"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="97"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="98"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#sync&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="99"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns the sync that created the page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="100"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.sync).to be_a Contentful::Sync</code> - </li> - - <li class="never" data-hits="" data-linenumber="101"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="102"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="103"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="f811ceb52b7a29eaa4e3dd16037352e742150ad6"> - <div class="header"> - <h3>spec/sync_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>79</b> relevant lines. - <span class="green"><b>79</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="3"> - <span class="hits">1</span> - - <code class="ruby">describe Contentful::Sync do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> - - <code class="ruby"> before :each do</code> - </li> - - <li class="covered" data-hits="14" data-linenumber="5"> - <span class="hits">14</span> - - <code class="ruby"> Contentful::ContentTypeCache.clear!</code> - </li> - - <li class="never" data-hits="" data-linenumber="6"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="7"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="8"> - <span class="hits">1</span> - - <code class="ruby"> let(:first_page) do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="9"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;sync_page&#39;)do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="10"> - <span class="hits">2</span> - - <code class="ruby"> create_client.sync(initial: true).first_page</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="13"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> - - <code class="ruby"> let(:last_page) do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="15"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;sync_page&#39;)do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="16"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;sync_page_2&#39;)do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="17"> - <span class="hits">2</span> - - <code class="ruby"> create_client.sync(initial: true).first_page.next_page</code> - </li> - - <li class="never" data-hits="" data-linenumber="18"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="19"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="20"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="21"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;environments&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="23"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;works for environments&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="24"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;sync_environment&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> - - <code class="ruby"> page = nil</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> - - <code class="ruby"> expect {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="27"> - <span class="hits">1</span> - - <code class="ruby"> page = create_client(</code> - </li> - - <li class="never" data-hits="" data-linenumber="28"> - - - <code class="ruby"> space: &#39;a22o2qgm356c&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"> access_token: &#39;bfbc63cf745a037125dbcc64f716a9a0e9d091df1a79e84920b890f87a6e7ab9&#39;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> environment: &#39;staging&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"> ).sync(initial: true).first_page</code> - </li> - - <li class="never" data-hits="" data-linenumber="32"> - - - <code class="ruby"> }.not_to raise_exception</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="34"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.items.first).to be_a ::Contentful::Entry</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="35"> - <span class="hits">1</span> - - <code class="ruby"> expect(page.items.first.environment.id).to eq &#39;staging&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="38"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="39"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="40"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#initialize&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;takes an options hash on initialization&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - - <code class="ruby"> expect do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="43"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;sync_deletion&#39;) { create_client.sync(initial: true, type: &#39;Deletion&#39;).first_page }</code> - </li> - - <li class="never" data-hits="" data-linenumber="44"> - - - <code class="ruby"> end.not_to raise_exception</code> - </li> - - <li class="never" data-hits="" data-linenumber="45"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="46"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="47"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;takes a next_sync_url on initialization&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="48"> - <span class="hits">1</span> - - <code class="ruby"> expect do</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="49"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;sync_page_2&#39;) { create_client.sync(&#39;https://cdn.contentful.com/spaces/cfexampleapi/environments/master/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCr8Okw6AYwqbDksO3ehvDpUPCgcKsKXbCiAwPC8K2w4LDvsOkw6nCjhPDpcOQADElWsOoU8KGR3HCtsOAwqd6wp_Dulp8w6LDsF_CtsK7Kk05wrMvwrLClMOgG2_Dn2sGPg&#39;).first_page }</code> - </li> - - <li class="never" data-hits="" data-linenumber="50"> - - - <code class="ruby"> end.not_to raise_exception</code> - </li> - - <li class="never" data-hits="" data-linenumber="51"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="52"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="53"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="54"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#first_page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="55"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns only the first page of a new sync&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;sync_page&#39;)do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="57"> - <span class="hits">1</span> - - <code class="ruby"> expect(create_client.sync(initial: true).first_page).to be_a Contentful::SyncPage</code> - </li> - - <li class="never" data-hits="" data-linenumber="58"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="59"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="60"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="61"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="62"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#each_page&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="63"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;iterates through sync pages&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="64"> - <span class="hits">1</span> - - <code class="ruby"> sync = create_client.sync(initial: true)</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="65"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;sync_page&#39;){ vcr(&#39;sync_page_2&#39;){</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="66"> - <span class="hits">1</span> - - <code class="ruby"> count = 0</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="67"> - <span class="hits">1</span> - - <code class="ruby"> sync.each_page do |page|</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="68"> - <span class="hits">2</span> - - <code class="ruby"> expect(page).to be_a Contentful::SyncPage</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="69"> - <span class="hits">2</span> - - <code class="ruby"> count += 1</code> - </li> - - <li class="never" data-hits="" data-linenumber="70"> - - - <code class="ruby"> end</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="71"> - <span class="hits">1</span> - - <code class="ruby"> expect(count).to eq 2</code> - </li> - - <li class="never" data-hits="" data-linenumber="72"> - - - <code class="ruby"> }}</code> - </li> - - <li class="never" data-hits="" data-linenumber="73"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="74"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="75"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="76"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#next_sync_url&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="77"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;is empty if there are still more pages to request in the current sync&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="78"> - <span class="hits">1</span> - - <code class="ruby"> expect(first_page.next_sync_url).to be_nil</code> - </li> - - <li class="never" data-hits="" data-linenumber="79"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="80"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="81"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;returns the url to continue the sync next time&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="82"> - <span class="hits">1</span> - - <code class="ruby"> expect(last_page.next_sync_url).to be_a String</code> - </li> - - <li class="never" data-hits="" data-linenumber="83"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="84"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="85"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="86"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#completed?&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="87"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return true if no more pages to request in the current sync&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="88"> - <span class="hits">1</span> - - <code class="ruby"> expect(first_page.next_sync_url).to be_falsey</code> - </li> - - <li class="never" data-hits="" data-linenumber="89"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="90"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="91"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will return true if not all pages requested, yet&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="92"> - <span class="hits">1</span> - - <code class="ruby"> expect(last_page.next_sync_url).to be_truthy</code> - </li> - - <li class="never" data-hits="" data-linenumber="93"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="94"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="95"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="96"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;#each_item&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="97"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will directly iterate through all resources&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="98"> - <span class="hits">1</span> - - <code class="ruby"> sync = create_client.sync(initial: true)</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="99"> - <span class="hits">2</span> - - <code class="ruby"> vcr(&#39;sync_page&#39;){ vcr(&#39;sync_page_2&#39;){</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="100"> - <span class="hits">1</span> - - <code class="ruby"> sync.each_item do |item|</code> - </li> - - <li class="covered" data-hits="14" data-linenumber="101"> - <span class="hits">14</span> - - <code class="ruby"> expect(item).to be_a Contentful::BaseResource</code> - </li> - - <li class="never" data-hits="" data-linenumber="102"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="103"> - - - <code class="ruby"> }}</code> - </li> - - <li class="never" data-hits="" data-linenumber="104"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="105"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="106"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="107"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;Resource parsing&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="108"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;will correctly parse the `file` field of an asset&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="109"> - <span class="hits">1</span> - - <code class="ruby"> sync = create_client.sync(initial: true)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="110"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;sync_page&#39;) {</code> - </li> - - <li class="covered" data-hits="15" data-linenumber="111"> - <span class="hits">15</span> - - <code class="ruby"> asset = sync.first_page.items.select { |item| item.is_a?(Contentful::Asset) }.first</code> - </li> - - <li class="never" data-hits="" data-linenumber="112"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="113"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.file_name).to eq &#39;doge.jpg&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="114"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.content_type).to eq &#39;image/jpeg&#39;</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="115"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.details[&#39;image&#39;][&#39;width&#39;]).to eq 5800</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="116"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.details[&#39;image&#39;][&#39;height&#39;]).to eq 4350</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="117"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.details[&#39;size&#39;]).to eq 522943</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="118"> - <span class="hits">1</span> - - <code class="ruby"> expect(asset.file.url).to eq &#39;//images.contentful.com/cfexampleapi/1x0xpXu4pSGS4OukSyWGUK/cc1239c6385428ef26f4180190532818/doge.jpg&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="119"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="120"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="121"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="122"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="123"> - <span class="hits">1</span> - - <code class="ruby"> describe &#39;raw_mode&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="124"> - <span class="hits">1</span> - - <code class="ruby"> before do</code> - </li> - - <li class="covered" data-hits="3" data-linenumber="125"> - <span class="hits">3</span> - - <code class="ruby"> @sync = create_client(raw_mode: true).sync(initial: true)</code> - </li> - - <li class="never" data-hits="" data-linenumber="126"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="127"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="128"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;should not fail&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="129"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;sync_page_short&#39;) {</code> - </li> - - <li class="covered" data-hits="2" data-linenumber="130"> - <span class="hits">2</span> - - <code class="ruby"> expect { @sync.first_page }.not_to raise_error</code> - </li> - - <li class="never" data-hits="" data-linenumber="131"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="132"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="133"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="134"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;should return a raw Response&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="135"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;sync_page_short&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="136"> - <span class="hits">1</span> - - <code class="ruby"> expect(@sync.first_page).to be_a Contentful::Response</code> - </li> - - <li class="never" data-hits="" data-linenumber="137"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="138"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="139"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="140"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;should return JSON&#39; do</code> - </li> - - <li class="never" data-hits="" data-linenumber="141"> - - - <code class="ruby"> expected = {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="142"> - <span class="hits">1</span> - - <code class="ruby"> &quot;sys&quot; =&gt; {&quot;type&quot; =&gt; &quot;Array&quot;},</code> - </li> - - <li class="never" data-hits="" data-linenumber="143"> - - - <code class="ruby"> &quot;items&quot; =&gt; [</code> - </li> - - <li class="never" data-hits="" data-linenumber="144"> - - - <code class="ruby"> {</code> - </li> - - <li class="never" data-hits="" data-linenumber="145"> - - - <code class="ruby"> &quot;sys&quot; =&gt; {</code> - </li> - - <li class="never" data-hits="" data-linenumber="146"> - - - <code class="ruby"> &quot;space&quot; =&gt; {</code> - </li> - - <li class="never" data-hits="" data-linenumber="147"> - - - <code class="ruby"> &quot;sys&quot; =&gt; {</code> - </li> - - <li class="never" data-hits="" data-linenumber="148"> - - - <code class="ruby"> &quot;type&quot; =&gt; &quot;Link&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="149"> - - - <code class="ruby"> &quot;linkType&quot; =&gt; &quot;Space&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="150"> - - - <code class="ruby"> &quot;id&quot; =&gt; &quot;cfexampleapi&quot;}</code> - </li> - - <li class="never" data-hits="" data-linenumber="151"> - - - <code class="ruby"> },</code> - </li> - - <li class="never" data-hits="" data-linenumber="152"> - - - <code class="ruby"> &quot;type&quot; =&gt; &quot;Entry&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="153"> - - - <code class="ruby"> &quot;contentType&quot; =&gt; {</code> - </li> - - <li class="never" data-hits="" data-linenumber="154"> - - - <code class="ruby"> &quot;sys&quot; =&gt; {</code> - </li> - - <li class="never" data-hits="" data-linenumber="155"> - - - <code class="ruby"> &quot;type&quot; =&gt; &quot;Link&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="156"> - - - <code class="ruby"> &quot;linkType&quot; =&gt; &quot;ContentType&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="157"> - - - <code class="ruby"> &quot;id&quot; =&gt; &quot;1t9IbcfdCk6m04uISSsaIK&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="158"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="159"> - - - <code class="ruby"> },</code> - </li> - - <li class="never" data-hits="" data-linenumber="160"> - - - <code class="ruby"> &quot;id&quot; =&gt; &quot;5ETMRzkl9KM4omyMwKAOki&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="161"> - - - <code class="ruby"> &quot;revision&quot; =&gt; 2,</code> - </li> - - <li class="never" data-hits="" data-linenumber="162"> - - - <code class="ruby"> &quot;createdAt&quot; =&gt; &quot;2014-02-21T13:42:57.752Z&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="163"> - - - <code class="ruby"> &quot;updatedAt&quot; =&gt; &quot;2014-04-16T12:44:02.691Z&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="164"> - - - <code class="ruby"> },</code> - </li> - - <li class="never" data-hits="" data-linenumber="165"> - - - <code class="ruby"> &quot;fields&quot; =&gt; {</code> - </li> - - <li class="never" data-hits="" data-linenumber="166"> - - - <code class="ruby"> &quot;name&quot; =&gt; {&quot;en-US&quot;=&gt;&quot;London&quot;},</code> - </li> - - <li class="never" data-hits="" data-linenumber="167"> - - - <code class="ruby"> &quot;center&quot; =&gt; {</code> - </li> - - <li class="never" data-hits="" data-linenumber="168"> - - - <code class="ruby"> &quot;en-US&quot; =&gt; {&quot;lat&quot;=&gt;51.508515, &quot;lon&quot;=&gt;-0.12548719999995228}</code> - </li> - - <li class="never" data-hits="" data-linenumber="169"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="170"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="171"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="172"> - - - <code class="ruby"> ],</code> - </li> - - <li class="never" data-hits="" data-linenumber="173"> - - - <code class="ruby"> &quot;nextSyncUrl&quot; =&gt; &quot;https://cdn.contentful.com/spaces/cfexampleapi/environments/master/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4grw45QdybCr8Okw6AYwqbDksO3ehvDpUPCgcKsKXbCiAwPC8K2w4LDvsOkw6nCjhPDpcOQADElWsOoU8KGR3HCtsOAwqd6wp_Dulp8w6LDsF_CtsK7Kk05wrMvwrLClMOgG2_Dn2sGPg&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="174"> - - - <code class="ruby"> }</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="175"> - <span class="hits">1</span> - - <code class="ruby"> vcr(&#39;sync_page_short&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="176"> - <span class="hits">1</span> - - <code class="ruby"> expect(@sync.first_page.object).to eql expected</code> - </li> - - <li class="never" data-hits="" data-linenumber="177"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="178"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="179"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="180"> <code class="ruby">end</code> </li>