./coverage/index.html in sinatra-param-0.1.2 vs ./coverage/index.html in sinatra-param-0.1.3
- old
+ new
@@ -1,16 +1,16 @@
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Code coverage for Sinatra-param</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <script src='./assets/0.7.1/application.js' type='text/javascript'></script>
+ <script src='./assets/0.7.1/application.js' type='text/javascript'></script>
<link href='./assets/0.7.1/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" type="image/png" href="./assets/0.7.1/favicon_red.png" />
<link rel="icon" type="image/png" href="./assets/0.7.1/favicon.png" />
</head>
-
+
<body>
<div id="loading">
<img src="./assets/0.7.1/loading.gif" alt="loading"/>
</div>
<div id="wrapper" style="display:none;">
@@ -30,11 +30,11 @@
</span> hits/line)
</h2>
<a name="AllFiles"></a>
<div>
<b>2</b> files in total.
- <b>63</b> relevant lines.
+ <b>63</b> relevant lines.
<span class="green"><b>18</b> lines covered</span> and
<span class="red"><b>45</b> lines missed </span>
</div>
<table class="file_list">
<thead>
@@ -47,742 +47,742 @@
<th>Lines missed</th>
<th>Avg. Hits / Line</th>
</tr>
</thead>
<tbody>
-
+
<tr>
<td class="strong"><a href="#0f7926ededdfd8418773c107837b6dc4182659b8" class="src_link" title="lib/sinatra/param.rb">lib/sinatra/param.rb</a></td>
<td class="red strong">25.0 %</td>
<td>105</td>
<td>60</td>
<td>15</td>
<td>45</td>
<td>0.3</td>
</tr>
-
+
<tr>
<td class="strong"><a href="#95bc1568394aeedcc2389ae1301b3fd7e08bf109" class="src_link" title="lib/sinatra/param/version.rb">lib/sinatra/param/version.rb</a></td>
<td class="green strong">100.0 %</td>
<td>5</td>
<td>3</td>
<td>3</td>
<td>0</td>
<td>1.0</td>
</tr>
-
+
</tbody>
</table>
</div>
-
+
</div>
-
+
<div id="footer">
- Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
+ Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
and simplecov-html v0.7.1<br/>
using RSpec
</div>
-
+
<div class="source_files">
-
+
<div class="source_table" id="0f7926ededdfd8418773c107837b6dc4182659b8">
<div class="header">
<h3>lib/sinatra/param.rb</h3>
<h4><span class="red">25.0 %</span> covered</h4>
<div>
- <b>60</b> relevant lines.
+ <b>60</b> relevant lines.
<span class="green"><b>15</b> lines covered</span> and
<span class="red"><b>45</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 'sinatra/base'</code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="2">
<span class="hits">1</span>
-
+
<code class="ruby">require 'sinatra/param/version'</code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="3">
<span class="hits">1</span>
-
+
<code class="ruby">require 'time'</code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="4">
<span class="hits">1</span>
-
+
<code class="ruby">require 'date'</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="5">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="6">
<span class="hits">1</span>
-
+
<code class="ruby">module Sinatra</code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="7">
<span class="hits">1</span>
-
+
<code class="ruby"> module Param</code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="8">
<span class="hits">1</span>
-
+
<code class="ruby"> class InvalidParameterError < StandardError; end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="9">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="10">
<span class="hits">1</span>
-
+
<code class="ruby"> def param(name, type, options = {})</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="11">
-
-
+
+
<code class="ruby"> begin</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="12">
-
-
+
+
<code class="ruby"> params[name] = coerce(params[name], type, options) || options[:default]</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="13">
-
-
+
+
<code class="ruby"> params[name] = options[:transform].to_proc.call(params[name]) if options[:transform]</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="14">
-
-
+
+
<code class="ruby"> validate!(params[name], options)</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="15">
-
-
+
+
<code class="ruby"> rescue</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="16">
-
-
+
+
<code class="ruby"> error = "Invalid parameter, #{name}"</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="17">
-
-
+
+
<code class="ruby"> if content_type and content_type.match(mime_type(:json))</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="18">
-
-
+
+
<code class="ruby"> error = {message: error}.to_json</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="19">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="20">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="21">
-
-
- <code class="ruby"> halt 406, error</code>
+
+
+ <code class="ruby"> halt 400, error</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="22">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="23">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="24">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="25">
<span class="hits">1</span>
-
+
<code class="ruby"> def one_of(*names)</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="26">
-
-
+
+
<code class="ruby"> count = 0</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="27">
-
-
+
+
<code class="ruby"> names.each do |name|</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="28">
-
-
+
+
<code class="ruby"> if params[name] and present?(params[name])</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="29">
-
-
+
+
<code class="ruby"> count += 1</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="30">
-
-
+
+
<code class="ruby"> next unless count > 1</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="31">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="32">
-
-
+
+
<code class="ruby"> error = "Parameters #{names.join(', ')} are mutually exclusive"</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="33">
-
-
+
+
<code class="ruby"> if content_type and content_type.match(mime_type(:json))</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="34">
-
-
+
+
<code class="ruby"> error = {message: error}.to_json</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="35">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="36">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="37">
-
-
- <code class="ruby"> halt 406, error</code>
+
+
+ <code class="ruby"> halt 400, error</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="38">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="39">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="40">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="41">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="42">
<span class="hits">1</span>
-
+
<code class="ruby"> private</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="43">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="44">
<span class="hits">1</span>
-
+
<code class="ruby"> def coerce(param, type, options = {})</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="45">
-
-
+
+
<code class="ruby"> return nil if param.nil?</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="46">
-
-
+
+
<code class="ruby"> return param if (param.is_a?(type) rescue false)</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="47">
-
-
+
+
<code class="ruby"> return Integer(param) if type == Integer</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="48">
-
-
+
+
<code class="ruby"> return Float(param) if type == Float</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="49">
-
-
+
+
<code class="ruby"> return String(param) if type == String</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="50">
-
-
+
+
<code class="ruby"> return Time.parse(param) if type == Time</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="51">
-
-
+
+
<code class="ruby"> return Date.parse(param) if type == Date</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="52">
-
-
+
+
<code class="ruby"> return DateTime.parse(param) if type == DateTime</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="53">
-
-
+
+
<code class="ruby"> return Array(param.split(options[:delimiter] || ",")) if type == Array</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="54">
-
-
+
+
<code class="ruby"> return Hash[param.split(options[:delimiter] || ",").map{|c| c.split(options[:separator] || ":")}] if type == Hash</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="55">
-
-
+
+
<code class="ruby"> return (/(false|f|no|n|0)$/i === param.to_s ? false : (/(true|t|yes|y|1)$/i === param.to_s ? true : nil)) if type == TrueClass || type == FalseClass || type == :boolean</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="56">
-
-
+
+
<code class="ruby"> return nil</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="57">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="58">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="59">
<span class="hits">1</span>
-
+
<code class="ruby"> def validate!(param, options)</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="60">
-
-
+
+
<code class="ruby"> options.each do |key, value|</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="61">
-
-
+
+
<code class="ruby"> case key</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="62">
-
-
+
+
<code class="ruby"> when :required</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="63">
-
-
+
+
<code class="ruby"> raise InvalidParameterError if value && param.nil?</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="64">
-
-
+
+
<code class="ruby"> when :blank</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="65">
-
-
+
+
<code class="ruby"> raise InvalidParameterError if !value && case param</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="66">
-
-
+
+
<code class="ruby"> when String</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="67">
-
-
+
+
<code class="ruby"> !(/\S/ === param)</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="68">
-
-
+
+
<code class="ruby"> when Array, Hash</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="69">
-
-
+
+
<code class="ruby"> param.empty?</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="70">
-
-
+
+
<code class="ruby"> else</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="71">
-
-
+
+
<code class="ruby"> param.nil?</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="72">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="73">
-
-
+
+
<code class="ruby"> when :is</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="74">
-
-
+
+
<code class="ruby"> raise InvalidParameterError unless value === param</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="75">
-
-
+
+
<code class="ruby"> when :in, :within, :range</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="76">
-
-
+
+
<code class="ruby"> raise InvalidParameterError unless param.nil? || case value</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="77">
-
-
+
+
<code class="ruby"> when Range</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="78">
-
-
+
+
<code class="ruby"> value.include?(param)</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="79">
-
-
+
+
<code class="ruby"> else</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="80">
-
-
+
+
<code class="ruby"> Array(value).include?(param)</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="81">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="82">
-
-
+
+
<code class="ruby"> when :min</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="83">
-
-
+
+
<code class="ruby"> raise InvalidParameterError unless param.nil? || value <= param</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="84">
-
-
+
+
<code class="ruby"> when :max</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="85">
-
-
+
+
<code class="ruby"> raise InvalidParameterError unless param.nil? || value >= param</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="86">
-
-
+
+
<code class="ruby"> when :min_length</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="87">
-
-
+
+
<code class="ruby"> raise InvalidParameterError unless param.nil? || value <= param.length</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="88">
-
-
+
+
<code class="ruby"> when :max_length</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="89">
-
-
+
+
<code class="ruby"> raise InvalidParameterError unless param.nil? || value >= param.length</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="90">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="91">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="92">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="93">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="94">
-
-
+
+
<code class="ruby"> # ActiveSupport #present? and #blank? without patching Object</code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="95">
<span class="hits">1</span>
-
+
<code class="ruby"> def present?(object)</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="96">
-
-
+
+
<code class="ruby"> !blank?(object)</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="97">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="98">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="99">
<span class="hits">1</span>
-
+
<code class="ruby"> def blank?(object)</code>
</li>
-
+
<li class="missed" data-hits="0" data-linenumber="100">
-
-
+
+
<code class="ruby"> object.respond_to?(:empty?) ? object.empty? : !object</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="101">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="102">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="103">
-
-
+
+
<code class="ruby"></code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="104">
<span class="hits">1</span>
-
+
<code class="ruby"> helpers Param</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="105">
-
-
+
+
<code class="ruby">end</code>
</li>
-
+
</ol>
</pre>
</div>
-
+
<div class="source_table" id="95bc1568394aeedcc2389ae1301b3fd7e08bf109">
<div class="header">
<h3>lib/sinatra/param/version.rb</h3>
<h4><span class="green">100.0 %</span> covered</h4>
<div>
- <b>3</b> relevant lines.
+ <b>3</b> relevant lines.
<span class="green"><b>3</b> lines covered</span> and
<span class="red"><b>0</b> lines missed.</span>
</div>
</div>
-
+
<pre>
<ol>
-
+
<li class="covered" data-hits="1" data-linenumber="1">
<span class="hits">1</span>
-
+
<code class="ruby">module Sinatra</code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="2">
<span class="hits">1</span>
-
+
<code class="ruby"> module Param</code>
</li>
-
+
<li class="covered" data-hits="1" data-linenumber="3">
<span class="hits">1</span>
-
+
<code class="ruby"> VERSION = "0.1.1"</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="4">
-
-
+
+
<code class="ruby"> end</code>
</li>
-
+
<li class="never" data-hits="" data-linenumber="5">
-
-
+
+
<code class="ruby">end</code>
</li>
-
+
</ol>
</pre>
</div>
-
+
</div>
</div>
</body>
</html>