Commit bad01f0d authored by John E. Vincent's avatar John E. Vincent

quick cleanup of test structure

parent 9fc817d8
......@@ -48,46 +48,30 @@
<tfoot>
<tr>
<td class="left_align">TOTAL</td>
<td class='right_align'><tt>610</tt></td>
<td class='right_align'><tt>518</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>55.25%</tt></div>
<td class='right_align'><tt>612</tt></td>
<td class='right_align'><tt>521</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>83.33%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:55px"></div>
<div class="uncovered" style="width:45px"></div>
<div class="covered" style="width:83px"></div>
<div class="uncovered" style="width:17px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class='coverage_total'>50.58%</tt></div>
<td class="left_align"><div class="percent_graph_legend"><tt class='coverage_total'>81.96%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:51px"></div>
<div class="uncovered" style="width:49px"></div>
<div class="covered" style="width:82px"></div>
<div class="uncovered" style="width:18px"></div>
</div></td>
</tr>
</tfoot>
<tbody>
<tr class="all_files all_coverage 50 60 70 80 90 100 even">
<td class="left_align"><a href="noah_rb.html">noah.rb</a></td>
<td class='right_align'><tt>325</tt></td>
<td class='right_align'><tt>283</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>48.31%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:48px"></div>
<div class="uncovered" style="width:52px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>42.40%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:42px"></div>
<div class="uncovered" style="width:58px"></div>
</div></td>
</tr>
<tr class="all_files all_coverage 60 70 80 90 100 lib odd">
<tr class="all_files all_coverage 60 70 80 90 100 lib even">
<td class="left_align"><a href="lib-helpers_rb.html">lib/helpers.rb</a></td>
<td class='right_align'><tt>55</tt></td>
<td class='right_align'><tt>45</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>54.55%</tt></div>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>56.36%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:55px"></div>
<div class="uncovered" style="width:45px"></div>
<div class="covered" style="width:56px"></div>
<div class="uncovered" style="width:44px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>57.78%</tt></div>
<div class="percent_graph">
......@@ -96,19 +80,35 @@
</div></td>
</tr>
<tr class="all_files all_coverage 70 80 90 100 lib even">
<tr class="all_files all_coverage 90 100 odd">
<td class="left_align"><a href="noah_rb.html">noah.rb</a></td>
<td class='right_align'><tt>326</tt></td>
<td class='right_align'><tt>285</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>82.52%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:83px"></div>
<div class="uncovered" style="width:17px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>81.05%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:81px"></div>
<div class="uncovered" style="width:19px"></div>
</div></td>
</tr>
<tr class="all_files all_coverage 90 100 lib even">
<td class="left_align"><a href="lib-models_rb.html">lib/models.rb</a></td>
<td class='right_align'><tt>230</tt></td>
<td class='right_align'><tt>190</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>65.22%</tt></div>
<td class='right_align'><tt>231</tt></td>
<td class='right_align'><tt>191</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>90.91%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:65px"></div>
<div class="uncovered" style="width:35px"></div>
<div class="covered" style="width:91px"></div>
<div class="uncovered" style="width:9px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>61.05%</tt></div>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>89.01%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:61px"></div>
<div class="uncovered" style="width:39px"></div>
<div class="covered" style="width:89px"></div>
<div class="uncovered" style="width:11px"></div>
</div></td>
</tr>
......@@ -116,7 +116,7 @@
</table>
</div>
<p>Generated on 2011-01-27 21:32:12 -0500 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
<p>Generated on 2011-01-31 05:03:32 -0500 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
<script type="text/javascript">
$(document).ready(function(){$("#report_table").tablesorter({widgets: ['zebra'], textExtraction: 'complex'});});
......
......@@ -30,10 +30,10 @@
<td class="left_align"><a href="lib-helpers_rb.html">lib/helpers.rb</a></td>
<td class='right_align'><tt>55</tt></td>
<td class='right_align'><tt>45</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>54.55%</tt></div>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>56.36%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:55px"></div>
<div class="uncovered" style="width:45px"></div>
<div class="covered" style="width:56px"></div>
<div class="uncovered" style="width:44px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>57.78%</tt></div>
<div class="percent_graph">
......@@ -158,13 +158,13 @@
<tr class="inferred">
<tr class="marked">
<td><pre><a name="line18">18</a> end </pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line19">19</a> </pre></td>
</tr>
......@@ -387,7 +387,7 @@
</tbody>
</table>
<p>Generated on 2011-01-27 21:32:12 -0500 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
<p>Generated on 2011-01-31 05:03:32 -0500 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
</body>
</html>
......@@ -28,17 +28,17 @@
<tbody>
<tr>
<td class="left_align"><a href="lib-models_rb.html">lib/models.rb</a></td>
<td class='right_align'><tt>230</tt></td>
<td class='right_align'><tt>190</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>65.22%</tt></div>
<td class='right_align'><tt>231</tt></td>
<td class='right_align'><tt>191</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>90.91%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:65px"></div>
<div class="uncovered" style="width:35px"></div>
<div class="covered" style="width:91px"></div>
<div class="uncovered" style="width:9px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>61.05%</tt></div>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>89.01%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:61px"></div>
<div class="uncovered" style="width:39px"></div>
<div class="covered" style="width:89px"></div>
<div class="uncovered" style="width:11px"></div>
</div></td>
</tr>
</tbody>
......@@ -207,133 +207,133 @@
<tr class="marked">
<td><pre><a name="line26">26</a> super.merge(:name =&gt; name, :status =&gt; status, :updated_at =&gt; updated_at, :services =&gt; arr)</pre></td>
<td><pre><a name="line26">26</a> h = {:name =&gt; name, :status =&gt; status, :created_at =&gt; created_at, :updated_at =&gt; updated_at, :services =&gt; arr}</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line27">27</a> end</pre></td>
<td><pre><a name="line27">27</a> super.merge(h)</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line28">28</a> </pre></td>
<td><pre><a name="line28">28</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line29">29</a> def is_new?</pre></td>
<tr class="marked">
<td><pre><a name="line29">29</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line30">30</a> self.created_at == self.updated_at</pre></td>
<td><pre><a name="line30">30</a> def is_new?</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line31">31</a> end</pre></td>
<td><pre><a name="line31">31</a> self.created_at == self.updated_at</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line32">32</a> </pre></td>
<td><pre><a name="line32">32</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line33">33</a> class &lt;&lt; self</pre></td>
<tr class="marked">
<td><pre><a name="line33">33</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line34">34</a> def find_or_create(opts = {})</pre></td>
<td><pre><a name="line34">34</a> class &lt;&lt; self</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line35">35</a> begin</pre></td>
<td><pre><a name="line35">35</a> def find_or_create(opts = {})</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line36">36</a> # exclude requested status from lookup</pre></td>
<td><pre><a name="line36">36</a> begin</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line37">37</a> h = find(opts.reject{|key,value| key == :status}).first</pre></td>
<tr class="marked">
<td><pre><a name="line37">37</a> # exclude requested status from lookup</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line38">38</a> host = h.nil? ? create(opts) : h</pre></td>
<td><pre><a name="line38">38</a> h = find(opts.reject{|key,value| key == :status}).first</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line39">39</a> host.status = opts[:status]</pre></td>
<td><pre><a name="line39">39</a> host = h.nil? ? create(opts) : h</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line40">40</a> if host.valid?</pre></td>
<td><pre><a name="line40">40</a> host.status = opts[:status]</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line41">41</a> host.save</pre></td>
<td><pre><a name="line41">41</a> if host.valid?</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line42">42</a> end</pre></td>
<td><pre><a name="line42">42</a> host.save</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line43">43</a> host</pre></td>
<tr class="marked">
<td><pre><a name="line43">43</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line44">44</a> rescue Exception =&gt; e</pre></td>
<td><pre><a name="line44">44</a> host</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line45">45</a> e.message</pre></td>
<tr class="marked">
<td><pre><a name="line45">45</a> rescue Exception =&gt; e</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line46">46</a> end</pre></td>
<td><pre><a name="line46">46</a> e.message</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line47">47</a> end</pre></td>
<td><pre><a name="line47">47</a> end</pre></td>
</tr>
......@@ -345,307 +345,307 @@
<tr class="marked">
<td><pre><a name="line49">49</a> end</pre></td>
<td><pre><a name="line49">49</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line50">50</a> </pre></td>
<td><pre><a name="line50">50</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line51">51</a> class Service &lt; Ohm::Model</pre></td>
<tr class="marked">
<td><pre><a name="line51">51</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line52">52</a> include Ohm::Typecast</pre></td>
<td><pre><a name="line52">52</a> class Service &lt; Ohm::Model</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line53">53</a> include Ohm::Timestamping</pre></td>
<td><pre><a name="line53">53</a> include Ohm::Typecast</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line54">54</a> include Ohm::Callbacks</pre></td>
<td><pre><a name="line54">54</a> include Ohm::Timestamping</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line55">55</a> include Ohm::ExtraValidations</pre></td>
<td><pre><a name="line55">55</a> include Ohm::Callbacks</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line56">56</a> </pre></td>
<td><pre><a name="line56">56</a> include Ohm::ExtraValidations</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line57">57</a> attribute :name</pre></td>
<tr class="marked">
<td><pre><a name="line57">57</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line58">58</a> attribute :status</pre></td>
<td><pre><a name="line58">58</a> attribute :name</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line59">59</a> reference :host, Host</pre></td>
<td><pre><a name="line59">59</a> attribute :status</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line60">60</a> </pre></td>
<td><pre><a name="line60">60</a> reference :host, Host</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line61">61</a> index :name</pre></td>
<tr class="marked">
<td><pre><a name="line61">61</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line62">62</a> index :status</pre></td>
<td><pre><a name="line62">62</a> index :name</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line63">63</a> </pre></td>
<td><pre><a name="line63">63</a> index :status</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line64">64</a> def validate</pre></td>
<tr class="marked">
<td><pre><a name="line64">64</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line65">65</a> assert_present :name</pre></td>
<td><pre><a name="line65">65</a> def validate</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line66">66</a> assert_present :status</pre></td>
<td><pre><a name="line66">66</a> assert_present :name</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line67">67</a> assert_present :host_id</pre></td>
<td><pre><a name="line67">67</a> assert_present :status</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line68">68</a> assert_unique [:name, :host_id]</pre></td>
<td><pre><a name="line68">68</a> assert_present :host_id</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line69">69</a> assert_member :status, [&quot;up&quot;, &quot;down&quot;, &quot;pending&quot;]</pre></td>
<td><pre><a name="line69">69</a> assert_unique [:name, :host_id]</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line70">70</a> end</pre></td>
<td><pre><a name="line70">70</a> assert_member :status, [&quot;up&quot;, &quot;down&quot;, &quot;pending&quot;]</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line71">71</a> </pre></td>
<td><pre><a name="line71">71</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line72">72</a> def to_hash</pre></td>
<tr class="marked">
<td><pre><a name="line72">72</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line73">73</a> super.merge(:name =&gt; name, :status =&gt; status, :updated_at =&gt; updated_at, :host =&gt; Host[host_id].name)</pre></td>
<td><pre><a name="line73">73</a> def to_hash</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line74">74</a> end</pre></td>
<td><pre><a name="line74">74</a> super.merge(:name =&gt; name, :status =&gt; status, :updated_at =&gt; updated_at, :host =&gt; Host[host_id].name)</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line75">75</a> </pre></td>
<td><pre><a name="line75">75</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line76">76</a> def is_new?</pre></td>
<tr class="marked">
<td><pre><a name="line76">76</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line77">77</a> self.created_at == self.updated_at</pre></td>
<td><pre><a name="line77">77</a> def is_new?</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line78">78</a> end</pre></td>
<td><pre><a name="line78">78</a> self.created_at == self.updated_at</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line79">79</a> </pre></td>
<td><pre><a name="line79">79</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line80">80</a> class &lt;&lt; self</pre></td>
<tr class="marked">
<td><pre><a name="line80">80</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line81">81</a> def find_or_create(opts = {})</pre></td>
<td><pre><a name="line81">81</a> class &lt;&lt; self</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line82">82</a> begin</pre></td>
<td><pre><a name="line82">82</a> def find_or_create(opts = {})</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line83">83</a> # convert passed host object to host_id if passed</pre></td>
<td><pre><a name="line83">83</a> begin</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line84">84</a> if opts.has_key?(:host)</pre></td>
<tr class="marked">
<td><pre><a name="line84">84</a> # convert passed host object to host_id if passed</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line85">85</a> opts.merge!({:host_id =&gt; opts[:host].id})</pre></td>
<td><pre><a name="line85">85</a> if opts.has_key?(:host)</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line86">86</a> opts.reject!{|key, value| key == :host}</pre></td>
<td><pre><a name="line86">86</a> opts.merge!({:host_id =&gt; opts[:host].id})</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line87">87</a> end </pre></td>
<td><pre><a name="line87">87</a> opts.reject!{|key, value| key == :host}</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line88">88</a> # exclude requested status from lookup</pre></td>
<tr class="marked">
<td><pre><a name="line88">88</a> end </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line89">89</a> s = find(opts.reject{|key,value| key == :status}).first</pre></td>
<tr class="inferred">
<td><pre><a name="line89">89</a> # exclude requested status from lookup</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line90">90</a> service = s.nil? ? create(opts) : s</pre></td>
<td><pre><a name="line90">90</a> s = find(opts.reject{|key,value| key == :status}).first</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line91">91</a> service.status = opts[:status]</pre></td>
<td><pre><a name="line91">91</a> service = s.nil? ? create(opts) : s</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line92">92</a> if service.valid?</pre></td>
<td><pre><a name="line92">92</a> service.status = opts[:status]</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line93">93</a> service.save</pre></td>
<td><pre><a name="line93">93</a> if service.valid?</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line94">94</a> end</pre></td>
<td><pre><a name="line94">94</a> service.save</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line95">95</a> service</pre></td>
<tr class="marked">
<td><pre><a name="line95">95</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line96">96</a> rescue Exception =&gt; e</pre></td>
<td><pre><a name="line96">96</a> service</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line97">97</a> e.message</pre></td>
<tr class="marked">
<td><pre><a name="line97">97</a> rescue Exception =&gt; e</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line98">98</a> end</pre></td>
<td><pre><a name="line98">98</a> e.message</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line99">99</a> end</pre></td>
<td><pre><a name="line99">99</a> end</pre></td>
</tr>
......@@ -657,259 +657,259 @@
<tr class="marked">
<td><pre><a name="line101">101</a> end</pre></td>
<td><pre><a name="line101">101</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line102">102</a> </pre></td>
<td><pre><a name="line102">102</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line103">103</a> class Configuration &lt; Ohm::Model</pre></td>
<tr class="marked">
<td><pre><a name="line103">103</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line104">104</a> include Ohm::Typecast</pre></td>
<td><pre><a name="line104">104</a> class Configuration &lt; Ohm::Model</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line105">105</a> include Ohm::Timestamping</pre></td>
<td><pre><a name="line105">105</a> include Ohm::Typecast</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line106">106</a> include Ohm::Callbacks</pre></td>
<td><pre><a name="line106">106</a> include Ohm::Timestamping</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line107">107</a> include Ohm::ExtraValidations</pre></td>
<td><pre><a name="line107">107</a> include Ohm::Callbacks</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line108">108</a> </pre></td>
<td><pre><a name="line108">108</a> include Ohm::ExtraValidations</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line109">109</a> attribute :name</pre></td>
<tr class="marked">
<td><pre><a name="line109">109</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line110">110</a> attribute :format</pre></td>
<td><pre><a name="line110">110</a> attribute :name</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line111">111</a> attribute :body</pre></td>
<td><pre><a name="line111">111</a> attribute :format</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line112">112</a> attribute :new_record</pre></td>
<td><pre><a name="line112">112</a> attribute :body</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line113">113</a> reference :application, Application</pre></td>
<td><pre><a name="line113">113</a> attribute :new_record</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line114">114</a> </pre></td>
<td><pre><a name="line114">114</a> reference :application, Application</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line115">115</a> index :name</pre></td>
<tr class="marked">
<td><pre><a name="line115">115</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line116">116</a> </pre></td>
<td><pre><a name="line116">116</a> index :name</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line117">117</a> def validate</pre></td>
<tr class="marked">
<td><pre><a name="line117">117</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line118">118</a> assert_present :name</pre></td>
<td><pre><a name="line118">118</a> def validate</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line119">119</a> assert_present :format</pre></td>
<td><pre><a name="line119">119</a> assert_present :name</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line120">120</a> assert_present :body</pre></td>
<td><pre><a name="line120">120</a> assert_present :format</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line121">121</a> assert_unique [:name, :application_id]</pre></td>
<td><pre><a name="line121">121</a> assert_present :body</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line122">122</a> end</pre></td>
<td><pre><a name="line122">122</a> assert_unique [:name, :application_id]</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line123">123</a> </pre></td>
<td><pre><a name="line123">123</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line124">124</a> def to_hash</pre></td>
<tr class="marked">
<td><pre><a name="line124">124</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line125">125</a> super.merge(:name =&gt; name, :format =&gt; format, :body =&gt; body, :update_at =&gt; updated_at, :application =&gt; Application[application_id].name)</pre></td>
<td><pre><a name="line125">125</a> def to_hash</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line126">126</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line126">126</a> super.merge(:name =&gt; name, :format =&gt; format, :body =&gt; body, :update_at =&gt; updated_at, :application =&gt; Application[application_id].name)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line127">127</a> </pre></td>
<tr class="marked">
<td><pre><a name="line127">127</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line128">128</a> def is_new?</pre></td>
<tr class="marked">
<td><pre><a name="line128">128</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line129">129</a> self.created_at == self.updated_at</pre></td>
<td><pre><a name="line129">129</a> def is_new?</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line130">130</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line130">130</a> self.created_at == self.updated_at</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line131">131</a> </pre></td>
<tr class="marked">
<td><pre><a name="line131">131</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line132">132</a> class &lt;&lt; self</pre></td>
<tr class="marked">
<td><pre><a name="line132">132</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line133">133</a> def find_or_create(opts={})</pre></td>
<td><pre><a name="line133">133</a> class &lt;&lt; self</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line134">134</a> begin</pre></td>
<td><pre><a name="line134">134</a> def find_or_create(opts={})</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line135">135</a> if find(opts).first.nil?</pre></td>
<tr class="marked">
<td><pre><a name="line135">135</a> begin</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line136">136</a> conf = create(opts)</pre></td>
<tr class="marked">
<td><pre><a name="line136">136</a> if find(opts).first.nil?</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line137">137</a> else </pre></td>
<tr class="marked">
<td><pre><a name="line137">137</a> conf = create(opts)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line138">138</a> conf = find(opts).first</pre></td>
<tr class="marked">
<td><pre><a name="line138">138</a> else </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line139">139</a> end </pre></td>
<td><pre><a name="line139">139</a> conf = find(opts).first</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line140">140</a> rescue Exception =&gt; e</pre></td>
<tr class="marked">
<td><pre><a name="line140">140</a> end </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line141">141</a> e.message</pre></td>
<td><pre><a name="line141">141</a> rescue Exception =&gt; e</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line142">142</a> end</pre></td>
<td><pre><a name="line142">142</a> e.message</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line143">143</a> end</pre></td>
<td><pre><a name="line143">143</a> end</pre></td>
</tr>
......@@ -921,241 +921,241 @@
<tr class="marked">
<td><pre><a name="line145">145</a> end</pre></td>
<td><pre><a name="line145">145</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line146">146</a> </pre></td>
<td><pre><a name="line146">146</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line147">147</a> class Application &lt; Ohm::Model</pre></td>
<tr class="marked">
<td><pre><a name="line147">147</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line148">148</a> include Ohm::Typecast</pre></td>
<td><pre><a name="line148">148</a> class Application &lt; Ohm::Model</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line149">149</a> include Ohm::Timestamping</pre></td>
<td><pre><a name="line149">149</a> include Ohm::Typecast</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line150">150</a> include Ohm::Callbacks</pre></td>
<td><pre><a name="line150">150</a> include Ohm::Timestamping</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line151">151</a> include Ohm::ExtraValidations</pre></td>
<td><pre><a name="line151">151</a> include Ohm::Callbacks</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line152">152</a> </pre></td>
<td><pre><a name="line152">152</a> include Ohm::ExtraValidations</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line153">153</a> attribute :name</pre></td>
<tr class="marked">
<td><pre><a name="line153">153</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line154">154</a> collection :configurations, Configuration</pre></td>
<td><pre><a name="line154">154</a> attribute :name</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line155">155</a> </pre></td>
<td><pre><a name="line155">155</a> collection :configurations, Configuration</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line156">156</a> index :name</pre></td>
<tr class="marked">
<td><pre><a name="line156">156</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line157">157</a> </pre></td>
<td><pre><a name="line157">157</a> index :name</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line158">158</a> def validate</pre></td>
<tr class="marked">
<td><pre><a name="line158">158</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line159">159</a> assert_present :name</pre></td>
<td><pre><a name="line159">159</a> def validate</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line160">160</a> assert_unique :name</pre></td>
<td><pre><a name="line160">160</a> assert_present :name</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line161">161</a> end</pre></td>
<td><pre><a name="line161">161</a> assert_unique :name</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line162">162</a> </pre></td>
<td><pre><a name="line162">162</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line163">163</a> def to_hash</pre></td>
<tr class="marked">
<td><pre><a name="line163">163</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line164">164</a> arr = []</pre></td>
<td><pre><a name="line164">164</a> def to_hash</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line165">165</a> configurations.sort.each {|c| arr &lt;&lt; c.to_hash}</pre></td>
<tr class="marked">
<td><pre><a name="line165">165</a> arr = []</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line166">166</a> super.merge(:name =&gt; name, :updated_at =&gt; updated_at, :configurations =&gt; arr)</pre></td>
<tr class="marked">
<td><pre><a name="line166">166</a> configurations.sort.each {|c| arr &lt;&lt; c.to_hash}</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line167">167</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line167">167</a> super.merge(:name =&gt; name, :updated_at =&gt; updated_at, :configurations =&gt; arr)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line168">168</a> </pre></td>
<tr class="marked">
<td><pre><a name="line168">168</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line169">169</a> def is_new?</pre></td>
<tr class="marked">
<td><pre><a name="line169">169</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line170">170</a> self.created_at == self.updated_at</pre></td>
<td><pre><a name="line170">170</a> def is_new?</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line171">171</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line171">171</a> self.created_at == self.updated_at</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line172">172</a> </pre></td>
<tr class="marked">
<td><pre><a name="line172">172</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line173">173</a> class &lt;&lt; self</pre></td>
<tr class="marked">
<td><pre><a name="line173">173</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line174">174</a> def find_or_create(opts = {})</pre></td>
<td><pre><a name="line174">174</a> class &lt;&lt; self</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line175">175</a> begin</pre></td>
<td><pre><a name="line175">175</a> def find_or_create(opts = {})</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line176">176</a> find(opts).first.nil? ? (app = create(opts)) : (app = find(opts).first)</pre></td>
<tr class="marked">
<td><pre><a name="line176">176</a> begin</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line177">177</a> if app.valid?</pre></td>
<tr class="marked">
<td><pre><a name="line177">177</a> find(opts).first.nil? ? (app = create(opts)) : (app = find(opts).first)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line178">178</a> app.save</pre></td>
<tr class="marked">
<td><pre><a name="line178">178</a> if app.valid?</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line179">179</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line179">179</a> app.save</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line180">180</a> app</pre></td>
<tr class="marked">
<td><pre><a name="line180">180</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line181">181</a> rescue Exception =&gt; e</pre></td>
<td><pre><a name="line181">181</a> app</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line182">182</a> e.message</pre></td>
<tr class="marked">
<td><pre><a name="line182">182</a> rescue Exception =&gt; e</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line183">183</a> end</pre></td>
<td><pre><a name="line183">183</a> e.message</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line184">184</a> end</pre></td>
<td><pre><a name="line184">184</a> end</pre></td>
</tr>
......@@ -1167,277 +1167,283 @@
<tr class="marked">
<td><pre><a name="line186">186</a> end</pre></td>
<td><pre><a name="line186">186</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line187">187</a> </pre></td>
<td><pre><a name="line187">187</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line188">188</a> class Watcher &lt; Ohm::Model #NYI</pre></td>
<tr class="marked">
<td><pre><a name="line188">188</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line189">189</a> include Ohm::Typecast</pre></td>
<td><pre><a name="line189">189</a> class Watcher &lt; Ohm::Model #NYI</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line190">190</a> include Ohm::Timestamping</pre></td>
<td><pre><a name="line190">190</a> include Ohm::Typecast</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line191">191</a> include Ohm::Callbacks</pre></td>
<td><pre><a name="line191">191</a> include Ohm::Timestamping</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line192">192</a> </pre></td>
<td><pre><a name="line192">192</a> include Ohm::Callbacks</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line193">193</a> attribute :client</pre></td>
<tr class="marked">
<td><pre><a name="line193">193</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line194">194</a> attribute :endpoint</pre></td>
<td><pre><a name="line194">194</a> attribute :client</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line195">195</a> attribute :event</pre></td>
<td><pre><a name="line195">195</a> attribute :endpoint</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line196">196</a> attribute :action </pre></td>
<td><pre><a name="line196">196</a> attribute :event</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line197">197</a> </pre></td>
<td><pre><a name="line197">197</a> attribute :action </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line198">198</a> index :client</pre></td>
<tr class="marked">
<td><pre><a name="line198">198</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line199">199</a> index :event</pre></td>
<td><pre><a name="line199">199</a> index :client</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line200">200</a> </pre></td>
<td><pre><a name="line200">200</a> index :event</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line201">201</a> def validate</pre></td>
<tr class="marked">
<td><pre><a name="line201">201</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line202">202</a> assert_present :client, :endpoint, :event, :action</pre></td>
<td><pre><a name="line202">202</a> def validate</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line203">203</a> assert_unique [:client, :endpoint, :event, :action]</pre></td>
<tr class="marked">
<td><pre><a name="line203">203</a> assert_present :client, :endpoint, :event, :action</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line204">204</a> end</pre></td>
<td><pre><a name="line204">204</a> assert_unique [:client, :endpoint, :event, :action]</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line205">205</a> end</pre></td>
<td><pre><a name="line205">205</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line206">206</a> </pre></td>
<td><pre><a name="line206">206</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line207">207</a> # Some pluralized helper models</pre></td>
<tr class="marked">
<td><pre><a name="line207">207</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line208">208</a> class Hosts</pre></td>
<tr class="inferred">
<td><pre><a name="line208">208</a> # Some pluralized helper models</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line209">209</a> def self.all(options = {})</pre></td>
<td><pre><a name="line209">209</a> class Hosts</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line210">210</a> options.empty? ? Host.all.sort : Host.find(options).sort</pre></td>
<td><pre><a name="line210">210</a> def self.all(options = {})</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line211">211</a> end</pre></td>
<td><pre><a name="line211">211</a> options.empty? ? Host.all.sort : Host.find(options).sort</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line212">212</a> end</pre></td>
<td><pre><a name="line212">212</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line213">213</a> </pre></td>
<td><pre><a name="line213">213</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line214">214</a> class Services</pre></td>
<tr class="marked">
<td><pre><a name="line214">214</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line215">215</a> def self.all(options = {})</pre></td>
<td><pre><a name="line215">215</a> class Services</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line216">216</a> options.empty? ? Service.all.sort : Service.find(options).sort</pre></td>
<td><pre><a name="line216">216</a> def self.all(options = {})</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line217">217</a> end</pre></td>
<td><pre><a name="line217">217</a> options.empty? ? Service.all.sort : Service.find(options).sort</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line218">218</a> end</pre></td>
<td><pre><a name="line218">218</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line219">219</a> </pre></td>
<td><pre><a name="line219">219</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line220">220</a> class Applications</pre></td>
<tr class="marked">
<td><pre><a name="line220">220</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line221">221</a> def self.all(options = {})</pre></td>
<td><pre><a name="line221">221</a> class Applications</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line222">222</a> options.empty? ? Application.all.sort : Application.find(options).sort</pre></td>
<td><pre><a name="line222">222</a> def self.all(options = {})</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line223">223</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line223">223</a> options.empty? ? Application.all.sort : Application.find(options).sort</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line224">224</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line224">224</a> end</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line225">225</a> </pre></td>
<td><pre><a name="line225">225</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line226">226</a> class Configurations</pre></td>
<tr class="marked">
<td><pre><a name="line226">226</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line227">227</a> class Configurations</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line227">227</a> def self.all(options = {})</pre></td>
<td><pre><a name="line228">228</a> def self.all(options = {})</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line228">228</a> options.empty? ? Configuration.all.sort : Configuration.find(options).sort</pre></td>
<td><pre><a name="line229">229</a> options.empty? ? Configuration.all.sort : Configuration.find(options).sort</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line229">229</a> end</pre></td>
<td><pre><a name="line230">230</a> end</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line230">230</a> end </pre></td>
<td><pre><a name="line231">231</a> end </pre></td>
</tr>
</tbody>
</table>
<p>Generated on 2011-01-27 21:32:12 -0500 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
<p>Generated on 2011-01-31 05:03:32 -0500 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
</body>
</html>
......@@ -28,17 +28,17 @@
<tbody>
<tr>
<td class="left_align"><a href="noah_rb.html">noah.rb</a></td>
<td class='right_align'><tt>325</tt></td>
<td class='right_align'><tt>283</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>48.31%</tt></div>
<td class='right_align'><tt>326</tt></td>
<td class='right_align'><tt>285</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>82.52%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:48px"></div>
<div class="uncovered" style="width:52px"></div>
<div class="covered" style="width:83px"></div>
<div class="uncovered" style="width:17px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>42.40%</tt></div>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>81.05%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:42px"></div>
<div class="uncovered" style="width:58px"></div>
<div class="covered" style="width:81px"></div>
<div class="uncovered" style="width:19px"></div>
</div></td>
</tr>
</tbody>
......@@ -615,7 +615,7 @@
<tr class="inferred">
<td><pre><a name="line94">94</a> put '/:hostname/?' do</pre></td>
<td><pre><a name="line94">94</a> put '/:hostname/?' do |hostname|</pre></td>
</tr>
......@@ -633,7 +633,7 @@
<tr class="marked">
<td><pre><a name="line97">97</a> data.keys.sort == required_params.sort ? (host = Host.find_or_create(:name =&gt; data['name'], :status =&gt; data['status'])) : (raise &quot;Missing Parameters&quot;)</pre></td>
<td><pre><a name="line97">97</a> (data.keys.sort == required_params.sort &amp;&amp; data['name'] == hostname) ? (host = Host.find_or_create(:name =&gt; data['name'], :status =&gt; data['status'])) : (raise &quot;Missing Parameters&quot;)</pre></td>
</tr>
......@@ -800,19 +800,19 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line125">125</a> if hs.nil?</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line126">126</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line127">127</a> else </pre></td>
</tr>
......@@ -824,13 +824,13 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line129">129</a> end </pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line130">130</a> end</pre></td>
</tr>
......@@ -854,19 +854,19 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line134">134</a> s.map {|x| x.to_hash}</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line135">135</a> if s.empty?</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line136">136</a> halt 404</pre></td>
</tr>
......@@ -884,13 +884,13 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line139">139</a> end </pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line140">140</a> end</pre></td>
</tr>
......@@ -914,7 +914,7 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line144">144</a> halt 404</pre></td>
</tr>
......@@ -932,97 +932,97 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line147">147</a> services.to_json</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line148">148</a> end </pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line149">149</a> end</pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line150">150</a> </pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line151">151</a> put '/:servicename/?' do |servicename|</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line152">152</a> # message format: {&quot;status&quot;:&quot;initial_status&quot;, &quot;host&quot;:&quot;hostname&quot;}</pre></td>
<td><pre><a name="line152">152</a> required_params = [&quot;status&quot;, &quot;host&quot;, &quot;name&quot;]</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line153">153</a> required_params = [&quot;status&quot;, &quot;host&quot;, &quot;name&quot;]</pre></td>
<tr class="marked">
<td><pre><a name="line153">153</a> data = JSON.parse(request.body.read)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line154">154</a> data = JSON.parse(request.body.read)</pre></td>
<tr class="marked">
<td><pre><a name="line154">154</a> if data.keys.sort == required_params.sort</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line155">155</a> if data.keys.sort == required_params.sort</pre></td>
<tr class="marked">
<td><pre><a name="line155">155</a> h = Host.find(:name =&gt; data['host']).first || (raise &quot;Invalid Host&quot;)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line156">156</a> h = Host.find(:name =&gt; data['host']).first || (raise &quot;Invalid Host&quot;)</pre></td>
<tr class="marked">
<td><pre><a name="line156">156</a> service = Service.find_or_create(:name =&gt; servicename, :status =&gt; data['status'], :host =&gt; h)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line157">157</a> service = Service.create(:name =&gt; servicename, :status =&gt; data['status'], :host =&gt; h)</pre></td>
<tr class="marked">
<td><pre><a name="line157">157</a> if service.valid?</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line158">158</a> if service.valid?</pre></td>
<tr class="marked">
<td><pre><a name="line158">158</a> action = service.is_new? ? &quot;create&quot; : &quot;update&quot;</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line159">159</a> service.save</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line160">160</a> r = {&quot;action&quot; =&gt; &quot;add&quot;, &quot;result&quot; =&gt; &quot;success&quot;, &quot;id&quot; =&gt; service.id, &quot;host&quot; =&gt; h.name, &quot;name&quot; =&gt; service.name}</pre></td>
<tr class="marked">
<td><pre><a name="line160">160</a> r = {&quot;action&quot; =&gt; action, &quot;result&quot; =&gt; &quot;success&quot;, &quot;id&quot; =&gt; service.id, &quot;host&quot; =&gt; h.name, &quot;name&quot; =&gt; service.name}</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line161">161</a> r.to_json</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line162">162</a> else</pre></td>
</tr>
......@@ -1034,7 +1034,7 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line164">164</a> end</pre></td>
</tr>
......@@ -1052,13 +1052,13 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line167">167</a> end </pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line168">168</a> end</pre></td>
</tr>
......@@ -1082,37 +1082,37 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line172">172</a> service = Service.find(:name =&gt; servicename, :host_id =&gt; host.id).first || (halt 404)</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line173">173</a> if host &amp;&amp; service</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line174">174</a> service.delete</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line175">175</a> r = {&quot;action&quot; =&gt; &quot;delete&quot;, &quot;result&quot; =&gt; &quot;success&quot;, &quot;id&quot; =&gt; service.id, &quot;host&quot; =&gt; host.name, &quot;service&quot; =&gt; servicename}</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line176">176</a> r.to_json</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line177">177</a> else</pre></td>
</tr>
......@@ -1178,19 +1178,19 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line188">188</a> if app.nil?</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line189">189</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line190">190</a> else </pre></td>
</tr>
......@@ -1202,19 +1202,19 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line192">192</a> c.to_json</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line193">193</a> end </pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line194">194</a> end</pre></td>
</tr>
......@@ -1238,19 +1238,19 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line198">198</a> if app.nil?</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line199">199</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line200">200</a> else</pre></td>
</tr>
......@@ -1262,13 +1262,13 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line202">202</a> end</pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line203">203</a> end</pre></td>
</tr>
......@@ -1292,37 +1292,37 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line207">207</a> data = JSON.parse(request.body.read)</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line208">208</a> if data.keys.sort == required_params.sort &amp;&amp; data['name'] == appname</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line209">209</a> app = Application.find_or_create(:name =&gt; appname)</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line210">210</a> else</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line211">211</a> raise &quot;Missing or invalid parameters&quot;</pre></td>
<td><pre><a name="line211">211</a> raise &quot;Missing Parameters&quot;</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line212">212</a> end </pre></td>
</tr>
......@@ -1334,31 +1334,31 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line214">214</a> action = app.is_new? ? &quot;create&quot; : &quot;update&quot;</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line215">215</a> app.save</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line216">216</a> r = {&quot;result&quot; =&gt; &quot;success&quot;,&quot;id&quot; =&gt; app.id, &quot;action&quot; =&gt; action, &quot;name&quot; =&gt; app.name }</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line217">217</a> r.to_json</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line218">218</a> else</pre></td>
</tr>
......@@ -1400,19 +1400,19 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line225">225</a> if app.nil?</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line226">226</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line227">227</a> else</pre></td>
</tr>
......@@ -1424,37 +1424,37 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line229">229</a> Configuration.find(:application_id =&gt; app.id).sort.each {|x| configurations &lt;&lt; x; x.delete} if app.configurations.size &gt; 0</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line230">230</a> app.delete</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line231">231</a> r = {&quot;result&quot; =&gt; &quot;success&quot;, &quot;action&quot; =&gt; &quot;delete&quot;, &quot;id&quot; =&gt; &quot;#{app.id}&quot;, &quot;name&quot; =&gt; &quot;#{app.name}&quot;, &quot;configurations&quot; =&gt; &quot;#{configurations.size}&quot;}</pre></td>
<tr class="marked">
<td><pre><a name="line231">231</a> r = {&quot;result&quot; =&gt; &quot;success&quot;, &quot;action&quot; =&gt; &quot;delete&quot;, &quot;id&quot; =&gt; &quot;#{app.id}&quot;, &quot;name&quot; =&gt; &quot;#{appname}&quot;, &quot;configurations&quot; =&gt; &quot;#{configurations.size}&quot;}</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line232">232</a> r.to_json</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line233">233</a> end</pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line234">234</a> end</pre></td>
</tr>
......@@ -1478,19 +1478,19 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line238">238</a> Application.all.sort.each {|a| apps &lt;&lt; a.to_hash}</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line239">239</a> if apps.empty?</pre></td>
</tr>
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line240">240</a> halt 404</pre></td>
</tr>
......@@ -1508,25 +1508,25 @@
<tr class="uncovered">
<tr class="marked">
<td><pre><a name="line243">243</a> end </pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line244">244</a> end</pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line245">245</a> </pre></td>
</tr>
<tr class="uncovered">
<tr class="inferred">
<td><pre><a name="line246">246</a> end</pre></td>
</tr>
......@@ -1581,433 +1581,439 @@
<tr class="inferred">
<td><pre><a name="line255">255</a> :xml =&gt; &quot;text/xml&quot;</pre></td>
<td><pre><a name="line255">255</a> :xml =&gt; &quot;text/xml&quot;,</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line256">256</a> }</pre></td>
<td><pre><a name="line256">256</a> :string =&gt; &quot;text/plain&quot;</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line257">257</a> </pre></td>
<td><pre><a name="line257">257</a> }</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line258">258</a> get '/:appname/:element/?' do |appname, element|</pre></td>
<td><pre><a name="line258">258</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line259">259</a> a = Application.find(:name =&gt; appname).first</pre></td>
<td><pre><a name="line259">259</a> get '/:appname/:element/?' do |appname, element|</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line260">260</a> if a.nil?</pre></td>
<tr class="marked">
<td><pre><a name="line260">260</a> a = Application.find(:name =&gt; appname).first</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line261">261</a> halt 404</pre></td>
<tr class="marked">
<td><pre><a name="line261">261</a> if a.nil?</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line262">262</a> else </pre></td>
<tr class="marked">
<td><pre><a name="line262">262</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line263">263</a> c = Configuration.find(:name =&gt; element, :application_id =&gt; a.id).first</pre></td>
<tr class="marked">
<td><pre><a name="line263">263</a> else </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line264">264</a> content_type content_type_mapping[c.format.to_sym] if content_type_mapping[c.format.to_sym]</pre></td>
<td><pre><a name="line264">264</a> c = Configuration.find(:name =&gt; element, :application_id =&gt; a.id).first</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line265">265</a> c.body</pre></td>
<tr class="marked">
<td><pre><a name="line265">265</a> content_type content_type_mapping[c.format.to_sym] if content_type_mapping[c.format.to_sym]</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line266">266</a> end </pre></td>
<tr class="marked">
<td><pre><a name="line266">266</a> c.body</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line267">267</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line267">267</a> end </pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line268">268</a> </pre></td>
<td><pre><a name="line268">268</a> end</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line269">269</a> get '/:appname/?' do |appname|</pre></td>
<td><pre><a name="line269">269</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line270">270</a> config = []</pre></td>
<td><pre><a name="line270">270</a> get '/:appname/?' do |appname|</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line271">271</a> a = Application.find(:name =&gt; appname).first</pre></td>
<tr class="marked">
<td><pre><a name="line271">271</a> config = []</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line272">272</a> if a.nil?</pre></td>
<tr class="marked">
<td><pre><a name="line272">272</a> a = Application.find(:name =&gt; appname).first</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line273">273</a> halt 404</pre></td>
<tr class="marked">
<td><pre><a name="line273">273</a> if a.nil?</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line274">274</a> else </pre></td>
<tr class="marked">
<td><pre><a name="line274">274</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line275">275</a> Configuration.find(:application_id =&gt; a.id).sort.each {|c| config &lt;&lt; c.to_hash}</pre></td>
<tr class="marked">
<td><pre><a name="line275">275</a> else </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line276">276</a> config.to_json</pre></td>
<td><pre><a name="line276">276</a> Configuration.find(:application_id =&gt; a.id).sort.each {|c| config &lt;&lt; c.to_hash}</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line277">277</a> end </pre></td>
<tr class="marked">
<td><pre><a name="line277">277</a> config.to_json</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line278">278</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line278">278</a> end </pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line279">279</a> </pre></td>
<td><pre><a name="line279">279</a> end</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line280">280</a> get '/?' do</pre></td>
<td><pre><a name="line280">280</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line281">281</a> configs = []</pre></td>
<td><pre><a name="line281">281</a> get '/?' do</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line282">282</a> Configuration.all.sort.each {|c| configs &lt;&lt; c.to_hash}</pre></td>
<tr class="marked">
<td><pre><a name="line282">282</a> configs = []</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line283">283</a> if configs.empty?</pre></td>
<tr class="marked">
<td><pre><a name="line283">283</a> Configuration.all.sort.each {|c| configs &lt;&lt; c.to_hash}</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line284">284</a> halt 404</pre></td>
<tr class="marked">
<td><pre><a name="line284">284</a> if configs.empty?</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line285">285</a> else </pre></td>
<tr class="marked">
<td><pre><a name="line285">285</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line286">286</a> configs.to_json</pre></td>
<td><pre><a name="line286">286</a> else </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line287">287</a> end </pre></td>
<td><pre><a name="line287">287</a> configs.to_json</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line288">288</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line288">288</a> end </pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line289">289</a> </pre></td>
<td><pre><a name="line289">289</a> end</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line290">290</a> put '/:appname/:element?' do |appname, element|</pre></td>
<td><pre><a name="line290">290</a> </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line291">291</a> app = Application.find_or_create(:name =&gt; appname)</pre></td>
<td><pre><a name="line291">291</a> put '/:appname/:element?' do |appname, element|</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line292">292</a> config = Configuration.find_or_create(:name =&gt; element, :application_id =&gt; app.id)</pre></td>
<tr class="marked">
<td><pre><a name="line292">292</a> app = Application.find_or_create(:name =&gt; appname)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line293">293</a> required_params = [&quot;format&quot;, &quot;body&quot;]</pre></td>
<tr class="marked">
<td><pre><a name="line293">293</a> config = Configuration.find_or_create(:name =&gt; element, :application_id =&gt; app.id)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line294">294</a> data = JSON.parse(request.body.read)</pre></td>
<tr class="marked">
<td><pre><a name="line294">294</a> required_params = [&quot;format&quot;, &quot;body&quot;]</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line295">295</a> data.keys.sort == required_params.sort ? (config.format = data[&quot;format&quot;]; config.body = data[&quot;body&quot;]) : (raise &quot;Missing Parameters&quot;)</pre></td>
<tr class="marked">
<td><pre><a name="line295">295</a> data = JSON.parse(request.body.read)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line296">296</a> if config.valid?</pre></td>
<tr class="marked">
<td><pre><a name="line296">296</a> data.keys.sort == required_params.sort ? (config.format = data[&quot;format&quot;]; config.body = data[&quot;body&quot;]) : (raise &quot;Missing Parameters&quot;)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line297">297</a> action = config.is_new? ? &quot;create&quot; : &quot;update&quot;</pre></td>
<tr class="marked">
<td><pre><a name="line297">297</a> if config.valid?</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line298">298</a> dependency_action = app.is_new? ? &quot;created&quot; : &quot;updated&quot;</pre></td>
<tr class="marked">
<td><pre><a name="line298">298</a> config.save</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line299">299</a> config.save</pre></td>
<tr class="marked">
<td><pre><a name="line299">299</a> action = config.is_new? ? &quot;create&quot; : &quot;update&quot;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line300">300</a> r = {&quot;result&quot; =&gt; &quot;success&quot;,&quot;id&quot; =&gt; &quot;#{config.id}&quot;, &quot;action&quot; =&gt; action, &quot;dependencies&quot; =&gt; dependency_action, &quot;application&quot; =&gt; app.name, &quot;item&quot; =&gt; config.name}</pre></td>
<tr class="marked">
<td><pre><a name="line300">300</a> dependency_action = app.is_new? ? &quot;created&quot; : &quot;updated&quot;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line301">301</a> r.to_json</pre></td>
<tr class="marked">
<td><pre><a name="line301">301</a> r = {&quot;result&quot; =&gt; &quot;success&quot;,&quot;id&quot; =&gt; &quot;#{config.id}&quot;, &quot;action&quot; =&gt; action, &quot;dependencies&quot; =&gt; dependency_action, &quot;application&quot; =&gt; app.name, &quot;item&quot; =&gt; config.name}</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line302">302</a> else</pre></td>
<tr class="marked">
<td><pre><a name="line302">302</a> r.to_json</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line303">303</a> else</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line303">303</a> raise &quot;#{config.errors}&quot;</pre></td>
<td><pre><a name="line304">304</a> raise &quot;#{config.errors}&quot;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line304">304</a> end</pre></td>
<td><pre><a name="line305">305</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line305">305</a> end</pre></td>
<td><pre><a name="line306">306</a> end</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line306">306</a> </pre></td>
<td><pre><a name="line307">307</a> </pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line307">307</a> delete '/:appname/:element?' do |appname, element|</pre></td>
<tr class="marked">
<td><pre><a name="line308">308</a> delete '/:appname/:element?' do |appname, element|</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line308">308</a> app = Application.find(:name =&gt; appname).first</pre></td>
<td><pre><a name="line309">309</a> app = Application.find(:name =&gt; appname).first</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line309">309</a> if app</pre></td>
<tr class="marked">
<td><pre><a name="line310">310</a> if app</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line310">310</a> config = Configuration.find(:name=&gt; element, :application_id =&gt; app.id).first</pre></td>
<tr class="marked">
<td><pre><a name="line311">311</a> config = Configuration.find(:name=&gt; element, :application_id =&gt; app.id).first</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line311">311</a> if config</pre></td>
<tr class="marked">
<td><pre><a name="line312">312</a> if config</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line312">312</a> config.delete</pre></td>
<tr class="marked">
<td><pre><a name="line313">313</a> config.delete</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line313">313</a> r = {&quot;result&quot; =&gt; &quot;success&quot;, &quot;id&quot; =&gt; &quot;#{config.id}&quot;, &quot;action&quot; =&gt; &quot;delete&quot;, &quot;application&quot; =&gt; &quot;#{app.name}&quot;, &quot;item&quot; =&gt; &quot;#{element}&quot;}</pre></td>
<tr class="marked">
<td><pre><a name="line314">314</a> r = {&quot;result&quot; =&gt; &quot;success&quot;, &quot;id&quot; =&gt; &quot;#{config.id}&quot;, &quot;action&quot; =&gt; &quot;delete&quot;, &quot;application&quot; =&gt; &quot;#{app.name}&quot;, &quot;item&quot; =&gt; &quot;#{element}&quot;}</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line314">314</a> r.to_json</pre></td>
<tr class="marked">
<td><pre><a name="line315">315</a> r.to_json</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line315">315</a> else</pre></td>
<tr class="marked">
<td><pre><a name="line316">316</a> else</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line316">316</a> halt 404</pre></td>
<td><pre><a name="line317">317</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line317">317</a> end</pre></td>
<tr class="marked">
<td><pre><a name="line318">318</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line318">318</a> else</pre></td>
<td><pre><a name="line319">319</a> else</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line319">319</a> halt 404</pre></td>
<td><pre><a name="line320">320</a> halt 404</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line320">320</a> end</pre></td>
<td><pre><a name="line321">321</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line321">321</a> end</pre></td>
<td><pre><a name="line322">322</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line322">322</a> </pre></td>
<td><pre><a name="line323">323</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line323">323</a> end</pre></td>
<td><pre><a name="line324">324</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line324">324</a> run! if app_file == $0</pre></td>
<tr class="marked">
<td><pre><a name="line325">325</a> run! if app_file == $0</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line325">325</a> end</pre></td>
<td><pre><a name="line326">326</a> end</pre></td>
</tr>
</tbody>
</table>
<p>Generated on 2011-01-27 21:32:12 -0500 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
<p>Generated on 2011-01-31 05:03:32 -0500 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
</body>
</html>
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Noah Host Model", :reset_redis => true do
describe "Using the Host Model", :reset_redis => true do
it "should create a new Host with no services" do
hostname = "host1.domain.com"
hoststatus = "up"
host = Host.create(:name => hostname, :status => hoststatus)
host.valid?.should == true
host.save
host.name.should == hostname
host.status.should == hoststatus
host.services.size.should == 0
end
describe "should" do
it "create a new Host with no services" do
hostname = "host1.domain.com"
hoststatus = "up"
host = Host.create(:name => hostname, :status => hoststatus)
host.valid?.should == true
host.save
host.name.should == hostname
host.status.should == hoststatus
host.services.size.should == 0
end
it "should create a new Host with services" do
hostname = "host2.domain.com"
hoststatus = "down"
servicename = 'myservice'
servicestatus = 'pending'
host = Host.create(:name => hostname, :status => hoststatus)
host.valid?.should == true
host.save
host.services << Service.create(:name => servicename, :status => servicestatus, :host => host)
host.name.should == hostname
host.status.should == hoststatus
host.services.size.should == 1
host.services[1].valid?.should == true
host.services[1].name.should == servicename
host.services[1].status.should == servicestatus
host.services[1].host_id.should == host.id
end
it "create a new Host with services" do
hostname = "host2.domain.com"
hoststatus = "down"
servicename = 'myservice'
servicestatus = 'pending'
host = Host.create(:name => hostname, :status => hoststatus)
host.valid?.should == true
host.save
host.services << Service.create(:name => servicename, :status => servicestatus, :host => host)
host.name.should == hostname
host.status.should == hoststatus
host.services.size.should == 1
host.services[1].valid?.should == true
host.services[1].name.should == servicename
host.services[1].status.should == servicestatus
host.services[1].host_id.should == host.id
end
it "should create a Host via find_or_create" do
hostname = "host3.domain.com"
hoststatus = "up"
host = Host.find_or_create(:name => hostname, :status => hoststatus)
host.valid?.should == true
host.save
host.is_new?.should == true
end
it "create a Host via find_or_create" do
hostname = "host3.domain.com"
hoststatus = "up"
host = Host.find_or_create(:name => hostname, :status => hoststatus)
host.valid?.should == true
host.save
host.is_new?.should == true
end
it "should update a Host via find_or_create" do
hostname = "host3.domain.com"
hoststatus = "pending"
newstatus = "down"
host = Host.find_or_create(:name => hostname, :status => hoststatus)
host.valid?.should == true
host.save
host.is_new?.should == true
sleep 1
host1 = Host.find_or_create(:name => hostname, :status => newstatus)
host1.save
host1.is_new?.should == false
end
it "update a Host via find_or_create" do
hostname = "host3.domain.com"
hoststatus = "pending"
newstatus = "down"
host = Host.find_or_create(:name => hostname, :status => hoststatus)
host.valid?.should == true
host.save
host.is_new?.should == true
sleep 1
host1 = Host.find_or_create(:name => hostname, :status => newstatus)
host1.save
host1.is_new?.should == false
end
it "should delete a Host" do
hostname = "host3.domain.com"
hoststatus = "pending"
host = Host.create(:name => hostname, :status => hoststatus)
host.save
host.delete
Host.find(:name => hostname).empty?.should == true
end
it "delete a Host" do
hostname = "host3.domain.com"
hoststatus = "pending"
host = Host.create(:name => hostname, :status => hoststatus)
host.save
host.delete
Host.find(:name => hostname).empty?.should == true
end
it "should not create a new Host with missing status" do
hostname ="host3.domain.com"
host = Host.create(:name => hostname)
host.valid?.should == false
host.errors.should == [[:status, :not_present], [:status, :not_member]]
it "should return all Hosts" do
hostname1 = "host1.domain.com"
status1 = "up"
hostname2 = "host2.domain.com"
status2= "down"
host1 = Host.create(:name => hostname1, :status => status1)
host2 = Host.create(:name => hostname2, :status => status2)
host1.save
host2.save
Hosts.all.class.should == Array
Hosts.all.size.should == 2
Hosts.all.first.name.should == hostname1
Hosts.all.first.status.should == status1
Hosts.all.last.name.should == hostname2
Hosts.all.last.status.should == status2
end
end
it "should not create a new Host with missing hostname" do
status = "up"
host = Host.create(:status => status)
host.valid?.should == false
host.errors.should == [[:name, :not_present]]
end
describe "should not" do
it "create a new Host with missing status" do
hostname ="host3.domain.com"
host = Host.create(:name => hostname)
host.valid?.should == false
host.errors.should == [[:status, :not_present], [:status, :not_member]]
end
it "should not create a new Host with an invalid status" do
hostname = "host3.domain.com"
status = "online"
host = Host.create(:name => hostname, :status => status)
host.valid?.should == false
host.errors.should == [[:status, :not_member]]
end
it "create a new Host with missing hostname" do
status = "up"
host = Host.create(:status => status)
host.valid?.should == false
host.errors.should == [[:name, :not_present]]
end
it "should not create a duplicate Host" do
hostname = "host1.domain.com"
status = "up"
host1 = Host.create(:name => hostname, :status => status)
host1.save
host2 = Host.create(:name => hostname, :status => status)
host2.valid?.should == false
host2.errors.should == [[:name, :not_unique]]
end
it "create a new Host with an invalid status" do
hostname = "host3.domain.com"
status = "online"
host = Host.create(:name => hostname, :status => status)
host.valid?.should == false
host.errors.should == [[:status, :not_member]]
end
it "should return all Hosts" do
hostname1 = "host1.domain.com"
status1 = "up"
hostname2 = "host2.domain.com"
status2= "down"
host1 = Host.create(:name => hostname1, :status => status1)
host2 = Host.create(:name => hostname2, :status => status2)
host1.save
host2.save
Hosts.all.class.should == Array
Hosts.all.size.should == 2
Hosts.all.first.name.should == hostname1
Hosts.all.first.status.should == status1
Hosts.all.last.name.should == hostname2
Hosts.all.last.status.should == status2
it "create a duplicate Host" do
hostname = "host1.domain.com"
status = "up"
host1 = Host.create(:name => hostname, :status => status)
host1.save
host2 = Host.create(:name => hostname, :status => status)
host2.valid?.should == false
host2.errors.should == [[:name, :not_unique]]
end
end
end
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Noah Service Model", :reset_redis => true do
describe "should" do
it "should create a new Service" do
servicename = "myservice"
servicestatus = "up"
hostname = "mytesthost1"
hoststatus = "up"
host = Host.create(:name => hostname, :status => hoststatus)
host.save
service = Service.create(:name => servicename, :status => servicestatus, :host => host)
service.valid?.should == true
service.save
service.name.should == servicename
service.status.should == servicestatus
service.host_id.should == host.id
host.services[1].name.should == servicename
end
it "create a new Service" do
servicename = "myservice"
servicestatus = "up"
hostname = "mytesthost1"
hoststatus = "up"
host = Host.create(:name => hostname, :status => hoststatus)
host.save
service = Service.create(:name => servicename, :status => servicestatus, :host => host)
service.valid?.should == true
service.save
service.name.should == servicename
service.status.should == servicestatus
service.host_id.should == host.id
host.services[1].name.should == servicename
end
it "should not create a new Service when missing a Host" do
servicename = "myservice1"
servicestatus = "up"
service = Service.create(:name => servicename, :status => servicestatus)
service.valid?.should == false
service.errors.should == [[:host_id, :not_present]]
end
it "create a new Service with find_or_create" do
host = Host.create(:name => "h1", :status => "up")
host.save
service = Service.find_or_create(:name => "s1", :status => "up", :host => host)
service.save
service.is_new?.should == true
end
it "should not create a new Service when missing a name" do
host = Host.create(:name => "host1.domain.com", :status => "up")
host.save
service = Service.create(:status => "up", :host => host)
service.valid?.should == false
service.errors.should == [[:name, :not_present]]
end
it "update an existing Service with find_or_create" do
host = Host.create(:name => "h2", :status => "up")
host.save
service = Service.find_or_create(:name => "s2", :status => "up", :host => host)
service.save
sleep 1
service2 = Service.find_or_create(:name => "s2", :status => "up", :host => host)
service2.save
service2.is_new?.should == false
end
it "should not create a new Service when missing a status" do
host = Host.create(:name => "host1.domain.com", :status => "up")
host.save
service = Service.create(:name => 'foo', :host => host)
service.valid?.should == false
service.errors.should == [[:status, :not_present], [:status, :not_member]]
end
it "delete a Service" do
h = Host.create(:name => "h1", :status => "up")
h.save
s = Service.create(:name => "s1", :status => "up", :host => h)
s.save
s = Service.find(:name => "s1").first
s.delete
s = Service.find(:name => "s1").first
s.should == nil
end
it "should not create a new Service with an invalid status" do
host = Host.create(:name => "host1.domain.com", :status => "up")
host.save
service = Service.create(:name => "myservice", :status => "invalid_status", :host => host)
service.valid?.should == false
service.errors.should == [[:status, :not_member]]
end
it "find multiple Services" do
h = Host.create(:name => "h1", :status => "up")
if h.valid?
h.services << Service.create(:name => "s1", :status => "up", :host => h)
h.services << Service.create(:name => "s2", :status => "up", :host => h)
h.save
end
Services.all.size.should == 2
Services.all.first.name.should == "s1"
Services.all.last.name.should == "s2"
end
it "should not create a duplicate Service" do
host = Host.create(:name => "host1.domain.com", :status => "up")
host.save
s = Service.create(:name => "myservice", :status => "up", :host => host)
s.save
s1 = Service.create(:name => "myservice", :status => "up", :host => host)
s1.valid?.should == false
s1.errors.should == [[[:name, :host_id], :not_unique]]
end
it "should create a new Service with find_or_create" do
host = Host.create(:name => "h1", :status => "up")
host.save
service = Service.find_or_create(:name => "s1", :status => "up", :host => host)
service.save
service.is_new?.should == true
end
describe "should not" do
it "should update an existing Service with find_or_create" do
host = Host.create(:name => "h2", :status => "up")
host.save
service = Service.find_or_create(:name => "s2", :status => "up", :host => host)
service.save
sleep 1
service2 = Service.find_or_create(:name => "s2", :status => "up", :host => host)
service2.save
service2.is_new?.should == false
end
it "create a new Service when missing a Host" do
servicename = "myservice1"
servicestatus = "up"
service = Service.create(:name => servicename, :status => servicestatus)
service.valid?.should == false
service.errors.should == [[:host_id, :not_present]]
end
it "should delete a Service" do
h = Host.create(:name => "h1", :status => "up")
h.save
s = Service.create(:name => "s1", :status => "up", :host => h)
s.save
s = Service.find(:name => "s1").first
s.delete
s = Service.find(:name => "s1").first
s.should == nil
end
it "create a new Service when missing a name" do
host = Host.create(:name => "host1.domain.com", :status => "up")
host.save
service = Service.create(:status => "up", :host => host)
service.valid?.should == false
service.errors.should == [[:name, :not_present]]
end
it "should find multiple Services" do
h = Host.create(:name => "h1", :status => "up")
if h.valid?
h.services << Service.create(:name => "s1", :status => "up", :host => h)
h.services << Service.create(:name => "s2", :status => "up", :host => h)
h.save
it "create a new Service when missing a status" do
host = Host.create(:name => "host1.domain.com", :status => "up")
host.save
service = Service.create(:name => 'foo', :host => host)
service.valid?.should == false
service.errors.should == [[:status, :not_present], [:status, :not_member]]
end
it "create a new Service with an invalid status" do
host = Host.create(:name => "host1.domain.com", :status => "up")
host.save
service = Service.create(:name => "myservice", :status => "invalid_status", :host => host)
service.valid?.should == false
service.errors.should == [[:status, :not_member]]
end
Services.all.size.should == 2
Services.all.first.name.should == "s1"
Services.all.last.name.should == "s2"
end
it "create a duplicate Service" do
host = Host.create(:name => "host1.domain.com", :status => "up")
host.save
s = Service.create(:name => "myservice", :status => "up", :host => host)
s.save
s1 = Service.create(:name => "myservice", :status => "up", :host => host)
s1.valid?.should == false
s1.errors.should == [[[:name, :host_id], :not_unique]]
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment