quarry 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/COPYING +344 -0
- data/MANIFEST +151 -0
- data/METADATA +22 -0
- data/NEWS +8 -0
- data/README +75 -0
- data/VERSION +1 -0
- data/bin/rubybreak +3 -0
- data/bin/xact-ruby +6 -0
- data/demo/spec/demo_check.rb +21 -0
- data/demo/spec/demo_outline.rb +25 -0
- data/demo/test/demo_run.rb +21 -0
- data/doc/manual.html2 +1416 -0
- data/doc/rdoc/classes/Assertion.html +101 -0
- data/doc/rdoc/classes/Assertion/False.html +132 -0
- data/doc/rdoc/classes/Assertion/True.html +137 -0
- data/doc/rdoc/classes/Kernel.html +86 -0
- data/doc/rdoc/classes/Method.html +137 -0
- data/doc/rdoc/classes/Module.html +165 -0
- data/doc/rdoc/classes/Object.html +154 -0
- data/doc/rdoc/classes/Quarry.html +177 -0
- data/doc/rdoc/classes/Quarry/Design.html +170 -0
- data/doc/rdoc/classes/Quarry/Design/Specification.html +265 -0
- data/doc/rdoc/classes/Quarry/Design/Specification/Context.html +174 -0
- data/doc/rdoc/classes/Quarry/MethodProbe.html +267 -0
- data/doc/rdoc/classes/Quarry/Mock.html +89 -0
- data/doc/rdoc/classes/Quarry/Mock/Object.html +276 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/CHANGES.html +100 -0
- data/doc/rdoc/files/COPYING.html +457 -0
- data/doc/rdoc/files/MANIFEST.html +630 -0
- data/doc/rdoc/files/METADATA.html +92 -0
- data/doc/rdoc/files/NEWS.html +99 -0
- data/doc/rdoc/files/README.html +171 -0
- data/doc/rdoc/files/VERSION.html +96 -0
- data/doc/rdoc/files/bin/rubybreak.html +96 -0
- data/doc/rdoc/files/bin/xact-ruby.html +92 -0
- data/doc/rdoc/files/lib/quarry/assert/must_rb.html +96 -0
- data/doc/rdoc/files/lib/quarry/assert/should_rb.html +96 -0
- data/doc/rdoc/files/lib/quarry/assertion_rb.html +96 -0
- data/doc/rdoc/files/lib/quarry/breakout_rb.html +144 -0
- data/doc/rdoc/files/lib/quarry/design/spec_rb.html +100 -0
- data/doc/rdoc/files/lib/quarry/document_rb.html +92 -0
- data/doc/rdoc/files/lib/quarry/loadmonitor_rb.html +92 -0
- data/doc/rdoc/files/lib/quarry/methodprobe_rb.html +111 -0
- data/doc/rdoc/files/lib/quarry/mock/object_rb.html +123 -0
- data/doc/rdoc/files/lib/quarry/mockery_rb.html +115 -0
- data/doc/rdoc/fr_class_index.html +60 -0
- data/doc/rdoc/fr_file_index.html +65 -0
- data/doc/rdoc/fr_method_index.html +77 -0
- data/doc/rdoc/index.html +26 -0
- data/doc/rdoc/rdoc-style.css +175 -0
- data/doc/ri/Assertion/False/assert-i.yaml +10 -0
- data/doc/ri/Assertion/False/cdesc-False.yaml +19 -0
- data/doc/ri/Assertion/False/message-i.yaml +10 -0
- data/doc/ri/Assertion/True/assert-i.yaml +11 -0
- data/doc/ri/Assertion/True/cdesc-True.yaml +24 -0
- data/doc/ri/Assertion/True/message-c.yaml +11 -0
- data/doc/ri/Assertion/True/message-i.yaml +11 -0
- data/doc/ri/Assertion/True/method_missing-i.yaml +11 -0
- data/doc/ri/Assertion/True/new-c.yaml +11 -0
- data/doc/ri/Assertion/cdesc-Assertion.yaml +17 -0
- data/doc/ri/Kernel/cdesc-Kernel.yaml +15 -0
- data/doc/ri/Method/cdesc-Method.yaml +18 -0
- data/doc/ri/Method/migration-i.yaml +12 -0
- data/doc/ri/Method/signature-i.yaml +12 -0
- data/doc/ri/Module/cdesc-Module.yaml +21 -0
- data/doc/ri/Module/doc-i.yaml +16 -0
- data/doc/ri/Module/method_added-i.yaml +10 -0
- data/doc/ri/Object/assert%21-i.yaml +14 -0
- data/doc/ri/Object/assert-i.yaml +14 -0
- data/doc/ri/Object/cdesc-Object.yaml +20 -0
- data/doc/ri/Quarry/Design/Specification/Context/after-i.yaml +10 -0
- data/doc/ri/Quarry/Design/Specification/Context/before-i.yaml +10 -0
- data/doc/ri/Quarry/Design/Specification/Context/cdesc-Context.yaml +24 -0
- data/doc/ri/Quarry/Design/Specification/Context/method_missing-i.yaml +10 -0
- data/doc/ri/Quarry/Design/Specification/Context/specifications-i.yaml +10 -0
- data/doc/ri/Quarry/Design/Specification/cdesc-Specification.yaml +44 -0
- data/doc/ri/Quarry/Design/Specification/check-i.yaml +12 -0
- data/doc/ri/Quarry/Design/Specification/new-c.yaml +12 -0
- data/doc/ri/Quarry/Design/Specification/outline-i.yaml +12 -0
- data/doc/ri/Quarry/Design/cdesc-Design.yaml +22 -0
- data/doc/ri/Quarry/Design/check-c.yaml +12 -0
- data/doc/ri/Quarry/Design/outline-c.yaml +10 -0
- data/doc/ri/Quarry/Design/specification-c.yaml +10 -0
- data/doc/ri/Quarry/Design/specifications-c.yaml +10 -0
- data/doc/ri/Quarry/MethodProbe/cdesc-MethodProbe.yaml +46 -0
- data/doc/ri/Quarry/MethodProbe/duckcall-c.yaml +10 -0
- data/doc/ri/Quarry/MethodProbe/initialize_copy-i.yaml +10 -0
- data/doc/ri/Quarry/MethodProbe/method_missing-i.yaml +10 -0
- data/doc/ri/Quarry/MethodProbe/new-c.yaml +10 -0
- data/doc/ri/Quarry/Mock/Object/cdesc-Object.yaml +52 -0
- data/doc/ri/Quarry/Mock/Object/echo-c.yaml +12 -0
- data/doc/ri/Quarry/Mock/Object/keys-c.yaml +12 -0
- data/doc/ri/Quarry/Mock/Object/mock-c.yaml +12 -0
- data/doc/ri/Quarry/Mock/Object/mocks-c.yaml +10 -0
- data/doc/ri/Quarry/Mock/Object/spin-c.yaml +12 -0
- data/doc/ri/Quarry/Mock/cdesc-Mock.yaml +15 -0
- data/doc/ri/Quarry/Mockery-i.yaml +12 -0
- data/doc/ri/Quarry/cdesc-Quarry.yaml +17 -0
- data/doc/ri/created.rid +1 -0
- data/lib/quarry/assert/must.rb +8 -0
- data/lib/quarry/assert/should.rb +9 -0
- data/lib/quarry/assertion.rb +95 -0
- data/lib/quarry/breakout.rb +45 -0
- data/lib/quarry/design/spec.rb +197 -0
- data/lib/quarry/document.rb +35 -0
- data/lib/quarry/loadmonitor.rb +14 -0
- data/lib/quarry/methodprobe.rb +216 -0
- data/lib/quarry/mock/object.rb +169 -0
- data/lib/quarry/mockery.rb +85 -0
- metadata +214 -0
@@ -0,0 +1,177 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
<html>
|
6
|
+
<head>
|
7
|
+
<title>Module: Quarry</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
<script language="JavaScript" type="text/javascript">
|
12
|
+
// <![CDATA[
|
13
|
+
|
14
|
+
function toggleSource( id )
|
15
|
+
{
|
16
|
+
var elem
|
17
|
+
var link
|
18
|
+
|
19
|
+
if( document.getElementById )
|
20
|
+
{
|
21
|
+
elem = document.getElementById( id )
|
22
|
+
link = document.getElementById( "l_" + id )
|
23
|
+
}
|
24
|
+
else if ( document.all )
|
25
|
+
{
|
26
|
+
elem = eval( "document.all." + id )
|
27
|
+
link = eval( "document.all.l_" + id )
|
28
|
+
}
|
29
|
+
else
|
30
|
+
return false;
|
31
|
+
|
32
|
+
if( elem.style.display == "block" )
|
33
|
+
{
|
34
|
+
elem.style.display = "none"
|
35
|
+
link.innerHTML = "show source"
|
36
|
+
}
|
37
|
+
else
|
38
|
+
{
|
39
|
+
elem.style.display = "block"
|
40
|
+
link.innerHTML = "hide source"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
function openCode( url )
|
45
|
+
{
|
46
|
+
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
47
|
+
}
|
48
|
+
// ]]>
|
49
|
+
</script>
|
50
|
+
</head>
|
51
|
+
|
52
|
+
<body>
|
53
|
+
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
+
<td class="file-title"><span class="file-title-prefix">Module</span><br />Quarry</td>
|
55
|
+
<td align="right">
|
56
|
+
<table cellspacing="0" cellpadding="2">
|
57
|
+
<tr valign="top">
|
58
|
+
<td>In:</td>
|
59
|
+
<td>
|
60
|
+
<a href="../files/lib/quarry/methodprobe_rb.html">lib/quarry/methodprobe.rb</a>
|
61
|
+
<a href="../files/lib/quarry/mock/object_rb.html">lib/quarry/mock/object.rb</a>
|
62
|
+
<a href="../files/lib/quarry/design/spec_rb.html">lib/quarry/design/spec.rb</a>
|
63
|
+
<a href="../files/lib/quarry/mockery_rb.html">lib/quarry/mockery.rb</a>
|
64
|
+
</td>
|
65
|
+
</tr>
|
66
|
+
</table>
|
67
|
+
</td>
|
68
|
+
</tr>
|
69
|
+
</table>
|
70
|
+
<!-- banner header -->
|
71
|
+
|
72
|
+
<div id="bodyContent">
|
73
|
+
<div id="content">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<div class="sectiontitle">Methods</div>
|
79
|
+
<ul>
|
80
|
+
<li><a href="#M000011">Mockery</a></li>
|
81
|
+
</ul>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<div class="sectiontitle">Classes and Modules</div>
|
86
|
+
Module <a href="Quarry/Design.html" class="link">Quarry::Design</a><br />
|
87
|
+
Module <a href="Quarry/Mock.html" class="link">Quarry::Mock</a><br />
|
88
|
+
Class <a href="Quarry/MethodProbe.html" class="link">Quarry::MethodProbe</a><br />
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<div class="sectiontitle">Public Instance methods</div>
|
94
|
+
<div class="method">
|
95
|
+
<div class="title">
|
96
|
+
<a name="M000011"></a><b>Mockery</b>( realclass )
|
97
|
+
</div>
|
98
|
+
<div class="description">
|
99
|
+
<p>
|
100
|
+
Factory method for creating semi-functional mock object classes given the
|
101
|
+
class which is to be mocked. It looks like a constant for purposes of
|
102
|
+
syntactic sugar.
|
103
|
+
</p>
|
104
|
+
</div>
|
105
|
+
<div class="sourcecode">
|
106
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000011_source')" id="l_M000011_source">show source</a> ]</p>
|
107
|
+
<div id="M000011_source" class="dyn-source">
|
108
|
+
<pre>
|
109
|
+
<span class="ruby-comment cmt"># File lib/quarry/mockery.rb, line 25</span>
|
110
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Mockery</span>( <span class="ruby-identifier">realclass</span> )
|
111
|
+
|
112
|
+
<span class="ruby-identifier">mockclass</span> = <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>( <span class="ruby-constant">Mock</span> )
|
113
|
+
|
114
|
+
<span class="ruby-identifier">mockclass</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span> <span class="ruby-ivar">@mocked_class</span> = <span class="ruby-identifier">realclass</span> <span class="ruby-keyword kw">end</span>
|
115
|
+
|
116
|
+
<span class="ruby-comment cmt"># Provide an accessor to class instance var that holds the class</span>
|
117
|
+
<span class="ruby-comment cmt"># object we're faking</span>
|
118
|
+
<span class="ruby-keyword kw">class</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">mockclass</span>
|
119
|
+
<span class="ruby-comment cmt"># The actual class being mocked</span>
|
120
|
+
<span class="ruby-identifier">attr_reader</span> <span class="ruby-identifier">:mocked_class</span>
|
121
|
+
|
122
|
+
<span class="ruby-comment cmt"># Propagate the mocked class ivar to derivatives so it can be</span>
|
123
|
+
<span class="ruby-comment cmt"># called like:</span>
|
124
|
+
<span class="ruby-comment cmt"># class MockFoo < Mock( RealClass )</span>
|
125
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inherited</span>( <span class="ruby-identifier">subclass</span> )
|
126
|
+
<span class="ruby-identifier">mc</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mockedClass</span>
|
127
|
+
<span class="ruby-identifier">subclass</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span> <span class="ruby-ivar">@mocked_class</span> = <span class="ruby-identifier">mc</span> <span class="ruby-keyword kw">end</span>
|
128
|
+
<span class="ruby-keyword kw">end</span>
|
129
|
+
<span class="ruby-keyword kw">end</span>
|
130
|
+
|
131
|
+
<span class="ruby-comment cmt"># Build method definitions for all the mocked class's instance</span>
|
132
|
+
<span class="ruby-comment cmt"># methods, as well as those given to it by its superclasses, since</span>
|
133
|
+
<span class="ruby-comment cmt"># we're not really inheriting from it.</span>
|
134
|
+
<span class="ruby-identifier">imethods</span> = <span class="ruby-identifier">realclass</span>.<span class="ruby-identifier">instance_methods</span>(<span class="ruby-keyword kw">true</span>).<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
|
135
|
+
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-operator">::</span><span class="ruby-constant">Mock</span><span class="ruby-operator">::</span><span class="ruby-constant">UnmockedMethods</span>
|
136
|
+
|
137
|
+
<span class="ruby-comment cmt"># Figure out the argument list</span>
|
138
|
+
<span class="ruby-identifier">arity</span> = <span class="ruby-identifier">realclass</span>.<span class="ruby-identifier">instance_method</span>( <span class="ruby-identifier">name</span> ).<span class="ruby-identifier">arity</span>
|
139
|
+
<span class="ruby-identifier">optargs</span> = <span class="ruby-keyword kw">false</span>
|
140
|
+
|
141
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arity</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
|
142
|
+
<span class="ruby-identifier">optargs</span> = <span class="ruby-keyword kw">true</span>
|
143
|
+
<span class="ruby-identifier">arity</span> = (<span class="ruby-identifier">arity</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>).<span class="ruby-identifier">abs</span>
|
144
|
+
<span class="ruby-keyword kw">end</span>
|
145
|
+
|
146
|
+
<span class="ruby-identifier">args</span> = []
|
147
|
+
<span class="ruby-identifier">arity</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"arg#{n+1}"</span> <span class="ruby-keyword kw">end</span>
|
148
|
+
<span class="ruby-identifier">args</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"*optargs"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">optargs</span>
|
149
|
+
|
150
|
+
<span class="ruby-comment cmt"># Build a method definition. Some methods need special</span>
|
151
|
+
<span class="ruby-comment cmt"># declarations.</span>
|
152
|
+
<span class="ruby-identifier">argsj</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">','</span>)
|
153
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">intern</span>
|
154
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:initialize</span>
|
155
|
+
<span class="ruby-node">"def initialize(#{argsj}) ; super ; end"</span>
|
156
|
+
<span class="ruby-keyword kw">else</span>
|
157
|
+
<span class="ruby-node">"def #{name}(#{argsj}) ; self.send(#{name},#{argsj}) ; end"</span>
|
158
|
+
<span class="ruby-comment cmt">#"def %s( %s ) ; self.__mockRegisterCall(%s) ; end" %</span>
|
159
|
+
<span class="ruby-comment cmt"># [ name, argstr, [":#{name}", *args].join(',') ]</span>
|
160
|
+
<span class="ruby-keyword kw">end</span>
|
161
|
+
<span class="ruby-keyword kw">end</span>
|
162
|
+
|
163
|
+
<span class="ruby-comment cmt"># Now add the instance methods to the mockclass class</span>
|
164
|
+
<span class="ruby-identifier">mockclass</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-identifier">imethods</span>.<span class="ruby-identifier">join</span>( <span class="ruby-value str">"\n"</span> )
|
165
|
+
|
166
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">mockclass</span>
|
167
|
+
<span class="ruby-keyword kw">end</span>
|
168
|
+
</pre>
|
169
|
+
</div>
|
170
|
+
</div>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
</div>
|
175
|
+
|
176
|
+
</body>
|
177
|
+
</html>
|
@@ -0,0 +1,170 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
<html>
|
6
|
+
<head>
|
7
|
+
<title>Module: Quarry::Design</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
<script language="JavaScript" type="text/javascript">
|
12
|
+
// <![CDATA[
|
13
|
+
|
14
|
+
function toggleSource( id )
|
15
|
+
{
|
16
|
+
var elem
|
17
|
+
var link
|
18
|
+
|
19
|
+
if( document.getElementById )
|
20
|
+
{
|
21
|
+
elem = document.getElementById( id )
|
22
|
+
link = document.getElementById( "l_" + id )
|
23
|
+
}
|
24
|
+
else if ( document.all )
|
25
|
+
{
|
26
|
+
elem = eval( "document.all." + id )
|
27
|
+
link = eval( "document.all.l_" + id )
|
28
|
+
}
|
29
|
+
else
|
30
|
+
return false;
|
31
|
+
|
32
|
+
if( elem.style.display == "block" )
|
33
|
+
{
|
34
|
+
elem.style.display = "none"
|
35
|
+
link.innerHTML = "show source"
|
36
|
+
}
|
37
|
+
else
|
38
|
+
{
|
39
|
+
elem.style.display = "block"
|
40
|
+
link.innerHTML = "hide source"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
function openCode( url )
|
45
|
+
{
|
46
|
+
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
47
|
+
}
|
48
|
+
// ]]>
|
49
|
+
</script>
|
50
|
+
</head>
|
51
|
+
|
52
|
+
<body>
|
53
|
+
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
+
<td class="file-title"><span class="file-title-prefix">Module</span><br />Quarry::Design</td>
|
55
|
+
<td align="right">
|
56
|
+
<table cellspacing="0" cellpadding="2">
|
57
|
+
<tr valign="top">
|
58
|
+
<td>In:</td>
|
59
|
+
<td>
|
60
|
+
<a href="../../files/lib/quarry/design/spec_rb.html">lib/quarry/design/spec.rb</a>
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
</table>
|
64
|
+
</td>
|
65
|
+
</tr>
|
66
|
+
</table>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
<div id="content">
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
<div class="sectiontitle">Methods</div>
|
76
|
+
<ul>
|
77
|
+
<li><a href="#M000014">check</a></li>
|
78
|
+
<li><a href="#M000015">outline</a></li>
|
79
|
+
<li><a href="#M000013">specification</a></li>
|
80
|
+
<li><a href="#M000012">specifications</a></li>
|
81
|
+
</ul>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<div class="sectiontitle">Classes and Modules</div>
|
86
|
+
Class <a href="Design/Specification.html" class="link">Quarry::Design::Specification</a><br />
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<div class="sectiontitle">Public Class methods</div>
|
92
|
+
<div class="method">
|
93
|
+
<div class="title">
|
94
|
+
<a name="M000014"></a><b>check</b>()
|
95
|
+
</div>
|
96
|
+
<div class="description">
|
97
|
+
<p>
|
98
|
+
TODO: make output compatible with unit_diff ?
|
99
|
+
</p>
|
100
|
+
</div>
|
101
|
+
<div class="sourcecode">
|
102
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000014_source')" id="l_M000014_source">show source</a> ]</p>
|
103
|
+
<div id="M000014_source" class="dyn-source">
|
104
|
+
<pre>
|
105
|
+
<span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 19</span>
|
106
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check</span>
|
107
|
+
<span class="ruby-identifier">specifications</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">specification</span><span class="ruby-operator">|</span>
|
108
|
+
<span class="ruby-identifier">specification</span>.<span class="ruby-identifier">check</span>
|
109
|
+
<span class="ruby-keyword kw">end</span>
|
110
|
+
<span class="ruby-keyword kw">end</span>
|
111
|
+
</pre>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="method">
|
116
|
+
<div class="title">
|
117
|
+
<a name="M000015"></a><b>outline</b>()
|
118
|
+
</div>
|
119
|
+
<div class="sourcecode">
|
120
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000015_source')" id="l_M000015_source">show source</a> ]</p>
|
121
|
+
<div id="M000015_source" class="dyn-source">
|
122
|
+
<pre>
|
123
|
+
<span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 25</span>
|
124
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">outline</span>
|
125
|
+
<span class="ruby-identifier">specifications</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">specification</span><span class="ruby-operator">|</span>
|
126
|
+
<span class="ruby-identifier">specification</span>.<span class="ruby-identifier">outline</span>
|
127
|
+
<span class="ruby-keyword kw">end</span>
|
128
|
+
<span class="ruby-keyword kw">end</span>
|
129
|
+
</pre>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
<div class="method">
|
134
|
+
<div class="title">
|
135
|
+
<a name="M000013"></a><b>specification</b>(description, &specification)
|
136
|
+
</div>
|
137
|
+
<div class="sourcecode">
|
138
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000013_source')" id="l_M000013_source">show source</a> ]</p>
|
139
|
+
<div id="M000013_source" class="dyn-source">
|
140
|
+
<pre>
|
141
|
+
<span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 12</span>
|
142
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">specification</span>(<span class="ruby-identifier">description</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">specification</span>)
|
143
|
+
<span class="ruby-identifier">specifications</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Specification</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">description</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">specification</span>)
|
144
|
+
<span class="ruby-keyword kw">end</span>
|
145
|
+
</pre>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
<div class="method">
|
150
|
+
<div class="title">
|
151
|
+
<a name="M000012"></a><b>specifications</b>()
|
152
|
+
</div>
|
153
|
+
<div class="sourcecode">
|
154
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000012_source')" id="l_M000012_source">show source</a> ]</p>
|
155
|
+
<div id="M000012_source" class="dyn-source">
|
156
|
+
<pre>
|
157
|
+
<span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 8</span>
|
158
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">specifications</span>
|
159
|
+
<span class="ruby-ivar">@specifications</span> <span class="ruby-operator">||=</span> []
|
160
|
+
<span class="ruby-keyword kw">end</span>
|
161
|
+
</pre>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
</div>
|
168
|
+
|
169
|
+
</body>
|
170
|
+
</html>
|
@@ -0,0 +1,265 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
<html>
|
6
|
+
<head>
|
7
|
+
<title>Class: Quarry::Design::Specification</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
<script language="JavaScript" type="text/javascript">
|
12
|
+
// <![CDATA[
|
13
|
+
|
14
|
+
function toggleSource( id )
|
15
|
+
{
|
16
|
+
var elem
|
17
|
+
var link
|
18
|
+
|
19
|
+
if( document.getElementById )
|
20
|
+
{
|
21
|
+
elem = document.getElementById( id )
|
22
|
+
link = document.getElementById( "l_" + id )
|
23
|
+
}
|
24
|
+
else if ( document.all )
|
25
|
+
{
|
26
|
+
elem = eval( "document.all." + id )
|
27
|
+
link = eval( "document.all.l_" + id )
|
28
|
+
}
|
29
|
+
else
|
30
|
+
return false;
|
31
|
+
|
32
|
+
if( elem.style.display == "block" )
|
33
|
+
{
|
34
|
+
elem.style.display = "none"
|
35
|
+
link.innerHTML = "show source"
|
36
|
+
}
|
37
|
+
else
|
38
|
+
{
|
39
|
+
elem.style.display = "block"
|
40
|
+
link.innerHTML = "hide source"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
function openCode( url )
|
45
|
+
{
|
46
|
+
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
47
|
+
}
|
48
|
+
// ]]>
|
49
|
+
</script>
|
50
|
+
</head>
|
51
|
+
|
52
|
+
<body>
|
53
|
+
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
+
<td class="file-title"><span class="file-title-prefix">Class</span><br />Quarry::Design::Specification</td>
|
55
|
+
<td align="right">
|
56
|
+
<table cellspacing="0" cellpadding="2">
|
57
|
+
<tr valign="top">
|
58
|
+
<td>In:</td>
|
59
|
+
<td>
|
60
|
+
<a href="../../../files/lib/quarry/design/spec_rb.html">lib/quarry/design/spec.rb</a>
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
<tr>
|
64
|
+
<td>Parent:</td>
|
65
|
+
<td>
|
66
|
+
<a href="../../Object.html">
|
67
|
+
Object
|
68
|
+
</a>
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</td>
|
73
|
+
</tr>
|
74
|
+
</table>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
<div id="content">
|
79
|
+
|
80
|
+
<div class="description"><p>
|
81
|
+
<a href="../Design.html">Design</a> specification. Sepcification can
|
82
|
+
contains sub-specifications.
|
83
|
+
</p>
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
<div class="sectiontitle">Methods</div>
|
89
|
+
<ul>
|
90
|
+
<li><a href="#M000017">check</a></li>
|
91
|
+
<li><a href="#M000016">new</a></li>
|
92
|
+
<li><a href="#M000018">outline</a></li>
|
93
|
+
</ul>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<div class="sectiontitle">Classes and Modules</div>
|
98
|
+
Class <a href="Specification/Context.html" class="link">Quarry::Design::Specification::Context</a><br />
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<div class="sectiontitle">Attributes</div>
|
103
|
+
<table border='0' cellpadding='5'>
|
104
|
+
<tr valign='top'>
|
105
|
+
<td class='attr-rw'>
|
106
|
+
[R]
|
107
|
+
</td>
|
108
|
+
<td class='attr-name'>after</td>
|
109
|
+
<td class='attr-desc'></td>
|
110
|
+
</tr>
|
111
|
+
<tr valign='top'>
|
112
|
+
<td class='attr-rw'>
|
113
|
+
[R]
|
114
|
+
</td>
|
115
|
+
<td class='attr-name'>before</td>
|
116
|
+
<td class='attr-desc'></td>
|
117
|
+
</tr>
|
118
|
+
<tr valign='top'>
|
119
|
+
<td class='attr-rw'>
|
120
|
+
[R]
|
121
|
+
</td>
|
122
|
+
<td class='attr-name'>context</td>
|
123
|
+
<td class='attr-desc'></td>
|
124
|
+
</tr>
|
125
|
+
<tr valign='top'>
|
126
|
+
<td class='attr-rw'>
|
127
|
+
[R]
|
128
|
+
</td>
|
129
|
+
<td class='attr-name'>description</td>
|
130
|
+
<td class='attr-desc'></td>
|
131
|
+
</tr>
|
132
|
+
<tr valign='top'>
|
133
|
+
<td class='attr-rw'>
|
134
|
+
[R]
|
135
|
+
</td>
|
136
|
+
<td class='attr-name'>relation</td>
|
137
|
+
<td class='attr-desc'></td>
|
138
|
+
</tr>
|
139
|
+
<tr valign='top'>
|
140
|
+
<td class='attr-rw'>
|
141
|
+
[R]
|
142
|
+
</td>
|
143
|
+
<td class='attr-name'>specification</td>
|
144
|
+
<td class='attr-desc'></td>
|
145
|
+
</tr>
|
146
|
+
</table>
|
147
|
+
|
148
|
+
<div class="sectiontitle">Public Class methods</div>
|
149
|
+
<div class="method">
|
150
|
+
<div class="title">
|
151
|
+
<a name="M000016"></a><b>new</b>(relation, description, context=nil, &specification)
|
152
|
+
</div>
|
153
|
+
<div class="description">
|
154
|
+
<p>
|
155
|
+
New <a href="Specification.html">Specification</a>
|
156
|
+
</p>
|
157
|
+
</div>
|
158
|
+
<div class="sourcecode">
|
159
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000016_source')" id="l_M000016_source">show source</a> ]</p>
|
160
|
+
<div id="M000016_source" class="dyn-source">
|
161
|
+
<pre>
|
162
|
+
<span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 44</span>
|
163
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">relation</span>, <span class="ruby-identifier">description</span>, <span class="ruby-identifier">context</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">specification</span>)
|
164
|
+
<span class="ruby-ivar">@relation</span> = <span class="ruby-identifier">relation</span>
|
165
|
+
<span class="ruby-ivar">@description</span> = <span class="ruby-identifier">description</span>
|
166
|
+
<span class="ruby-ivar">@specification</span> = <span class="ruby-identifier">specification</span>
|
167
|
+
<span class="ruby-ivar">@context</span> = <span class="ruby-identifier">context</span>
|
168
|
+
<span class="ruby-ivar">@before</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">before</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>
|
169
|
+
<span class="ruby-ivar">@after</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">after</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>
|
170
|
+
<span class="ruby-keyword kw">end</span>
|
171
|
+
</pre>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
<div class="sectiontitle">Public Instance methods</div>
|
176
|
+
<div class="method">
|
177
|
+
<div class="title">
|
178
|
+
<a name="M000017"></a><b>check</b>(level=0)
|
179
|
+
</div>
|
180
|
+
<div class="description">
|
181
|
+
<p>
|
182
|
+
Check <a href="Specification.html">Specification</a>
|
183
|
+
</p>
|
184
|
+
</div>
|
185
|
+
<div class="sourcecode">
|
186
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000017_source')" id="l_M000017_source">show source</a> ]</p>
|
187
|
+
<div id="M000017_source" class="dyn-source">
|
188
|
+
<pre>
|
189
|
+
<span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 55</span>
|
190
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">check</span>(<span class="ruby-identifier">level</span>=<span class="ruby-value">0</span>)
|
191
|
+
<span class="ruby-identifier">padding</span> = <span class="ruby-value str">" "</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span>
|
192
|
+
|
193
|
+
<span class="ruby-identifier">clause</span> = <span class="ruby-node">"#{relation} #{description}"</span>.<span class="ruby-identifier">strip</span>
|
194
|
+
|
195
|
+
<span class="ruby-identifier">new_context</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>
|
196
|
+
<span class="ruby-identifier">new_context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">before</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">before</span>
|
197
|
+
<span class="ruby-keyword kw">begin</span>
|
198
|
+
<span class="ruby-identifier">new_context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">specification</span>)
|
199
|
+
<span class="ruby-identifier">puts</span> (<span class="ruby-value str">"="</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>)) <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">clause</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\b\w/</span>){<span class="ruby-identifier">$&</span>.<span class="ruby-identifier">upcase</span>}
|
200
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Assertion</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
201
|
+
<span class="ruby-comment cmt">#puts padding + " (FAIL) [#{e.backtrace[2]}] " + clause</span>
|
202
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"* "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">clause</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'_'</span>,<span class="ruby-value str">' '</span>) <span class="ruby-operator">+</span> <span class="ruby-node">" [#{e.backtrace[2]}]"</span>
|
203
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$VERBOSE</span>
|
204
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
205
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
|
206
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">padding</span>
|
207
|
+
<span class="ruby-comment cmt">#puts padding + " (ERROR) [#{e.backtrace[2]}] " + clause</span>
|
208
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">padding</span> <span class="ruby-operator">+</span> <span class="ruby-node">" (ERROR) #{e}"</span>
|
209
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$VERBOSE</span>
|
210
|
+
<span class="ruby-keyword kw">ensure</span>
|
211
|
+
<span class="ruby-identifier">new_context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">after</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">after</span>
|
212
|
+
<span class="ruby-keyword kw">end</span>
|
213
|
+
|
214
|
+
<span class="ruby-identifier">new_context</span>.<span class="ruby-identifier">specifications</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
|
215
|
+
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">check</span>(<span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>)
|
216
|
+
<span class="ruby-keyword kw">end</span>
|
217
|
+
<span class="ruby-keyword kw">end</span>
|
218
|
+
</pre>
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
</div>
|
222
|
+
<div class="method">
|
223
|
+
<div class="title">
|
224
|
+
<a name="M000018"></a><b>outline</b>(level=0)
|
225
|
+
</div>
|
226
|
+
<div class="description">
|
227
|
+
<p>
|
228
|
+
Outline <a href="Specification.html">Specification</a>
|
229
|
+
</p>
|
230
|
+
</div>
|
231
|
+
<div class="sourcecode">
|
232
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000018_source')" id="l_M000018_source">show source</a> ]</p>
|
233
|
+
<div id="M000018_source" class="dyn-source">
|
234
|
+
<pre>
|
235
|
+
<span class="ruby-comment cmt"># File lib/quarry/design/spec.rb, line 86</span>
|
236
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">outline</span>(<span class="ruby-identifier">level</span>=<span class="ruby-value">0</span>)
|
237
|
+
<span class="ruby-identifier">padding</span> = (<span class="ruby-value str">" "</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"- "</span>
|
238
|
+
<span class="ruby-identifier">context</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>
|
239
|
+
<span class="ruby-keyword kw">begin</span>
|
240
|
+
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">specification</span>)
|
241
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Assertion</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
242
|
+
<span class="ruby-comment cmt">#rescue Exception => e</span>
|
243
|
+
<span class="ruby-keyword kw">end</span>
|
244
|
+
|
245
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
|
246
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{relation} "</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">relation</span>
|
247
|
+
<span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{description}"</span>
|
248
|
+
<span class="ruby-comment cmt">#str = str.strip #.gsub(/\b\w/){$&.upcase}</span>
|
249
|
+
|
250
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">padding</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">strip</span>
|
251
|
+
|
252
|
+
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">specifications</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
|
253
|
+
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">outline</span>(<span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>)
|
254
|
+
<span class="ruby-keyword kw">end</span>
|
255
|
+
<span class="ruby-keyword kw">end</span>
|
256
|
+
</pre>
|
257
|
+
</div>
|
258
|
+
</div>
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
</div>
|
263
|
+
|
264
|
+
</body>
|
265
|
+
</html>
|