C0 code coverage information
Generated on Sat Feb 02 17:44:29 +0100 2008 with rcov 0.8.1.2
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2 # All files in this distribution are subject to the terms of the Ruby license.
3
4 begin
5 require 'rubygems'
6 rescue LoadError => ex
7 end
8
9 require 'timeout'
10
11 require 'ramaze'
12 require 'ramaze/spec/helper/bacon'
13
14 def ramaze(options = {})
15 appdir = File.dirname(caller[0].split(':').first)
16 options = {
17 :template_root => appdir/:template,
18 :public_root => appdir/:public,
19 :adapter => false,
20 :run_loose => true,
21 :error_page => false,
22 :port => 7007,
23 :host => '127.0.0.1',
24 :force => true,
25 :sourcereload => false,
26 :origin => :spec,
27 }.merge(options)
28
29 Ramaze.start(options)
30 end
31
32 SPEC_REQUIRE_DEPENDENCY = {
33 'sequel' => %w[sqlite3 sequel_model sequel_core]
34 }
35
36 # require each of the following and rescue LoadError, telling you why it failed.
37 def spec_require(*following)
38 following << following.map{|f| SPEC_REQUIRE_DEPENDENCY[f] }
39 following.flatten.uniq.compact.reverse.each do |file|
40 require file.to_s
41 end
42 rescue LoadError => ex
43 puts ex
44 puts "Can't run #{$0}: #{ex}"
45 puts "Usually you should not worry about this failure, just install the"
46 puts "library and try again (if you want to use that feature later on)"
47 exit
48 end
49
50 def testcase_requires(*following)
51 warn "'testcase_requires' is being deprecated, please use 'spec_require' instead"
52 spec_require(*following)
53 end
54
55 shared "http" do
56 require 'ramaze/spec/helper/mock_http'
57 extend MockHTTP
58 end
59
60 shared 'browser' do
61 require 'ramaze/spec/helper/simple_http'
62 require 'ramaze/spec/helper/browser'
63 end
64
65 shared 'requester' do
66 require 'ramaze/spec/helper/requester'
67 end
68
69 shared 'xpath' do
70 behaves_like 'http'
71
72 require 'rexml/document'
73 require 'rexml/xpath'
74
75 class Rack::MockResponse
76 def match(xpath = '*')
77 REXML::XPath::match(REXML::Document.new(body), xpath)
78 end
79 alias / match
80 alias search match
81
82 def first(xpath = '*')
83 REXML::XPath::first(REXML::Document.new(body), xpath)
84 end
85 alias at first
86
87 def each(xpath = '*', &block)
88 REXML::XPath::each(REXML::Document.new(body), xpath, &block)
89 end
90 end
91
92 def xp_match(obj, xpath = '*')
93 XPath::match(rexml_doc(body), xpath, &block)
94 end
95 alias xp_search xp_match
96
97 def xp_first(obj, xpath = '*')
98 XPath::first(rexml_doc(body), xpath, &block)
99 end
100 alias xp_at xp_first
101
102 def xp_each(obj, xpath = '*', &block)
103 XPath::each(rexml_doc(body), xpath, &block)
104 end
105
106 def rexml_doc(obj)
107 case obj
108 when REXML::Document, REXML::Element
109 obj
110 else
111 REXML::Document.new(obj)
112 end
113 end
114 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.