coverage/index.html in gqli-0.3.0 vs coverage/index.html in gqli-0.4.0

- old
+ new

@@ -12,31 +12,31 @@ <body> <div id="loading"> <img src="./assets/0.10.2/loading.gif" alt="loading"/> </div> <div id="wrapper" style="display:none;"> - <div class="timestamp">Generated <abbr class="timeago" title="2018-10-19T16:26:02+02:00">2018-10-19T16:26:02+02:00</abbr></div> + <div class="timestamp">Generated <abbr class="timeago" title="2018-11-16T16:45:19+01:00">2018-11-16T16:45:19+01:00</abbr></div> <ul class="group_tabs"></ul> <div id="content"> <div class="file_list_container" id="AllFiles"> <h2> <span class="group_name">All Files</span> - (<span class="covered_percent"><span class="green">97.18%</span></span> + (<span class="covered_percent"><span class="green">95.94%</span></span> covered at <span class="covered_strength"> <span class="green"> - 27.54 + 35.32 </span> </span> hits/line) </h2> <a name="AllFiles"></a> <div> - <b>12</b> files in total. - <b>461</b> relevant lines. - <span class="green"><b>448</b> lines covered</span> and - <span class="red"><b>13</b> lines missed </span> + <b>11</b> files in total. + <b>443</b> relevant lines. + <span class="green"><b>425</b> lines covered</span> and + <span class="red"><b>18</b> lines missed </span> </div> <table class="file_list"> <thead> <tr> <th>File</th> @@ -65,31 +65,31 @@ <td class="green strong">100.0 %</td> <td>57</td> <td>28</td> <td>28</td> <td>0</td> - <td>99.2</td> + <td>102.9</td> </tr> <tr> <td class="strong"><a href="#68dcd39c86205e255ffb6dcb92fa9f24c6f7d923" class="src_link" title="lib/gqli/client.rb">lib/gqli/client.rb</a></td> - <td class="green strong">93.75 %</td> + <td class="red strong">78.13 %</td> <td>71</td> <td>32</td> - <td>30</td> - <td>2</td> - <td>4.9</td> + <td>25</td> + <td>7</td> + <td>5.2</td> </tr> <tr> <td class="strong"><a href="#9abd05ccff4ad7a4f5b1bb75901af6e008bc9c5d" class="src_link" title="lib/gqli/dsl.rb">lib/gqli/dsl.rb</a></td> <td class="green strong">100.0 %</td> <td>37</td> <td>12</td> <td>12</td> <td>0</td> - <td>3.1</td> + <td>3.4</td> </tr> <tr> <td class="strong"><a href="#049f7e831814eec17f9b96573767e0e1613dd427" class="src_link" title="lib/gqli/fragment.rb">lib/gqli/fragment.rb</a></td> <td class="green strong">100.0 %</td> @@ -105,71 +105,61 @@ <td class="green strong">100.0 %</td> <td>99</td> <td>65</td> <td>65</td> <td>0</td> - <td>2.3</td> + <td>2.6</td> </tr> <tr> <td class="strong"><a href="#827311add0f30734381233709eff6f2feef29107" class="src_link" title="lib/gqli/node.rb">lib/gqli/node.rb</a></td> <td class="green strong">100.0 %</td> - <td>48</td> - <td>25</td> - <td>25</td> + <td>61</td> + <td>31</td> + <td>31</td> <td>0</td> - <td>279.2</td> + <td>300.9</td> </tr> <tr> <td class="strong"><a href="#add3b96d53406d04d830c517b925e60e5592500d" class="src_link" title="lib/gqli/query.rb">lib/gqli/query.rb</a></td> <td class="red strong">80.0 %</td> <td>29</td> <td>10</td> <td>8</td> <td>2</td> - <td>5.4</td> + <td>5.8</td> </tr> <tr> <td class="strong"><a href="#fc631e4d066aa11a78ad288ef5341c2bc5e2fd9d" class="src_link" title="lib/gqli/response.rb">lib/gqli/response.rb</a></td> <td class="green strong">100.0 %</td> <td>15</td> <td>7</td> <td>7</td> <td>0</td> - <td>4.1</td> + <td>5.0</td> </tr> <tr> <td class="strong"><a href="#4c31f7a77052c02790c8c5c06fd2085c7022ac23" class="src_link" title="lib/gqli/validation.rb">lib/gqli/validation.rb</a></td> - <td class="yellow strong">89.89 %</td> - <td>170</td> - <td>89</td> - <td>80</td> + <td class="green strong">91.0 %</td> + <td>188</td> + <td>100</td> + <td>91</td> <td>9</td> - <td>25.3</td> + <td>27.1</td> </tr> <tr> - <td class="strong"><a href="#8f4756eb3921bfb6ba841bdb3a8d508fd15e06f8" class="src_link" title="spec/lib/gqli/dsl_spec.rb">spec/lib/gqli/dsl_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>249</td> - <td>91</td> - <td>91</td> - <td>0</td> - <td>1.1</td> - </tr> - - <tr> <td class="strong"><a href="#a6d1c1911a021a8ab76d6b8afd1ba662a68cd017" class="src_link" title="spec/lib/gqli/introspection_spec.rb">spec/lib/gqli/introspection_spec.rb</a></td> <td class="green strong">100.0 %</td> - <td>159</td> - <td>88</td> - <td>88</td> + <td>252</td> + <td>144</td> + <td>144</td> <td>0</td> - <td>1.5</td> + <td>1.6</td> </tr> </tbody> </table> </div> @@ -301,30 +291,30 @@ <span class="hits">1</span> <code class="ruby"> def initialize(name = nil, depth = 0, &amp;block)</code> </li> - <li class="covered" data-hits="313" data-linenumber="9"> - <span class="hits">313</span> + <li class="covered" data-hits="328" data-linenumber="9"> + <span class="hits">328</span> <code class="ruby"> @__name = name</code> </li> - <li class="covered" data-hits="313" data-linenumber="10"> - <span class="hits">313</span> + <li class="covered" data-hits="328" data-linenumber="10"> + <span class="hits">328</span> <code class="ruby"> @__depth = depth</code> </li> - <li class="covered" data-hits="313" data-linenumber="11"> - <span class="hits">313</span> + <li class="covered" data-hits="328" data-linenumber="11"> + <span class="hits">328</span> <code class="ruby"> @__nodes = []</code> </li> - <li class="covered" data-hits="313" data-linenumber="12"> - <span class="hits">313</span> + <li class="covered" data-hits="328" data-linenumber="12"> + <span class="hits">328</span> <code class="ruby"> instance_eval(&amp;block) unless block.nil?</code> </li> <li class="never" data-hits="" data-linenumber="13"> @@ -409,18 +399,18 @@ <span class="hits">1</span> <code class="ruby"> def __node(name, params = {}, &amp;block)</code> </li> - <li class="covered" data-hits="112" data-linenumber="27"> - <span class="hits">112</span> + <li class="covered" data-hits="123" data-linenumber="27"> + <span class="hits">123</span> <code class="ruby"> require_relative &#39;./node&#39;</code> </li> - <li class="covered" data-hits="112" data-linenumber="28"> - <span class="hits">112</span> + <li class="covered" data-hits="123" data-linenumber="28"> + <span class="hits">123</span> <code class="ruby"> @__nodes &lt;&lt; Node.new(name, params, __depth + 1, &amp;block)</code> </li> <li class="never" data-hits="" data-linenumber="29"> @@ -547,12 +537,12 @@ <span class="hits">1</span> <code class="ruby"> def __params_from_args(args)</code> </li> - <li class="covered" data-hits="107" data-linenumber="50"> - <span class="hits">107</span> + <li class="covered" data-hits="118" data-linenumber="50"> + <span class="hits">118</span> <code class="ruby"> args.empty? ? {} : args[0]</code> </li> <li class="never" data-hits="" data-linenumber="51"> @@ -571,12 +561,12 @@ <span class="hits">1</span> <code class="ruby"> def method_missing(name, *args, &amp;block)</code> </li> - <li class="covered" data-hits="107" data-linenumber="54"> - <span class="hits">107</span> + <li class="covered" data-hits="118" data-linenumber="54"> + <span class="hits">118</span> <code class="ruby"> __node(name.to_s, __params_from_args(args), &amp;block)</code> </li> <li class="never" data-hits="" data-linenumber="55"> @@ -603,15 +593,15 @@ <div class="source_table" id="68dcd39c86205e255ffb6dcb92fa9f24c6f7d923"> <div class="header"> <h3>lib/gqli/client.rb</h3> - <h4><span class="green">93.75 %</span> covered</h4> + <h4><span class="red">78.13 %</span> covered</h4> <div> <b>32</b> relevant lines. - <span class="green"><b>30</b> lines covered</span> and - <span class="red"><b>2</b> lines missed.</span> + <span class="green"><b>25</b> lines covered</span> and + <span class="red"><b>7</b> lines missed.</span> </div> </div> <pre> <ol> @@ -698,42 +688,42 @@ <span class="hits">1</span> <code class="ruby"> def initialize(url, params: {}, headers: {}, validate_query: true)</code> </li> - <li class="covered" data-hits="13" data-linenumber="15"> - <span class="hits">13</span> + <li class="covered" data-hits="15" data-linenumber="15"> + <span class="hits">15</span> <code class="ruby"> @url = url</code> </li> - <li class="covered" data-hits="13" data-linenumber="16"> - <span class="hits">13</span> + <li class="covered" data-hits="15" data-linenumber="16"> + <span class="hits">15</span> <code class="ruby"> @params = params</code> </li> - <li class="covered" data-hits="13" data-linenumber="17"> - <span class="hits">13</span> + <li class="covered" data-hits="15" data-linenumber="17"> + <span class="hits">15</span> <code class="ruby"> @headers = headers</code> </li> - <li class="covered" data-hits="13" data-linenumber="18"> - <span class="hits">13</span> + <li class="covered" data-hits="15" data-linenumber="18"> + <span class="hits">15</span> <code class="ruby"> @validate_query = validate_query</code> </li> <li class="never" data-hits="" data-linenumber="19"> <code class="ruby"></code> </li> - <li class="covered" data-hits="13" data-linenumber="20"> - <span class="hits">13</span> + <li class="covered" data-hits="15" data-linenumber="20"> + <span class="hits">15</span> <code class="ruby"> @schema = Introspection.new(self) if validate_query</code> </li> <li class="never" data-hits="" data-linenumber="21"> @@ -764,25 +754,25 @@ <span class="hits">1</span> <code class="ruby"> def execute(query)</code> </li> - <li class="covered" data-hits="3" data-linenumber="26"> - <span class="hits">3</span> + <li class="missed" data-hits="0" data-linenumber="26"> + <code class="ruby"> if validate_query</code> </li> - <li class="covered" data-hits="2" data-linenumber="27"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="27"> + <code class="ruby"> validation = schema.validate(query)</code> </li> - <li class="covered" data-hits="2" data-linenumber="28"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="28"> + <code class="ruby"> fail validation_error_message(validation) unless validation.valid?</code> </li> <li class="never" data-hits="" data-linenumber="29"> @@ -794,13 +784,13 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="2" data-linenumber="31"> - <span class="hits">2</span> + <li class="missed" data-hits="0" data-linenumber="31"> + <code class="ruby"> execute!(query)</code> </li> <li class="never" data-hits="" data-linenumber="32"> @@ -830,48 +820,48 @@ <span class="hits">1</span> <code class="ruby"> def execute!(query)</code> </li> - <li class="covered" data-hits="14" data-linenumber="37"> - <span class="hits">14</span> + <li class="covered" data-hits="15" data-linenumber="37"> + <span class="hits">15</span> <code class="ruby"> http_response = HTTP.headers(request_headers).post(@url, params: @params, json: { query: query.to_gql })</code> </li> <li class="never" data-hits="" data-linenumber="38"> <code class="ruby"></code> </li> - <li class="covered" data-hits="14" data-linenumber="39"> - <span class="hits">14</span> + <li class="covered" data-hits="15" data-linenumber="39"> + <span class="hits">15</span> <code class="ruby"> fail &quot;Error: #{http_response.reason}\nBody: #{http_response.body}&quot; if http_response.status &gt;= 300</code> </li> <li class="never" data-hits="" data-linenumber="40"> <code class="ruby"></code> </li> - <li class="covered" data-hits="12" data-linenumber="41"> - <span class="hits">12</span> + <li class="covered" data-hits="15" data-linenumber="41"> + <span class="hits">15</span> <code class="ruby"> data = JSON.parse(http_response.to_s)[&#39;data&#39;]</code> </li> <li class="never" data-hits="" data-linenumber="42"> <code class="ruby"></code> </li> - <li class="covered" data-hits="12" data-linenumber="43"> - <span class="hits">12</span> + <li class="covered" data-hits="15" data-linenumber="43"> + <span class="hits">15</span> <code class="ruby"> Response.new(data, query)</code> </li> <li class="never" data-hits="" data-linenumber="44"> @@ -944,13 +934,13 @@ <span class="hits">1</span> <code class="ruby"> def validation_error_message(validation)</code> </li> - <li class="covered" data-hits="1" data-linenumber="56"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="56"> + <code class="ruby"> &lt;&lt;~ERROR</code> </li> <li class="never" data-hits="" data-linenumber="57"> @@ -1016,12 +1006,12 @@ <code class="ruby"> user_agent: &quot;gqli.rb/#{VERSION}; http.rb/#{HTTP::VERSION}&quot;</code> </li> - <li class="covered" data-hits="14" data-linenumber="68"> - <span class="hits">14</span> + <li class="covered" data-hits="15" data-linenumber="68"> + <span class="hits">15</span> <code class="ruby"> }.merge(@headers)</code> </li> <li class="never" data-hits="" data-linenumber="69"> @@ -1131,12 +1121,12 @@ <span class="hits">1</span> <code class="ruby"> def self.query(name = nil, &amp;block)</code> </li> - <li class="covered" data-hits="19" data-linenumber="13"> - <span class="hits">19</span> + <li class="covered" data-hits="23" data-linenumber="13"> + <span class="hits">23</span> <code class="ruby"> Query.new(name, &amp;block)</code> </li> <li class="never" data-hits="" data-linenumber="14"> @@ -1955,36 +1945,36 @@ <span class="hits">1</span> <code class="ruby"> def initialize(client)</code> </li> - <li class="covered" data-hits="11" data-linenumber="82"> - <span class="hits">11</span> + <li class="covered" data-hits="15" data-linenumber="82"> + <span class="hits">15</span> <code class="ruby"> @schema = client.execute!(IntrospectionQuery).data.__schema</code> </li> - <li class="covered" data-hits="11" data-linenumber="83"> - <span class="hits">11</span> + <li class="covered" data-hits="15" data-linenumber="83"> + <span class="hits">15</span> <code class="ruby"> @query_type = schema.queryType</code> </li> - <li class="covered" data-hits="11" data-linenumber="84"> - <span class="hits">11</span> + <li class="covered" data-hits="15" data-linenumber="84"> + <span class="hits">15</span> <code class="ruby"> @mutation_type = schema.mutationType</code> </li> - <li class="covered" data-hits="11" data-linenumber="85"> - <span class="hits">11</span> + <li class="covered" data-hits="15" data-linenumber="85"> + <span class="hits">15</span> <code class="ruby"> @subscription_type = schema.subscriptionType</code> </li> - <li class="covered" data-hits="11" data-linenumber="86"> - <span class="hits">11</span> + <li class="covered" data-hits="15" data-linenumber="86"> + <span class="hits">15</span> <code class="ruby"> @types = schema.types</code> </li> <li class="never" data-hits="" data-linenumber="87"> @@ -2009,12 +1999,12 @@ <span class="hits">1</span> <code class="ruby"> def validate(query)</code> </li> - <li class="covered" data-hits="16" data-linenumber="91"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="91"> + <span class="hits">21</span> <code class="ruby"> Validation.new(self, query)</code> </li> <li class="never" data-hits="" data-linenumber="92"> @@ -2073,12 +2063,12 @@ <div class="source_table" id="827311add0f30734381233709eff6f2feef29107"> <div class="header"> <h3>lib/gqli/node.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>25</b> relevant lines. - <span class="green"><b>25</b> lines covered</span> and + <b>31</b> relevant lines. + <span class="green"><b>31</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -2142,18 +2132,18 @@ <span class="hits">1</span> <code class="ruby"> def initialize(name, params = {}, depth = 1, &amp;block)</code> </li> - <li class="covered" data-hits="284" data-linenumber="11"> - <span class="hits">284</span> + <li class="covered" data-hits="295" data-linenumber="11"> + <span class="hits">295</span> <code class="ruby"> super(name, depth, &amp;block)</code> </li> - <li class="covered" data-hits="284" data-linenumber="12"> - <span class="hits">284</span> + <li class="covered" data-hits="295" data-linenumber="12"> + <span class="hits">295</span> <code class="ruby"> @__params = params</code> </li> <li class="never" data-hits="" data-linenumber="13"> @@ -2178,42 +2168,42 @@ <span class="hits">1</span> <code class="ruby"> def to_gql</code> </li> - <li class="covered" data-hits="1258" data-linenumber="17"> - <span class="hits">1258</span> + <li class="covered" data-hits="1699" data-linenumber="17"> + <span class="hits">1699</span> <code class="ruby"> result = &#39; &#39; * __depth + __name</code> </li> - <li class="covered" data-hits="1258" data-linenumber="18"> - <span class="hits">1258</span> + <li class="covered" data-hits="1699" data-linenumber="18"> + <span class="hits">1699</span> - <code class="ruby"> result += &#39;(&#39; + __params_to_s(__params, true) + &#39;)&#39; unless __params.empty?</code> + <code class="ruby"> result += __params_to_s(__params, true) unless __params.empty?</code> </li> - <li class="covered" data-hits="1258" data-linenumber="19"> - <span class="hits">1258</span> + <li class="covered" data-hits="1699" data-linenumber="19"> + <span class="hits">1699</span> <code class="ruby"> unless __nodes.empty?</code> </li> - <li class="covered" data-hits="400" data-linenumber="20"> - <span class="hits">400</span> + <li class="covered" data-hits="538" data-linenumber="20"> + <span class="hits">538</span> <code class="ruby"> result += &quot; {\n&quot;</code> </li> - <li class="covered" data-hits="400" data-linenumber="21"> - <span class="hits">400</span> + <li class="covered" data-hits="538" data-linenumber="21"> + <span class="hits">538</span> <code class="ruby"> result += __nodes.map(&amp;:to_gql).join(&quot;\n&quot;)</code> </li> - <li class="covered" data-hits="400" data-linenumber="22"> - <span class="hits">400</span> + <li class="covered" data-hits="538" data-linenumber="22"> + <span class="hits">538</span> <code class="ruby"> result += &quot;\n#{&#39; &#39; * __depth}}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="23"> @@ -2226,12 +2216,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="1258" data-linenumber="25"> - <span class="hits">1258</span> + <li class="covered" data-hits="1699" data-linenumber="25"> + <span class="hits">1699</span> <code class="ruby"> result</code> </li> <li class="never" data-hits="" data-linenumber="26"> @@ -2259,116 +2249,194 @@ </li> <li class="covered" data-hits="1" data-linenumber="30"> <span class="hits">1</span> + <code class="ruby"> def __directive?(params)</code> + </li> + + <li class="covered" data-hits="40" data-linenumber="31"> + <span class="hits">40</span> + + <code class="ruby"> params.size == 1 &amp;&amp; params.keys.first.to_s.start_with?(&#39;@&#39;)</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 __directive(params)</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="35"> + <span class="hits">2</span> + + <code class="ruby"> params.first.tap do |directive, directive_params|</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="36"> + <span class="hits">2</span> + + <code class="ruby"> return &quot; #{directive}#{__params_to_s(directive_params, true)}&quot;</code> + </li> + + <li class="never" data-hits="" data-linenumber="37"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="38"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="39"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="40"> + <span class="hits">1</span> + <code class="ruby"> def __params_to_s(params, initial = false)</code> </li> - <li class="covered" data-hits="57" data-linenumber="31"> - <span class="hits">57</span> + <li class="covered" data-hits="79" data-linenumber="41"> + <span class="hits">79</span> <code class="ruby"> case params</code> </li> - <li class="never" data-hits="" data-linenumber="32"> + <li class="never" data-hits="" data-linenumber="42"> <code class="ruby"> when ::Hash</code> </li> - <li class="covered" data-hits="28" data-linenumber="33"> - <span class="hits">28</span> + <li class="covered" data-hits="40" data-linenumber="43"> + <span class="hits">40</span> + <code class="ruby"> return __directive(params) if __directive?(params)</code> + </li> + + <li class="never" data-hits="" data-linenumber="44"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="38" data-linenumber="45"> + <span class="hits">38</span> + <code class="ruby"> result = params.map do |k, v|</code> </li> - <li class="covered" data-hits="28" data-linenumber="34"> - <span class="hits">28</span> + <li class="covered" data-hits="38" data-linenumber="46"> + <span class="hits">38</span> <code class="ruby"> &quot;#{k}: #{__params_to_s(v)}&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="never" data-hits="" data-linenumber="47"> <code class="ruby"> end.join(&#39;, &#39;)</code> </li> - <li class="never" data-hits="" data-linenumber="36"> + <li class="never" data-hits="" data-linenumber="48"> <code class="ruby"></code> </li> - <li class="covered" data-hits="28" data-linenumber="37"> - <span class="hits">28</span> + <li class="covered" data-hits="38" data-linenumber="49"> + <span class="hits">38</span> - <code class="ruby"> return result if initial</code> + <code class="ruby"> return &quot;(#{result})&quot; if initial</code> </li> - <li class="covered" data-hits="1" data-linenumber="38"> + <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"> &quot;{#{result}}&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="39"> + <li class="never" data-hits="" data-linenumber="52"> <code class="ruby"> when ::Array</code> </li> - <li class="covered" data-hits="3" data-linenumber="40"> + <li class="covered" data-hits="3" data-linenumber="53"> <span class="hits">3</span> <code class="ruby"> &quot;[#{params.map { |p| __params_to_s(p) }.join(&#39;, &#39;)}]&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="41"> + <li class="never" data-hits="" data-linenumber="54"> <code class="ruby"> when ::String</code> </li> - <li class="covered" data-hits="2" data-linenumber="42"> + <li class="covered" data-hits="2" data-linenumber="55"> <span class="hits">2</span> <code class="ruby"> &quot;\&quot;#{params}\&quot;&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="43"> + <li class="never" data-hits="" data-linenumber="56"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="26" data-linenumber="44"> - <span class="hits">26</span> + <li class="covered" data-hits="36" data-linenumber="57"> + <span class="hits">36</span> <code class="ruby"> params.to_s</code> </li> - <li class="never" data-hits="" data-linenumber="45"> + <li class="never" data-hits="" data-linenumber="58"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="46"> + <li class="never" data-hits="" data-linenumber="59"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="47"> + <li class="never" data-hits="" data-linenumber="60"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="48"> + <li class="never" data-hits="" data-linenumber="61"> <code class="ruby">end</code> </li> @@ -2443,12 +2511,12 @@ <span class="hits">1</span> <code class="ruby"> def to_gql</code> </li> - <li class="covered" data-hits="24" data-linenumber="10"> - <span class="hits">24</span> + <li class="covered" data-hits="26" data-linenumber="10"> + <span class="hits">26</span> <code class="ruby"> result = &lt;&lt;~GQL</code> </li> <li class="never" data-hits="" data-linenumber="11"> @@ -2479,12 +2547,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="24" data-linenumber="16"> - <span class="hits">24</span> + <li class="covered" data-hits="26" data-linenumber="16"> + <span class="hits">26</span> <code class="ruby"> result.lstrip</code> </li> <li class="never" data-hits="" data-linenumber="17"> @@ -2642,18 +2710,18 @@ <span class="hits">1</span> <code class="ruby"> def initialize(data, query)</code> </li> - <li class="covered" data-hits="12" data-linenumber="11"> - <span class="hits">12</span> + <li class="covered" data-hits="15" data-linenumber="11"> + <span class="hits">15</span> <code class="ruby"> @data = Hashie::Mash.new(data)</code> </li> - <li class="covered" data-hits="12" data-linenumber="12"> - <span class="hits">12</span> + <li class="covered" data-hits="15" data-linenumber="12"> + <span class="hits">15</span> <code class="ruby"> @query = query</code> </li> <li class="never" data-hits="" data-linenumber="13"> @@ -2680,14 +2748,14 @@ <div class="source_table" id="4c31f7a77052c02790c8c5c06fd2085c7022ac23"> <div class="header"> <h3>lib/gqli/validation.rb</h3> - <h4><span class="yellow">89.89 %</span> covered</h4> + <h4><span class="green">91.0 %</span> covered</h4> <div> - <b>89</b> relevant lines. - <span class="green"><b>80</b> lines covered</span> and + <b>100</b> relevant lines. + <span class="green"><b>91</b> lines covered</span> and <span class="red"><b>9</b> lines missed.</span> </div> </div> <pre> @@ -2739,36 +2807,36 @@ <span class="hits">1</span> <code class="ruby"> def initialize(schema, query)</code> </li> - <li class="covered" data-hits="16" data-linenumber="9"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="9"> + <span class="hits">21</span> <code class="ruby"> @schema = schema</code> </li> - <li class="covered" data-hits="16" data-linenumber="10"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="10"> + <span class="hits">21</span> <code class="ruby"> @query = query</code> </li> - <li class="covered" data-hits="16" data-linenumber="11"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="11"> + <span class="hits">21</span> <code class="ruby"> @errors = []</code> </li> <li class="never" data-hits="" data-linenumber="12"> <code class="ruby"></code> </li> - <li class="covered" data-hits="16" data-linenumber="13"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="13"> + <span class="hits">21</span> <code class="ruby"> validate</code> </li> <li class="never" data-hits="" data-linenumber="14"> @@ -2793,12 +2861,12 @@ <span class="hits">1</span> <code class="ruby"> def valid?</code> </li> - <li class="covered" data-hits="16" data-linenumber="18"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="18"> + <span class="hits">21</span> <code class="ruby"> errors.empty?</code> </li> <li class="never" data-hits="" data-linenumber="19"> @@ -2829,54 +2897,54 @@ <span class="hits">1</span> <code class="ruby"> def validate</code> </li> - <li class="covered" data-hits="16" data-linenumber="24"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="24"> + <span class="hits">21</span> <code class="ruby"> fail &#39;Not a Query object&#39; unless query.is_a?(Query)</code> </li> <li class="never" data-hits="" data-linenumber="25"> <code class="ruby"></code> </li> - <li class="covered" data-hits="32" data-linenumber="26"> - <span class="hits">32</span> + <li class="covered" data-hits="42" data-linenumber="26"> + <span class="hits">42</span> <code class="ruby"> query_type = types.find { |t| t.name.casecmp(&#39;query&#39;).zero? }</code> </li> - <li class="covered" data-hits="16" data-linenumber="27"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="27"> + <span class="hits">21</span> <code class="ruby"> query.__nodes.each do |node|</code> </li> - <li class="covered" data-hits="16" data-linenumber="28"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="28"> + <span class="hits">21</span> <code class="ruby"> begin</code> </li> - <li class="covered" data-hits="16" data-linenumber="29"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="29"> + <span class="hits">21</span> <code class="ruby"> validate_node(query_type, node)</code> </li> <li class="never" data-hits="" data-linenumber="30"> <code class="ruby"> rescue StandardError =&gt; e</code> </li> - <li class="covered" data-hits="9" data-linenumber="31"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="31"> + <span class="hits">11</span> <code class="ruby"> errors &lt;&lt; e</code> </li> <li class="never" data-hits="" data-linenumber="32"> @@ -2895,12 +2963,12 @@ <code class="ruby"></code> </li> - <li class="covered" data-hits="16" data-linenumber="35"> - <span class="hits">16</span> + <li class="covered" data-hits="21" data-linenumber="35"> + <span class="hits">21</span> <code class="ruby"> true</code> </li> <li class="never" data-hits="" data-linenumber="36"> @@ -2943,12 +3011,12 @@ <span class="hits">1</span> <code class="ruby"> def types</code> </li> - <li class="covered" data-hits="79" data-linenumber="43"> - <span class="hits">79</span> + <li class="covered" data-hits="93" data-linenumber="43"> + <span class="hits">93</span> <code class="ruby"> schema.types</code> </li> <li class="never" data-hits="" data-linenumber="44"> @@ -2967,96 +3035,96 @@ <span class="hits">1</span> <code class="ruby"> def validate_node(parent_type, node)</code> </li> - <li class="covered" data-hits="52" data-linenumber="47"> - <span class="hits">52</span> + <li class="covered" data-hits="63" data-linenumber="47"> + <span class="hits">63</span> - <code class="ruby"> return if parent_type.kind == &#39;SCALAR&#39;</code> + <code class="ruby"> validate_directives(node)</code> </li> <li class="never" data-hits="" data-linenumber="48"> <code class="ruby"></code> </li> - <li class="covered" data-hits="52" data-linenumber="49"> - <span class="hits">52</span> + <li class="covered" data-hits="60" data-linenumber="49"> + <span class="hits">60</span> <code class="ruby"> return valid_match_node?(parent_type, node) if node.__name.start_with?(&#39;... on&#39;)</code> </li> <li class="never" data-hits="" data-linenumber="50"> <code class="ruby"></code> </li> - <li class="covered" data-hits="295" data-linenumber="51"> - <span class="hits">295</span> + <li class="covered" data-hits="326" data-linenumber="51"> + <span class="hits">326</span> <code class="ruby"> node_type = parent_type.fetch(&#39;fields&#39;, []).find { |f| f.name == node.__name }</code> </li> - <li class="covered" data-hits="48" data-linenumber="52"> - <span class="hits">48</span> + <li class="covered" data-hits="56" data-linenumber="52"> + <span class="hits">56</span> <code class="ruby"> fail &quot;Node type not found for &#39;#{node.__name}&#39;&quot; if node_type.nil?</code> </li> <li class="never" data-hits="" data-linenumber="53"> <code class="ruby"></code> </li> - <li class="covered" data-hits="45" data-linenumber="54"> - <span class="hits">45</span> + <li class="covered" data-hits="54" data-linenumber="54"> + <span class="hits">54</span> <code class="ruby"> validate_params(node_type, node)</code> </li> <li class="never" data-hits="" data-linenumber="55"> <code class="ruby"></code> </li> - <li class="covered" data-hits="45" data-linenumber="56"> - <span class="hits">45</span> + <li class="covered" data-hits="54" data-linenumber="56"> + <span class="hits">54</span> <code class="ruby"> resolved_node_type = type_for(node_type)</code> </li> - <li class="covered" data-hits="45" data-linenumber="57"> - <span class="hits">45</span> + <li class="covered" data-hits="54" data-linenumber="57"> + <span class="hits">54</span> <code class="ruby"> fail &quot;Node type not found for &#39;#{node.__name}&#39;&quot; if resolved_node_type.nil?</code> </li> <li class="never" data-hits="" data-linenumber="58"> <code class="ruby"></code> </li> - <li class="covered" data-hits="45" data-linenumber="59"> - <span class="hits">45</span> + <li class="covered" data-hits="54" data-linenumber="59"> + <span class="hits">54</span> <code class="ruby"> validate_nesting_node(resolved_node_type, node)</code> </li> <li class="never" data-hits="" data-linenumber="60"> <code class="ruby"></code> </li> - <li class="covered" data-hits="77" data-linenumber="61"> - <span class="hits">77</span> + <li class="covered" data-hits="92" data-linenumber="61"> + <span class="hits">92</span> <code class="ruby"> node.__nodes.each { |n| validate_node(resolved_node_type, n) }</code> </li> <li class="never" data-hits="" data-linenumber="62"> @@ -3102,631 +3170,739 @@ </li> <li class="covered" data-hits="1" data-linenumber="69"> <span class="hits">1</span> + <code class="ruby"> def validate_directives(node)</code> + </li> + + <li class="covered" data-hits="63" data-linenumber="70"> + <span class="hits">63</span> + + <code class="ruby"> return unless node.__params.size == 1</code> + </li> + + <li class="covered" data-hits="11" data-linenumber="71"> + <span class="hits">11</span> + + <code class="ruby"> node.__params.first.tap do |k, v|</code> + </li> + + <li class="covered" data-hits="11" data-linenumber="72"> + <span class="hits">11</span> + + <code class="ruby"> break unless k.to_s.start_with?(&#39;@&#39;)</code> + </li> + + <li class="never" data-hits="" data-linenumber="73"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="7" data-linenumber="74"> + <span class="hits">7</span> + + <code class="ruby"> fail &quot;Directive unknown &#39;#{k}&#39;&quot; unless %i[@include @skip].include?(k)</code> + </li> + + <li class="covered" data-hits="6" data-linenumber="75"> + <span class="hits">6</span> + + <code class="ruby"> fail &quot;Missing arguments for directive &#39;#{k}&#39;&quot; if v.nil? || !v.is_a?(::Hash) || v.empty?</code> + </li> + + <li class="covered" data-hits="4" data-linenumber="76"> + <span class="hits">4</span> + + <code class="ruby"> v.each do |arg, value|</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="77"> + <span class="hits">5</span> + + <code class="ruby"> begin</code> + </li> + + <li class="covered" data-hits="5" data-linenumber="78"> + <span class="hits">5</span> + + <code class="ruby"> fail &quot;Invalid argument &#39;#{arg}&#39; for directive &#39;#{k}&#39;&quot; if arg.to_s != &#39;if&#39;</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="79"> + <span class="hits">3</span> + + <code class="ruby"> fail &quot;Invalid value for &#39;if`, must be a boolean&quot; if value != !!value</code> + </li> + + <li class="never" data-hits="" data-linenumber="80"> + + + <code class="ruby"> rescue StandardError =&gt; e</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="81"> + <span class="hits">3</span> + + <code class="ruby"> errors &lt;&lt; e</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"> 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"> def validate_params(node_type, node)</code> </li> - <li class="covered" data-hits="45" data-linenumber="70"> - <span class="hits">45</span> + <li class="covered" data-hits="68" data-linenumber="88"> + <span class="hits">68</span> - <code class="ruby"> node.__params.each do |param, value|</code> + <code class="ruby"> node.__params.reject { |p, _| p.to_s.start_with?(&#39;@&#39;) }.each do |param, value|</code> </li> - <li class="covered" data-hits="10" data-linenumber="71"> + <li class="covered" data-hits="10" data-linenumber="89"> <span class="hits">10</span> <code class="ruby"> begin</code> </li> - <li class="covered" data-hits="48" data-linenumber="72"> + <li class="covered" data-hits="48" data-linenumber="90"> <span class="hits">48</span> <code class="ruby"> arg = node_type.fetch(&#39;args&#39;, []).find { |a| a.name == param.to_s }</code> </li> - <li class="covered" data-hits="10" data-linenumber="73"> + <li class="covered" data-hits="10" data-linenumber="91"> <span class="hits">10</span> <code class="ruby"> fail &quot;Invalid argument &#39;#{param}&#39;&quot; if arg.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="74"> + <li class="never" data-hits="" data-linenumber="92"> <code class="ruby"></code> </li> - <li class="covered" data-hits="8" data-linenumber="75"> + <li class="covered" data-hits="8" data-linenumber="93"> <span class="hits">8</span> <code class="ruby"> arg_type = type_for(arg)</code> </li> - <li class="covered" data-hits="8" data-linenumber="76"> + <li class="covered" data-hits="8" data-linenumber="94"> <span class="hits">8</span> <code class="ruby"> fail &quot;Argument type not found for &#39;#{param}&#39;&quot; if arg_type.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="77"> + <li class="never" data-hits="" data-linenumber="95"> <code class="ruby"></code> </li> - <li class="covered" data-hits="8" data-linenumber="78"> + <li class="covered" data-hits="8" data-linenumber="96"> <span class="hits">8</span> <code class="ruby"> validate_value_for_type(arg_type, value, param)</code> </li> - <li class="never" data-hits="" data-linenumber="79"> + <li class="never" data-hits="" data-linenumber="97"> <code class="ruby"> rescue StandardError =&gt; e</code> </li> - <li class="covered" data-hits="4" data-linenumber="80"> + <li class="covered" data-hits="4" data-linenumber="98"> <span class="hits">4</span> <code class="ruby"> errors &lt;&lt; e</code> </li> - <li class="never" data-hits="" data-linenumber="81"> + <li class="never" data-hits="" data-linenumber="99"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="82"> + <li class="never" data-hits="" data-linenumber="100"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="83"> + <li class="never" data-hits="" data-linenumber="101"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="84"> + <li class="never" data-hits="" data-linenumber="102"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="85"> + <li class="covered" data-hits="1" data-linenumber="103"> <span class="hits">1</span> <code class="ruby"> def validate_nesting_node(node_type, node)</code> </li> - <li class="covered" data-hits="45" data-linenumber="86"> - <span class="hits">45</span> + <li class="covered" data-hits="54" data-linenumber="104"> + <span class="hits">54</span> <code class="ruby"> fail &quot;Invalid object for node &#39;#{node.__name}&#39;&quot; unless valid_object_node?(node_type, node)</code> </li> - <li class="never" data-hits="" data-linenumber="87"> + <li class="never" data-hits="" data-linenumber="105"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="88"> + <li class="never" data-hits="" data-linenumber="106"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="89"> + <li class="covered" data-hits="1" data-linenumber="107"> <span class="hits">1</span> <code class="ruby"> def valid_object_node?(node_type, node)</code> </li> - <li class="covered" data-hits="45" data-linenumber="90"> - <span class="hits">45</span> + <li class="covered" data-hits="54" data-linenumber="108"> + <span class="hits">54</span> <code class="ruby"> return false if %w[OBJECT INTERFACE].include?(node_type.kind) &amp;&amp; node.__nodes.empty?</code> </li> - <li class="covered" data-hits="41" data-linenumber="91"> - <span class="hits">41</span> + <li class="covered" data-hits="50" data-linenumber="109"> + <span class="hits">50</span> <code class="ruby"> true</code> </li> - <li class="never" data-hits="" data-linenumber="92"> + <li class="never" data-hits="" data-linenumber="110"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="93"> + <li class="never" data-hits="" data-linenumber="111"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="94"> + <li class="covered" data-hits="1" data-linenumber="112"> <span class="hits">1</span> <code class="ruby"> def valid_array_node?(node_type, node)</code> </li> - <li class="missed" data-hits="0" data-linenumber="95"> + <li class="missed" data-hits="0" data-linenumber="113"> <code class="ruby"> return false if %w[OBJECT INTERFACE].include?(node_type.kind) &amp;&amp; node.__nodes.empty?</code> </li> - <li class="missed" data-hits="0" data-linenumber="96"> + <li class="missed" data-hits="0" data-linenumber="114"> <code class="ruby"> true</code> </li> - <li class="never" data-hits="" data-linenumber="97"> + <li class="never" data-hits="" data-linenumber="115"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="98"> + <li class="never" data-hits="" data-linenumber="116"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="99"> + <li class="covered" data-hits="1" data-linenumber="117"> <span class="hits">1</span> <code class="ruby"> def value_type_error(is_type, should_be, for_arg)</code> </li> - <li class="covered" data-hits="2" data-linenumber="100"> + <li class="covered" data-hits="2" data-linenumber="118"> <span class="hits">2</span> <code class="ruby"> fail &quot;Value is &#39;#{is_type}&#39;, but should be &#39;#{should_be}&#39; for &#39;#{for_arg}&#39;&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="101"> + <li class="never" data-hits="" data-linenumber="119"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="102"> + <li class="never" data-hits="" data-linenumber="120"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="103"> + <li class="covered" data-hits="1" data-linenumber="121"> <span class="hits">1</span> <code class="ruby"> def validate_value_for_type(arg_type, value, for_arg)</code> </li> - <li class="covered" data-hits="14" data-linenumber="104"> + <li class="covered" data-hits="14" data-linenumber="122"> <span class="hits">14</span> <code class="ruby"> case value</code> </li> - <li class="never" data-hits="" data-linenumber="105"> + <li class="never" data-hits="" data-linenumber="123"> <code class="ruby"> when ::String</code> </li> - <li class="covered" data-hits="8" data-linenumber="106"> + <li class="covered" data-hits="8" data-linenumber="124"> <span class="hits">8</span> <code class="ruby"> unless arg_type.name == &#39;String&#39; || arg_type.kind == &#39;ENUM&#39; || arg_type.name == &#39;ID&#39;</code> </li> - <li class="covered" data-hits="2" data-linenumber="107"> + <li class="covered" data-hits="2" data-linenumber="125"> <span class="hits">2</span> <code class="ruby"> value_type_error(&#39;String, Enum or ID&#39;, arg_type.name, for_arg)</code> </li> - <li class="never" data-hits="" data-linenumber="108"> + <li class="never" data-hits="" data-linenumber="126"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="6" data-linenumber="109"> + <li class="covered" data-hits="6" data-linenumber="127"> <span class="hits">6</span> <code class="ruby"> if arg_type.kind == &#39;ENUM&#39; &amp;&amp; !arg_type.enumValues.map(&amp;:name).include?(value)</code> </li> - <li class="missed" data-hits="0" data-linenumber="110"> + <li class="missed" data-hits="0" data-linenumber="128"> <code class="ruby"> fail &quot;Invalid value for Enum &#39;#{arg_type.name}&#39; for &#39;#{for_arg}&#39;&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="111"> + <li class="never" data-hits="" data-linenumber="129"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="112"> + <li class="never" data-hits="" data-linenumber="130"> <code class="ruby"> when ::Integer</code> </li> - <li class="covered" data-hits="2" data-linenumber="113"> + <li class="covered" data-hits="2" data-linenumber="131"> <span class="hits">2</span> <code class="ruby"> value_type_error(&#39;Integer&#39;, arg_type.name, for_arg) unless arg_type.name == &#39;Int&#39;</code> </li> - <li class="never" data-hits="" data-linenumber="114"> + <li class="never" data-hits="" data-linenumber="132"> <code class="ruby"> when ::Float</code> </li> - <li class="missed" data-hits="0" data-linenumber="115"> + <li class="missed" data-hits="0" data-linenumber="133"> <code class="ruby"> value_type_error(&#39;Float&#39;, arg_type.name, for_arg) unless arg_type.name == &#39;Float&#39;</code> </li> - <li class="never" data-hits="" data-linenumber="116"> + <li class="never" data-hits="" data-linenumber="134"> <code class="ruby"> when ::Hash</code> </li> - <li class="covered" data-hits="4" data-linenumber="117"> + <li class="covered" data-hits="4" data-linenumber="135"> <span class="hits">4</span> <code class="ruby"> validate_hash_value(arg_type, value, for_arg)</code> </li> - <li class="never" data-hits="" data-linenumber="118"> + <li class="never" data-hits="" data-linenumber="136"> <code class="ruby"> when true, false</code> </li> - <li class="missed" data-hits="0" data-linenumber="119"> + <li class="missed" data-hits="0" data-linenumber="137"> <code class="ruby"> value_type_error(&#39;Boolean&#39;, arg_type.name, for_arg) unless arg_type.name == &#39;Boolean&#39;</code> </li> - <li class="never" data-hits="" data-linenumber="120"> + <li class="never" data-hits="" data-linenumber="138"> <code class="ruby"> else</code> </li> - <li class="missed" data-hits="0" data-linenumber="121"> + <li class="missed" data-hits="0" data-linenumber="139"> <code class="ruby"> value_type_error(value.class.name, arg_type.name, for_arg)</code> </li> - <li class="never" data-hits="" data-linenumber="122"> + <li class="never" data-hits="" data-linenumber="140"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="123"> + <li class="never" data-hits="" data-linenumber="141"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="124"> + <li class="never" data-hits="" data-linenumber="142"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="125"> + <li class="covered" data-hits="1" data-linenumber="143"> <span class="hits">1</span> <code class="ruby"> def validate_hash_value(arg_type, value, for_arg)</code> </li> - <li class="covered" data-hits="4" data-linenumber="126"> + <li class="covered" data-hits="4" data-linenumber="144"> <span class="hits">4</span> <code class="ruby"> value_type_error(&#39;Object&#39;, arg_type.name, for_arg) unless arg_type.kind == &#39;INPUT_OBJECT&#39;</code> </li> - <li class="never" data-hits="" data-linenumber="127"> + <li class="never" data-hits="" data-linenumber="145"> <code class="ruby"></code> </li> - <li class="covered" data-hits="96" data-linenumber="128"> + <li class="covered" data-hits="96" data-linenumber="146"> <span class="hits">96</span> <code class="ruby"> type = types.find { |f| f.name == arg_type.name }</code> </li> - <li class="covered" data-hits="4" data-linenumber="129"> + <li class="covered" data-hits="4" data-linenumber="147"> <span class="hits">4</span> <code class="ruby"> fail &quot;Type not found for &#39;#{arg_type.name}&#39;&quot; if type.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="130"> + <li class="never" data-hits="" data-linenumber="148"> <code class="ruby"></code> </li> - <li class="covered" data-hits="4" data-linenumber="131"> + <li class="covered" data-hits="4" data-linenumber="149"> <span class="hits">4</span> <code class="ruby"> value.each do |k, v|</code> </li> - <li class="covered" data-hits="6" data-linenumber="132"> + <li class="covered" data-hits="6" data-linenumber="150"> <span class="hits">6</span> <code class="ruby"> begin</code> </li> - <li class="covered" data-hits="104" data-linenumber="133"> + <li class="covered" data-hits="104" data-linenumber="151"> <span class="hits">104</span> <code class="ruby"> input_field = type.fetch(&#39;inputFields&#39;, []).find { |f| f.name == k.to_s }</code> </li> - <li class="covered" data-hits="6" data-linenumber="134"> + <li class="covered" data-hits="6" data-linenumber="152"> <span class="hits">6</span> <code class="ruby"> fail &quot;Input field definition not found for &#39;#{k}&#39;&quot; if input_field.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="135"> + <li class="never" data-hits="" data-linenumber="153"> <code class="ruby"></code> </li> - <li class="covered" data-hits="6" data-linenumber="136"> + <li class="covered" data-hits="6" data-linenumber="154"> <span class="hits">6</span> <code class="ruby"> input_field_type = type_for(input_field)</code> </li> - <li class="covered" data-hits="6" data-linenumber="137"> + <li class="covered" data-hits="6" data-linenumber="155"> <span class="hits">6</span> <code class="ruby"> fail &quot;Input field type not found for &#39;#{k}&#39;&quot; if input_field_type.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="138"> + <li class="never" data-hits="" data-linenumber="156"> <code class="ruby"></code> </li> - <li class="covered" data-hits="6" data-linenumber="139"> + <li class="covered" data-hits="6" data-linenumber="157"> <span class="hits">6</span> <code class="ruby"> validate_value_for_type(input_field_type, v, k)</code> </li> - <li class="never" data-hits="" data-linenumber="140"> + <li class="never" data-hits="" data-linenumber="158"> <code class="ruby"> rescue StandardError =&gt; e</code> </li> - <li class="missed" data-hits="0" data-linenumber="141"> + <li class="missed" data-hits="0" data-linenumber="159"> <code class="ruby"> errors &lt;&lt; e</code> </li> - <li class="never" data-hits="" data-linenumber="142"> + <li class="never" data-hits="" data-linenumber="160"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="143"> + <li class="never" data-hits="" data-linenumber="161"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="144"> + <li class="never" data-hits="" data-linenumber="162"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="145"> + <li class="never" data-hits="" data-linenumber="163"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="146"> + <li class="covered" data-hits="1" data-linenumber="164"> <span class="hits">1</span> <code class="ruby"> def type_for(field_type)</code> </li> - <li class="covered" data-hits="59" data-linenumber="147"> - <span class="hits">59</span> + <li class="covered" data-hits="68" data-linenumber="165"> + <span class="hits">68</span> <code class="ruby"> type = case field_type.type.kind</code> </li> - <li class="never" data-hits="" data-linenumber="148"> + <li class="never" data-hits="" data-linenumber="166"> <code class="ruby"> when &#39;NON_NULL&#39;</code> </li> - <li class="covered" data-hits="11" data-linenumber="149"> - <span class="hits">11</span> + <li class="covered" data-hits="14" data-linenumber="167"> + <span class="hits">14</span> <code class="ruby"> non_null_type(field_type.type.ofType)</code> </li> - <li class="never" data-hits="" data-linenumber="150"> + <li class="never" data-hits="" data-linenumber="168"> <code class="ruby"> when &#39;LIST&#39;</code> </li> - <li class="covered" data-hits="2" data-linenumber="151"> + <li class="covered" data-hits="2" data-linenumber="169"> <span class="hits">2</span> <code class="ruby"> field_type.type.ofType</code> </li> - <li class="never" data-hits="" data-linenumber="152"> + <li class="never" data-hits="" data-linenumber="170"> <code class="ruby"> when &#39;OBJECT&#39;, &#39;INTERFACE&#39;, &#39;INPUT_OBJECT&#39;</code> </li> - <li class="covered" data-hits="21" data-linenumber="153"> - <span class="hits">21</span> + <li class="covered" data-hits="24" data-linenumber="171"> + <span class="hits">24</span> <code class="ruby"> field_type.type</code> </li> - <li class="never" data-hits="" data-linenumber="154"> + <li class="never" data-hits="" data-linenumber="172"> <code class="ruby"> when &#39;SCALAR&#39;</code> </li> - <li class="covered" data-hits="25" data-linenumber="155"> - <span class="hits">25</span> + <li class="covered" data-hits="28" data-linenumber="173"> + <span class="hits">28</span> <code class="ruby"> field_type.type</code> </li> - <li class="never" data-hits="" data-linenumber="156"> + <li class="never" data-hits="" data-linenumber="174"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="157"> + <li class="never" data-hits="" data-linenumber="175"> <code class="ruby"></code> </li> - <li class="covered" data-hits="542" data-linenumber="158"> - <span class="hits">542</span> + <li class="covered" data-hits="620" data-linenumber="176"> + <span class="hits">620</span> <code class="ruby"> types.find { |t| t.name == type.name }</code> </li> - <li class="never" data-hits="" data-linenumber="159"> + <li class="never" data-hits="" data-linenumber="177"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="160"> + <li class="never" data-hits="" data-linenumber="178"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="161"> + <li class="covered" data-hits="1" data-linenumber="179"> <span class="hits">1</span> <code class="ruby"> def non_null_type(non_null)</code> </li> - <li class="covered" data-hits="11" data-linenumber="162"> - <span class="hits">11</span> + <li class="covered" data-hits="14" data-linenumber="180"> + <span class="hits">14</span> <code class="ruby"> case non_null.kind</code> </li> - <li class="never" data-hits="" data-linenumber="163"> + <li class="never" data-hits="" data-linenumber="181"> <code class="ruby"> when &#39;LIST&#39;</code> </li> - <li class="covered" data-hits="11" data-linenumber="164"> - <span class="hits">11</span> + <li class="covered" data-hits="14" data-linenumber="182"> + <span class="hits">14</span> <code class="ruby"> non_null.ofType</code> </li> - <li class="never" data-hits="" data-linenumber="165"> + <li class="never" data-hits="" data-linenumber="183"> <code class="ruby"> else</code> </li> - <li class="missed" data-hits="0" data-linenumber="166"> + <li class="missed" data-hits="0" data-linenumber="184"> <code class="ruby"> non_null</code> </li> - <li class="never" data-hits="" data-linenumber="167"> + <li class="never" data-hits="" data-linenumber="185"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="168"> + <li class="never" data-hits="" data-linenumber="186"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="169"> + <li class="never" data-hits="" data-linenumber="187"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="170"> + <li class="never" data-hits="" data-linenumber="188"> <code class="ruby">end</code> </li> </ol> </pre> </div> - <div class="source_table" id="8f4756eb3921bfb6ba841bdb3a8d508fd15e06f8"> + <div class="source_table" id="a6d1c1911a021a8ab76d6b8afd1ba662a68cd017"> <div class="header"> - <h3>spec/lib/gqli/dsl_spec.rb</h3> + <h3>spec/lib/gqli/introspection_spec.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>91</b> relevant lines. - <span class="green"><b>91</b> lines covered</span> and + <b>144</b> relevant lines. + <span class="green"><b>144</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -3745,329 +3921,329 @@ </li> <li class="covered" data-hits="1" data-linenumber="3"> <span class="hits">1</span> - <code class="ruby">class MockGQLInterface</code> + <code class="ruby">describe GQLi::Introspection do</code> </li> - <li class="covered" data-hits="1" data-linenumber="4"> - <span class="hits">1</span> + <li class="covered" data-hits="15" data-linenumber="4"> + <span class="hits">15</span> - <code class="ruby"> include GQLi::DSL</code> + <code class="ruby"> let(:dsl) { GQLi::DSL }</code> </li> - <li class="never" data-hits="" data-linenumber="5"> + <li class="covered" data-hits="1" data-linenumber="5"> + <span class="hits">1</span> - - <code class="ruby">end</code> + <code class="ruby"> let(:client) do</code> </li> - <li class="never" data-hits="" data-linenumber="6"> + <li class="covered" data-hits="15" data-linenumber="6"> + <span class="hits">15</span> - - <code class="ruby"></code> + <code class="ruby"> vcr(&#39;client&#39;) {</code> </li> - <li class="covered" data-hits="1" data-linenumber="7"> - <span class="hits">1</span> + <li class="covered" data-hits="15" data-linenumber="7"> + <span class="hits">15</span> - <code class="ruby">describe GQLi::DSL do</code> + <code class="ruby"> space_id = &#39;cfexampleapi&#39;</code> </li> - <li class="covered" data-hits="10" data-linenumber="8"> - <span class="hits">10</span> + <li class="covered" data-hits="15" data-linenumber="8"> + <span class="hits">15</span> - <code class="ruby"> subject { described_class }</code> + <code class="ruby"> token = &#39;b4c0n73n7fu1&#39;</code> </li> - <li class="never" data-hits="" data-linenumber="9"> + <li class="covered" data-hits="15" data-linenumber="9"> + <span class="hits">15</span> - - <code class="ruby"></code> + <code class="ruby"> GQLi::Client.new(</code> </li> - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="10"> - <code class="ruby"> describe &#39;module level methods&#39; do</code> + + <code class="ruby"> &quot;https://graphql.contentful.com/content/v1/spaces/#{space_id}&quot;,</code> </li> - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="11"> - <code class="ruby"> describe &#39;::query&#39; do</code> + + <code class="ruby"> headers: { &quot;Authorization&quot; =&gt; &quot;Bearer #{token}&quot; }</code> </li> - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> it &#39;can create a query without name&#39; do</code> + + <code class="ruby"> )</code> </li> - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="13"> - <code class="ruby"> query = subject.query {</code> + + <code class="ruby"> }</code> </li> - <li class="covered" data-hits="1" data-linenumber="14"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="14"> - <code class="ruby"> someField</code> + + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="15"> - <code class="ruby"> }</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="16"> + <li class="covered" data-hits="16" data-linenumber="16"> + <span class="hits">16</span> - - <code class="ruby"></code> + <code class="ruby"> subject { client.schema }</code> </li> - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="17"> - <code class="ruby"> expect(query).to be_a GQLi::Query</code> + + <code class="ruby"></code> </li> <li class="covered" data-hits="1" data-linenumber="18"> <span class="hits">1</span> - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> + <code class="ruby"> describe &#39;introspection schema&#39; do</code> </li> - <li class="never" data-hits="" data-linenumber="19"> + <li class="covered" data-hits="1" data-linenumber="19"> + <span class="hits">1</span> - - <code class="ruby"> query {</code> + <code class="ruby"> it &#39;queries the API for the schema&#39; do</code> </li> - <li class="never" data-hits="" data-linenumber="20"> + <li class="covered" data-hits="1" data-linenumber="20"> + <span class="hits">1</span> - - <code class="ruby"> someField</code> + <code class="ruby"> expect(subject.types).not_to be_empty</code> </li> <li class="never" data-hits="" data-linenumber="21"> - <code class="ruby"> }</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="22"> + <li class="covered" data-hits="1" data-linenumber="22"> + <span class="hits">1</span> - - <code class="ruby"> GRAPHQL</code> + <code class="ruby"> expect(subject.types.map(&amp;:name)).to include(&#39;Cat&#39;, &#39;CatCollection&#39;, &#39;Human&#39;)</code> </li> <li class="never" data-hits="" data-linenumber="23"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="24"> - <code class="ruby"></code> + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="25"> - <code class="ruby"> it &#39;can create a query with a name&#39; do</code> + + <code class="ruby"></code> </li> <li class="covered" data-hits="1" data-linenumber="26"> <span class="hits">1</span> - <code class="ruby"> query = subject.query(&#39;FooBar&#39;) {</code> + <code class="ruby"> describe &#39;validations&#39; do</code> </li> <li class="covered" data-hits="1" data-linenumber="27"> <span class="hits">1</span> - <code class="ruby"> someOtherField</code> + <code class="ruby"> it &#39;valid query returns true&#39; do</code> </li> - <li class="never" data-hits="" data-linenumber="28"> + <li class="covered" data-hits="1" data-linenumber="28"> + <span class="hits">1</span> - - <code class="ruby"> }</code> + <code class="ruby"> query = dsl.query {</code> </li> <li class="never" data-hits="" data-linenumber="29"> - <code class="ruby"></code> + <code class="ruby"> catCollection(</code> </li> - <li class="covered" data-hits="1" data-linenumber="30"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="30"> - <code class="ruby"> expect(query).to be_a GQLi::Query</code> + + <code class="ruby"> locale:&quot;en-US&quot;,</code> </li> - <li class="covered" data-hits="1" data-linenumber="31"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="31"> - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> + + <code class="ruby"> limit: 1,</code> </li> <li class="never" data-hits="" data-linenumber="32"> - <code class="ruby"> query FooBar {</code> + <code class="ruby"> where: {</code> </li> <li class="never" data-hits="" data-linenumber="33"> - <code class="ruby"> someOtherField</code> + <code class="ruby"> name:&quot;Nyan Cat&quot;,</code> </li> <li class="never" data-hits="" data-linenumber="34"> - <code class="ruby"> }</code> + <code class="ruby"> OR: {</code> </li> <li class="never" data-hits="" data-linenumber="35"> - <code class="ruby"> GRAPHQL</code> + <code class="ruby"> name:&quot;Happy Cat&quot;</code> </li> <li class="never" data-hits="" data-linenumber="36"> - <code class="ruby"> end</code> + <code class="ruby"> }</code> </li> <li class="never" data-hits="" data-linenumber="37"> - <code class="ruby"> end</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="38"> + <li class="covered" data-hits="1" data-linenumber="38"> + <span class="hits">1</span> - - <code class="ruby"></code> + <code class="ruby"> ) {</code> </li> <li class="covered" data-hits="1" data-linenumber="39"> <span class="hits">1</span> - <code class="ruby"> describe &#39;::fragment&#39; do</code> + <code class="ruby"> items {</code> </li> <li class="covered" data-hits="1" data-linenumber="40"> <span class="hits">1</span> - <code class="ruby"> it &#39;can create a fragment&#39; do</code> + <code class="ruby"> name</code> </li> <li class="covered" data-hits="1" data-linenumber="41"> <span class="hits">1</span> - <code class="ruby"> fragment = subject.fragment(&#39;FooBar&#39;, &#39;Foo&#39;) {</code> + <code class="ruby"> color</code> </li> <li class="covered" data-hits="1" data-linenumber="42"> <span class="hits">1</span> - <code class="ruby"> someFooField</code> + <code class="ruby"> birthday</code> </li> - <li class="never" data-hits="" data-linenumber="43"> + <li class="covered" data-hits="1" data-linenumber="43"> + <span class="hits">1</span> - - <code class="ruby"> }</code> + <code class="ruby"> lives</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="covered" data-hits="1" data-linenumber="44"> + <span class="hits">1</span> - - <code class="ruby"></code> + <code class="ruby"> bestFriend {</code> </li> <li class="covered" data-hits="1" data-linenumber="45"> <span class="hits">1</span> - <code class="ruby"> expect(fragment).to be_a GQLi::Fragment</code> + <code class="ruby"> __on(&#39;Cat&#39;) {</code> </li> <li class="covered" data-hits="1" data-linenumber="46"> <span class="hits">1</span> - <code class="ruby"> expect(fragment.to_gql).to eq &lt;&lt;~GRAPHQL</code> + <code class="ruby"> name</code> </li> <li class="never" data-hits="" data-linenumber="47"> - <code class="ruby"> fragment FooBar on Foo {</code> + <code class="ruby"> }</code> </li> <li class="never" data-hits="" data-linenumber="48"> - <code class="ruby"> someFooField</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="covered" data-hits="1" data-linenumber="49"> + <span class="hits">1</span> - - <code class="ruby"> }</code> + <code class="ruby"> image {</code> </li> - <li class="never" data-hits="" data-linenumber="50"> + <li class="covered" data-hits="1" data-linenumber="50"> + <span class="hits">1</span> - - <code class="ruby"> GRAPHQL</code> + <code class="ruby"> url</code> </li> <li class="never" data-hits="" data-linenumber="51"> - <code class="ruby"> end</code> + <code class="ruby"> }</code> </li> <li class="never" data-hits="" data-linenumber="52"> - <code class="ruby"> end</code> + <code class="ruby"> }</code> </li> <li class="never" data-hits="" data-linenumber="53"> - <code class="ruby"> end</code> + <code class="ruby"> }</code> </li> <li class="never" data-hits="" data-linenumber="54"> - <code class="ruby"></code> + <code class="ruby"> }</code> </li> - <li class="covered" data-hits="1" data-linenumber="55"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="55"> - <code class="ruby"> describe &#39;instance level methods&#39; do</code> + + <code class="ruby"></code> </li> - <li class="covered" data-hits="4" data-linenumber="56"> - <span class="hits">4</span> + <li class="covered" data-hits="1" data-linenumber="56"> + <span class="hits">1</span> - <code class="ruby"> subject { MockGQLInterface.new }</code> + <code class="ruby"> expect(subject.valid?(query)).to be_truthy</code> </li> <li class="never" data-hits="" data-linenumber="57"> @@ -4075,2126 +4251,1171 @@ </li> <li class="covered" data-hits="1" data-linenumber="58"> <span class="hits">1</span> - <code class="ruby"> describe &#39;#query does the same as ::query&#39; do</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> <li class="covered" data-hits="1" data-linenumber="59"> <span class="hits">1</span> - <code class="ruby"> it &#39;can create a query without name&#39; do</code> + <code class="ruby"> expect(validation.valid?).to be_truthy</code> </li> <li class="covered" data-hits="1" data-linenumber="60"> <span class="hits">1</span> - <code class="ruby"> query = subject.query {</code> + <code class="ruby"> expect(validation.errors).to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="61"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="61"> - <code class="ruby"> someField</code> + + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="62"> - <code class="ruby"> }</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="63"> + <li class="covered" data-hits="1" data-linenumber="63"> + <span class="hits">1</span> - - <code class="ruby"></code> + <code class="ruby"> it &#39;wrong node returns false&#39; do</code> </li> <li class="covered" data-hits="1" data-linenumber="64"> <span class="hits">1</span> - <code class="ruby"> expect(query).to be_a GQLi::Query</code> + <code class="ruby"> query = dsl.query {</code> </li> <li class="covered" data-hits="1" data-linenumber="65"> <span class="hits">1</span> - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> + <code class="ruby"> foo</code> </li> <li class="never" data-hits="" data-linenumber="66"> - <code class="ruby"> query {</code> + <code class="ruby"> }</code> </li> <li class="never" data-hits="" data-linenumber="67"> - <code class="ruby"> someField</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="68"> + <li class="covered" data-hits="1" data-linenumber="68"> + <span class="hits">1</span> - - <code class="ruby"> }</code> + <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> </li> <li class="never" data-hits="" data-linenumber="69"> - <code class="ruby"> GRAPHQL</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="70"> + <li class="covered" data-hits="1" data-linenumber="70"> + <span class="hits">1</span> - - <code class="ruby"> end</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="never" data-hits="" data-linenumber="71"> + <li class="covered" data-hits="1" data-linenumber="71"> + <span class="hits">1</span> - - <code class="ruby"></code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> <li class="covered" data-hits="1" data-linenumber="72"> <span class="hits">1</span> - <code class="ruby"> it &#39;can create a query with a name&#39; do</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> <li class="covered" data-hits="1" data-linenumber="73"> <span class="hits">1</span> - <code class="ruby"> query = subject.query(&#39;FooBar&#39;) {</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Node type not found for &#39;foo&#39;&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="74"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="74"> - <code class="ruby"> someOtherField</code> + + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="75"> - <code class="ruby"> }</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="76"> + <li class="covered" data-hits="1" data-linenumber="76"> + <span class="hits">1</span> - - <code class="ruby"></code> + <code class="ruby"> it &#39;object node that doesnt have proper values returns false&#39; do</code> </li> <li class="covered" data-hits="1" data-linenumber="77"> <span class="hits">1</span> - <code class="ruby"> expect(query).to be_a GQLi::Query</code> + <code class="ruby"> query = dsl.query {</code> </li> <li class="covered" data-hits="1" data-linenumber="78"> <span class="hits">1</span> - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> + <code class="ruby"> catCollection</code> </li> <li class="never" data-hits="" data-linenumber="79"> - <code class="ruby"> query FooBar {</code> + <code class="ruby"> }</code> </li> <li class="never" data-hits="" data-linenumber="80"> - <code class="ruby"> someOtherField</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="81"> + <li class="covered" data-hits="1" data-linenumber="81"> + <span class="hits">1</span> - - <code class="ruby"> }</code> + <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> </li> <li class="never" data-hits="" data-linenumber="82"> - <code class="ruby"> GRAPHQL</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"> + <li class="covered" data-hits="1" data-linenumber="83"> <span class="hits">1</span> - <code class="ruby"> describe &#39;#fragment does the same as ::fragment&#39; do</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="covered" data-hits="1" data-linenumber="87"> + <li class="covered" data-hits="1" data-linenumber="84"> <span class="hits">1</span> - <code class="ruby"> it &#39;can create a fragment&#39; do</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="88"> + <li class="covered" data-hits="1" data-linenumber="85"> <span class="hits">1</span> - <code class="ruby"> fragment = subject.fragment(&#39;FooBar&#39;, &#39;Foo&#39;) {</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="89"> + <li class="covered" data-hits="1" data-linenumber="86"> <span class="hits">1</span> - <code class="ruby"> someFooField</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid object for node &#39;catCollection&#39;&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="90"> + <li class="never" data-hits="" data-linenumber="87"> - <code class="ruby"> }</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="91"> + <li class="never" data-hits="" data-linenumber="88"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="92"> + <li class="covered" data-hits="1" data-linenumber="89"> <span class="hits">1</span> - <code class="ruby"> expect(fragment).to be_a GQLi::Fragment</code> + <code class="ruby"> it &#39;object list node that doesnt have proper values returns false&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="93"> + <li class="covered" data-hits="1" data-linenumber="90"> <span class="hits">1</span> - <code class="ruby"> expect(fragment.to_gql).to eq &lt;&lt;~GRAPHQL</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="never" data-hits="" data-linenumber="94"> + <li class="covered" data-hits="1" data-linenumber="91"> + <span class="hits">1</span> - - <code class="ruby"> fragment FooBar on Foo {</code> + <code class="ruby"> catCollection {</code> </li> - <li class="never" data-hits="" data-linenumber="95"> + <li class="covered" data-hits="1" data-linenumber="92"> + <span class="hits">1</span> - - <code class="ruby"> someFooField</code> + <code class="ruby"> items</code> </li> - <li class="never" data-hits="" data-linenumber="96"> + <li class="never" data-hits="" data-linenumber="93"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="97"> + <li class="never" data-hits="" data-linenumber="94"> - <code class="ruby"> GRAPHQL</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="98"> + <li class="never" data-hits="" data-linenumber="95"> - <code class="ruby"> end</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="covered" data-hits="1" data-linenumber="102"> + <li class="covered" data-hits="1" data-linenumber="96"> <span class="hits">1</span> - <code class="ruby"> describe &#39;node DSL&#39; do</code> + <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="103"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="97"> - <code class="ruby"> it &#39;nodes can have arguments&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="104"> - <span class="hits">1</span> - <code class="ruby"> query = subject.query {</code> + <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="105"> + <li class="covered" data-hits="1" data-linenumber="98"> <span class="hits">1</span> - <code class="ruby"> someNode(arg1: 100)</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="covered" data-hits="1" data-linenumber="106"> + <li class="covered" data-hits="1" data-linenumber="99"> <span class="hits">1</span> - <code class="ruby"> otherNode(arg2: &#39;some_string&#39;)</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="107"> + <li class="covered" data-hits="1" data-linenumber="100"> <span class="hits">1</span> - <code class="ruby"> moreNodes(arg3: { nestedArg: [1, 2] })</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="never" data-hits="" data-linenumber="108"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="109"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="110"> + <li class="covered" data-hits="1" data-linenumber="101"> <span class="hits">1</span> - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid object for node &#39;items&#39;&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="111"> + <li class="never" data-hits="" data-linenumber="102"> - <code class="ruby"> query {</code> - </li> - - <li class="never" data-hits="" data-linenumber="112"> - - - <code class="ruby"> someNode(arg1: 100)</code> - </li> - - <li class="never" data-hits="" data-linenumber="113"> - - - <code class="ruby"> otherNode(arg2: &quot;some_string&quot;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="114"> - - - <code class="ruby"> moreNodes(arg3: {nestedArg: [1, 2]})</code> - </li> - - <li class="never" data-hits="" data-linenumber="115"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="116"> - - - <code class="ruby"> GRAPHQL</code> - </li> - - <li class="never" data-hits="" data-linenumber="117"> - - <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="118"> + <li class="never" data-hits="" data-linenumber="103"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="119"> + <li class="covered" data-hits="1" data-linenumber="104"> <span class="hits">1</span> - <code class="ruby"> it &#39;nodes can have arbitrarily nested nodes&#39; do</code> + <code class="ruby"> it &#39;type matching on invalid type returns false&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="120"> + <li class="covered" data-hits="1" data-linenumber="105"> <span class="hits">1</span> - <code class="ruby"> query = subject.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="121"> + <li class="covered" data-hits="1" data-linenumber="106"> <span class="hits">1</span> - <code class="ruby"> aNode {</code> + <code class="ruby"> catCollection {</code> </li> - <li class="covered" data-hits="1" data-linenumber="122"> + <li class="covered" data-hits="1" data-linenumber="107"> <span class="hits">1</span> - <code class="ruby"> withChild {</code> + <code class="ruby"> items {</code> </li> - <li class="covered" data-hits="1" data-linenumber="123"> + <li class="covered" data-hits="1" data-linenumber="108"> <span class="hits">1</span> - <code class="ruby"> moreChildren</code> + <code class="ruby"> bestFriend {</code> </li> - <li class="covered" data-hits="1" data-linenumber="124"> + <li class="covered" data-hits="1" data-linenumber="109"> <span class="hits">1</span> - <code class="ruby"> andASibiling(someParameterHere: &#39;just for fun&#39;) {</code> + <code class="ruby"> __on(&#39;InvalidType&#39;) {</code> </li> - <li class="covered" data-hits="1" data-linenumber="125"> + <li class="covered" data-hits="1" data-linenumber="110"> <span class="hits">1</span> - <code class="ruby"> withEvenMore</code> + <code class="ruby"> foo</code> </li> - <li class="never" data-hits="" data-linenumber="126"> + <li class="never" data-hits="" data-linenumber="111"> - <code class="ruby"> }</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"> alsoASibiling</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"> withoutChild</code> - </li> - - <li class="never" data-hits="" data-linenumber="131"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="132"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="133"> - <span class="hits">1</span> - - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> - </li> - - <li class="never" data-hits="" data-linenumber="134"> - - - <code class="ruby"> query {</code> - </li> - - <li class="never" data-hits="" data-linenumber="135"> - - - <code class="ruby"> aNode {</code> - </li> - - <li class="never" data-hits="" data-linenumber="136"> - - - <code class="ruby"> withChild {</code> - </li> - - <li class="never" data-hits="" data-linenumber="137"> - - - <code class="ruby"> moreChildren</code> - </li> - - <li class="never" data-hits="" data-linenumber="138"> - - - <code class="ruby"> andASibiling(someParameterHere: &quot;just for fun&quot;) {</code> - </li> - - <li class="never" data-hits="" data-linenumber="139"> - - - <code class="ruby"> withEvenMore</code> - </li> - - <li class="never" data-hits="" data-linenumber="140"> - - <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="141"> + <li class="never" data-hits="" data-linenumber="112"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="142"> + <li class="never" data-hits="" data-linenumber="113"> - <code class="ruby"> alsoASibiling</code> - </li> - - <li class="never" data-hits="" data-linenumber="143"> - - <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="144"> + <li class="never" data-hits="" data-linenumber="114"> - <code class="ruby"> withoutChild</code> - </li> - - <li class="never" data-hits="" data-linenumber="145"> - - <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="146"> + <li class="never" data-hits="" data-linenumber="115"> - <code class="ruby"> GRAPHQL</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="covered" data-hits="1" data-linenumber="149"> - <span class="hits">1</span> - - <code class="ruby"> it &#39;queries can have inlined fragments at any level&#39; do</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="150"> - <span class="hits">1</span> - - <code class="ruby"> NameFragment = subject.fragment(&#39;NameFragment&#39;, &#39;Foo&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="151"> - <span class="hits">1</span> - - <code class="ruby"> name</code> - </li> - - <li class="never" data-hits="" data-linenumber="152"> - - <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="153"> + <li class="never" data-hits="" data-linenumber="116"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="154"> + <li class="covered" data-hits="1" data-linenumber="117"> <span class="hits">1</span> - <code class="ruby"> AgeFragment = subject.fragment(&#39;AgeFragment&#39;, &#39;Foo&#39;) {</code> + <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="155"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="118"> - <code class="ruby"> age</code> - </li> - - <li class="never" data-hits="" data-linenumber="156"> - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="157"> - - <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="158"> + <li class="covered" data-hits="1" data-linenumber="119"> <span class="hits">1</span> - <code class="ruby"> query = subject.query {</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="covered" data-hits="1" data-linenumber="159"> + <li class="covered" data-hits="1" data-linenumber="120"> <span class="hits">1</span> - <code class="ruby"> peopleCollection {</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="160"> + <li class="covered" data-hits="1" data-linenumber="121"> <span class="hits">1</span> - <code class="ruby"> ___ NameFragment</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="161"> + <li class="covered" data-hits="1" data-linenumber="122"> <span class="hits">1</span> - <code class="ruby"> ___ AgeFragment</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Match type &#39;InvalidType&#39; invalid&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="162"> + <li class="never" data-hits="" data-linenumber="123"> - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="163"> - - - <code class="ruby"> }</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"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> - </li> - - <li class="never" data-hits="" data-linenumber="166"> - - - <code class="ruby"> query {</code> - </li> - - <li class="never" data-hits="" data-linenumber="167"> - - - <code class="ruby"> peopleCollection {</code> - </li> - - <li class="never" data-hits="" data-linenumber="168"> - - - <code class="ruby"> name</code> - </li> - - <li class="never" data-hits="" data-linenumber="169"> - - - <code class="ruby"> age</code> - </li> - - <li class="never" data-hits="" data-linenumber="170"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="171"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="172"> - - - <code class="ruby"> GRAPHQL</code> - </li> - - <li class="never" data-hits="" data-linenumber="173"> - - <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="174"> + <li class="never" data-hits="" data-linenumber="124"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="175"> + <li class="covered" data-hits="1" data-linenumber="125"> <span class="hits">1</span> - <code class="ruby"> it &#39;queries can have type matchers&#39; do</code> + <code class="ruby"> it &#39;invalid arguments return false&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="176"> + <li class="covered" data-hits="1" data-linenumber="126"> <span class="hits">1</span> - <code class="ruby"> query = subject.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="177"> + <li class="covered" data-hits="1" data-linenumber="127"> <span class="hits">1</span> - <code class="ruby"> catCollection {</code> + <code class="ruby"> catCollection(invalidParam: 1) {</code> </li> - <li class="covered" data-hits="1" data-linenumber="178"> + <li class="covered" data-hits="1" data-linenumber="128"> <span class="hits">1</span> <code class="ruby"> items {</code> </li> - <li class="covered" data-hits="1" data-linenumber="179"> + <li class="covered" data-hits="1" data-linenumber="129"> <span class="hits">1</span> <code class="ruby"> name</code> </li> - <li class="covered" data-hits="1" data-linenumber="180"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="130"> - <code class="ruby"> bestFriend {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="181"> - <span class="hits">1</span> - <code class="ruby"> __on(&#39;Cat&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="182"> - <span class="hits">1</span> - - <code class="ruby"> name</code> - </li> - - <li class="never" data-hits="" data-linenumber="183"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="184"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="185"> - - <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="186"> + <li class="never" data-hits="" data-linenumber="131"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="187"> + <li class="never" data-hits="" data-linenumber="132"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="188"> + <li class="never" data-hits="" data-linenumber="133"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="189"> + <li class="covered" data-hits="1" data-linenumber="134"> <span class="hits">1</span> - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> + <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> </li> - <li class="never" data-hits="" data-linenumber="190"> + <li class="never" data-hits="" data-linenumber="135"> - <code class="ruby"> query {</code> - </li> - - <li class="never" data-hits="" data-linenumber="191"> - - - <code class="ruby"> catCollection {</code> - </li> - - <li class="never" data-hits="" data-linenumber="192"> - - - <code class="ruby"> items {</code> - </li> - - <li class="never" data-hits="" data-linenumber="193"> - - - <code class="ruby"> name</code> - </li> - - <li class="never" data-hits="" data-linenumber="194"> - - - <code class="ruby"> bestFriend {</code> - </li> - - <li class="never" data-hits="" data-linenumber="195"> - - - <code class="ruby"> ... on Cat {</code> - </li> - - <li class="never" data-hits="" data-linenumber="196"> - - - <code class="ruby"> name</code> - </li> - - <li class="never" data-hits="" data-linenumber="197"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="198"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="199"> - - - <code class="ruby"> }</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"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="202"> - - - <code class="ruby"> GRAPHQL</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"> + <li class="covered" data-hits="1" data-linenumber="136"> <span class="hits">1</span> - <code class="ruby"> it &#39;can use __node to define nodes that would collide otherwise&#39; do</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="covered" data-hits="1" data-linenumber="206"> + <li class="covered" data-hits="1" data-linenumber="137"> <span class="hits">1</span> - <code class="ruby"> query = subject.query {</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="207"> + <li class="covered" data-hits="1" data-linenumber="138"> <span class="hits">1</span> - <code class="ruby"> catCollection {</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="208"> + <li class="covered" data-hits="1" data-linenumber="139"> <span class="hits">1</span> - <code class="ruby"> items {</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid argument &#39;invalidParam&#39;&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="209"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="140"> - <code class="ruby"> sys {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="210"> - <span class="hits">1</span> - <code class="ruby"> __node(&#39;id&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="211"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="212"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="213"> - - - <code class="ruby"> }</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"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="216"> - <span class="hits">1</span> - - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> - </li> - - <li class="never" data-hits="" data-linenumber="217"> - - - <code class="ruby"> query {</code> - </li> - - <li class="never" data-hits="" data-linenumber="218"> - - - <code class="ruby"> catCollection {</code> - </li> - - <li class="never" data-hits="" data-linenumber="219"> - - - <code class="ruby"> items {</code> - </li> - - <li class="never" data-hits="" data-linenumber="220"> - - - <code class="ruby"> sys {</code> - </li> - - <li class="never" data-hits="" data-linenumber="221"> - - - <code class="ruby"> id</code> - </li> - - <li class="never" data-hits="" data-linenumber="222"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="223"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="224"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="225"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="226"> - - - <code class="ruby"> GRAPHQL</code> - </li> - - <li class="never" data-hits="" data-linenumber="227"> - - <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="228"> + <li class="never" data-hits="" data-linenumber="141"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="229"> + <li class="covered" data-hits="1" data-linenumber="142"> <span class="hits">1</span> - <code class="ruby"> it &#39;__node can receive arguments and children nodes&#39; do</code> + <code class="ruby"> it &#39;invalid argument type returns false&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="230"> + <li class="covered" data-hits="1" data-linenumber="143"> <span class="hits">1</span> - <code class="ruby"> query = subject.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="231"> + <li class="covered" data-hits="1" data-linenumber="144"> <span class="hits">1</span> - <code class="ruby"> __node(&#39;catCollection&#39;, limit: 1) {</code> + <code class="ruby"> catCollection(limit: &#39;foo&#39;) {</code> </li> - <li class="covered" data-hits="1" data-linenumber="232"> + <li class="covered" data-hits="1" data-linenumber="145"> <span class="hits">1</span> <code class="ruby"> items {</code> </li> - <li class="covered" data-hits="1" data-linenumber="233"> + <li class="covered" data-hits="1" data-linenumber="146"> <span class="hits">1</span> <code class="ruby"> name</code> </li> - <li class="never" data-hits="" data-linenumber="234"> + <li class="never" data-hits="" data-linenumber="147"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="235"> + <li class="never" data-hits="" data-linenumber="148"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="236"> + <li class="never" data-hits="" data-linenumber="149"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="237"> + <li class="never" data-hits="" data-linenumber="150"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="238"> + <li class="covered" data-hits="1" data-linenumber="151"> <span class="hits">1</span> - <code class="ruby"> expect(query.to_gql).to eq &lt;&lt;~GRAPHQL</code> + <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> </li> - <li class="never" data-hits="" data-linenumber="239"> + <li class="never" data-hits="" data-linenumber="152"> - <code class="ruby"> query {</code> - </li> - - <li class="never" data-hits="" data-linenumber="240"> - - - <code class="ruby"> catCollection(limit: 1) {</code> - </li> - - <li class="never" data-hits="" data-linenumber="241"> - - - <code class="ruby"> items {</code> - </li> - - <li class="never" data-hits="" data-linenumber="242"> - - - <code class="ruby"> name</code> - </li> - - <li class="never" data-hits="" data-linenumber="243"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="244"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="245"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="246"> - - - <code class="ruby"> GRAPHQL</code> - </li> - - <li class="never" data-hits="" data-linenumber="247"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="248"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="249"> - - - <code class="ruby">end</code> - </li> - - </ol> - </pre> -</div> - - - <div class="source_table" id="a6d1c1911a021a8ab76d6b8afd1ba662a68cd017"> - <div class="header"> - <h3>spec/lib/gqli/introspection_spec.rb</h3> - <h4><span class="green">100.0 %</span> covered</h4> - <div> - <b>88</b> relevant lines. - <span class="green"><b>88</b> lines covered</span> and - <span class="red"><b>0</b> lines missed.</span> - </div> - </div> - - <pre> - <ol> - - <li class="covered" data-hits="1" data-linenumber="1"> - <span class="hits">1</span> - - <code class="ruby">require &#39;spec_helper&#39;</code> - </li> - - <li class="never" data-hits="" data-linenumber="2"> - - <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="3"> + <li class="covered" data-hits="1" data-linenumber="153"> <span class="hits">1</span> - <code class="ruby">describe GQLi::Introspection do</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="covered" data-hits="8" data-linenumber="4"> - <span class="hits">8</span> - - <code class="ruby"> let(:dsl) { GQLi::DSL }</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="5"> + <li class="covered" data-hits="1" data-linenumber="154"> <span class="hits">1</span> - <code class="ruby"> let(:client) do</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="8" data-linenumber="6"> - <span class="hits">8</span> - - <code class="ruby"> vcr(&#39;client&#39;) {</code> - </li> - - <li class="covered" data-hits="8" data-linenumber="7"> - <span class="hits">8</span> - - <code class="ruby"> space_id = &#39;cfexampleapi&#39;</code> - </li> - - <li class="covered" data-hits="8" data-linenumber="8"> - <span class="hits">8</span> - - <code class="ruby"> token = &#39;b4c0n73n7fu1&#39;</code> - </li> - - <li class="covered" data-hits="8" data-linenumber="9"> - <span class="hits">8</span> - - <code class="ruby"> GQLi::Client.new(</code> - </li> - - <li class="never" data-hits="" data-linenumber="10"> - - - <code class="ruby"> &quot;https://graphql.contentful.com/content/v1/spaces/#{space_id}&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> headers: { &quot;Authorization&quot; =&gt; &quot;Bearer #{token}&quot; }</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - - <code class="ruby"> )</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> - - <li class="never" data-hits="" data-linenumber="15"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="9" data-linenumber="16"> - <span class="hits">9</span> - - <code class="ruby"> subject { client.schema }</code> - </li> - - <li class="never" data-hits="" data-linenumber="17"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="18"> + <li class="covered" data-hits="1" data-linenumber="155"> <span class="hits">1</span> - <code class="ruby"> describe &#39;introspection schema&#39; do</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="19"> + <li class="covered" data-hits="1" data-linenumber="156"> <span class="hits">1</span> - <code class="ruby"> it &#39;queries the API for the schema&#39; do</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Value is &#39;String, Enum or ID&#39;, but should be &#39;Int&#39; for &#39;limit&#39;&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="20"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="157"> - <code class="ruby"> expect(subject.types).not_to be_empty</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"> expect(subject.types.map(&amp;:name)).to include(&#39;Cat&#39;, &#39;CatCollection&#39;, &#39;Human&#39;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="23"> - - <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="24"> + <li class="never" data-hits="" data-linenumber="158"> - <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"> + <li class="covered" data-hits="1" data-linenumber="159"> <span class="hits">1</span> - <code class="ruby"> describe &#39;validations&#39; do</code> + <code class="ruby"> describe &#39;directives&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="27"> + <li class="covered" data-hits="1" data-linenumber="160"> <span class="hits">1</span> - <code class="ruby"> it &#39;valid query returns true&#39; do</code> + <code class="ruby"> it &#39;can create a query with a directive and validations should not fail&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="28"> + <li class="covered" data-hits="1" data-linenumber="161"> <span class="hits">1</span> - <code class="ruby"> query = dsl.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="never" data-hits="" data-linenumber="29"> - - - <code class="ruby"> catCollection(</code> - </li> - - <li class="never" data-hits="" data-linenumber="30"> - - - <code class="ruby"> locale:&quot;en-US&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="31"> - - - <code class="ruby"> limit: 1,</code> - </li> - - <li class="never" data-hits="" data-linenumber="32"> - - - <code class="ruby"> where: {</code> - </li> - - <li class="never" data-hits="" data-linenumber="33"> - - - <code class="ruby"> name:&quot;Nyan Cat&quot;,</code> - </li> - - <li class="never" data-hits="" data-linenumber="34"> - - - <code class="ruby"> OR: {</code> - </li> - - <li class="never" data-hits="" data-linenumber="35"> - - - <code class="ruby"> name:&quot;Happy Cat&quot;</code> - </li> - - <li class="never" data-hits="" data-linenumber="36"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="37"> - - - <code class="ruby"> }</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="38"> + <li class="covered" data-hits="1" data-linenumber="162"> <span class="hits">1</span> - <code class="ruby"> ) {</code> + <code class="ruby"> catCollection {</code> </li> - <li class="covered" data-hits="1" data-linenumber="39"> + <li class="covered" data-hits="1" data-linenumber="163"> <span class="hits">1</span> - <code class="ruby"> items {</code> + <code class="ruby"> items {</code> </li> - <li class="covered" data-hits="1" data-linenumber="40"> + <li class="covered" data-hits="1" data-linenumber="164"> <span class="hits">1</span> - <code class="ruby"> name</code> + <code class="ruby"> name(:@include =&gt; { if: true })</code> </li> - <li class="covered" data-hits="1" data-linenumber="41"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="165"> - <code class="ruby"> color</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="42"> - <span class="hits">1</span> - <code class="ruby"> birthday</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="43"> - <span class="hits">1</span> - - <code class="ruby"> lives</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="44"> - <span class="hits">1</span> - - <code class="ruby"> bestFriend {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="45"> - <span class="hits">1</span> - - <code class="ruby"> __on(&#39;Cat&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="46"> - <span class="hits">1</span> - - <code class="ruby"> name</code> - </li> - - <li class="never" data-hits="" data-linenumber="47"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="48"> - - <code class="ruby"> }</code> </li> - <li class="covered" data-hits="1" data-linenumber="49"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="166"> - <code class="ruby"> image {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="50"> - <span class="hits">1</span> - <code class="ruby"> url</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"> }</code> </li> - <li class="never" data-hits="" data-linenumber="53"> + <li class="never" data-hits="" data-linenumber="167"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="54"> + <li class="never" data-hits="" data-linenumber="168"> - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="55"> - - <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="56"> + <li class="covered" data-hits="1" data-linenumber="169"> <span class="hits">1</span> - <code class="ruby"> expect(subject.valid?(query)).to be_truthy</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="never" data-hits="" data-linenumber="57"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="58"> + <li class="covered" data-hits="1" data-linenumber="170"> <span class="hits">1</span> - <code class="ruby"> validation = subject.validate(query)</code> + <code class="ruby"> expect(validation.valid?).to be_truthy</code> </li> - <li class="covered" data-hits="1" data-linenumber="59"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="171"> - <code class="ruby"> expect(validation.valid?).to be_truthy</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="60"> - <span class="hits">1</span> - <code class="ruby"> expect(validation.errors).to be_empty</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="61"> + <li class="never" data-hits="" data-linenumber="172"> - <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"> + <li class="covered" data-hits="1" data-linenumber="173"> <span class="hits">1</span> - <code class="ruby"> it &#39;wrong node returns false&#39; do</code> + <code class="ruby"> it &#39;unknown directives will fail&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="64"> + <li class="covered" data-hits="1" data-linenumber="174"> <span class="hits">1</span> - <code class="ruby"> query = dsl.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="65"> + <li class="covered" data-hits="1" data-linenumber="175"> <span class="hits">1</span> - <code class="ruby"> foo</code> + <code class="ruby"> catCollection(:@unknownDirective =&gt; nil)</code> </li> - <li class="never" data-hits="" data-linenumber="66"> + <li class="never" data-hits="" data-linenumber="176"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="67"> + <li class="never" data-hits="" data-linenumber="177"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="68"> + <li class="covered" data-hits="1" data-linenumber="178"> <span class="hits">1</span> - <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="never" data-hits="" data-linenumber="69"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="70"> + <li class="covered" data-hits="1" data-linenumber="179"> <span class="hits">1</span> - <code class="ruby"> validation = subject.validate(query)</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="71"> + <li class="covered" data-hits="1" data-linenumber="180"> <span class="hits">1</span> - <code class="ruby"> expect(validation.valid?).to be_falsey</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="72"> + <li class="covered" data-hits="1" data-linenumber="181"> <span class="hits">1</span> - <code class="ruby"> expect(validation.errors).not_to be_empty</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Directive unknown &#39;@unknownDirective&#39;&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="73"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="182"> - <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Node type not found for &#39;foo&#39;&quot;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="74"> - - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="75"> + <li class="never" data-hits="" data-linenumber="183"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="76"> + <li class="covered" data-hits="1" data-linenumber="184"> <span class="hits">1</span> - <code class="ruby"> it &#39;object node that doesnt have proper values returns false&#39; do</code> + <code class="ruby"> it &#39;known directive will fail if no arguments are passed&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="77"> + <li class="covered" data-hits="1" data-linenumber="185"> <span class="hits">1</span> - <code class="ruby"> query = dsl.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="78"> + <li class="covered" data-hits="1" data-linenumber="186"> <span class="hits">1</span> - <code class="ruby"> catCollection</code> + <code class="ruby"> catCollection(:@include =&gt; nil)</code> </li> - <li class="never" data-hits="" data-linenumber="79"> + <li class="never" data-hits="" data-linenumber="187"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="80"> + <li class="never" data-hits="" data-linenumber="188"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="81"> + <li class="covered" data-hits="1" data-linenumber="189"> <span class="hits">1</span> - <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="never" data-hits="" data-linenumber="82"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="83"> + <li class="covered" data-hits="1" data-linenumber="190"> <span class="hits">1</span> - <code class="ruby"> validation = subject.validate(query)</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="84"> + <li class="covered" data-hits="1" data-linenumber="191"> <span class="hits">1</span> - <code class="ruby"> expect(validation.valid?).to be_falsey</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="85"> + <li class="covered" data-hits="1" data-linenumber="192"> <span class="hits">1</span> - <code class="ruby"> expect(validation.errors).not_to be_empty</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Missing arguments for directive &#39;@include&#39;&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="86"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="193"> - <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid object for node &#39;catCollection&#39;&quot;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="87"> - - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="88"> + <li class="never" data-hits="" data-linenumber="194"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="89"> + <li class="covered" data-hits="1" data-linenumber="195"> <span class="hits">1</span> - <code class="ruby"> it &#39;object list node that doesnt have proper values returns false&#39; do</code> + <code class="ruby"> it &#39;known directive will fail if arguments are empty&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="90"> + <li class="covered" data-hits="1" data-linenumber="196"> <span class="hits">1</span> - <code class="ruby"> query = dsl.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="91"> + <li class="covered" data-hits="1" data-linenumber="197"> <span class="hits">1</span> - <code class="ruby"> catCollection {</code> + <code class="ruby"> catCollection(:@include =&gt; {})</code> </li> - <li class="covered" data-hits="1" data-linenumber="92"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="198"> - <code class="ruby"> items</code> - </li> - - <li class="never" data-hits="" data-linenumber="93"> - <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="94"> + <li class="never" data-hits="" data-linenumber="199"> - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="95"> - - <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="96"> + <li class="covered" data-hits="1" data-linenumber="200"> <span class="hits">1</span> - <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="never" data-hits="" data-linenumber="97"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="98"> + <li class="covered" data-hits="1" data-linenumber="201"> <span class="hits">1</span> - <code class="ruby"> validation = subject.validate(query)</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="99"> + <li class="covered" data-hits="1" data-linenumber="202"> <span class="hits">1</span> - <code class="ruby"> expect(validation.valid?).to be_falsey</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="100"> + <li class="covered" data-hits="1" data-linenumber="203"> <span class="hits">1</span> - <code class="ruby"> expect(validation.errors).not_to be_empty</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Missing arguments for directive &#39;@include&#39;&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="101"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="204"> - <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid object for node &#39;items&#39;&quot;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="102"> - - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="103"> + <li class="never" data-hits="" data-linenumber="205"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="104"> + <li class="covered" data-hits="1" data-linenumber="206"> <span class="hits">1</span> - <code class="ruby"> it &#39;type matching on invalid type returns false&#39; do</code> + <code class="ruby"> it &#39;known directive will fail if arguments is not if&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="105"> + <li class="covered" data-hits="1" data-linenumber="207"> <span class="hits">1</span> - <code class="ruby"> query = dsl.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="106"> + <li class="covered" data-hits="1" data-linenumber="208"> <span class="hits">1</span> - <code class="ruby"> catCollection {</code> + <code class="ruby"> catCollection {</code> </li> - <li class="covered" data-hits="1" data-linenumber="107"> + <li class="covered" data-hits="1" data-linenumber="209"> <span class="hits">1</span> - <code class="ruby"> items {</code> + <code class="ruby"> items {</code> </li> - <li class="covered" data-hits="1" data-linenumber="108"> + <li class="covered" data-hits="1" data-linenumber="210"> <span class="hits">1</span> - <code class="ruby"> bestFriend {</code> + <code class="ruby"> name(:@include =&gt; { else: true })</code> </li> - <li class="covered" data-hits="1" data-linenumber="109"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="211"> - <code class="ruby"> __on(&#39;InvalidType&#39;) {</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="110"> - <span class="hits">1</span> - <code class="ruby"> foo</code> - </li> - - <li class="never" data-hits="" data-linenumber="111"> - - - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="112"> - - <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="113"> + <li class="never" data-hits="" data-linenumber="212"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="114"> + <li class="never" data-hits="" data-linenumber="213"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="115"> + <li class="never" data-hits="" data-linenumber="214"> - <code class="ruby"> }</code> - </li> - - <li class="never" data-hits="" data-linenumber="116"> - - <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="117"> + <li class="covered" data-hits="1" data-linenumber="215"> <span class="hits">1</span> - <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="never" data-hits="" data-linenumber="118"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="119"> + <li class="covered" data-hits="1" data-linenumber="216"> <span class="hits">1</span> - <code class="ruby"> validation = subject.validate(query)</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="120"> + <li class="covered" data-hits="1" data-linenumber="217"> <span class="hits">1</span> - <code class="ruby"> expect(validation.valid?).to be_falsey</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="121"> + <li class="covered" data-hits="1" data-linenumber="218"> <span class="hits">1</span> - <code class="ruby"> expect(validation.errors).not_to be_empty</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid argument &#39;else&#39; for directive &#39;@include&#39;&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="122"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="219"> - <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Match type &#39;InvalidType&#39; invalid&quot;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="123"> - - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="124"> + <li class="never" data-hits="" data-linenumber="220"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="125"> + <li class="covered" data-hits="1" data-linenumber="221"> <span class="hits">1</span> - <code class="ruby"> it &#39;invalid arguments return false&#39; do</code> + <code class="ruby"> it &#39;known directive will fail when if value is not boolean&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="126"> + <li class="covered" data-hits="1" data-linenumber="222"> <span class="hits">1</span> - <code class="ruby"> query = dsl.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="127"> + <li class="covered" data-hits="1" data-linenumber="223"> <span class="hits">1</span> - <code class="ruby"> catCollection(invalidParam: 1) {</code> + <code class="ruby"> catCollection {</code> </li> - <li class="covered" data-hits="1" data-linenumber="128"> + <li class="covered" data-hits="1" data-linenumber="224"> <span class="hits">1</span> - <code class="ruby"> items {</code> + <code class="ruby"> items {</code> </li> - <li class="covered" data-hits="1" data-linenumber="129"> + <li class="covered" data-hits="1" data-linenumber="225"> <span class="hits">1</span> - <code class="ruby"> name</code> + <code class="ruby"> name(:@include =&gt; { if: 123 })</code> </li> - <li class="never" data-hits="" data-linenumber="130"> + <li class="never" data-hits="" data-linenumber="226"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="131"> + <li class="never" data-hits="" data-linenumber="227"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="132"> + <li class="never" data-hits="" data-linenumber="228"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="133"> + <li class="never" data-hits="" data-linenumber="229"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="134"> + <li class="covered" data-hits="1" data-linenumber="230"> <span class="hits">1</span> - <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="never" data-hits="" data-linenumber="135"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="136"> + <li class="covered" data-hits="1" data-linenumber="231"> <span class="hits">1</span> - <code class="ruby"> validation = subject.validate(query)</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="137"> + <li class="covered" data-hits="1" data-linenumber="232"> <span class="hits">1</span> - <code class="ruby"> expect(validation.valid?).to be_falsey</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="138"> + <li class="covered" data-hits="1" data-linenumber="233"> <span class="hits">1</span> - <code class="ruby"> expect(validation.errors).not_to be_empty</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid value for &#39;if`, must be a boolean&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="139"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="234"> - <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid argument &#39;invalidParam&#39;&quot;)</code> - </li> - - <li class="never" data-hits="" data-linenumber="140"> - - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="141"> + <li class="never" data-hits="" data-linenumber="235"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="142"> + <li class="covered" data-hits="1" data-linenumber="236"> <span class="hits">1</span> - <code class="ruby"> it &#39;invalid argument type returns false&#39; do</code> + <code class="ruby"> it &#39;known directive will fail when multiple arguments are passed&#39; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="143"> + <li class="covered" data-hits="1" data-linenumber="237"> <span class="hits">1</span> - <code class="ruby"> query = dsl.query {</code> + <code class="ruby"> query = dsl.query {</code> </li> - <li class="covered" data-hits="1" data-linenumber="144"> + <li class="covered" data-hits="1" data-linenumber="238"> <span class="hits">1</span> - <code class="ruby"> catCollection(limit: &#39;foo&#39;) {</code> + <code class="ruby"> catCollection {</code> </li> - <li class="covered" data-hits="1" data-linenumber="145"> + <li class="covered" data-hits="1" data-linenumber="239"> <span class="hits">1</span> - <code class="ruby"> items {</code> + <code class="ruby"> items {</code> </li> - <li class="covered" data-hits="1" data-linenumber="146"> + <li class="covered" data-hits="1" data-linenumber="240"> <span class="hits">1</span> - <code class="ruby"> name</code> + <code class="ruby"> name(:@include =&gt; { if: true, else: false })</code> </li> - <li class="never" data-hits="" data-linenumber="147"> + <li class="never" data-hits="" data-linenumber="241"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="148"> + <li class="never" data-hits="" data-linenumber="242"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="149"> + <li class="never" data-hits="" data-linenumber="243"> - <code class="ruby"> }</code> + <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="150"> + <li class="never" data-hits="" data-linenumber="244"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="151"> + <li class="covered" data-hits="1" data-linenumber="245"> <span class="hits">1</span> - <code class="ruby"> expect(subject.valid?(query)).to be_falsey</code> + <code class="ruby"> validation = subject.validate(query)</code> </li> - <li class="never" data-hits="" data-linenumber="152"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="1" data-linenumber="153"> + <li class="covered" data-hits="1" data-linenumber="246"> <span class="hits">1</span> - <code class="ruby"> validation = subject.validate(query)</code> + <code class="ruby"> expect(validation.valid?).to be_falsey</code> </li> - <li class="covered" data-hits="1" data-linenumber="154"> + <li class="covered" data-hits="1" data-linenumber="247"> <span class="hits">1</span> - <code class="ruby"> expect(validation.valid?).to be_falsey</code> + <code class="ruby"> expect(validation.errors).not_to be_empty</code> </li> - <li class="covered" data-hits="1" data-linenumber="155"> + <li class="covered" data-hits="1" data-linenumber="248"> <span class="hits">1</span> - <code class="ruby"> expect(validation.errors).not_to be_empty</code> + <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Invalid argument &#39;else&#39; for directive &#39;@include&#39;&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="156"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="249"> - <code class="ruby"> expect(validation.errors.map(&amp;:to_s)).to include(&quot;Value is &#39;String, Enum or ID&#39;, but should be &#39;Int&#39; for &#39;limit&#39;&quot;)</code> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="157"> + <li class="never" data-hits="" data-linenumber="250"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="158"> + <li class="never" data-hits="" data-linenumber="251"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="159"> + <li class="never" data-hits="" data-linenumber="252"> <code class="ruby">end</code> </li>