coverage/index.html in search-kit-0.0.6 vs coverage/index.html in search-kit-0.0.7
- old
+ new
@@ -3,40 +3,40 @@
<head>
<title>Code coverage for Search-kit</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src='./assets/0.10.0/application.js' type='text/javascript'></script>
<link href='./assets/0.10.0/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
- <link rel="shortcut icon" type="image/png" href="./assets/0.10.0/favicon_red.png" />
+ <link rel="shortcut icon" type="image/png" href="./assets/0.10.0/favicon_green.png" />
<link rel="icon" type="image/png" href="./assets/0.10.0/favicon.png" />
</head>
<body>
<div id="loading">
<img src="./assets/0.10.0/loading.gif" alt="loading"/>
</div>
<div id="wrapper" style="display:none;">
- <div class="timestamp">Generated <abbr class="timeago" title="2015-11-30T10:58:58-06:00">2015-11-30T10:58:58-06:00</abbr></div>
+ <div class="timestamp">Generated <abbr class="timeago" title="2015-11-30T13:36:49-06:00">2015-11-30T13:36:49-06: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="red">31.43%</span></span>
+ (<span class="covered_percent"><span class="green">98.1%</span></span>
covered at
<span class="covered_strength">
- <span class="red">
- 0.28
+ <span class="green">
+ 3.55
</span>
</span> hits/line)
</h2>
<a name="AllFiles"></a>
<div>
- <b>2</b> files in total.
- <b>35</b> relevant lines.
- <span class="green"><b>11</b> lines covered</span> and
- <span class="red"><b>24</b> lines missed </span>
+ <b>61</b> files in total.
+ <b>2268</b> relevant lines.
+ <span class="green"><b>2225</b> lines covered</span> and
+ <span class="red"><b>43</b> lines missed </span>
</div>
<table class="file_list">
<thead>
<tr>
<th>File</th>
@@ -50,28 +50,618 @@
</thead>
<tbody>
<tr>
<td class="strong"><a href="#ea4aee8e664c2722568830a0f0c773ee88f48250" class="src_link" title="lib/search_kit.rb">lib/search_kit.rb</a></td>
- <td class="red strong">4.17 %</td>
+ <td class="green strong">100.0 %</td>
<td>33</td>
<td>24</td>
- <td>1</td>
+ <td>24</td>
+ <td>0</td>
+ <td>2.4</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#02ad635ee5740179988e580306ab6ff85aaad7fd" class="src_link" title="lib/search_kit/cli.rb">lib/search_kit/cli.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>16</td>
+ <td>13</td>
+ <td>13</td>
+ <td>0</td>
+ <td>1.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#6f7ac3857dfc522d3ccf357b880e81aae76b8f36" class="src_link" title="lib/search_kit/cli/documents.rb">lib/search_kit/cli/documents.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>77</td>
+ <td>45</td>
+ <td>45</td>
+ <td>0</td>
+ <td>4.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#8c4f8c2a7029e05fe79223a128225e3fa372e653" class="src_link" title="lib/search_kit/cli/events.rb">lib/search_kit/cli/events.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>90</td>
+ <td>51</td>
+ <td>51</td>
+ <td>0</td>
+ <td>4.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#06355c4af74a2b702f9c0c8bacb1ad2a367ed0cc" class="src_link" title="lib/search_kit/cli/indices.rb">lib/search_kit/cli/indices.rb</a></td>
+ <td class="green strong">93.48 %</td>
+ <td>80</td>
+ <td>46</td>
+ <td>43</td>
+ <td>3</td>
+ <td>3.6</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#2ef6b785681bea229d544682bc69afaa3a06ee1b" class="src_link" title="lib/search_kit/cli/scaffolds.rb">lib/search_kit/cli/scaffolds.rb</a></td>
+ <td class="green strong">95.65 %</td>
+ <td>41</td>
<td>23</td>
- <td>0.0</td>
+ <td>22</td>
+ <td>1</td>
+ <td>2.6</td>
</tr>
<tr>
- <td class="strong"><a href="#6a4ecdd9246f807fcfbecc9b1dc5ee55fc23b2db" class="src_link" title="lib/search_kit/version.rb">lib/search_kit/version.rb</a></td>
- <td class="green strong">90.91 %</td>
- <td>20</td>
+ <td class="strong"><a href="#7950db67b9d2c69eeadc342d679a52e648333d5a" class="src_link" title="lib/search_kit/cli/search.rb">lib/search_kit/cli/search.rb</a></td>
+ <td class="yellow strong">89.47 %</td>
+ <td>62</td>
+ <td>38</td>
+ <td>34</td>
+ <td>4</td>
+ <td>2.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#49e73d14f0b046792eed70005c7d3670ac63c79c" class="src_link" title="lib/search_kit/cli/subscribers.rb">lib/search_kit/cli/subscribers.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>47</td>
+ <td>27</td>
+ <td>27</td>
+ <td>0</td>
+ <td>3.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#759c9d07762562638ab3aafcf7f1ef94234bcc7f" class="src_link" title="lib/search_kit/clients.rb">lib/search_kit/clients.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>12</td>
+ <td>10</td>
+ <td>10</td>
+ <td>0</td>
+ <td>1.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#11c0d2d387f2edf65a414a43dde6dfd4f3991a1a" class="src_link" title="lib/search_kit/clients/documents.rb">lib/search_kit/clients/documents.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>71</td>
+ <td>40</td>
+ <td>40</td>
+ <td>0</td>
+ <td>6.5</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#1703620bd71c2dac160973d252bdfba322bc88e9" class="src_link" title="lib/search_kit/clients/events.rb">lib/search_kit/clients/events.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>77</td>
+ <td>43</td>
+ <td>43</td>
+ <td>0</td>
+ <td>6.7</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#37f584a1db374f97c0dd34acb6c6989e7baa284f" class="src_link" title="lib/search_kit/clients/indices.rb">lib/search_kit/clients/indices.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>70</td>
+ <td>39</td>
+ <td>39</td>
+ <td>0</td>
+ <td>6.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#04e7a0595f4af8378444eace01941783aa4fff5c" class="src_link" title="lib/search_kit/clients/keys.rb">lib/search_kit/clients/keys.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>78</td>
+ <td>44</td>
+ <td>44</td>
+ <td>0</td>
+ <td>4.5</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#0d73c1123d394fd511aa7e763341d6fcc46317dc" class="src_link" title="lib/search_kit/clients/populate.rb">lib/search_kit/clients/populate.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>72</td>
+ <td>43</td>
+ <td>43</td>
+ <td>0</td>
+ <td>5.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#165dca77c5f5da80c4d54057962a18d40f514b8c" class="src_link" title="lib/search_kit/clients/scaffold.rb">lib/search_kit/clients/scaffold.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>36</td>
+ <td>18</td>
+ <td>18</td>
+ <td>0</td>
+ <td>4.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#a98f5c0a88a68907e745d6197d7bae088ea1d5e6" class="src_link" title="lib/search_kit/clients/search.rb">lib/search_kit/clients/search.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>33</td>
+ <td>19</td>
+ <td>19</td>
+ <td>0</td>
+ <td>5.4</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#6c04c4ba7ad24f497fa73a7f12d30ecb895aea93" class="src_link" title="lib/search_kit/clients/subscribers.rb">lib/search_kit/clients/subscribers.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>54</td>
+ <td>32</td>
+ <td>32</td>
+ <td>0</td>
+ <td>6.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#301e3c1e285eb9842d365882a554f5bf8c5f09e4" class="src_link" title="lib/search_kit/configuration.rb">lib/search_kit/configuration.rb</a></td>
+ <td class="yellow strong">87.88 %</td>
+ <td>63</td>
+ <td>33</td>
+ <td>29</td>
+ <td>4</td>
+ <td>19.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#8a64d3d076ac8f875871a0940f07b2d95b77ee2f" class="src_link" title="lib/search_kit/errors.rb">lib/search_kit/errors.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>12</td>
+ <td>10</td>
+ <td>10</td>
+ <td>0</td>
+ <td>1.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#6729bb292277725406022dbf37073cb5e1c97a01" class="src_link" title="lib/search_kit/logger.rb">lib/search_kit/logger.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>30</td>
+ <td>12</td>
+ <td>12</td>
+ <td>0</td>
+ <td>1.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#42fcdce6679883e42f4fb4592008870d2b2d7317" class="src_link" title="lib/search_kit/messages.rb">lib/search_kit/messages.rb</a></td>
+ <td class="red strong">54.55 %</td>
+ <td>41</td>
+ <td>22</td>
+ <td>12</td>
+ <td>10</td>
+ <td>0.5</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#11dbd3ddccb2a40d26776c9c878e8850575a0f18" class="src_link" title="lib/search_kit/messages/messaging.rb">lib/search_kit/messages/messaging.rb</a></td>
+ <td class="yellow strong">87.18 %</td>
+ <td>83</td>
+ <td>39</td>
+ <td>34</td>
+ <td>5</td>
+ <td>4.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#f003c10a94604816ecac8606a68fff9c180b46ed" class="src_link" title="lib/search_kit/models.rb">lib/search_kit/models.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>14</td>
<td>11</td>
+ <td>11</td>
+ <td>0</td>
+ <td>1.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#e05422f61848c51b55f9be09eb16b61bcd4a9b72" class="src_link" title="lib/search_kit/models/document.rb">lib/search_kit/models/document.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>30</td>
+ <td>14</td>
+ <td>14</td>
+ <td>0</td>
+ <td>1.6</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#b265574cb03a3ec10dd6cd9b3684f60824150e42" class="src_link" title="lib/search_kit/models/documents.rb">lib/search_kit/models/documents.rb</a></td>
+ <td class="red strong">76.47 %</td>
+ <td>31</td>
+ <td>17</td>
+ <td>13</td>
+ <td>4</td>
+ <td>4.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#19ee630b527cd18bcddf32258d4b5e011d2c67c4" class="src_link" title="lib/search_kit/models/event.rb">lib/search_kit/models/event.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>18</td>
+ <td>11</td>
+ <td>11</td>
+ <td>0</td>
+ <td>5.9</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#540c92052dd89a90a6c81d58dd7b06e122dd42ff" class="src_link" title="lib/search_kit/models/events.rb">lib/search_kit/models/events.rb</a></td>
+ <td class="red strong">70.59 %</td>
+ <td>31</td>
+ <td>17</td>
+ <td>12</td>
+ <td>5</td>
+ <td>2.6</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#8dbfcd08b310a90c27d98f046f73cf199dde9df1" class="src_link" title="lib/search_kit/models/key.rb">lib/search_kit/models/key.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>26</td>
+ <td>16</td>
+ <td>16</td>
+ <td>0</td>
+ <td>4.9</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#5350a3db664b89863367db63f0234c0851a398e4" class="src_link" title="lib/search_kit/models/keys.rb">lib/search_kit/models/keys.rb</a></td>
+ <td class="green strong">90.48 %</td>
+ <td>38</td>
+ <td>21</td>
+ <td>19</td>
+ <td>2</td>
+ <td>6.3</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#88a48a5f31a8c5013c2bbcc76f73a98d13ff4fdd" class="src_link" title="lib/search_kit/models/search.rb">lib/search_kit/models/search.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>17</td>
<td>10</td>
+ <td>10</td>
+ <td>0</td>
+ <td>2.8</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#565b166b090d2ac1fbaa839552be52c7697d202a" class="src_link" title="lib/search_kit/models/subscriber.rb">lib/search_kit/models/subscriber.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>26</td>
+ <td>16</td>
+ <td>16</td>
+ <td>0</td>
+ <td>8.8</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#1739292ead23399da05af931e58221e4a6947f17" class="src_link" title="lib/search_kit/polling.rb">lib/search_kit/polling.rb</a></td>
+ <td class="red strong">73.33 %</td>
+ <td>30</td>
+ <td>15</td>
+ <td>11</td>
+ <td>4</td>
+ <td>1.0</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#2bbb5d064d5f585b39714d0209d414583f53705c" class="src_link" title="lib/search_kit/polling/process.rb">lib/search_kit/polling/process.rb</a></td>
+ <td class="green strong">95.0 %</td>
+ <td>40</td>
+ <td>20</td>
+ <td>19</td>
<td>1</td>
- <td>0.9</td>
+ <td>2.4</td>
</tr>
+ <tr>
+ <td class="strong"><a href="#a8f8e3ad09f54a9df3faf746349dd6a3361f9010" class="src_link" title="lib/search_kit/thor.rb">lib/search_kit/thor.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>12</td>
+ <td>8</td>
+ <td>8</td>
+ <td>0</td>
+ <td>10.4</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#6a4ecdd9246f807fcfbecc9b1dc5ee55fc23b2db" class="src_link" title="lib/search_kit/version.rb">lib/search_kit/version.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>20</td>
+ <td>11</td>
+ <td>11</td>
+ <td>0</td>
+ <td>1.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#aadaf5955bdf242e02f195a0a0d24b40dc9b5fe2" class="src_link" title="spec/search_kit/cli/documents_spec.rb">spec/search_kit/cli/documents_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>234</td>
+ <td>130</td>
+ <td>130</td>
+ <td>0</td>
+ <td>2.4</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#a5a8667a114b5cd4fe8e06d60385632062aa0db9" class="src_link" title="spec/search_kit/cli/events_spec.rb">spec/search_kit/cli/events_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>243</td>
+ <td>137</td>
+ <td>137</td>
+ <td>0</td>
+ <td>2.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#7be34029cd94c988e9feb272c2f97ecd32bf91a2" class="src_link" title="spec/search_kit/cli/indices_spec.rb">spec/search_kit/cli/indices_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>213</td>
+ <td>119</td>
+ <td>119</td>
+ <td>0</td>
+ <td>2.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#4a3dfeedaa9fa6440dcf8acbad0379f0290f7ff4" class="src_link" title="spec/search_kit/cli/scaffolds_spec.rb">spec/search_kit/cli/scaffolds_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>70</td>
+ <td>41</td>
+ <td>41</td>
+ <td>0</td>
+ <td>2.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#83164236d68ad1048eeca55428628ff7975c9a72" class="src_link" title="spec/search_kit/cli/search_spec.rb">spec/search_kit/cli/search_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>77</td>
+ <td>44</td>
+ <td>44</td>
+ <td>0</td>
+ <td>2.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#8316f221a02888ba368e428a23a1788cd0ff469a" class="src_link" title="spec/search_kit/cli/subscribers_spec.rb">spec/search_kit/cli/subscribers_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>108</td>
+ <td>59</td>
+ <td>59</td>
+ <td>0</td>
+ <td>2.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#77c40391d66a01527ba8cf13f9131cd43a465f1f" class="src_link" title="spec/search_kit/clients/documents_spec.rb">spec/search_kit/clients/documents_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>210</td>
+ <td>107</td>
+ <td>107</td>
+ <td>0</td>
+ <td>3.7</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#702520ccbeb6503195a6837c6955fc14395245d1" class="src_link" title="spec/search_kit/clients/events_spec.rb">spec/search_kit/clients/events_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>202</td>
+ <td>107</td>
+ <td>107</td>
+ <td>0</td>
+ <td>3.7</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#8983cc176455e47c3d9ae69f42531c6b3295f4a4" class="src_link" title="spec/search_kit/clients/indices_spec.rb">spec/search_kit/clients/indices_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>193</td>
+ <td>104</td>
+ <td>104</td>
+ <td>0</td>
+ <td>3.4</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#bf25117f1c4a980b79ddfe284f8e2b2465306ad9" class="src_link" title="spec/search_kit/clients/keys_spec.rb">spec/search_kit/clients/keys_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>216</td>
+ <td>117</td>
+ <td>117</td>
+ <td>0</td>
+ <td>3.4</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#e92fe2a3328028ac3c1ff90c9971c3e5f32ca919" class="src_link" title="spec/search_kit/clients/populate_spec.rb">spec/search_kit/clients/populate_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>195</td>
+ <td>103</td>
+ <td>103</td>
+ <td>0</td>
+ <td>3.7</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#2956c2b61788d8b33009bd05b8a5d291f53b62f0" class="src_link" title="spec/search_kit/clients/scaffold_spec.rb">spec/search_kit/clients/scaffold_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>70</td>
+ <td>36</td>
+ <td>36</td>
+ <td>0</td>
+ <td>2.6</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#04c25164a52d051c558e56a48dea5796c0952d17" class="src_link" title="spec/search_kit/clients/search_spec.rb">spec/search_kit/clients/search_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>87</td>
+ <td>48</td>
+ <td>48</td>
+ <td>0</td>
+ <td>3.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#7988686f2fece63da46b5ffc0b8be7e5f1dbc10c" class="src_link" title="spec/search_kit/clients/subscribers_spec.rb">spec/search_kit/clients/subscribers_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>166</td>
+ <td>85</td>
+ <td>85</td>
+ <td>0</td>
+ <td>3.6</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#1eeb8cc0143cf0f537138464e6f664e35a300656" class="src_link" title="spec/search_kit/configuration_spec.rb">spec/search_kit/configuration_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>25</td>
+ <td>13</td>
+ <td>13</td>
+ <td>0</td>
+ <td>1.8</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#113a213a6e4e6d30c6c20d36fd8dc7b1ff94aa61" class="src_link" title="spec/search_kit/messages_spec.rb">spec/search_kit/messages_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>45</td>
+ <td>27</td>
+ <td>27</td>
+ <td>0</td>
+ <td>2.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#b55fc7449a4d2c9c8d51a643aa6c496549bbc71d" class="src_link" title="spec/search_kit/models/document_spec.rb">spec/search_kit/models/document_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>34</td>
+ <td>19</td>
+ <td>19</td>
+ <td>0</td>
+ <td>2.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#abe3760ff37f2a1e4fe992bf4b7adf6cdd6d6c74" class="src_link" title="spec/search_kit/models/documents_spec.rb">spec/search_kit/models/documents_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>12</td>
+ <td>7</td>
+ <td>7</td>
+ <td>0</td>
+ <td>2.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#5010e41abae2d1ce106aae48a134af7f9cb01bc1" class="src_link" title="spec/search_kit/models/event_spec.rb">spec/search_kit/models/event_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>14</td>
+ <td>9</td>
+ <td>9</td>
+ <td>0</td>
+ <td>2.8</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#45b27afaf5b04598d672c1b89332b34027f6d3b8" class="src_link" title="spec/search_kit/models/events_spec.rb">spec/search_kit/models/events_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>12</td>
+ <td>7</td>
+ <td>7</td>
+ <td>0</td>
+ <td>2.1</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#1acff358ef575b030819b388457c0e18738ae9d7" class="src_link" title="spec/search_kit/models/key_spec.rb">spec/search_kit/models/key_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>26</td>
+ <td>15</td>
+ <td>15</td>
+ <td>0</td>
+ <td>2.3</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#f77f9b90fa94ec206baf18142085b69958d9dc3c" class="src_link" title="spec/search_kit/models/keys_spec.rb">spec/search_kit/models/keys_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>39</td>
+ <td>18</td>
+ <td>18</td>
+ <td>0</td>
+ <td>2.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#4d94a689850b6376c68bb5b16af4c8dba8f9cd87" class="src_link" title="spec/search_kit/models/subscriber_spec.rb">spec/search_kit/models/subscriber_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>22</td>
+ <td>13</td>
+ <td>13</td>
+ <td>0</td>
+ <td>2.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#e2fd081246518b5179fe20c3eca4e08ada3511f7" class="src_link" title="spec/search_kit/polling/process_spec.rb">spec/search_kit/polling/process_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>65</td>
+ <td>28</td>
+ <td>28</td>
+ <td>0</td>
+ <td>2.4</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#b7260a9485c0e24754a3a73a6a8c6b0752a836ae" class="src_link" title="spec/search_kit/polling_spec.rb">spec/search_kit/polling_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>24</td>
+ <td>13</td>
+ <td>13</td>
+ <td>0</td>
+ <td>2.2</td>
+ </tr>
+
+ <tr>
+ <td class="strong"><a href="#c2616e5ad65c8699e7311860fc3850d5c215948f" class="src_link" title="spec/search_kit_spec.rb">spec/search_kit_spec.rb</a></td>
+ <td class="green strong">100.0 %</td>
+ <td>7</td>
+ <td>4</td>
+ <td>4</td>
+ <td>0</td>
+ <td>1.0</td>
+ </tr>
+
</tbody>
</table>
</div>
@@ -87,15 +677,15 @@
<div class="source_files">
<div class="source_table" id="ea4aee8e664c2722568830a0f0c773ee88f48250">
<div class="header">
<h3>lib/search_kit.rb</h3>
- <h4><span class="red">4.17 %</span> covered</h4>
+ <h4><span class="green">100.0 %</span> covered</h4>
<div>
<b>24</b> relevant lines.
- <span class="green"><b>1</b> lines covered</span> and
- <span class="red"><b>23</b> lines missed.</span>
+ <span class="green"><b>24</b> lines covered</span> and
+ <span class="red"><b>0</b> lines missed.</span>
</div>
</div>
<pre>
<ol>
@@ -104,214 +694,9556 @@
<span class="hits">1</span>
<code class="ruby">require 'bundler/setup'</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="2">
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
-
<code class="ruby">require 'i18n'</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="3">
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
-
<code class="ruby">require "search_kit/version"</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="4">
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
-
<code class="ruby">require "search_kit/thor"</code>
</li>
<li class="never" data-hits="" data-linenumber="5">
<code class="ruby"></code>
</li>
- <li class="missed" data-hits="0" data-linenumber="6">
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+ <code class="ruby"> autoload :CLI, 'search_kit/cli'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Clients, 'search_kit/clients'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Configuration, 'search_kit/configuration'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Errors, 'search_kit/errors'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="11">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Logger, 'search_kit/logger'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Messages, 'search_kit/messages'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="13">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Models, 'search_kit/models'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="14">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Polling, 'search_kit/polling'</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"> def self.logger</code>
+ </li>
+
+ <li class="covered" data-hits="35" data-linenumber="17">
+ <span class="hits">35</span>
+
+ <code class="ruby"> @logger ||= Logger.new</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"> extend Configuration</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"> configure do |config|</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="23">
+ <span class="hits">1</span>
+
+ <code class="ruby"> config.app_dir = fetch("APP_DIR")</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="24">
+ <span class="hits">1</span>
+
+ <code class="ruby"> config.app_env = fetch("APP_ENV")</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="25">
+ <span class="hits">1</span>
+
+ <code class="ruby"> config.app_uri = fetch("APP_URI")</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="26">
+ <span class="hits">1</span>
+
+ <code class="ruby"> config.config_dir = File.join(config.app_dir, "config")</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="27">
+ <span class="hits">1</span>
+
+ <code class="ruby"> config.log_dir = fetch("LOG_DIR")</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> config.verbose = fetch("APP_VERBOSE")</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"> I18n.load_path += Dir.glob(File.join(config.config_dir, "locales/*.yml"))</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="32">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="33">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="02ad635ee5740179988e580306ab6ff85aaad7fd">
+ <div class="header">
+ <h3>lib/search_kit/cli.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>13</b> relevant lines.
+ <span class="green"><b>13</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 'ansi'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'highline'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'thor'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'search_kit/thor'</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">module SearchKit</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="7">
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+ <code class="ruby"> module CLI</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
- <code class="ruby"> autoload :CLI, 'search_kit/cli'</code>
+ <code class="ruby"> autoload :All, 'search_kit/cli/all'</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="8">
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+ <code class="ruby"> autoload :Documents, 'search_kit/cli/documents'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
- <code class="ruby"> autoload :Clients, 'search_kit/clients'</code>
+ <code class="ruby"> autoload :Events, 'search_kit/cli/events'</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="9">
+ <li class="covered" data-hits="1" data-linenumber="11">
+ <span class="hits">1</span>
+ <code class="ruby"> autoload :Indices, 'search_kit/cli/indices'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
- <code class="ruby"> autoload :Configuration, 'search_kit/configuration'</code>
+ <code class="ruby"> autoload :Scaffolds, 'search_kit/cli/scaffolds'</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="10">
+ <li class="covered" data-hits="1" data-linenumber="13">
+ <span class="hits">1</span>
+ <code class="ruby"> autoload :Search, 'search_kit/cli/search'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="14">
+ <span class="hits">1</span>
- <code class="ruby"> autoload :Errors, 'search_kit/errors'</code>
+ <code class="ruby"> autoload :Subscribers, 'search_kit/cli/subscribers'</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="11">
+ <li class="never" data-hits="" data-linenumber="15">
- <code class="ruby"> autoload :Logger, 'search_kit/logger'</code>
+ <code class="ruby"> end</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="12">
+ <li class="never" data-hits="" data-linenumber="16">
- <code class="ruby"> autoload :Messages, 'search_kit/messages'</code>
+ <code class="ruby">end</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="13">
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="6f7ac3857dfc522d3ccf357b880e81aae76b8f36">
+ <div class="header">
+ <h3>lib/search_kit/cli/documents.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>45</b> relevant lines.
+ <span class="green"><b>45</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
- <code class="ruby"> autoload :Models, 'search_kit/models'</code>
+ <code class="ruby">require 'json'</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="14">
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+ <code class="ruby">require 'search_kit/thor'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
- <code class="ruby"> autoload :Polling, 'search_kit/polling'</code>
+ <code class="ruby">require 'thor'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module CLI</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Documents < Thor</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> namespace :documents</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"> no_commands do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def client</code>
+ </li>
+
+ <li class="covered" data-hits="62" data-linenumber="13">
+ <span class="hits">62</span>
+
+ <code class="ruby"> @client ||= SearchKit::Clients::Documents.new</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="missed" data-hits="0" data-linenumber="16">
+ <li class="covered" data-hits="1" data-linenumber="16">
+ <span class="hits">1</span>
+ <code class="ruby"> def messages</code>
+ </li>
+
+ <li class="covered" data-hits="42" data-linenumber="17">
+ <span class="hits">42</span>
- <code class="ruby"> def self.logger</code>
+ <code class="ruby"> @messages ||= SearchKit::Messages.new</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="17">
+ <li class="never" data-hits="" data-linenumber="18">
- <code class="ruby"> @logger ||= Logger.new</code>
+ <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"> document :create</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def create(slug, document)</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="23">
+ <span class="hits">8</span>
+
+ <code class="ruby"> document = JSON.parse(document, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="24">
+ <span class="hits">7</span>
+
+ <code class="ruby"> response = client.create(slug, document)</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="25">
+ <span class="hits">3</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="26">
+
+
+ <code class="ruby"> rescue Errors::IndexNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="27">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="28">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="29">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="30">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="31">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="32">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="33">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="34">
+
+
+ <code class="ruby"> rescue JSON::ParserError</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="35">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.json_parse_error</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"> document :delete</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="39">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def delete(slug, id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="40">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = client.delete(slug, id)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="41">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"> rescue Errors::IndexNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="44">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="45">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="46">
+
+
+ <code class="ruby"> end</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"> document :show</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="49">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def show(slug, id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="50">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = client.show(slug, id)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="51">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="52">
+
+
+ <code class="ruby"> rescue Errors::IndexNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="53">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="54">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="55">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="58">
+ <span class="hits">1</span>
+
+ <code class="ruby"> document :update</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="59">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def update(slug, id, document)</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="60">
+ <span class="hits">8</span>
+
+ <code class="ruby"> document = JSON.parse(document, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="61">
+ <span class="hits">7</span>
+
+ <code class="ruby"> response = client.update(slug, id, document)</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="62">
+ <span class="hits">3</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="63">
+
+
+ <code class="ruby"> rescue JSON::ParserError</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="64">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.json_parse_error</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="65">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="66">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="67">
+
+
+ <code class="ruby"> rescue Errors::IndexNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="68">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="69">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="70">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="71">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="72">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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="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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="8c4f8c2a7029e05fe79223a128225e3fa372e653">
+ <div class="header">
+ <h3>lib/search_kit/cli/events.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>51</b> relevant lines.
+ <span class="green"><b>51</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'search_kit/thor'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'thor'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module CLI</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Events < Thor</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> namespace :events</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"> no_commands do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def client</code>
+ </li>
+
+ <li class="covered" data-hits="73" data-linenumber="13">
+ <span class="hits">73</span>
+
+ <code class="ruby"> @client ||= SearchKit::Clients::Events.new</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"> def messages</code>
+ </li>
+
+ <li class="covered" data-hits="40" data-linenumber="17">
+ <span class="hits">40</span>
+
+ <code class="ruby"> @messages ||= SearchKit::Messages.new</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"> document :complete</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def complete(id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="23">
+ <span class="hits">4</span>
+
+ <code class="ruby"> client.complete(id)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="24">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info I18n.t('cli.events.complete.success', id: id)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="25">
+
+
+ <code class="ruby"> rescue Errors::EventNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="26">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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"> document :pending</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="32">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def pending(channel = nil)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="33">
+ <span class="hits">7</span>
+
+ <code class="ruby"> events = channel ? client.pending(channel) : client.index</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="34">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="35">
+ <span class="hits">3</span>
+
+ <code class="ruby"> message_path = %w(cli events pending success)</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="36">
+ <span class="hits">3</span>
+
+ <code class="ruby"> message_path << (channel ? 'filtered' : 'index')</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="37">
+ <span class="hits">3</span>
+
+ <code class="ruby"> message_path << (events.any? ? 'discovered' : 'empty')</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="38">
+ <span class="hits">3</span>
+
+ <code class="ruby"> message = I18n.t(message_path.join('.'), channel: channel)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="39">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="40">
+ <span class="hits">3</span>
+
+ <code class="ruby"> messages.info(message)</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="41">
+ <span class="hits">3</span>
+
+ <code class="ruby"> events.each { |event| messages.info(event.to_json) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="44">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="45">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="46">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="47">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="48">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="49">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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"> document :publish</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="53">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def publish(channel, payload)</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="54">
+ <span class="hits">8</span>
+
+ <code class="ruby"> payload = JSON.parse(payload, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="55">
+ <span class="hits">7</span>
+
+ <code class="ruby"> event = client.publish(channel, payload)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="56">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="57">
+ <span class="hits">3</span>
+
+ <code class="ruby"> message = I18n.t('cli.events.publish.success',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="58">
+
+
+ <code class="ruby"> channel: channel,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="59">
+
+
+ <code class="ruby"> id: event.id</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="60">
+
+
+ <code class="ruby"> )</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="61">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="62">
+ <span class="hits">3</span>
+
+ <code class="ruby"> messages.info(message)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="63">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="64">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="65">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="66">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="67">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="68">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="69">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="70">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="71">
+
+
+ <code class="ruby"> rescue JSON::ParserError</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="72">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.json_parse_error</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"> document :status</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="76">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def status(id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="77">
+ <span class="hits">4</span>
+
+ <code class="ruby"> event = client.show(id)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="78">
+ <span class="hits">2</span>
+
+ <code class="ruby"> status = event.state</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="79">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="80">
+ <span class="hits">2</span>
+
+ <code class="ruby"> message = I18n.t('cli.events.status.success', id: id, status: status)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="81">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info(message)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="82">
+
+
+ <code class="ruby"> rescue Errors::EventNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="83">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="84">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="85">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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="never" data-hits="" data-linenumber="88">
+
+
+ <code class="ruby"> end</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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="06355c4af74a2b702f9c0c8bacb1ad2a367ed0cc">
+ <div class="header">
+ <h3>lib/search_kit/cli/indices.rb</h3>
+ <h4><span class="green">93.48 %</span> covered</h4>
+ <div>
+ <b>46</b> relevant lines.
+ <span class="green"><b>43</b> lines covered</span> and
+ <span class="red"><b>3</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'search_kit/thor'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'thor'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module CLI</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Indices < Thor</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> namespace :indices</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"> no_commands do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def client</code>
+ </li>
+
+ <li class="covered" data-hits="59" data-linenumber="13">
+ <span class="hits">59</span>
+
+ <code class="ruby"> @client ||= SearchKit::Clients::Indices.new</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"> def messages</code>
+ </li>
+
+ <li class="covered" data-hits="38" data-linenumber="17">
+ <span class="hits">38</span>
+
+ <code class="ruby"> @messages ||= SearchKit::Messages.new</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="missed" data-hits="0" data-linenumber="20">
+ <li class="covered" data-hits="1" data-linenumber="21">
+ <span class="hits">1</span>
+ <code class="ruby"> document :archive</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
- <code class="ruby"> extend Configuration</code>
+ <code class="ruby"> def archive(slug)</code>
</li>
+ <li class="covered" data-hits="5" data-linenumber="23">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = client.archive(slug)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="24">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="25">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="26">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"> rescue Errors::IndexNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="29">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="30">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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"> document :create</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="34">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def create(name)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="35">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = client.create(name)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="36">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="37">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="38">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="39">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="40">
+
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="41">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="42">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="43">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="44">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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"> document :show</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="48">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def show(slug)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="49">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = client.show(slug)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="50">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="51">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="52">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="53">
+
+
+ <code class="ruby"> rescue Errors::IndexNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="54">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="55">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="56">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="59">
+ <span class="hits">1</span>
+
+ <code class="ruby"> document :update</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="60">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def update(slug, update_json)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="61">
+ <span class="hits">6</span>
+
+ <code class="ruby"> options = JSON.parse(update_json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="62">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = client.update(slug, options)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="63">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="64">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="65">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="66">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="67">
+
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"> rescue Errors::IndexNotFound</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="69">
+
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="70">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="71">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="72">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="73">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="74">
+
+
+ <code class="ruby"> rescue JSON::ParserError</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="75">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.json_parse_error</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="never" data-hits="" data-linenumber="78">
+
+
+ <code class="ruby"> end</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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="2ef6b785681bea229d544682bc69afaa3a06ee1b">
+ <div class="header">
+ <h3>lib/search_kit/cli/scaffolds.rb</h3>
+ <h4><span class="green">95.65 %</span> covered</h4>
+ <div>
+ <b>23</b> relevant lines.
+ <span class="green"><b>22</b> lines covered</span> and
+ <span class="red"><b>1</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'search_kit/thor'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'thor'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module CLI</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Scaffolds < Thor</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> namespace :scaffolds</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"> no_commands do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def client</code>
+ </li>
+
+ <li class="covered" data-hits="17" data-linenumber="13">
+ <span class="hits">17</span>
+
+ <code class="ruby"> @client ||= SearchKit::Clients::Scaffold.new</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"> def messages</code>
+ </li>
+
+ <li class="covered" data-hits="11" data-linenumber="17">
+ <span class="hits">11</span>
+
+ <code class="ruby"> @messages ||= SearchKit::Messages.new</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"> document :scaffold</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def create(name, json = "[]")</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="23">
+ <span class="hits">6</span>
+
+ <code class="ruby"> documents = JSON.parse(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="24">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = client.create(name, documents)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="25">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="26">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info response.to_json</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="29">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="30">
+
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="31">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="32">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="33">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="34">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="35">
+
+
+ <code class="ruby"> rescue JSON::ParserError</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="36">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.json_parse_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="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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="7950db67b9d2c69eeadc342d679a52e648333d5a">
+ <div class="header">
+ <h3>lib/search_kit/cli/search.rb</h3>
+ <h4><span class="yellow">89.47 %</span> covered</h4>
+ <div>
+ <b>38</b> relevant lines.
+ <span class="green"><b>34</b> lines covered</span> and
+ <span class="red"><b>4</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'search_kit/thor'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'thor'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module CLI</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Search < Thor</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> namespace :search</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"> no_commands do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def client</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="13">
+ <span class="hits">20</span>
+
+ <code class="ruby"> @client ||= SearchKit::Clients::Search.new</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"> def messages</code>
+ </li>
+
+ <li class="covered" data-hits="13" data-linenumber="17">
+ <span class="hits">13</span>
+
+ <code class="ruby"> @messages ||= SearchKit::Messages.new</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"> document :create</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> option :display, aliases: ['-d'], type: :array, required: false</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="23">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def create(slug, phrase)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="24">
+ <span class="hits">7</span>
+
+ <code class="ruby"> search = client.search(slug, phrase: phrase)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="25">
+ <span class="hits">2</span>
+
+ <code class="ruby"> head_path = 'cli.search.create.success.headline'</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="26">
+ <span class="hits">2</span>
+
+ <code class="ruby"> info_path = 'cli.search.create.success.info'</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="27">
+ <span class="hits">2</span>
+
+ <code class="ruby"> headline = I18n.t(head_path, slug: slug, phrase: phrase)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="28">
+ <span class="hits">2</span>
+
+ <code class="ruby"> info = I18n.t(info_path, count: search.results, time: search.time)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="29">
+ <span class="hits">2</span>
+
+ <code class="ruby"> lines = [ headline, info ]</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="30">
+ <span class="hits">2</span>
+
+ <code class="ruby"> display = options.fetch('display', [])</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="31">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="32">
+ <span class="hits">2</span>
+
+ <code class="ruby"> lines += search.documents.map do |document|</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="33">
+
+
+ <code class="ruby"> if display.any?</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="34">
+
+
+ <code class="ruby"> fields = display.map { |field| document.get(field) }</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="35">
+
+
+ <code class="ruby"> " -- #{fields.join(' | ')} | score: #{document.score}"</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="36">
+
+
+ <code class="ruby"> else</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="37">
+
+
+ <code class="ruby"> " -- #{document.id} | score: #{document.score}"</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="2" data-linenumber="41">
+ <span class="hits">2</span>
+
+ <code class="ruby"> lines.each(&messages.method(:info))</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="44">
+
+
+ <code class="ruby"> rescue Errors::IndexNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="45">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="46">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="47">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="48">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="49">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="50">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="51">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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"> no_commands do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="55">
+ <span class="hits">1</span>
+
+ <code class="ruby"> alias_method :search, :create</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="56">
+ <span class="hits">1</span>
+
+ <code class="ruby"> alias_method :c, :create</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="57">
+ <span class="hits">1</span>
+
+ <code class="ruby"> alias_method :s, :search</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="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="49e73d14f0b046792eed70005c7d3670ac63c79c">
+ <div class="header">
+ <h3>lib/search_kit/cli/subscribers.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>27</b> relevant lines.
+ <span class="green"><b>27</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'search_kit/thor'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'thor'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module CLI</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Subscribers < Thor</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> namespace :subscribers</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"> no_commands do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def client</code>
+ </li>
+
+ <li class="covered" data-hits="28" data-linenumber="13">
+ <span class="hits">28</span>
+
+ <code class="ruby"> @client ||= SearchKit::Clients::Subscribers.new</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"> def messages</code>
+ </li>
+
+ <li class="covered" data-hits="18" data-linenumber="17">
+ <span class="hits">18</span>
+
+ <code class="ruby"> @messages ||= SearchKit::Messages.new</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"> document :create</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def create(email, password)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="23">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subscriber = client.create(email: email, password: password)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="24">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info(subscriber.to_json)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="25">
+
+
+ <code class="ruby"> rescue Errors::BadRequest</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="26">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.bad_request</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"> rescue Errors::Unprocessable</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="29">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="30">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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"> document :info</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="34">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def info</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="35">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subscriber = client.info</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="36">
+ <span class="hits">2</span>
+
+ <code class="ruby"> messages.info(subscriber.to_json)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="37">
+
+
+ <code class="ruby"> rescue Errors::SubscriberNotFound</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="38">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.not_found</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="39">
+
+
+ <code class="ruby"> rescue Errors::Unauthorized</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="40">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="41">
+
+
+ <code class="ruby"> rescue Faraday::ConnectionFailed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="42">
+ <span class="hits">1</span>
+
+ <code class="ruby"> messages.no_service</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="never" data-hits="" data-linenumber="45">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="46">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="47">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="759c9d07762562638ab3aafcf7f1ef94234bcc7f">
+ <div class="header">
+ <h3>lib/search_kit/clients.rb</h3>
+ <h4><span class="green">100.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>
+ </div>
+ </div>
+
+ <pre>
+ <ol>
+
+ <li class="covered" data-hits="1" data-linenumber="1">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Documents, 'search_kit/clients/documents'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Events, 'search_kit/clients/events'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Indices, 'search_kit/clients/indices'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Keys, 'search_kit/clients/keys'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Populate, 'search_kit/clients/populate'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Scaffold, 'search_kit/clients/scaffold'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Search, 'search_kit/clients/search'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Subscribers, 'search_kit/clients/subscribers'</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="11c0d2d387f2edf65a414a43dde6dfd4f3991a1a">
+ <div class="header">
+ <h3>lib/search_kit/clients/documents.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>40</b> relevant lines.
+ <span class="green"><b>40</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Documents</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :connection, :token</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="46" data-linenumber="10">
+ <span class="hits">46</span>
+
+ <code class="ruby"> uri = [SearchKit.config.app_uri, "documents"].join("/")</code>
+ </li>
+
+ <li class="covered" data-hits="46" data-linenumber="11">
+ <span class="hits">46</span>
+
+ <code class="ruby"> @connection = Faraday.new(uri)</code>
+ </li>
+
+ <li class="covered" data-hits="46" data-linenumber="12">
+ <span class="hits">46</span>
+
+ <code class="ruby"> @token = SearchKit.config.app_token</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"> def create(slug, options)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="16">
+ <span class="hits">6</span>
+
+ <code class="ruby"> document = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> data: { type: "documents", attributes: options }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="21">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = connection.post(slug, document)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="22">
+ <span class="hits">6</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="24">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="25">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="26">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="27">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="28">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="29">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def delete(slug, id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="33">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.delete("#{slug}/#{id}", token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="34">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="35">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="36">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="37">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="38">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="39">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def show(slug, id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="43">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.get("#{slug}/#{id}", token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="44">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="45">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="46">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="47">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="48">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="49">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def update(slug, id, options)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="53">
+ <span class="hits">6</span>
+
+ <code class="ruby"> document = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="54">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="55">
+
+
+ <code class="ruby"> data: { type: "documents", id: id, attributes: options }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="56">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="57">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="58">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = connection.patch("#{slug}/#{id}", document)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="59">
+ <span class="hits">6</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="60">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="61">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="62">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="63">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="64">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="65">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="66">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="67">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="71">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="1703620bd71c2dac160973d252bdfba322bc88e9">
+ <div class="header">
+ <h3>lib/search_kit/clients/events.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>43</b> relevant lines.
+ <span class="green"><b>43</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Events</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :connection, :token</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="54" data-linenumber="10">
+ <span class="hits">54</span>
+
+ <code class="ruby"> uri = [ SearchKit.config.app_uri, "events" ].join("/")</code>
+ </li>
+
+ <li class="covered" data-hits="54" data-linenumber="11">
+ <span class="hits">54</span>
+
+ <code class="ruby"> @connection = Faraday.new(uri)</code>
+ </li>
+
+ <li class="covered" data-hits="54" data-linenumber="12">
+ <span class="hits">54</span>
+
+ <code class="ruby"> @token = SearchKit.config.app_token</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"> def complete(id)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="16">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = connection.delete(id, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="17">
+ <span class="hits">5</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="19">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="20">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::EventNotFound if response.status == 404</code>
+ </li>
+
<li class="never" data-hits="" data-linenumber="21">
<code class="ruby"></code>
</li>
- <li class="missed" data-hits="0" data-linenumber="22">
+ <li class="covered" data-hits="3" data-linenumber="22">
+ <span class="hits">3</span>
+ <code class="ruby"> SearchKit::Models::Event.new body.fetch(:data, {})</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
- <code class="ruby"> configure do |config|</code>
+
+ <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"> def index</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="26">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.get(token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="27">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="28">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="29">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="30">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="31">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Events.new body.fetch(:data, [])</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"> def pending(channel)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="35">
+ <span class="hits">4</span>
+
+ <code class="ruby"> params = { "filter[channel]" => channel, token: token }</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="36">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.get('', params)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="37">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="38">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="39">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="40">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="41">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="43">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Events.new body.fetch(:data, [])</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"> def publish(channel, payload)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="47">
+ <span class="hits">6</span>
+
+ <code class="ruby"> params = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="48">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="49">
+
+
+ <code class="ruby"> data: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="50">
+
+
+ <code class="ruby"> type: 'events',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="51">
+
+
+ <code class="ruby"> attributes: { channel: channel, payload: payload }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="52">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="53">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="54">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="55">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = connection.post("", params)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="56">
+ <span class="hits">6</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="57">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="58">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="59">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="60">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="61">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="62">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Event.new body.fetch(:data, {})</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"> def show(id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="66">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.get(id, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="67">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="69">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="70">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::EventNotFound if response.status == 404</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="71">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="72">
+ <span class="hits">2</span>
+
+ <code class="ruby"> SearchKit::Models::Event.new body.fetch(:data, {})</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="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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="37f584a1db374f97c0dd34acb6c6989e7baa284f">
+ <div class="header">
+ <h3>lib/search_kit/clients/indices.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>39</b> relevant lines.
+ <span class="green"><b>39</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Indices</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :connection, :token</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="42" data-linenumber="10">
+ <span class="hits">42</span>
+
+ <code class="ruby"> uri = [SearchKit.config.app_uri, "indices"].join("/")</code>
+ </li>
+
+ <li class="covered" data-hits="42" data-linenumber="11">
+ <span class="hits">42</span>
+
+ <code class="ruby"> @connection = Faraday.new(uri)</code>
+ </li>
+
+ <li class="covered" data-hits="42" data-linenumber="12">
+ <span class="hits">42</span>
+
+ <code class="ruby"> @token = SearchKit.config.app_token</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"> def archive(slug)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="16">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.delete(slug, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="17">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="19">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="20">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="21">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="22">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def create(name)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="26">
+ <span class="hits">5</span>
+
+ <code class="ruby"> options = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="28">
+
+
+ <code class="ruby"> data: { type: 'indices', attributes: { name: name } }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="29">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="30">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="31">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = connection.post('', options)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="32">
+ <span class="hits">5</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="33">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="34">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="35">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="36">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="37">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="38">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def show(slug)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="42">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.get(slug, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="43">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="44">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="45">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="46">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="47">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="48">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def update(slug, options)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="52">
+ <span class="hits">6</span>
+
+ <code class="ruby"> options = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="53">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="54">
+
+
+ <code class="ruby"> data: { type: 'indices', attributes: options }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="55">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="56">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="57">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = connection.patch(slug, options)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="58">
+ <span class="hits">6</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="59">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="60">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="61">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="62">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="63">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="64">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="65">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"> end</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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="04e7a0595f4af8378444eace01941783aa4fff5c">
+ <div class="header">
+ <h3>lib/search_kit/clients/keys.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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Keys</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :connection, :token</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="24" data-linenumber="10">
+ <span class="hits">24</span>
+
+ <code class="ruby"> uri = [SearchKit.config.app_uri, "keys"].join("/")</code>
+ </li>
+
+ <li class="covered" data-hits="24" data-linenumber="11">
+ <span class="hits">24</span>
+
+ <code class="ruby"> @connection = Faraday.new(uri)</code>
+ </li>
+
+ <li class="covered" data-hits="24" data-linenumber="12">
+ <span class="hits">24</span>
+
+ <code class="ruby"> @token = SearchKit.config.app_token</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"> def create(name, options = {})</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="16">
+ <span class="hits">5</span>
+
+ <code class="ruby"> options = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> data: { type: 'keys', attributes: { name: name }.merge(options) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="21">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = connection.post('', options)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="22">
+ <span class="hits">5</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="24">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="25">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="26">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="28">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def expire(id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="32">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.delete(id, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="33">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="34">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="35">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="36">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::KeyNotFound if response.status == 404</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="37">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="38">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def index</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="42">
+ <span class="hits">3</span>
+
+ <code class="ruby"> response = connection.get("", token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="43">
+ <span class="hits">3</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="44">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="45">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="46">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="47">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def show(id)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="51">
+ <span class="hits">4</span>
+
+ <code class="ruby"> response = connection.get(id, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="52">
+ <span class="hits">4</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="53">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="54">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="55">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::KeyNotFound if response.status == 404</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="56">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="57">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def update(id, options)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="61">
+ <span class="hits">6</span>
+
+ <code class="ruby"> options = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="62">
+
+
+ <code class="ruby"> token: token, data: { type: 'keys', attributes: options }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="63">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="64">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="65">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = connection.patch(id, options)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="66">
+ <span class="hits">6</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="67">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="68">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="69">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="70">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::KeyNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="71">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="72">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="73">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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="never" data-hits="" data-linenumber="76">
+
+
+ <code class="ruby"> end</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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="0d73c1123d394fd511aa7e763341d6fcc46317dc">
+ <div class="header">
+ <h3>lib/search_kit/clients/populate.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>43</b> relevant lines.
+ <span class="green"><b>43</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Populate</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :connection, :token</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="10">
+ <span class="hits">20</span>
+
+ <code class="ruby"> uri = [SearchKit.config.app_uri, "populate"].join("/")</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="11">
+ <span class="hits">20</span>
+
+ <code class="ruby"> @connection = Faraday.new(uri)</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="12">
+ <span class="hits">20</span>
+
+ <code class="ruby"> @token = SearchKit.config.app_token</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"> def create(slug, documents)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="16">
+ <span class="hits">6</span>
+
+ <code class="ruby"> documents = documents.map do |document|</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="17">
+ <span class="hits">6</span>
+
+ <code class="ruby"> { type: 'documents', attributes: document }</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="6" data-linenumber="20">
+ <span class="hits">6</span>
+
+ <code class="ruby"> params = { token: token, data: documents }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="21">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = connection.post(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="22">
+ <span class="hits">6</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="24">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="25">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="26">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="27">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="28">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="29">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def update(slug, documents)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="33">
+ <span class="hits">6</span>
+
+ <code class="ruby"> documents = documents.map do |document|</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"> type: 'documents',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="36">
+
+
+ <code class="ruby"> id: document.fetch(:id, nil),</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="37">
+
+
+ <code class="ruby"> attributes: document</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="38">
+ <span class="hits">6</span>
+
+ <code class="ruby"> }</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="6" data-linenumber="41">
+ <span class="hits">6</span>
+
+ <code class="ruby"> params = { token: token, data: documents }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="42">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = connection.patch(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="43">
+ <span class="hits">6</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="44">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="45">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="46">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="47">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="48">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="49">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="50">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> def delete(slug, ids)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="54">
+ <span class="hits">6</span>
+
+ <code class="ruby"> documents = ids.map do |id|</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="55">
+ <span class="hits">6</span>
+
+ <code class="ruby"> { type: 'documents', id: id, attributes: { id: id } }</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"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="58">
+ <span class="hits">6</span>
+
+ <code class="ruby"> params = { token: token, data: documents }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="59">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response = connection.delete(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="60">
+ <span class="hits">6</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="61">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="62">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="63">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="64">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="65">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="66">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="67">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"> end</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"> 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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="165dca77c5f5da80c4d54057962a18d40f514b8c">
+ <div class="header">
+ <h3>lib/search_kit/clients/scaffold.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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Scaffold</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :connection, :token</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="12" data-linenumber="10">
+ <span class="hits">12</span>
+
+ <code class="ruby"> uri = [SearchKit.config.app_uri, "scaffold"].join("/")</code>
+ </li>
+
+ <li class="covered" data-hits="12" data-linenumber="11">
+ <span class="hits">12</span>
+
+ <code class="ruby"> @connection = Faraday.new(uri)</code>
+ </li>
+
+ <li class="covered" data-hits="12" data-linenumber="12">
+ <span class="hits">12</span>
+
+ <code class="ruby"> @token = SearchKit.config.app_token</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"> def create(name, documents)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="16">
+ <span class="hits">5</span>
+
+ <code class="ruby"> options = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> data: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"> type: 'indices',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"> attributes: { name: name },</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="21">
+
+
+ <code class="ruby"> relationships: { documents: documents }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="22">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="24">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="25">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = connection.post('', options)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="26">
+ <span class="hits">5</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="28">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="29">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="30">
+ <span class="hits">3</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="31">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="32">
+ <span class="hits">2</span>
+
+ <code class="ruby"> body</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"> 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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="a98f5c0a88a68907e745d6197d7bae088ea1d5e6">
+ <div class="header">
+ <h3>lib/search_kit/clients/search.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>19</b> relevant lines.
+ <span class="green"><b>19</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Search</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :connection, :token</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="10">
+ <span class="hits">16</span>
+
+ <code class="ruby"> uri = [SearchKit.config.app_uri, "search"].join("/")</code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="11">
+ <span class="hits">16</span>
+
+ <code class="ruby"> @connection = Faraday.new(uri)</code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="12">
+ <span class="hits">16</span>
+
+ <code class="ruby"> @token = SearchKit.config.app_token</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"> def search(slug, options)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="16">
+ <span class="hits">7</span>
+
+ <code class="ruby"> params = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"> token: token, data: { type: "searches", attributes: options }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="20">
+ <span class="hits">7</span>
+
+ <code class="ruby"> response = connection.post(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="21">
+ <span class="hits">7</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="22">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="23">
+ <span class="hits">7</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="24">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="25">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::IndexNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="26">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="28">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Search.new(body.fetch(:data, {}))</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="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="6c04c4ba7ad24f497fa73a7f12d30ecb895aea93">
+ <div class="header">
+ <h3>lib/search_kit/clients/subscribers.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>32</b> relevant lines.
+ <span class="green"><b>32</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 'faraday'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'json'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Clients</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Subscribers</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :connection, :token</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="29" data-linenumber="10">
+ <span class="hits">29</span>
+
+ <code class="ruby"> uri = [ SearchKit.config.app_uri, "subscribers" ].join("/")</code>
+ </li>
+
+ <li class="covered" data-hits="29" data-linenumber="11">
+ <span class="hits">29</span>
+
+ <code class="ruby"> @connection = Faraday.new(uri)</code>
+ </li>
+
+ <li class="covered" data-hits="29" data-linenumber="12">
+ <span class="hits">29</span>
+
+ <code class="ruby"> @token = SearchKit.config.app_token</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"> def create(options = {})</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="16">
+ <span class="hits">5</span>
+
+ <code class="ruby"> options = { data: { type: 'subscribers', attributes: options } }</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="17">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = connection.post("", options)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="18">
+ <span class="hits">5</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="20">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="21">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="22">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="23">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Subscriber.new body.fetch(:data, {})</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"> def info</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="27">
+ <span class="hits">5</span>
+
+ <code class="ruby"> response = connection.get("", token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="28">
+ <span class="hits">5</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="29">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="30">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="31">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::SubscriberNotFound if response.status == 404</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="32">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="33">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Subscriber.new body.fetch(:data, {})</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"> def update(options = {})</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="37">
+ <span class="hits">7</span>
+
+ <code class="ruby"> options = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="38">
+
+
+ <code class="ruby"> token: token, data: { type: 'subscribers', attributes: options }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="39">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="40">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="41">
+ <span class="hits">7</span>
+
+ <code class="ruby"> response = connection.patch("", options)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="42">
+ <span class="hits">7</span>
+
+ <code class="ruby"> body = JSON.parse(response.body, symbolize_names: true)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="43">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="44">
+ <span class="hits">7</span>
+
+ <code class="ruby"> fail Errors::BadRequest if response.status == 400</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="45">
+ <span class="hits">6</span>
+
+ <code class="ruby"> fail Errors::Unauthorized if response.status == 401</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="46">
+ <span class="hits">5</span>
+
+ <code class="ruby"> fail Errors::SubscriberNotFound if response.status == 404</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="47">
+ <span class="hits">4</span>
+
+ <code class="ruby"> fail Errors::Unprocessable if response.status == 422</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="48">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="49">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Subscriber.new body.fetch(:data, {})</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="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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="301e3c1e285eb9842d365882a554f5bf8c5f09e4">
+ <div class="header">
+ <h3>lib/search_kit/configuration.rb</h3>
+ <h4><span class="yellow">87.88 %</span> covered</h4>
+ <div>
+ <b>33</b> relevant lines.
+ <span class="green"><b>29</b> lines covered</span> and
+ <span class="red"><b>4</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 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'yaml'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'user_config'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="4">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Configuration</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"> def configure</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="9">
+ <span class="hits">3</span>
+
+ <code class="ruby"> yield(config) if block_given?</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"> def config</code>
+ </li>
+
+ <li class="covered" data-hits="557" data-linenumber="13">
+ <span class="hits">557</span>
+
+ <code class="ruby"> return @config if @config</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="14">
+ <span class="hits">2</span>
+
+ <code class="ruby"> root = UserConfig.new(".search-kit")</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="15">
+ <span class="hits">2</span>
+
+ <code class="ruby"> yaml = root['config.yml']</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="16">
+ <span class="hits">2</span>
+
+ <code class="ruby"> config = OpenStruct.new</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="18">
+ <span class="hits">6</span>
+
+ <code class="ruby"> yaml.each { |key, value| config.send("#{key}=", value) }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="19">
+ <span class="hits">2</span>
+
+ <code class="ruby"> @config = config</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"> def set_config(key, value)</code>
+ </li>
+
<li class="missed" data-hits="0" data-linenumber="23">
- <code class="ruby"> config.app_dir = fetch("APP_DIR")</code>
+ <code class="ruby"> root = UserConfig.new(".search-kit")</code>
</li>
<li class="missed" data-hits="0" data-linenumber="24">
- <code class="ruby"> config.app_env = fetch("APP_ENV")</code>
+ <code class="ruby"> yaml = root['config.yml']</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="25">
+ <li class="never" data-hits="" data-linenumber="25">
- <code class="ruby"> config.app_uri = fetch("APP_URI")</code>
+ <code class="ruby"></code>
</li>
<li class="missed" data-hits="0" data-linenumber="26">
- <code class="ruby"> config.config_dir = File.join(config.app_dir, "config")</code>
+ <code class="ruby"> yaml[key] = value</code>
</li>
<li class="missed" data-hits="0" data-linenumber="27">
- <code class="ruby"> config.log_dir = fetch("LOG_DIR")</code>
+ <code class="ruby"> yaml.save</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"> def show_config(key)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="31">
+ <span class="hits">5</span>
+
+ <code class="ruby"> root = UserConfig.new(".search-kit")</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="32">
+ <span class="hits">5</span>
+
+ <code class="ruby"> root['config.yml'][key]</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"> def fetch(key)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="36">
+ <span class="hits">5</span>
+
+ <code class="ruby"> ENV.fetch(key, show_config(key.downcase) || default(key.to_sym))</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"> private</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"> def default(key)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="42">
+ <span class="hits">4</span>
+
+ <code class="ruby"> default_table = {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="43">
+
+
+ <code class="ruby"> APP_URI: "http://localhost:8080",</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="44">
+
+
+ <code class="ruby"> APP_ENV: "development",</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="45">
+
+
+ <code class="ruby"> APP_DIR: default_app_dir,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="46">
+
+
+ <code class="ruby"> APP_VERBOSE: true,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="47">
+
+
+ <code class="ruby"> LOG_DIR: default_log_dir</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="48">
+
+
+ <code class="ruby"> }.fetch(key, nil)</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"> def default_app_dir</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="52">
+ <span class="hits">8</span>
+
+ <code class="ruby"> File.expand_path("../../", __dir__)</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"> def default_log_dir</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="56">
+ <span class="hits">4</span>
+
+ <code class="ruby"> log_dir = File.join(default_app_dir, 'log')</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="57">
+ <span class="hits">4</span>
+
+ <code class="ruby"> Dir.mkdir(log_dir) unless Dir.exist?(log_dir)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="58">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="59">
+ <span class="hits">4</span>
+
+ <code class="ruby"> log_dir</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="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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="8a64d3d076ac8f875871a0940f07b2d95b77ee2f">
+ <div class="header">
+ <h3>lib/search_kit/errors.rb</h3>
+ <h4><span class="green">100.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>
+ </div>
+ </div>
+
+ <pre>
+ <ol>
+
+ <li class="covered" data-hits="1" data-linenumber="1">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Errors</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class BadRequest < StandardError; end</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class EventNotFound < StandardError; end</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class IndexNotFound < StandardError; end</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class KeyNotFound < StandardError; end</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class PublicationFailed < StandardError; end</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class SubscriberNotFound < StandardError; end</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Unauthorized < StandardError; end</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Unprocessable < StandardError; end</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="6729bb292277725406022dbf37073cb5e1c97a01">
+ <div class="header">
+ <h3>lib/search_kit/logger.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 'forwardable'</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">module SearchKit</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="4">
+
+
+ <code class="ruby"> # The SearchKit logger, handled in its own class mainly for the purpose</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="5">
+
+
+ <code class="ruby"> # of allowing the daemonized process to quickly and cleanly reinitialize its</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="6">
+
+
+ <code class="ruby"> # connection to logfiles even after its process has been decoupled.</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"> class Logger</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> extend Forwardable</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"> attr_reader :logger</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"> def_delegators :logger, :info, :warn</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"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="16">
+ <span class="hits">1</span>
+
+ <code class="ruby"> environment = SearchKit.config.app_env</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"> loginfo = [</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"> SearchKit.config.log_dir,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"> "search-kit-#{environment}.log"</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="21">
+
+
+ <code class="ruby"> ]</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"> logpath = File.join(*loginfo)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="24">
+ <span class="hits">1</span>
+
+ <code class="ruby"> default = ::Logger.new(logpath, "daily")</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"> @logger = SearchKit.config.logger || default</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="29">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="30">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="42fcdce6679883e42f4fb4592008870d2b2d7317">
+ <div class="header">
+ <h3>lib/search_kit/messages.rb</h3>
+ <h4><span class="red">54.55 %</span> covered</h4>
+ <div>
+ <b>22</b> relevant lines.
+ <span class="green"><b>12</b> lines covered</span> and
+ <span class="red"><b>10</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 'ansi'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Messages</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Messaging, 'search_kit/messages/messaging'</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"> include Messaging</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"> def unauthorized</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="10">
+
+
+ <code class="ruby"> warning(I18n.t('http.401'))</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"> def bad_request</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="14">
+
+
+ <code class="ruby"> warning(I18n.t('http.400'))</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def not_found(type = 'Resource')</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="18">
+
+
+ <code class="ruby"> message = I18n.t('http.404', type: type)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="19">
+
+
+ <code class="ruby"> warning(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"> def json_parse_error(type = 'Argument')</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="23">
+
+
+ <code class="ruby"> message = I18n.t('cli.errors.json_parse', type: type)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="24">
+
+
+ <code class="ruby"> warning(message)</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"> def no_service</code>
+ </li>
+
<li class="missed" data-hits="0" data-linenumber="28">
- <code class="ruby"> config.verbose = fetch("APP_VERBOSE")</code>
+ <code class="ruby"> message = I18n.t('cli.errors.no_service', uri: SearchKit.config.app_uri)</code>
</li>
+ <li class="missed" data-hits="0" data-linenumber="29">
+
+
+ <code class="ruby"> warning(message)</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"> def unprocessable</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="33">
+
+
+ <code class="ruby"> warning(I18n.t('http.422'))</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"> def unreadable(error)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="37">
+
+
+ <code class="ruby"> warning(I18n.t('cli.errors.unreadable', error: error))</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="never" data-hits="" data-linenumber="40">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="41">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="11dbd3ddccb2a40d26776c9c878e8850575a0f18">
+ <div class="header">
+ <h3>lib/search_kit/messages/messaging.rb</h3>
+ <h4><span class="yellow">87.18 %</span> covered</h4>
+ <div>
+ <b>39</b> relevant lines.
+ <span class="green"><b>34</b> lines covered</span> and
+ <span class="red"><b>5</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 'ansi'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Messages</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="5">
+
+
+ <code class="ruby"> # The goal of the Messaging module is to provide an easy to include internal</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="6">
+
+
+ <code class="ruby"> # interface which will allow a SearchKit gem to dutifully log and provide</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="7">
+
+
+ <code class="ruby"> # output of what it's up to and how it may be doing.</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"> module Messaging</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def info(message)</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="11">
+ <span class="hits">23</span>
+
+ <code class="ruby"> Message.new(message).info</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"> def warning(message)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="15">
+ <span class="hits">2</span>
+
+ <code class="ruby"> Message.new(message).warn</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"> def prompt(message)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="19">
+
+
+ <code class="ruby"> Message.new(message).prompt</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"> def password_prompt(message)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="23">
+
+
+ <code class="ruby"> Message.new(message).password_prompt</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"> private</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"> # Most of the logic for the Messaging module exists in this (not so)</code>
+ </li>
+
<li class="never" data-hits="" data-linenumber="29">
+ <code class="ruby"> # private class. This lets more complex handling of message logic enter</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="30">
+
+
+ <code class="ruby"> # into the module gracefully, for example silence or logging level.</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"> class Message</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="33">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :cli, :message</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"> def initialize(message)</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="36">
+ <span class="hits">25</span>
+
+ <code class="ruby"> @message = message</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="37">
+ <span class="hits">25</span>
+
+ <code class="ruby"> @cli = HighLine.new</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"> def warn</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="41">
+ <span class="hits">2</span>
+
+ <code class="ruby"> Kernel.warn(Prefixed(message.ansi(:red))) if SearchKit.config.verbose</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="42">
+ <span class="hits">2</span>
+
+ <code class="ruby"> SearchKit.logger.warn message</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"> def info</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="46">
+ <span class="hits">23</span>
+
+ <code class="ruby"> Kernel.puts(Prefixed(message.ansi(:cyan))) if SearchKit.config.verbose</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="47">
+ <span class="hits">23</span>
+
+ <code class="ruby"> SearchKit.logger.info message</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"> def prompt</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="51">
+
+
+ <code class="ruby"> cli.ask(Prefixed(message.ansi(:cyan)))</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"> def password_prompt</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="55">
+
+
+ <code class="ruby"> cli.ask(Prefixed(message.ansi(:cyan))) do |prompt|</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="56">
+
+
+ <code class="ruby"> prompt.echo = '*'</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"> private</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"> def Prefixed(*messages)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="63">
+ <span class="hits">4</span>
+
+ <code class="ruby"> Prefixed.new.join(*messages)</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"> class Prefixed</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="67">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attr_reader :body</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="69">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def initialize</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="70">
+ <span class="hits">4</span>
+
+ <code class="ruby"> env = SearchKit.config.app_env.to_s.ansi(:magenta)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="71">
+ <span class="hits">4</span>
+
+ <code class="ruby"> @body = "--> [ #{env} ]: "</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"> def join(*messages)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="75">
+ <span class="hits">4</span>
+
+ <code class="ruby"> [body, *messages].join(" ")</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="never" data-hits="" data-linenumber="78">
+
+
+ <code class="ruby"> end</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="never" data-hits="" data-linenumber="81">
+
+
+ <code class="ruby"> end</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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="f003c10a94604816ecac8606a68fff9c180b46ed">
+ <div class="header">
+ <h3>lib/search_kit/models.rb</h3>
+ <h4><span class="green">100.0 %</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>
+ </div>
+ </div>
+
+ <pre>
+ <ol>
+
+ <li class="covered" data-hits="1" data-linenumber="1">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'virtus'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Document, 'search_kit/models/document'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Documents, 'search_kit/models/documents'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Event, 'search_kit/models/event'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Events, 'search_kit/models/events'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Key, 'search_kit/models/key'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Keys, 'search_kit/models/keys'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="11">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Search, 'search_kit/models/search'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Subscriber, 'search_kit/models/subscriber'</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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="e05422f61848c51b55f9be09eb16b61bcd4a9b72">
+ <div class="header">
+ <h3>lib/search_kit/models/document.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>14</b> relevant lines.
+ <span class="green"><b>14</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Document</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class AttributeNotFound < StandardError; end</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"> include Virtus.model</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"> attribute :id</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :source</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :score</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"> def initialize(document_data = {})</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="13">
+ <span class="hits">5</span>
+
+ <code class="ruby"> attributes = document_data.fetch(:attributes, {})</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="14">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="15">
+
+
+ <code class="ruby"> super(</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="16">
+
+
+ <code class="ruby"> source: attributes,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"> id: attributes.fetch(:id, nil),</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> score: attributes.fetch(:score, nil)</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="19">
+ <span class="hits">5</span>
+
+ <code class="ruby"> )</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"> def get(field)</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="23">
+ <span class="hits">2</span>
+
+ <code class="ruby"> source.fetch(field.to_sym)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="24">
+
+
+ <code class="ruby"> rescue KeyError</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="25">
+ <span class="hits">1</span>
+
+ <code class="ruby"> fail AttributeNotFound, field</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="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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="b265574cb03a3ec10dd6cd9b3684f60824150e42">
+ <div class="header">
+ <h3>lib/search_kit/models/documents.rb</h3>
+ <h4><span class="red">76.47 %</span> covered</h4>
+ <div>
+ <b>17</b> relevant lines.
+ <span class="green"><b>13</b> lines covered</span> and
+ <span class="red"><b>4</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Documents</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> include Enumerable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="5">
+
+
<code class="ruby"></code>
</li>
- <li class="missed" data-hits="0" data-linenumber="31">
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+ <code class="ruby"> def self.[](*arguments)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
- <code class="ruby"> I18n.load_path += Dir.glob(File.join(config.config_dir, "locales/*.yml"))</code>
+ <code class="ruby"> new(arguments)</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"> attr_reader :contents, :member_class</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"> def initialize(contents = [])</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="13">
+ <span class="hits">23</span>
+
+ <code class="ruby"> @contents = contents</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="14">
+ <span class="hits">23</span>
+
+ <code class="ruby"> @member_class = SearchKit::Models::Document</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def <<(new_doc)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="18">
+
+
+ <code class="ruby"> case new_doc</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="19">
+
+
+ <code class="ruby"> when Hash then contents << member_class.new(new_doc)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="20">
+
+
+ <code class="ruby"> when member_class then contents << new_doc</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="21">
+
+
+ <code class="ruby"> else contents</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"> def each(&block)</code>
+ </li>
+
+ <li class="covered" data-hits="15" data-linenumber="26">
+ <span class="hits">15</span>
+
+ <code class="ruby"> contents.each(&block)</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="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="19ee630b527cd18bcddf32258d4b5e011d2c67c4">
+ <div class="header">
+ <h3>lib/search_kit/models/event.rb</h3>
+ <h4><span class="green">100.0 %</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>
+ </div>
+ </div>
+
+ <pre>
+ <ol>
+
+ <li class="covered" data-hits="1" data-linenumber="1">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Event</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> include Virtus.model</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"> attribute :id</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :channel</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :state</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :payload, Hash</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"> def initialize(event_data = {})</code>
+ </li>
+
+ <li class="covered" data-hits="28" data-linenumber="12">
+ <span class="hits">28</span>
+
+ <code class="ruby"> attributes = event_data.fetch(:attributes, {})</code>
+ </li>
+
+ <li class="covered" data-hits="28" data-linenumber="13">
+ <span class="hits">28</span>
+
+ <code class="ruby"> super(attributes)</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="never" data-hits="" data-linenumber="16">
+
+
+ <code class="ruby"> end</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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="540c92052dd89a90a6c81d58dd7b06e122dd42ff">
+ <div class="header">
+ <h3>lib/search_kit/models/events.rb</h3>
+ <h4><span class="red">70.59 %</span> covered</h4>
+ <div>
+ <b>17</b> relevant lines.
+ <span class="green"><b>12</b> lines covered</span> and
+ <span class="red"><b>5</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Events</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> include Enumerable</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"> def self.[](*arguments)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="7">
+
+
+ <code class="ruby"> new(arguments)</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"> attr_reader :contents, :member_class</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"> def initialize(contents = [])</code>
+ </li>
+
+ <li class="covered" data-hits="15" data-linenumber="13">
+ <span class="hits">15</span>
+
+ <code class="ruby"> @contents = contents</code>
+ </li>
+
+ <li class="covered" data-hits="15" data-linenumber="14">
+ <span class="hits">15</span>
+
+ <code class="ruby"> @member_class = SearchKit::Models::Event</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def <<(new_event)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="18">
+
+
+ <code class="ruby"> case new_event</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="19">
+
+
+ <code class="ruby"> when Hash then contents << member_class.new(new_event)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="20">
+
+
+ <code class="ruby"> when member_class then contents << new_event</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="21">
+
+
+ <code class="ruby"> else contents</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"> def each(&block)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="26">
+ <span class="hits">6</span>
+
+ <code class="ruby"> contents.each(&block)</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="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="8dbfcd08b310a90c27d98f046f73cf199dde9df1">
+ <div class="header">
+ <h3>lib/search_kit/models/key.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>16</b> relevant lines.
+ <span class="green"><b>16</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 'virtus'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Key</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> include Virtus.model</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"> attribute :id, String</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :name, String</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :privilege, String</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="11">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :token, String</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="12">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :uri, String</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(key_data = {})</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="15">
+ <span class="hits">20</span>
+
+ <code class="ruby"> attributes = key_data.fetch(:attributes, {})</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="16">
+ <span class="hits">20</span>
+
+ <code class="ruby"> uri = key_data.fetch(:links, {}).fetch(:self, '')</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="18">
+ <span class="hits">20</span>
+
+ <code class="ruby"> super(attributes.merge(uri: uri))</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"> def creator?</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="22">
+ <span class="hits">7</span>
+
+ <code class="ruby"> privilege == 'creator'</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>
+
+ <li class="never" data-hits="" data-linenumber="26">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="5350a3db664b89863367db63f0234c0851a398e4">
+ <div class="header">
+ <h3>lib/search_kit/models/keys.rb</h3>
+ <h4><span class="green">90.48 %</span> covered</h4>
+ <div>
+ <b>21</b> relevant lines.
+ <span class="green"><b>19</b> lines covered</span> and
+ <span class="red"><b>2</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Keys</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> include Enumerable</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"> def self.[](*arguments)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> new(arguments)</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"> attr_reader :contents, :member_class</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"> def initialize(contents = [])</code>
+ </li>
+
+ <li class="covered" data-hits="41" data-linenumber="13">
+ <span class="hits">41</span>
+
+ <code class="ruby"> @contents = contents</code>
+ </li>
+
+ <li class="covered" data-hits="41" data-linenumber="14">
+ <span class="hits">41</span>
+
+ <code class="ruby"> @member_class = SearchKit::Models::Key</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def <<(new_key)</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="18">
+ <span class="hits">8</span>
+
+ <code class="ruby"> case new_key</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="19">
+
+
+ <code class="ruby"> when Hash then contents << member_class.new(new_key)</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="20">
+ <span class="hits">8</span>
+
+ <code class="ruby"> when member_class then contents << new_key</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="21">
+
+
+ <code class="ruby"> else contents</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"> def each(&block)</code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="26">
+ <span class="hits">16</span>
+
+ <code class="ruby"> contents.each(&block)</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"> def creator</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="30">
+ <span class="hits">4</span>
+
+ <code class="ruby"> self.class.new(select(&:creator?))</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="never" data-hits="" data-linenumber="33">
+ <li class="covered" data-hits="1" data-linenumber="33">
+ <span class="hits">1</span>
+ <code class="ruby"> def tokens</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="34">
+ <span class="hits">3</span>
+ <code class="ruby"> contents.map(&:token)</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">end</code>
</li>
</ol>
</pre>
</div>
+ <div class="source_table" id="88a48a5f31a8c5013c2bbcc76f73a98d13ff4fdd">
+ <div class="header">
+ <h3>lib/search_kit/models/search.rb</h3>
+ <h4><span class="green">100.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>
+ </div>
+ </div>
+
+ <pre>
+ <ol>
+
+ <li class="covered" data-hits="1" data-linenumber="1">
+ <span class="hits">1</span>
+
+ <code class="ruby">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Search</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> include Virtus.model</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"> attribute :time</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :results</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="8">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :documents, Models::Documents[Models::Document]</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"> def initialize(search_data = {})</code>
+ </li>
+
+ <li class="covered" data-hits="10" data-linenumber="11">
+ <span class="hits">10</span>
+
+ <code class="ruby"> attributes = search_data.fetch(:attributes, {})</code>
+ </li>
+
+ <li class="covered" data-hits="10" data-linenumber="12">
+ <span class="hits">10</span>
+
+ <code class="ruby"> super attributes</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="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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="565b166b090d2ac1fbaa839552be52c7697d202a">
+ <div class="header">
+ <h3>lib/search_kit/models/subscriber.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>16</b> relevant lines.
+ <span class="green"><b>16</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 'virtus'</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> module Models</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Subscriber</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> include Virtus.model</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"> attribute :email, String</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="9">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :id, String</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :keys, SearchKit::Models::Keys[SearchKit::Models::Key]</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="11">
+ <span class="hits">1</span>
+
+ <code class="ruby"> attribute :uri, String</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"> def initialize(subscriber_data = {})</code>
+ </li>
+
+ <li class="covered" data-hits="32" data-linenumber="14">
+ <span class="hits">32</span>
+
+ <code class="ruby"> attributes = subscriber_data.fetch(:attributes, {})</code>
+ </li>
+
+ <li class="covered" data-hits="32" data-linenumber="15">
+ <span class="hits">32</span>
+
+ <code class="ruby"> keys = subscriber_data.fetch(:relationships, {}).fetch(:keys, [])</code>
+ </li>
+
+ <li class="covered" data-hits="32" data-linenumber="16">
+ <span class="hits">32</span>
+
+ <code class="ruby"> uri = subscriber_data.fetch(:links, {}).fetch(:self, '')</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="32" data-linenumber="18">
+ <span class="hits">32</span>
+
+ <code class="ruby"> super(attributes.merge(uri: uri, keys: keys))</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"> def creator_tokens</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="22">
+ <span class="hits">2</span>
+
+ <code class="ruby"> keys.creator.tokens</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>
+
+ <li class="never" data-hits="" data-linenumber="26">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="1739292ead23399da05af931e58221e4a6947f17">
+ <div class="header">
+ <h3>lib/search_kit/polling.rb</h3>
+ <h4><span class="red">73.33 %</span> covered</h4>
+ <div>
+ <b>15</b> relevant lines.
+ <span class="green"><b>11</b> lines covered</span> and
+ <span class="red"><b>4</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">module SearchKit</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="2">
+
+
+ <code class="ruby"> # This file houses the polling loop of the Event service.</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"> #</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Polling</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> autoload :Process, 'search_kit/polling/process'</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"> def self.perform(channel, &block)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="8">
+
+
+ <code class="ruby"> new(channel, &block).perform</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"> attr_reader :block, :channel</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"> def initialize(channel, &block)</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="14">
+ <span class="hits">3</span>
+
+ <code class="ruby"> @block = block</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="15">
+ <span class="hits">3</span>
+
+ <code class="ruby"> @channel = channel</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"> def perform</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="19">
+
+
+ <code class="ruby"> loop do</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="20">
+
+
+ <code class="ruby"> process_queue</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="21">
+
+
+ <code class="ruby"> sleep 1</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"> def process_queue</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="26">
+ <span class="hits">1</span>
+
+ <code class="ruby"> SearchKit::Polling::Process.perform(channel, &block)</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="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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="2bbb5d064d5f585b39714d0209d414583f53705c">
+ <div class="header">
+ <h3>lib/search_kit/polling/process.rb</h3>
+ <h4><span class="green">95.0 %</span> covered</h4>
+ <div>
+ <b>20</b> relevant lines.
+ <span class="green"><b>19</b> lines covered</span> and
+ <span class="red"><b>1</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">module SearchKit</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby"> class Polling</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"> # The logic of interacting with the event service to retrieve and process</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="4">
+
+
+ <code class="ruby"> # events is contained here.</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"> class Process</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def self.perform(channel, &block)</code>
+ </li>
+
+ <li class="missed" data-hits="0" data-linenumber="8">
+
+
+ <code class="ruby"> new(channel, &block).perform</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"> attr_reader :block, :channel, :client</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"> def initialize(channel, &block)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="14">
+ <span class="hits">6</span>
+
+ <code class="ruby"> @block = block</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="15">
+ <span class="hits">6</span>
+
+ <code class="ruby"> @channel = channel</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="16">
+ <span class="hits">6</span>
+
+ <code class="ruby"> @client = SearchKit::Clients::Events.new</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 perform</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="20">
+ <span class="hits">3</span>
+
+ <code class="ruby"> events.each do |event|</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="21">
+ <span class="hits">3</span>
+
+ <code class="ruby"> begin</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="22">
+ <span class="hits">3</span>
+
+ <code class="ruby"> block.call(event)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
+
+
+ <code class="ruby"> rescue</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="24">
+ <span class="hits">1</span>
+
+ <code class="ruby"> raise</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="25">
+
+
+ <code class="ruby"> else</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="26">
+ <span class="hits">2</span>
+
+ <code class="ruby"> client.complete(event.id)</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"> 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"> private</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"> def events</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="34">
+ <span class="hits">3</span>
+
+ <code class="ruby"> response = client.pending(channel)</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="35">
+ <span class="hits">6</span>
+
+ <code class="ruby"> response.fetch(:data, []).map { |raw| OpenStruct.new(raw) }</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="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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="a8f8e3ad09f54a9df3faf746349dd6a3361f9010">
+ <div class="header">
+ <h3>lib/search_kit/thor.rb</h3>
+ <h4><span class="green">100.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>
+ </div>
+ </div>
+
+ <pre>
+ <ol>
+
+ <li class="covered" data-hits="1" data-linenumber="1">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'thor'</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 Thor</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> def self.document(task)</code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="5">
+ <span class="hits">16</span>
+
+ <code class="ruby"> usage = I18n.t("cli.#{namespace}.#{task}.command")</code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="6">
+ <span class="hits">16</span>
+
+ <code class="ruby"> summary = I18n.t("cli.#{namespace}.#{task}.summary")</code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="7">
+ <span class="hits">16</span>
+
+ <code class="ruby"> detail = I18n.t("cli.#{namespace}.#{task}.detail")</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="8">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="9">
+ <span class="hits">16</span>
+
+ <code class="ruby"> desc(usage, summary)</code>
+ </li>
+
+ <li class="covered" data-hits="16" data-linenumber="10">
+ <span class="hits">16</span>
+
+ <code class="ruby"> long_desc(detail)</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="6a4ecdd9246f807fcfbecc9b1dc5ee55fc23b2db">
<div class="header">
<h3>lib/search_kit/version.rb</h3>
- <h4><span class="green">90.91 %</span> covered</h4>
+ <h4><span class="green">100.0 %</span> covered</h4>
<div>
<b>11</b> relevant lines.
- <span class="green"><b>10</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>0</b> lines missed.</span>
</div>
</div>
<pre>
<ol>
@@ -326,13 +10258,13 @@
<span class="hits">1</span>
<code class="ruby"> def self.gem_version</code>
</li>
- <li class="missed" data-hits="0" data-linenumber="3">
+ <li class="covered" data-hits="1" data-linenumber="3">
+ <span class="hits">1</span>
-
<code class="ruby"> Gem::Version.new(version_string)</code>
</li>
<li class="never" data-hits="" data-linenumber="4">
@@ -350,12 +10282,12 @@
<span class="hits">1</span>
<code class="ruby"> def self.version_string</code>
</li>
- <li class="covered" data-hits="1" data-linenumber="7">
- <span class="hits">1</span>
+ <li class="covered" data-hits="2" data-linenumber="7">
+ <span class="hits">2</span>
<code class="ruby"> VERSION::STRING</code>
</li>
<li class="never" data-hits="" data-linenumber="8">
@@ -401,11 +10333,11 @@
</li>
<li class="covered" data-hits="1" data-linenumber="15">
<span class="hits">1</span>
- <code class="ruby"> TINY = 3</code>
+ <code class="ruby"> TINY = 6</code>
</li>
<li class="covered" data-hits="1" data-linenumber="16">
<span class="hits">1</span>
@@ -429,9 +10361,16131 @@
<code class="ruby"> end</code>
</li>
<li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="aadaf5955bdf242e02f195a0a0d24b40dc9b5fe2">
+ <div class="header">
+ <h3>spec/search_kit/cli/documents_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>130</b> relevant lines.
+ <span class="green"><b>130</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 'spec_helper'</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 SearchKit::CLI::Documents do</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="4">
+ <span class="hits">25</span>
+
+ <code class="ruby"> let(:cli) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="15" data-linenumber="5">
+ <span class="hits">15</span>
+
+ <code class="ruby"> let(:json) { response.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="6">
+ <span class="hits">25</span>
+
+ <code class="ruby"> let(:response) { {} }</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="7">
+ <span class="hits">25</span>
+
+ <code class="ruby"> let(:slug) { "an-index-slug" }</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"> subject { cli }</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"> describe '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="12">
+ <span class="hits">9</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:create).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="13">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="14">
+ <span class="hits">9</span>
+
+ <code class="ruby"> subject { cli.create(slug, json) }</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 "parses the given document json" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="18">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> it "calls client.create with the slug and document" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:create).with(slug, {})</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="23">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="27">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(response.to_json)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given bad json' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="32">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:json) { "Arglebargle" }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="33">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "reports an error" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="34">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:json_parse_error)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="35">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="40">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:create).and_raise(*error) }</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="43">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::IndexNotFound }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="46">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="47">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'bad request error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="52">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::BadRequest }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="55">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:bad_request)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="56">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="61">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="64">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="65">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="69">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="70">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="71">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="72">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="73">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="74">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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="never" data-hits="" data-linenumber="78">
+
+
+ <code class="ruby"> end</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"> describe '#delete' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="82">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="83">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="84">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:delete).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="85">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="86">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { cli.delete(slug, id) }</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 "calls client.create with the slug and document" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="89">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:delete).with(slug, id)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="90">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="94">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(response.to_json)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="95">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="99">
+ <span class="hits">3</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:delete).and_raise(*error) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="100">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="101">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="102">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::IndexNotFound }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="103">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="104">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="105">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="106">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</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 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="111">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="114">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="115">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="118">
+
+
+ <code class="ruby"></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 '#show' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="123">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="124">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="125">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:show).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="126">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="127">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { cli.show(slug, id) }</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 "calls client.create with the slug and document" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="130">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:show).with(slug, id)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="131">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="135">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(response.to_json)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="136">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="137">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="138">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="139">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="140">
+ <span class="hits">3</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:show).and_raise(*error) }</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="143">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::IndexNotFound }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="144">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="145">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="146">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="147">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="152">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="153">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="154">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="155">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="156">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="161">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="162">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="163">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe '#update' do</code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="164">
+ <span class="hits">9</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="165">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="166">
+ <span class="hits">9</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:update).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="167">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="168">
+ <span class="hits">9</span>
+
+ <code class="ruby"> subject { cli.update(slug, id, json) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="169">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="170">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "parses the given document json" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="171">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="172">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="175">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls client.create with the slug and document" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="176">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:update).with(slug, id, {})</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="177">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="181">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(response.to_json)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="182">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="183">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="184">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="185">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given bad json' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="186">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:json) { "Arglebargle" }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="187">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "reports an error" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="188">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:json_parse_error)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="189">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="193">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="194">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:update).and_raise(*error) }</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="197">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::IndexNotFound }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="198">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="199">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="200">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="201">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="204">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="205">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'bad request error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="206">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::BadRequest }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="207">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="208">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="209">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:bad_request)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="210">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="211">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="212">
+
+
+ <code class="ruby"> end</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"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="215">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="216">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="217">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="218">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="219">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="220">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="221">
+
+
+ <code class="ruby"> end</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="224">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="225">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="226">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="227">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="228">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="229">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="230">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="231">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="232">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="233">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="234">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="a5a8667a114b5cd4fe8e06d60385632062aa0db9">
+ <div class="header">
+ <h3>spec/search_kit/cli/events_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>137</b> relevant lines.
+ <span class="green"><b>137</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 'spec_helper'</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 SearchKit::CLI::Events do</code>
+ </li>
+
+ <li class="covered" data-hits="15" data-linenumber="4">
+ <span class="hits">15</span>
+
+ <code class="ruby"> let(:channel) { "colon:separated:values" }</code>
+ </li>
+
+ <li class="covered" data-hits="24" data-linenumber="5">
+ <span class="hits">24</span>
+
+ <code class="ruby"> let(:cli) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="6">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:json) { response.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:response) { {} }</code>
+ </li>
+
+ <li class="covered" data-hits="17" data-linenumber="8">
+ <span class="hits">17</span>
+
+ <code class="ruby"> let(:event) { SearchKit::Models::Event.new }</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="9">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:events) { SearchKit::Models::Events.new }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="10">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:slug) { "an-index-slug" }</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"> subject { cli }</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 '#complete' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="15">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="16">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="17">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:complete).and_return(event) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="19">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { cli.complete(id) }</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"> it "calls client.complete with the event id" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:complete).with(id)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="23">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="27">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="32">
+ <span class="hits">3</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:complete).and_raise(*error) }</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="35">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::EventNotFound }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="38">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="39">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="44">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="47">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="48">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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>
+
+ <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 '#pending' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="55">
+ <span class="hits">1</span>
+
+ <code class="ruby"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="56">
+ <span class="hits">7</span>
+
+ <code class="ruby"> allow(cli.client).to receive(:index).and_return(events)</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="57">
+ <span class="hits">7</span>
+
+ <code class="ruby"> allow(cli.client).to receive(:pending).and_return(events)</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="8" data-linenumber="60">
+ <span class="hits">8</span>
+
+ <code class="ruby"> subject { cli.pending(channel) }</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"> context 'when given a channel' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="63">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls client.pending with the channel" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="64">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:pending).with(channel)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="65">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="69">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'otherwise' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="70">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:channel) { nil }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="71">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="72">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls client.index" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="73">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:index)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="74">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> it "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="79">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="80">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="84">
+ <span class="hits">1</span>
+
+ <code class="ruby"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="85">
+ <span class="hits">4</span>
+
+ <code class="ruby"> allow(cli.client).to receive(:index).and_raise(*error)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="86">
+ <span class="hits">4</span>
+
+ <code class="ruby"> allow(cli.client).to receive(:pending).and_raise(*error)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="87">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="88">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="89">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="90">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="91">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="92">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="93">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="94">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'bad request error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="99">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::BadRequest }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="100">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="101">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="102">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:bad_request)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="103">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="108">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="111">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="112">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="115">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="116">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="117">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="120">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="121">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="122">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="123">
+
+
+ <code class="ruby"> end</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"> 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"> describe '#publish' do</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="129">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:payload) { { one_fish: true, two_fish: true } }</code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="130">
+ <span class="hits">9</span>
+
+ <code class="ruby"> let(:payload_json) { payload.to_json }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="133">
+ <span class="hits">8</span>
+
+ <code class="ruby"> allow(cli.client).to receive(:publish).and_return(event)</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="9" data-linenumber="136">
+ <span class="hits">9</span>
+
+ <code class="ruby"> subject { cli.publish(channel, payload_json) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="137">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="138">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "parses the given document json" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="139">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(payload_json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="140">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="141">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="142">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="143">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls client.create with the slug and document" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="144">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:publish).with(channel, payload)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="145">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> it "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="149">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="150">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given bad json' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="154">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:payload) { "Arglebargle" }</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"> it "reports an error" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="157">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:json_parse_error)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="158">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="159">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="160">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="161">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="162">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="163">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:publish).and_raise(*error) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="164">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="165">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="166">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="169">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="170">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="171">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="172">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="173">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="174">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'bad request error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="175">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::BadRequest }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="176">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="177">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="178">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:bad_request)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="179">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="180">
+
+
+ <code class="ruby"> end</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="183">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="184">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="185">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="186">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="187">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="188">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="193">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="194">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="195">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="196">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="197">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="198">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="199">
+
+
+ <code class="ruby"> end</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"> 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 '#status' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="205">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="206">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="207">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:show).and_return(event) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="208">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="209">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { cli.status(id) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="210">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="211">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls client.show with the event id" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="212">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:show).with(id)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="213">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="216">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="217">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="218">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="222">
+ <span class="hits">3</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:show).and_raise(*error) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="223">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="224">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="225">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::EventNotFound }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="226">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="227">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="228">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="229">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="230">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="231">
+
+
+ <code class="ruby"> end</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="234">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="235">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="236">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="237">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="238">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="239">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="240">
+
+
+ <code class="ruby"> end</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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="7be34029cd94c988e9feb272c2f97ecd32bf91a2">
+ <div class="header">
+ <h3>spec/search_kit/cli/indices_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>119</b> relevant lines.
+ <span class="green"><b>119</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 'spec_helper'</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 SearchKit::CLI::Indices do</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="4">
+ <span class="hits">22</span>
+
+ <code class="ruby"> let(:cli) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:json) { response.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="6">
+ <span class="hits">22</span>
+
+ <code class="ruby"> let(:response) { {} }</code>
+ </li>
+
+ <li class="covered" data-hits="17" data-linenumber="7">
+ <span class="hits">17</span>
+
+ <code class="ruby"> let(:slug) { "an-index-slug" }</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"> subject { cli }</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"> describe '#archive' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="12">
+ <span class="hits">6</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:archive).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="13">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="14">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { cli.archive(slug) }</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 "calls client.complete with the index slug" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:archive).with(slug)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="18">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> it "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="23">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="27">
+ <span class="hits">4</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:archive).and_raise(*error) }</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"> context 'unauthorized error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="30">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="33">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="34">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="38">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="39">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::IndexNotFound }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="42">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'no service error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="48">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="51">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="52">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> 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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="58">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="59">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:name) { "Index Name" }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="60">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="61">
+ <span class="hits">6</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:create).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="62">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="63">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { cli.create(name) }</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"> it "calls client.create with the index name" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="66">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:create).with(name)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="67">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="69">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="70">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="71">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="72">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="76">
+ <span class="hits">4</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:create).and_raise(*error) }</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"> context 'unauthorized error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="79">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="82">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="83">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</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"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="88">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="89">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="90">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="91">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="92">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'no service error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="97">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="100">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="101">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> 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 '#show' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="108">
+ <span class="hits">6</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:show).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="109">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="110">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { cli.show(slug) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="111">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="112">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls client.show with the index slug" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="113">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:show).with(slug)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="114">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="115">
+
+
+ <code class="ruby"> end</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"> it "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="118">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="119">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="123">
+ <span class="hits">4</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:show).and_raise(*error) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="124">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="125">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'unauthorized error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="126">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="129">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="130">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="131">
+
+
+ <code class="ruby"> end</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="135">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::IndexNotFound }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="138">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="139">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="140">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="141">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="142">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="143">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'no service error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="144">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="147">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="148">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="153">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="154">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe '#update' do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="155">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:update) { { name: "New Name" } }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="156">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:update_json) { update.to_json }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="157">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="158">
+ <span class="hits">7</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:update).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="159">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="160">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { cli.update(slug, update_json) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="161">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="162">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls client.update with the index slug and given json" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="163">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:update).with(slug, update)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="164">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="167">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="168">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="169">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="170">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="171">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="172">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="173">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:update).and_raise(*error) }</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"> context 'unauthorized error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="176">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="179">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="180">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="185">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="188">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="189">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="193">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'json error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="194">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { JSON::ParserError }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="197">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:json_parse_error)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="198">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="199">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="200">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="201">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="202">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'no service error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="203">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="204">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="205">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="206">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="207">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="208">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="209">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="210">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="211">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="212">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="213">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="4a3dfeedaa9fa6440dcf8acbad0379f0290f7ff4">
+ <div class="header">
+ <h3>spec/search_kit/cli/scaffolds_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>41</b> relevant lines.
+ <span class="green"><b>41</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 'spec_helper'</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 SearchKit::CLI::Scaffolds do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="4">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:cli) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:json) { response.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="6">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:response) { {} }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="7">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:slug) { "an-index-slug" }</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"> subject { cli }</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"> describe '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="12">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:documents) { [{ title: "Yep", id: 1 }] }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="13">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:documents_json) { documents.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="14">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:name) { "Index Name" }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="15">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="16">
+ <span class="hits">7</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:create).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="18">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { cli.create(name, documents_json) }</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 "calls client.create with the index name" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="21">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:create).with(name, documents)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="26">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="27">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="31">
+ <span class="hits">5</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:create).and_raise(*error) }</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"> context 'unauthorized error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="34">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="37">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="38">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="43">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="46">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="47">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'json error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="52">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { JSON::ParserError }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="55">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:json_parse_error)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="56">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'no service error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="61">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="64">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="65">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"> end</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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="83164236d68ad1048eeca55428628ff7975c9a72">
+ <div class="header">
+ <h3>spec/search_kit/cli/search_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 'spec_helper'</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 SearchKit::CLI::Search do</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="4">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:cli) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:json) { response.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="6">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:phrase) { "Michael Jackson" }</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="7">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:response) { SearchKit::Models::Search.new }</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="8">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:slug) { "an-index-slug" }</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"> subject { cli }</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 '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="13">
+ <span class="hits">8</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:search).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="14">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="15">
+ <span class="hits">8</span>
+
+ <code class="ruby"> subject { cli.create(slug, phrase) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="16">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls client.search with the slug, and phrase" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="18">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:search).with(slug, phrase: phrase)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="19">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "reports on its results" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="23">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String)).twice</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="24">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="28">
+ <span class="hits">6</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:search).and_raise(*error) }</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"> context 'unauthorized error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="31">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="34">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="35">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="40">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="44">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</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"> context 'bad request error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="49">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::BadRequest }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="52">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:bad_request)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="53">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="57">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="58">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::IndexNotFound }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="61">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="62">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> 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"> context 'no service error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="67">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="69">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="70">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="71">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> 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"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="77">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="8316f221a02888ba368e428a23a1788cd0ff469a">
+ <div class="header">
+ <h3>spec/search_kit/cli/subscribers_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>59</b> relevant lines.
+ <span class="green"><b>59</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 'spec_helper'</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 SearchKit::CLI::Subscribers do</code>
+ </li>
+
+ <li class="covered" data-hits="11" data-linenumber="4">
+ <span class="hits">11</span>
+
+ <code class="ruby"> let(:cli) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="11" data-linenumber="5">
+ <span class="hits">11</span>
+
+ <code class="ruby"> let(:subscriber) { SearchKit::Models::Subscriber.new }</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"> subject { cli }</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 '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="10">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:email) { "email@example.com" }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="11">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:password) { "password" }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="12">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="13">
+ <span class="hits">6</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:create).and_return(subscriber) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="14">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="15">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { cli.create(email, password) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="16">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls create on the client with the given parameters" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="18">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"> .to receive(:create)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"> .with(email: email, password: password)</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"> subject</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 "sends a message that the subscriber has been created" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="26">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="27">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> describe 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="31">
+ <span class="hits">4</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:create).and_raise(*error) }</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"> context 'bad request error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="34">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::BadRequest }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="37">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:bad_request)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="38">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="43">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unprocessable }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="46">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unprocessable)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="47">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="52">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="55">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="56">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> 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 '#info' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="63">
+ <span class="hits">6</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:info).and_return(subscriber) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="64">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="65">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { cli.info }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="66">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="67">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls info on the client" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="68">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.client).to receive(:info)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="69">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="72">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "sends a message that the subscriber has been created" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="73">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:info).with(an_instance_of(String))</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="74">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="77">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe 'error handling' do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="78">
+ <span class="hits">4</span>
+
+ <code class="ruby"> before { allow(cli.client).to receive(:info).and_raise(*error) }</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"> context 'unprocessable error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="81">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::Unauthorized }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="84">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:unauthorized)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="85">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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>
+
+ <li class="never" data-hits="" data-linenumber="88">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="89">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'not found error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="90">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { SearchKit::Errors::SubscriberNotFound }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="91">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="92">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="93">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:not_found)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="94">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'no service error' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="99">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:error) { [Faraday::ConnectionFailed, "Message"] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="100">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="101">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="102">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(cli.messages).to receive(:no_service)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="103">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="108">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="77c40391d66a01527ba8cf13f9131cd43a465f1f">
+ <div class="header">
+ <h3>spec/search_kit/clients/documents_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>107</b> relevant lines.
+ <span class="green"><b>107</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 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">describe SearchKit::Clients::Documents do</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="5">
+ <span class="hits">23</span>
+
+ <code class="ruby"> let(:body) { { data: [] } }</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="6">
+ <span class="hits">23</span>
+
+ <code class="ruby"> let(:client) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="7">
+ <span class="hits">21</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="8">
+ <span class="hits">23</span>
+
+ <code class="ruby"> let(:json) { body.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="23" data-linenumber="9">
+ <span class="hits">23</span>
+
+ <code class="ruby"> let(:response) { OpenStruct.new(body: json, status: status) }</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="10">
+ <span class="hits">21</span>
+
+ <code class="ruby"> let(:slug) { "index-slug" }</code>
+ </li>
+
+ <li class="covered" data-hits="11" data-linenumber="11">
+ <span class="hits">11</span>
+
+ <code class="ruby"> let(:status) { 200 }</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="12">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:token) { SearchKit.config.app_token }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="15">
+ <span class="hits">22</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:delete).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="16">
+ <span class="hits">22</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:get).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="17">
+ <span class="hits">22</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:patch).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="18">
+ <span class="hits">22</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:post).and_return(response)</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="2" data-linenumber="21">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="22">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="23">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</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 '#connection' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="26">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client.connection }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="27">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of Faraday::Connection }</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"> describe '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="31">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:document) { { id: id, title: "The first document" } }</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"> let(:params) do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="34">
+ <span class="hits">1</span>
+
+ <code class="ruby"> { token: token, data: { type: "documents", attributes: document } }</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="7" data-linenumber="37">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { client.create(slug, document) }</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 "calls #connection.post with the base path and a document" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="40">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:post).with(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="41">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="45">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="46">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when the response status is 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="50">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</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 "raises a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="53">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::BadRequest)</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="57">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="58">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 "raises a not authorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="61">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</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"> context 'when the response status is 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="66">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="69">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::IndexNotFound)</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 'when the response status is 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="74">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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"> it "raises an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="77">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unprocessable)</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="80">
+
+
+ <code class="ruby"></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"> describe '#delete' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="84">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.delete(slug, id) }</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"> it "calls #connection.get with the base events path" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="87">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="88">
+
+
+ <code class="ruby"> .to receive(:delete)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="89">
+
+
+ <code class="ruby"> .with("#{slug}/#{id}", token: token)</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"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="95">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="96">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="97">
+
+
+ <code class="ruby"> end</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"> context 'when the response status is 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="100">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="101">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="102">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises a not authorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="103">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</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"> context 'when the response status is 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="108">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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"> it "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="111">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::IndexNotFound)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="112">
+
+
+ <code class="ruby"> end</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="never" data-hits="" data-linenumber="115">
+
+
+ <code class="ruby"> end</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"> describe '#show' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="118">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.show(slug, id) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="119">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="120">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls #connection.get with the given id" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="121">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="122">
+
+
+ <code class="ruby"> .to receive(:get)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="123">
+
+
+ <code class="ruby"> .with("#{slug}/#{id}", token: token)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="124">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="125">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="129">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="130">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="131">
+
+
+ <code class="ruby"> end</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"> context 'when the response status is 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="134">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it "raises a not authorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="137">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</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"> context 'when the response status is 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="142">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="145">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::IndexNotFound)</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"> end</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="151">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe '#update' do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="152">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:document) { { id: id, title: "The first document" } }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="153">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="154">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:params) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="155">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="156">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="157">
+
+
+ <code class="ruby"> data: { type: "documents", id: id, attributes: document }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="158">
+ <span class="hits">1</span>
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="159">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="160">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="161">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { client.update(slug, id, document) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="162">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="163">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls #connection.patch with the slug, id and document" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="164">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="165">
+
+
+ <code class="ruby"> .to receive(:patch)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="166">
+
+
+ <code class="ruby"> .with("#{slug}/#{id}", params)</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"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="169">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="170">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="171">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="172">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="173">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when the response status is 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="177">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="178">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="179">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="180">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::BadRequest)</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"> context 'when the response status is 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="185">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 "raises a not authorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="188">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</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"> context 'when the response status is 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="193">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="194">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="195">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="196">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unprocessable)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="197">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="198">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="199">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="200">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="201">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="204">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::IndexNotFound)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="205">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="206">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="207">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="208">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="209">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="210">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="702520ccbeb6503195a6837c6955fc14395245d1">
+ <div class="header">
+ <h3>spec/search_kit/clients/events_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>107</b> relevant lines.
+ <span class="green"><b>107</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 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">describe SearchKit::Clients::Events do</code>
+ </li>
+
+ <li class="covered" data-hits="26" data-linenumber="5">
+ <span class="hits">26</span>
+
+ <code class="ruby"> let(:client) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="10" data-linenumber="6">
+ <span class="hits">10</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="covered" data-hits="26" data-linenumber="7">
+ <span class="hits">26</span>
+
+ <code class="ruby"> let(:hash) { {} }</code>
+ </li>
+
+ <li class="covered" data-hits="26" data-linenumber="8">
+ <span class="hits">26</span>
+
+ <code class="ruby"> let(:json) { hash.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="26" data-linenumber="9">
+ <span class="hits">26</span>
+
+ <code class="ruby"> let(:response) { OpenStruct.new(status: status, body: json) }</code>
+ </li>
+
+ <li class="covered" data-hits="17" data-linenumber="10">
+ <span class="hits">17</span>
+
+ <code class="ruby"> let(:status) { 200 }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="11">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:token) { SearchKit.config.app_token }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="14">
+ <span class="hits">25</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:delete).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="15">
+ <span class="hits">25</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:get).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="16">
+ <span class="hits">25</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:post).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="17">
+ <span class="hits">25</span>
+
+ <code class="ruby"> allow(JSON).to receive(:parse).and_return(hash)</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="2" data-linenumber="20">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="21">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="22">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</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 '#connection' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="25">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client.connection }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="26">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of Faraday::Connection }</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 '#complete' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="30">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { client.complete(id) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="31">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="32">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Event }</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 "calls #connection.get with the base events path" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="35">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:delete).with(id, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="36">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="40">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="41">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="45">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="48">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</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>
+
+ <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"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="53">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="56">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::EventNotFound)</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"> 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"> describe '#index' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="62">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.index }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="63">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="64">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Events }</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 "calls #connection.get with the base events path" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="67">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:get).with(token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="68">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="72">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="73">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="77">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="80">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</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"> end</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="85">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe '#pending' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="86">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:channel) { "colon:separated:string" }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="87">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="88">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.pending(channel) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="89">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="90">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Events }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="91">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="92">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls #connection.get with the base events path" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="93">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="94">
+
+
+ <code class="ruby"> .to receive(:get)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="95">
+
+
+ <code class="ruby"> .with('', "filter[channel]" => channel, token: token)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="96">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="97">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="101">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="102">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="106">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="109">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="110">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="111">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="112">
+
+
+ <code class="ruby"></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"> describe '#publish' do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="116">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:channel) { "colon:separated:string" }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="117">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:options) { { channel: channel, payload: payload } }</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"> let(:payload) do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="120">
+ <span class="hits">6</span>
+
+ <code class="ruby"> { one_key: true, two_key: true, red_key: true, blue_key: true }</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"> let(:params) do</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"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="126">
+
+
+ <code class="ruby"> data: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="127">
+
+
+ <code class="ruby"> type: 'events',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="128">
+
+
+ <code class="ruby"> attributes: { channel: channel, payload: payload }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="129">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="130">
+ <span class="hits">1</span>
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="131">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="132">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="133">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { client.publish(channel, payload) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="134">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="135">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Event }</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 "calls #connection.get with the base events path" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="138">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:post).with('', params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="139">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="140">
+
+
+ <code class="ruby"> end</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"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="143">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="144">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="147">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="148">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="149">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="150">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="151">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::BadRequest)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="152">
+
+
+ <code class="ruby"> end</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="155">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="156">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="159">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="160">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="161">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="162">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="163">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="164">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="165">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="166">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="167">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unprocessable)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="168">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="169">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="170">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="171">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="172">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe '#show' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="173">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.show(id) }</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"> it "calls #connection.get with the base events path / id" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="176">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:get).with(id, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="177">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="181">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="182">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="183">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="184">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="185">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="186">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="189">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="193">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="194">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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"> it do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="197">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::EventNotFound)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="198">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="199">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="200">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="201">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="202">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="8983cc176455e47c3d9ae69f42531c6b3295f4a4">
+ <div class="header">
+ <h3>spec/search_kit/clients/indices_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 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">describe SearchKit::Clients::Indices do</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="5">
+ <span class="hits">22</span>
+
+ <code class="ruby"> let(:json) { response_body.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="6">
+ <span class="hits">22</span>
+
+ <code class="ruby"> let(:response) { OpenStruct.new(status: status, body: json) }</code>
+ </li>
+
+ <li class="covered" data-hits="11" data-linenumber="7">
+ <span class="hits">11</span>
+
+ <code class="ruby"> let(:status) { 200 }</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="8">
+ <span class="hits">22</span>
+
+ <code class="ruby"> let(:client) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="22" data-linenumber="9">
+ <span class="hits">22</span>
+
+ <code class="ruby"> let(:response_body) { { data: [] } }</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="10">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:token) { SearchKit.config.app_token }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="13">
+ <span class="hits">21</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:delete).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="14">
+ <span class="hits">21</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:get).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="15">
+ <span class="hits">21</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:patch).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="16">
+ <span class="hits">21</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:post).and_return(response)</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="2" data-linenumber="19">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="21">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</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"> describe '#connection' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="24">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client.connection }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="25">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of Faraday::Connection }</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 '#archive' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="29">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:slug) { "slug" }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="30">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="31">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.archive(slug) }</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 "calls #connection.delete with given slug" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="34">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:delete).with(slug, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="35">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="39">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="40">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="41">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="44">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="47">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::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"> 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"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="52">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="55">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::IndexNotFound</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 '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="61">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:name) { "name" }</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"> let(:params) do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="64">
+ <span class="hits">1</span>
+
+ <code class="ruby"> { token: token, data: { type: 'indices', attributes: { name: name } } }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="65">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="66">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="67">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { client.create(name) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="69">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls #connection.post with given name" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="70">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:post).with('', params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="71">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="75">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="76">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="79">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="80">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</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"> it "throws a Bad Request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="83">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::BadRequest</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"> end</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="86">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="87">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="88">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="89">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="90">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</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"> 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"> context 'when given status 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="95">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="96">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="97">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws an Unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="98">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="99">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="100">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="101">
+
+
+ <code class="ruby"></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="covered" data-hits="1" data-linenumber="104">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe '#show' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="105">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:slug) { "slug" }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="106">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="107">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.show(slug) }</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 "calls #connection.get with given slug" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="110">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:get).with(slug, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="111">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="112">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="113">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="114">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="115">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="116">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="120">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="123">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</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 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="128">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="129">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="130">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="131">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::IndexNotFound</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"> end</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"> describe '#update' do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="138">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:new_name) { "New name" }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="139">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:slug) { "name" }</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"> let(:params) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="142">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="143">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="144">
+
+
+ <code class="ruby"> data: { type: 'indices', attributes: { name: new_name } }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="145">
+ <span class="hits">1</span>
+
+ <code class="ruby"> }</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="7" data-linenumber="148">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { client.update(slug, name: new_name) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="149">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="150">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls #connection.patch with given slug and attributes" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="151">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:patch).with(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="152">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="155">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="156">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="157">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="161">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="162">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="163">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="164">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::BadRequest</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="169">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="170">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="171">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="172">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</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"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="177">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="178">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="179">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="180">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::IndexNotFound</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"> context 'when given status 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="185">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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 "throws an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="188">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unprocessable</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="never" data-hits="" data-linenumber="192">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="193">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="bf25117f1c4a980b79ddfe284f8e2b2465306ad9">
+ <div class="header">
+ <h3>spec/search_kit/clients/keys_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>117</b> relevant lines.
+ <span class="green"><b>117</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 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">describe SearchKit::Clients::Keys do</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="5">
+ <span class="hits">25</span>
+
+ <code class="ruby"> let(:response) { OpenStruct.new(status: status, body: json) }</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="6">
+ <span class="hits">25</span>
+
+ <code class="ruby"> let(:json) { response_body.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="13" data-linenumber="7">
+ <span class="hits">13</span>
+
+ <code class="ruby"> let(:status) { 200 }</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="8">
+ <span class="hits">25</span>
+
+ <code class="ruby"> let(:client) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="25" data-linenumber="9">
+ <span class="hits">25</span>
+
+ <code class="ruby"> let(:response_body) { { data: [] } }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="10">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:token) { SearchKit.config.app_token }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="24" data-linenumber="13">
+ <span class="hits">24</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:delete).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="24" data-linenumber="14">
+ <span class="hits">24</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:get).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="24" data-linenumber="15">
+ <span class="hits">24</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:patch).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="24" data-linenumber="16">
+ <span class="hits">24</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:post).and_return(response)</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="2" data-linenumber="19">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="21">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</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"> describe '#connection' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="24">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client.connection }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="25">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of Faraday::Connection }</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 '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="29">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:name) { "name" }</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"> let(:params) do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="32">
+ <span class="hits">1</span>
+
+ <code class="ruby"> { token: token, data: { type: 'keys', attributes: { name: name } } }</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="6" data-linenumber="35">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { client.create(name) }</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 "calls #connection.post with given name" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="38">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:post).with('', params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="39">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="44">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="48">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</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 "throws a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="51">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::BadRequest</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="56">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="59">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</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"> context 'when given status 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="64">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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 "throws an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="67">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"> end</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="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"> describe '#expire' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="74">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="75">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="76">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.expire(id) }</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"> it "calls #connection.delete with given slug" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="79">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:delete).with(id, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="80">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="84">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="85">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="89">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="92">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</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"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="97">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="100">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::KeyNotFound</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>
+
+ <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 '#index' do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="106">
+ <span class="hits">4</span>
+
+ <code class="ruby"> subject { client.index }</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"> it "calls #connection.get" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="109">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:get).with("", token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="110">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="111">
+
+
+ <code class="ruby"> end</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"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="114">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="115">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="119">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="120">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="121">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="122">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="123">
+
+
+ <code class="ruby"> end</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"> describe '#show' do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="128">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="129">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="130">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { client.show(id) }</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"> it "calls #connection.get with given id" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="133">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:get).with(id, token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="134">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="138">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="139">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="140">
+
+
+ <code class="ruby"> end</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="143">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="144">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="145">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="146">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="147">
+
+
+ <code class="ruby"> end</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="150">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="151">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="154">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::KeyNotFound</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="155">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="156">
+
+
+ <code class="ruby"> end</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"> describe '#update' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="160">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:name) { "name" }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="161">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:new_name) { "New name" }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="162">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:id) { 1 }</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"> let(:params) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="165">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="166">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="167">
+
+
+ <code class="ruby"> data: { type: 'keys', attributes: { name: new_name } }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="168">
+ <span class="hits">1</span>
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="169">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="170">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="171">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { client.update(id, name: new_name) }</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"> it "calls #connection.patch with given id and attributes" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="174">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:patch).with(id, params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="175">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="176">
+
+
+ <code class="ruby"> end</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"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="179">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="180">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="183">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="184">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="185">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="186">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="187">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::BadRequest</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="188">
+
+
+ <code class="ruby"> end</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="191">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="192">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="195">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="196">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="197">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="198">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="199">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="200">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="201">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="202">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="203">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::KeyNotFound</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="206">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="207">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="208">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="209">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="210">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws an Unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="211">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="212">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="213">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="214">
+
+
+ <code class="ruby"></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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="e92fe2a3328028ac3c1ff90c9971c3e5f32ca919">
+ <div class="header">
+ <h3>spec/search_kit/clients/populate_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>103</b> relevant lines.
+ <span class="green"><b>103</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 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">describe SearchKit::Clients::Populate do</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="5">
+ <span class="hits">21</span>
+
+ <code class="ruby"> let(:response) { OpenStruct.new(status: status, body: json) }</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="6">
+ <span class="hits">21</span>
+
+ <code class="ruby"> let(:json) { response_body.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="7">
+ <span class="hits">9</span>
+
+ <code class="ruby"> let(:status) { 200 }</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="8">
+ <span class="hits">21</span>
+
+ <code class="ruby"> let(:client) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="19" data-linenumber="9">
+ <span class="hits">19</span>
+
+ <code class="ruby"> let(:id) { 1 }</code>
+ </li>
+
+ <li class="covered" data-hits="21" data-linenumber="10">
+ <span class="hits">21</span>
+
+ <code class="ruby"> let(:response_body) { { data: [] } }</code>
+ </li>
+
+ <li class="covered" data-hits="19" data-linenumber="11">
+ <span class="hits">19</span>
+
+ <code class="ruby"> let(:slug) { "an-index-slug" }</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="12">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:token) { SearchKit.config.app_token }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="15">
+ <span class="hits">20</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:delete).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="16">
+ <span class="hits">20</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:get).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="17">
+ <span class="hits">20</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:patch).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="18">
+ <span class="hits">20</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:post).and_return(response)</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="2" data-linenumber="21">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="22">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="23">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</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 '#connection' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="26">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client.connection }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="27">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of Faraday::Connection }</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"> describe '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="31">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:document) { { id: id, title: "The first document" } }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="32">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:documents) { [document] }</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"> let(:params) do</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"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="37">
+
+
+ <code class="ruby"> data: [{ type: "documents", attributes: document }]</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="38">
+ <span class="hits">1</span>
+
+ <code class="ruby"> }</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="7" data-linenumber="41">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { client.create(slug, documents) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls #connection.post with the base path and a document" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="44">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:post).with(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="45">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="46">
+
+
+ <code class="ruby"> end</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"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="49">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="50">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 'when the response status is 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="54">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</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 "raises a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="57">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::BadRequest)</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="61">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="62">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="65">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="69">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="70">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="71">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="72">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="73">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::IndexNotFound)</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="77">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="78">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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 "raises an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="81">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unprocessable)</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"> 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 '#update' do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="87">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:document) { { id: id, title: "The first document" } }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="88">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:documents) { [document] }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="89">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="90">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:params) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="91">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="92">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="93">
+
+
+ <code class="ruby"> data: [{ type: "documents", id: id, attributes: document }]</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="94">
+ <span class="hits">1</span>
+
+ <code class="ruby"> }</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"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="97">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { client.update(slug, documents) }</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 "calls #connection.patch with the slug and documents" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="100">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:patch).with(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="101">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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="covered" data-hits="1" data-linenumber="104">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="105">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="106">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when the response status is 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="110">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="111">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="112">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="113">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::BadRequest)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="114">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="115">
+
+
+ <code class="ruby"> end</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"> context 'when the response status is 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="118">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="119">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="120">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="121">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="122">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="123">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="124">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="125">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="126">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="129">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::IndexNotFound)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="130">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="131">
+
+
+ <code class="ruby"> end</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"> context 'when the response status is 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="134">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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"> it "raises an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="137">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unprocessable)</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"> end</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"> describe '#delete' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="143">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:params) do</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"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="146">
+
+
+ <code class="ruby"> data: [{ type: 'documents', id: id, attributes: { id: id } }]</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="147">
+ <span class="hits">1</span>
+
+ <code class="ruby"> }</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"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="150">
+ <span class="hits">7</span>
+
+ <code class="ruby"> subject { client.delete(slug, [id]) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="151">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="152">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls #connection.get with the correct params" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="153">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:delete).with(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="154">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="155">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="156">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="157">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="158">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="159">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="160">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="161">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="162">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="163">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="164">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="165">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="166">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::BadRequest)</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="169">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="170">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="171">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="174">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="175">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="176">
+
+
+ <code class="ruby"> end</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"> context 'when the response status is 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="179">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="180">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="181">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="182">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::IndexNotFound)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="183">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="184">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="185">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="186">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="187">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="188">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="189">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="190">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unprocessable)</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>
+
+ <li class="never" data-hits="" data-linenumber="193">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="194">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="195">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="2956c2b61788d8b33009bd05b8a5d291f53b62f0">
+ <div class="header">
+ <h3>spec/search_kit/clients/scaffold_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <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>
+ <ol>
+
+ <li class="covered" data-hits="1" data-linenumber="1">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">describe SearchKit::Clients::Scaffold do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="5">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:client) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="6">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:json) { response_body.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="7">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:response_body) { { data: [] } }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="8">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:response) { OpenStruct.new(status: status, body: json) }</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="9">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:status) { 200 }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:token) { SearchKit.config.app_token }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="11">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="12">
+ <span class="hits">7</span>
+
+ <code class="ruby"> before { allow(client.connection).to receive(:post).and_return(response) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="13">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="14">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="15">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="16">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</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 '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="19">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:name) { "My Favorite Scaffolded Index" }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="20">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:documents) { [{ its: "A", plain: "Hash", with: "An", id: 1 }] }</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"> let(:params) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="24">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="25">
+
+
+ <code class="ruby"> data: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="26">
+
+
+ <code class="ruby"> type: 'indices',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="27">
+
+
+ <code class="ruby"> attributes: { name: name },</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="28">
+
+
+ <code class="ruby"> relationships: { documents: documents }</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"> }</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="6" data-linenumber="33">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { client.create(name, documents) }</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 "calls #connection.post with given name" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="36">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:post).with('', params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="37">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="41">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="42">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when gven status 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="46">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</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"> it "throws a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="49">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::BadRequest</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"> 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 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="54">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 "throws an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="57">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="61">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="62">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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 "throws an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="65">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unprocessable</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"></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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="04c25164a52d051c558e56a48dea5796c0952d17">
+ <div class="header">
+ <h3>spec/search_kit/clients/search_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>48</b> relevant lines.
+ <span class="green"><b>48</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 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">describe SearchKit::Clients::Search do</code>
+ </li>
+
+ <li class="covered" data-hits="10" data-linenumber="5">
+ <span class="hits">10</span>
+
+ <code class="ruby"> let(:client) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="10" data-linenumber="6">
+ <span class="hits">10</span>
+
+ <code class="ruby"> let(:json) { response_body.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="10" data-linenumber="7">
+ <span class="hits">10</span>
+
+ <code class="ruby"> let(:response_body) { { data: {} } }</code>
+ </li>
+
+ <li class="covered" data-hits="10" data-linenumber="8">
+ <span class="hits">10</span>
+
+ <code class="ruby"> let(:response) { OpenStruct.new(body: json, status: status) }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="9">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:status) { 200 }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:token) { SearchKit.config.app_token }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="13">
+ <span class="hits">9</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:post).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="9" data-linenumber="14">
+ <span class="hits">9</span>
+
+ <code class="ruby"> allow(JSON).to receive(:parse).and_return(response_body)</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"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="17">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="19">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</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 '#connection' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="22">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client.connection }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="23">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of Faraday::Connection }</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 '#search' do</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="27">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:filters) { { size: 10.5, width: "Wide", gender: "Mens" } }</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="28">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:options) { { phrase: phrase, filters: filters } }</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="29">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:phrase) { "red boots" }</code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="30">
+ <span class="hits">8</span>
+
+ <code class="ruby"> let(:slug) { "an-index-slug" }</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"> let(:params) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="33">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="34">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="35">
+
+
+ <code class="ruby"> data: { type: 'searches', attributes: options }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="36">
+ <span class="hits">1</span>
+
+ <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"></code>
+ </li>
+
+ <li class="covered" data-hits="8" data-linenumber="39">
+ <span class="hits">8</span>
+
+ <code class="ruby"> subject { client.search(slug, options) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="40">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="41">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Search }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "calls #connection.get with the base events path" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="44">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:post).with(slug, params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="45">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="46">
+
+
+ <code class="ruby"> end</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"> it "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="49">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</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"> subject</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"> context 'when the response status is 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="55">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="56">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="57">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="58">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::BadRequest)</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"> context 'when the response status is 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="63">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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"> it "raises an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="66">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unauthorized)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="67">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="69">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="70">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when the response status is 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="71">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "raises an index not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="74">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::IndexNotFound)</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"> context 'when the response status is 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="79">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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 "raises an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="82">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(SearchKit::Errors::Unprocessable)</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="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="7988686f2fece63da46b5ffc0b8be7e5f1dbc10c">
+ <div class="header">
+ <h3>spec/search_kit/clients/subscribers_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>85</b> relevant lines.
+ <span class="green"><b>85</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 'ostruct'</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="2">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="3">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby">describe SearchKit::Clients::Subscribers do</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="5">
+ <span class="hits">20</span>
+
+ <code class="ruby"> let(:client) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="13" data-linenumber="6">
+ <span class="hits">13</span>
+
+ <code class="ruby"> let(:email) { "email@example.com" }</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="7">
+ <span class="hits">20</span>
+
+ <code class="ruby"> let(:json) { response_body.to_json }</code>
+ </li>
+
+ <li class="covered" data-hits="13" data-linenumber="8">
+ <span class="hits">13</span>
+
+ <code class="ruby"> let(:password) { "password" }</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="9">
+ <span class="hits">20</span>
+
+ <code class="ruby"> let(:response_body) { { data: {} } }</code>
+ </li>
+
+ <li class="covered" data-hits="20" data-linenumber="10">
+ <span class="hits">20</span>
+
+ <code class="ruby"> let(:response) { OpenStruct.new(status: status, body: json) }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="11">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:subscriber) { SearchKit::Models::Subscriber.new }</code>
+ </li>
+
+ <li class="covered" data-hits="12" data-linenumber="12">
+ <span class="hits">12</span>
+
+ <code class="ruby"> let(:status) { 200 }</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="13">
+ <span class="hits">3</span>
+
+ <code class="ruby"> let(:token) { SearchKit.config.app_token }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="19" data-linenumber="16">
+ <span class="hits">19</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:get).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="19" data-linenumber="17">
+ <span class="hits">19</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:patch).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="19" data-linenumber="18">
+ <span class="hits">19</span>
+
+ <code class="ruby"> allow(client.connection).to receive(:post).and_return(response)</code>
+ </li>
+
+ <li class="covered" data-hits="19" data-linenumber="19">
+ <span class="hits">19</span>
+
+ <code class="ruby"> allow(JSON).to receive(:parse).and_return(response_body)</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="2" data-linenumber="22">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="24">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</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 '#connection' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="27">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { client.connection }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="28">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of Faraday::Connection }</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 '#create' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="32">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:params) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="33">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="34">
+
+
+ <code class="ruby"> data: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="35">
+
+
+ <code class="ruby"> type: 'subscribers',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="36">
+
+
+ <code class="ruby"> attributes: { email: email, password: password }</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"> }</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="6" data-linenumber="41">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { client.create(email: email, password: password) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="43">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Subscriber }</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 "calls #connection.post with given name" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="46">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:post).with('', params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="47">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="51">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="52">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="56">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</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"> it "throws a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="59">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::BadRequest</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"> context 'when given status 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="64">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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 "throws an unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="67">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="68">
+
+
+ <code class="ruby"> end</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="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"> describe '#info' do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="74">
+ <span class="hits">6</span>
+
+ <code class="ruby"> subject { client.info }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="75">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="76">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Subscriber }</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"> it "calls #connection.get" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="79">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:get).with("", token: token)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="80">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="84">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="85">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="89">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</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 "throws an unauthorized error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="92">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</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"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="97">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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 "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="100">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="101">
+
+
+ <code class="ruby"> .to raise_exception SearchKit::Errors::SubscriberNotFound</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="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 '#update' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="108">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:params) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="109">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="110">
+
+
+ <code class="ruby"> token: token,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="111">
+
+
+ <code class="ruby"> data: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="112">
+
+
+ <code class="ruby"> type: 'subscribers',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="113">
+
+
+ <code class="ruby"> attributes: { email: email, password: password }</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"> }</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="8" data-linenumber="118">
+ <span class="hits">8</span>
+
+ <code class="ruby"> subject { client.update(email: email, password: password) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="119">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="120">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Subscriber }</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"> it "calls #connection.patch with given id and attributes" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="123">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(client.connection).to receive(:patch).with("", params)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="124">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "parses the json response" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="128">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(JSON).to receive(:parse).with(json, symbolize_names: true)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="129">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="130">
+
+
+ <code class="ruby"> end</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"> context 'when given status 400' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="133">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 400 }</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"> it "throws a bad request error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="136">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::BadRequest</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="137">
+
+
+ <code class="ruby"> end</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"> context 'when given status 401' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="141">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 401 }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="142">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="143">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="144">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unauthorized</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"> context 'when given status 404' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="149">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 404 }</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"> it "throws a not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="152">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="153">
+
+
+ <code class="ruby"> .to raise_exception SearchKit::Errors::SubscriberNotFound</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="156">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="157">
+ <span class="hits">1</span>
+
+ <code class="ruby"> context 'when given status 422' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="158">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:status) { 422 }</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"> it "throws an Unprocessable error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="161">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception SearchKit::Errors::Unprocessable</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="162">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="163">
+
+
+ <code class="ruby"> end</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="166">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="1eeb8cc0143cf0f537138464e6f664e35a300656">
+ <div class="header">
+ <h3>spec/search_kit/configuration_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>13</b> relevant lines.
+ <span class="green"><b>13</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 'spec_helper'</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 SearchKit::Configuration do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="4">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:klass) { Class.new }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="5">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="6">
+ <span class="hits">4</span>
+
+ <code class="ruby"> before { klass.extend(described_class) }</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"> subject { klass }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="9">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :config }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="11">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :configure }</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"> describe "Arbitrary assignment" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="14">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "allows any arbitrary setting to hold a value" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="15">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect {</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="16">
+ <span class="hits">1</span>
+
+ <code class="ruby"> klass.configure do |config|</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> config.arbitrary_setting = "value"</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> end</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="19">
+ <span class="hits">2</span>
+
+ <code class="ruby"> }.to change { klass.config.arbitrary_setting }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"> .from(nil)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="21">
+
+
+ <code class="ruby"> .to("value")</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="never" data-hits="" data-linenumber="25">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="113a213a6e4e6d30c6c20d36fd8dc7b1ff94aa61">
+ <div class="header">
+ <h3>spec/search_kit/messages_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>27</b> relevant lines.
+ <span class="green"><b>27</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 'spec_helper'</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 SearchKit::Messages do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="4">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:messages) { described_class.new }</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="5">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:message) { "Just about any string" }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="8">
+ <span class="hits">4</span>
+
+ <code class="ruby"> SearchKit.config.verbose = true</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="9">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="10">
+ <span class="hits">4</span>
+
+ <code class="ruby"> allow(Kernel).to receive(:warn)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="11">
+ <span class="hits">4</span>
+
+ <code class="ruby"> allow(Kernel).to receive(:puts)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="12">
+ <span class="hits">4</span>
+
+ <code class="ruby"> allow(SearchKit.logger).to receive(:warn)</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="13">
+ <span class="hits">4</span>
+
+ <code class="ruby"> allow(SearchKit.logger).to receive(:info)</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="5" data-linenumber="16">
+ <span class="hits">5</span>
+
+ <code class="ruby"> after { SearchKit.config.verbose = false }</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 "#info" do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="19">
+ <span class="hits">3</span>
+
+ <code class="ruby"> subject { messages.info(message) }</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"> it "warns in stderr" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="22">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(Kernel).to receive(:puts)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="23">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "logs a warning" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="27">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(SearchKit.logger).to receive(:info).with(message)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="32">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe "#warning" do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="33">
+ <span class="hits">3</span>
+
+ <code class="ruby"> subject { messages.warning(message) }</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 "warns in stderr" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="36">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(Kernel).to receive(:warn)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="37">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "logs a warning" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="41">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(SearchKit.logger).to receive(:warn).with(message)</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="42">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="45">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="b55fc7449a4d2c9c8d51a643aa6c496549bbc71d">
+ <div class="header">
+ <h3>spec/search_kit/models/document_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>19</b> relevant lines.
+ <span class="green"><b>19</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 'spec_helper'</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 SearchKit::Models::Document do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="4">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:document_data) { {} }</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="5">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:document) { described_class.new(document_data) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="6">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="7">
+ <span class="hits">4</span>
+
+ <code class="ruby"> subject { document }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="8">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="9">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :id }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :source }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="11">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :score }</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"> describe '#get' do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="14">
+ <span class="hits">3</span>
+
+ <code class="ruby"> let(:key) { :a_key }</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"> subject { document.get(key) }</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"> context 'when the source has the available content' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="19">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:content) { :key_content }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="20">
+ <span class="hits">2</span>
+
+ <code class="ruby"> let(:document_data) { { attributes: { key => content } } }</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 "returns the content" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="23">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(subject).to eq content</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>
+
+ <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"> context 'otherwise' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="28">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it "raises an attribute not found error" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="29">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="30">
+
+
+ <code class="ruby"> .to raise_exception(described_class::AttributeNotFound)</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>
+
+ <li class="never" data-hits="" data-linenumber="34">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="abe3760ff37f2a1e4fe992bf4b7adf6cdd6d6c74">
+ <div class="header">
+ <h3>spec/search_kit/models/documents_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 'spec_helper'</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 SearchKit::Models::Documents do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="4">
+ <span class="hits">3</span>
+
+ <code class="ruby"> let(:document_data) { [{}] }</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="5">
+ <span class="hits">3</span>
+
+ <code class="ruby"> let(:documents) { described_class.new(document_data) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="6">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="7">
+ <span class="hits">3</span>
+
+ <code class="ruby"> subject { documents }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="8">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="9">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :contents }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :each }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="11">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="12">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="5010e41abae2d1ce106aae48a134af7f9cb01bc1">
+ <div class="header">
+ <h3>spec/search_kit/models/event_spec.rb</h3>
+ <h4><span class="green">100.0 %</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>
+ </div>
+ </div>
+
+ <pre>
+ <ol>
+
+ <li class="covered" data-hits="1" data-linenumber="1">
+ <span class="hits">1</span>
+
+ <code class="ruby">require 'spec_helper'</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 SearchKit::Models::Event do</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="4">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:event_data) { {} }</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="5">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:event) { described_class.new(event_data) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="6">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="7">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { event }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="8">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="9">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :id }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :channel }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="11">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :payload }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="12">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :state }</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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="45b27afaf5b04598d672c1b89332b34027f6d3b8">
+ <div class="header">
+ <h3>spec/search_kit/models/events_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 'spec_helper'</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 SearchKit::Models::Events do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="4">
+ <span class="hits">3</span>
+
+ <code class="ruby"> let(:event_data) { [{}] }</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="5">
+ <span class="hits">3</span>
+
+ <code class="ruby"> let(:events) { described_class.new(event_data) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="6">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="7">
+ <span class="hits">3</span>
+
+ <code class="ruby"> subject { events }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="8">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="9">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :contents }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :each }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="11">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="12">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="1acff358ef575b030819b388457c0e18738ae9d7">
+ <div class="header">
+ <h3>spec/search_kit/models/key_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>15</b> relevant lines.
+ <span class="green"><b>15</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 'spec_helper'</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 SearchKit::Models::Key do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="4">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:model) { described_class.new }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="5">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="6">
+ <span class="hits">5</span>
+
+ <code class="ruby"> subject { model }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="7">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="8">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Key }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="9">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :uri }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :token }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="11">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :name }</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"> describe '#creator?' do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="14">
+ <span class="hits">3</span>
+
+ <code class="ruby"> subject { model.creator? }</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"> context 'when #privilege is set to "creator"' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="17">
+ <span class="hits">2</span>
+
+ <code class="ruby"> before { model.privilege = 'creator' }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="18">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be true }</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"> context 'otherwise' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="22">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be false }</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="never" data-hits="" data-linenumber="26">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="f77f9b90fa94ec206baf18142085b69958d9dc3c">
+ <div class="header">
+ <h3>spec/search_kit/models/keys_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 'spec_helper'</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 SearchKit::Models::Keys do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:creator_key) do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="5">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Key.new(</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="6">
+
+
+ <code class="ruby"> attributes: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="7">
+
+
+ <code class="ruby"> privilege: 'creator',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="8">
+
+
+ <code class="ruby"> token: creator_token</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="9">
+
+
+ <code class="ruby"> }</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"> 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"> let(:consumer_key) do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="14">
+ <span class="hits">3</span>
+
+ <code class="ruby"> SearchKit::Models::Key.new(</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="15">
+
+
+ <code class="ruby"> attributes: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="16">
+
+
+ <code class="ruby"> privilege: 'consumer',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"> token: consumer_token</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"> )</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="4" data-linenumber="22">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:creator_token) { "12345" }</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="23">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:consumer_token) { "67890" }</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="24">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:keys) { [ creator_key, consumer_key ] }</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="25">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:model) { described_class.new(keys) }</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"> subject { model }</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 "#creator" do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="30">
+ <span class="hits">3</span>
+
+ <code class="ruby"> subject { model.creator }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="31">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of described_class }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="32">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to match described_class.new([creator_key]) }</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"> describe "#tokens" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="36">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { model.tokens }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="37">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to match [creator_token, consumer_token] }</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>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="4d94a689850b6376c68bb5b16af4c8dba8f9cd87">
+ <div class="header">
+ <h3>spec/search_kit/models/subscriber_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>13</b> relevant lines.
+ <span class="green"><b>13</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 'spec_helper'</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 SearchKit::Models::Subscriber do</code>
+ </li>
+
+ <li class="covered" data-hits="6" data-linenumber="4">
+ <span class="hits">6</span>
+
+ <code class="ruby"> let(:model) { described_class.new }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="5">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="6">
+ <span class="hits">4</span>
+
+ <code class="ruby"> subject { model }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="7">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="8">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :id }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="9">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :email }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :uri }</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 '#creator_tokens' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="13">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { model.creator_tokens }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="14">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of Array }</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"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> describe '#keys' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="18">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { model.keys }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="19">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to be_instance_of SearchKit::Models::Keys }</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="never" data-hits="" data-linenumber="22">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="e2fd081246518b5179fe20c3eca4e08ada3511f7">
+ <div class="header">
+ <h3>spec/search_kit/polling/process_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 'spec_helper'</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 SearchKit::Polling::Process do</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="4">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:block) { -> x { true } }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="5">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:channel) { "mail" }</code>
+ </li>
+
+ <li class="covered" data-hits="7" data-linenumber="6">
+ <span class="hits">7</span>
+
+ <code class="ruby"> let(:process) { described_class.new(channel, &block) }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="7">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="8">
+ <span class="hits">4</span>
+
+ <code class="ruby"> subject { process }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="9">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :channel }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="11">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :client }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="12">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :block }</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 '#perform' do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="15">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:event_id) { 345 }</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="16">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:event) do</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="17">
+
+
+ <code class="ruby"> {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> data: [{</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"> type: 'events',</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="20">
+
+
+ <code class="ruby"> id: event_id,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="21">
+
+
+ <code class="ruby"> attributes: {</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="22">
+
+
+ <code class="ruby"> channel: channel,</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="23">
+
+
+ <code class="ruby"> payload: { id: event_id, title: "Gee willikers" }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="24">
+
+
+ <code class="ruby"> }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="25">
+
+
+ <code class="ruby"> }]</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="26">
+ <span class="hits">3</span>
+
+ <code class="ruby"> }</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"> before do</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="30">
+ <span class="hits">3</span>
+
+ <code class="ruby"> allow(process.client).to receive(:pending).and_return(event)</code>
+ </li>
+
+ <li class="covered" data-hits="3" data-linenumber="31">
+ <span class="hits">3</span>
+
+ <code class="ruby"> allow(process.client).to receive(:complete)</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="4" data-linenumber="34">
+ <span class="hits">4</span>
+
+ <code class="ruby"> subject { process.perform }</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 "calls the block with every event" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="37">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(process.block)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="38">
+
+
+ <code class="ruby"> .to receive(:call)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="39">
+
+
+ <code class="ruby"> .and_return(process.block)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="40">
+
+
+ <code class="ruby"> .with(instance_of(OpenStruct))</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="41">
+
+
+ <code class="ruby"> .once</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="42">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="43">
+ <span class="hits">1</span>
+
+ <code class="ruby"> subject</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 "completes the event" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="47">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(process.client)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="48">
+
+
+ <code class="ruby"> .to receive(:complete)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="49">
+
+
+ <code class="ruby"> .with(event_id)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="50">
+
+
+ <code class="ruby"> .once</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"> subject</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"> context "if something fails" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="56">
+ <span class="hits">1</span>
+
+ <code class="ruby"> let(:block) do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="57">
+ <span class="hits">2</span>
+
+ <code class="ruby"> -> * { fail("Generic failure") }</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 "raises an exception" do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="61">
+ <span class="hits">2</span>
+
+ <code class="ruby"> expect { subject }.to raise_exception(StandardError)</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"> end</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="65">
+
+
+ <code class="ruby">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="b7260a9485c0e24754a3a73a6a8c6b0752a836ae">
+ <div class="header">
+ <h3>spec/search_kit/polling_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>13</b> relevant lines.
+ <span class="green"><b>13</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 'spec_helper'</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 SearchKit::Polling do</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="4">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:channel) { 'mail' }</code>
+ </li>
+
+ <li class="covered" data-hits="5" data-linenumber="5">
+ <span class="hits">5</span>
+
+ <code class="ruby"> let(:block) { Proc.new { |x| true } }</code>
+ </li>
+
+ <li class="covered" data-hits="4" data-linenumber="6">
+ <span class="hits">4</span>
+
+ <code class="ruby"> let(:service) { described_class.new(channel, &block) }</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"> subject { service }</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="9">
+
+
+ <code class="ruby"></code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="10">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :channel }</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="11">
+ <span class="hits">2</span>
+
+ <code class="ruby"> it { is_expected.to respond_to :block }</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"> describe '#process_queue' do</code>
+ </li>
+
+ <li class="covered" data-hits="2" data-linenumber="14">
+ <span class="hits">2</span>
+
+ <code class="ruby"> subject { service.process_queue }</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 "performs a Process action" do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="17">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(SearchKit::Polling::Process)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="18">
+
+
+ <code class="ruby"> .to receive(:perform)</code>
+ </li>
+
+ <li class="never" data-hits="" data-linenumber="19">
+
+
+ <code class="ruby"> .with(channel, &block)</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"> subject</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">end</code>
+ </li>
+
+ </ol>
+ </pre>
+</div>
+
+ <div class="source_table" id="c2616e5ad65c8699e7311860fc3850d5c215948f">
+ <div class="header">
+ <h3>spec/search_kit_spec.rb</h3>
+ <h4><span class="green">100.0 %</span> covered</h4>
+ <div>
+ <b>4</b> relevant lines.
+ <span class="green"><b>4</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 'spec_helper'</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 SearchKit do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="4">
+ <span class="hits">1</span>
+
+ <code class="ruby"> it 'has a version number' do</code>
+ </li>
+
+ <li class="covered" data-hits="1" data-linenumber="5">
+ <span class="hits">1</span>
+
+ <code class="ruby"> expect(described_class.gem_version).not_to be nil</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">end</code>
</li>