spectie 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +21 -0
- data/README.rdoc +85 -0
- data/Rakefile +8 -0
- data/VERSION.yml +4 -0
- data/initialize.rb +6 -0
- data/lib/spectie.rb +3 -0
- data/lib/spectie/configuration.rb +10 -0
- data/lib/spectie/main.rb +26 -0
- data/lib/spectie/rails.rb +2 -0
- data/lib/spectie/rails_story_example_group.rb +55 -0
- data/lib/spectie/selenium.rb +3 -0
- data/lib/spectie/selenium/configuration.rb +27 -0
- data/lib/spectie/selenium/story_example_group.rb +51 -0
- data/lib/spectie/story_example_group_methods.rb +40 -0
- data/rake_tasks/package.rake +51 -0
- data/rake_tasks/publish.rake +40 -0
- data/rake_tasks/spec.rake +42 -0
- data/rake_tasks/utility.rake +11 -0
- data/rdoc/classes/Spectie.html +135 -0
- data/rdoc/classes/Spectie/Configuration.html +175 -0
- data/rdoc/classes/Spectie/Configuration/ForScenarios.html +111 -0
- data/rdoc/classes/Spectie/Configuration/Selenium.html +220 -0
- data/rdoc/classes/Spectie/Main.html +161 -0
- data/rdoc/classes/Spectie/RailsStoryExampleGroup.html +118 -0
- data/rdoc/classes/Spectie/SeleniumStoryExampleGroup.html +119 -0
- data/rdoc/classes/Spectie/StoryExampleGroupMethods.html +254 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README_rdoc.html +266 -0
- data/rdoc/files/lib/spectie/configuration_rb.html +101 -0
- data/rdoc/files/lib/spectie/main_rb.html +108 -0
- data/rdoc/files/lib/spectie/rails_rb.html +109 -0
- data/rdoc/files/lib/spectie/rails_story_example_group_rb.html +182 -0
- data/rdoc/files/lib/spectie/selenium/configuration_rb.html +101 -0
- data/rdoc/files/lib/spectie/selenium/story_example_group_rb.html +101 -0
- data/rdoc/files/lib/spectie/selenium_rb.html +110 -0
- data/rdoc/files/lib/spectie/story_example_group_methods_rb.html +101 -0
- data/rdoc/files/lib/spectie_rb.html +110 -0
- data/rdoc/fr_class_index.html +34 -0
- data/rdoc/fr_file_index.html +36 -0
- data/rdoc/fr_method_index.html +38 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/script/selenium_webapp +45 -0
- data/script/spec +10 -0
- data/spec/example_run_state_tracking.rb +65 -0
- data/spec/selenium_config.rb +11 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/spectie/rails_helper.rb +29 -0
- data/spec/spectie/rails_story_example_group_spec.rb +59 -0
- data/spec/spectie/selenium/configuration_spec.rb +91 -0
- data/spec/spectie/selenium/spec_helper.rb +16 -0
- data/spec/spectie/selenium/story_example_group_spec.rb +132 -0
- data/spec/spectie/spec_helper.rb +1 -0
- data/spec/spectie/story_example_group_methods_spec.rb +217 -0
- data/spec/spectie_spec.rb +46 -0
- data/spec/support/rails_app/controllers/application_controller.rb +2 -0
- data/tags +19899 -0
- metadata +125 -0
@@ -0,0 +1,119 @@
|
|
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
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Spectie::SeleniumStoryExampleGroup</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Spectie::SeleniumStoryExampleGroup</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/spectie/selenium/story_example_group_rb.html">
|
59
|
+
lib/spectie/selenium/story_example_group.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
<!-- if includes -->
|
90
|
+
<div id="includes">
|
91
|
+
<h3 class="section-bar">Included Modules</h3>
|
92
|
+
|
93
|
+
<div id="includes-list">
|
94
|
+
<span class="include-name"><a href="StoryExampleGroupMethods.html">StoryExampleGroupMethods</a></span>
|
95
|
+
<span class="include-name">Selenium::Client::SeleniumHelper</span>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
<div id="section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if method_list -->
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
<div id="validator-badges">
|
115
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
</body>
|
119
|
+
</html>
|
@@ -0,0 +1,254 @@
|
|
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
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Spectie::StoryExampleGroupMethods</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Spectie::StoryExampleGroupMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/spectie/story_example_group_methods_rb.html">
|
59
|
+
lib/spectie/story_example_group_methods.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000011">Scenario</a>
|
84
|
+
<a href="#M000009">included</a>
|
85
|
+
<a href="#M000010">scenario_methods</a>
|
86
|
+
<a href="#M000012">xScenario</a>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
<!-- if includes -->
|
94
|
+
<div id="includes">
|
95
|
+
<h3 class="section-bar">Included Modules</h3>
|
96
|
+
|
97
|
+
<div id="includes-list">
|
98
|
+
<span class="include-name">Spec::Example::ExampleMethods</span>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="section">
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
<!-- if method_list -->
|
112
|
+
<div id="methods">
|
113
|
+
<h3 class="section-bar">Public Class methods</h3>
|
114
|
+
|
115
|
+
<div id="method-M000011" class="method-detail">
|
116
|
+
<a name="M000011"></a>
|
117
|
+
|
118
|
+
<div class="method-heading">
|
119
|
+
<a href="#M000011" class="method-signature">
|
120
|
+
<span class="method-name">Scenario</span><span class="method-args">(description, options={}, backtrace=nil, &implementation)</span>
|
121
|
+
</a>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div class="method-description">
|
125
|
+
<p>
|
126
|
+
Creates a scenario example within a feature (see <a
|
127
|
+
href="Main.html#M000003">Spectie::Main#Feature</a>).
|
128
|
+
</p>
|
129
|
+
<p><a class="source-toggle" href="#"
|
130
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
131
|
+
<div class="method-source-code" id="M000011-source">
|
132
|
+
<pre>
|
133
|
+
<span class="ruby-comment cmt"># File lib/spectie/story_example_group_methods.rb, line 14</span>
|
134
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Scenario</span>(<span class="ruby-identifier">description</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">backtrace</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">implementation</span>)
|
135
|
+
<span class="ruby-identifier">example</span>(<span class="ruby-identifier">description</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">backtrace</span>) <span class="ruby-keyword kw">do</span>
|
136
|
+
<span class="ruby-identifier">instance_eval</span> <span class="ruby-operator">&</span><span class="ruby-identifier">implementation</span>
|
137
|
+
<span class="ruby-keyword kw">end</span>
|
138
|
+
<span class="ruby-keyword kw">end</span>
|
139
|
+
</pre>
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div id="method-M000009" class="method-detail">
|
145
|
+
<a name="M000009"></a>
|
146
|
+
|
147
|
+
<div class="method-heading">
|
148
|
+
<a href="#M000009" class="method-signature">
|
149
|
+
<span class="method-name">included</span><span class="method-args">(mod)</span>
|
150
|
+
</a>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div class="method-description">
|
154
|
+
<p><a class="source-toggle" href="#"
|
155
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
156
|
+
<div class="method-source-code" id="M000009-source">
|
157
|
+
<pre>
|
158
|
+
<span class="ruby-comment cmt"># File lib/spectie/story_example_group_methods.rb, line 4</span>
|
159
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">mod</span>)
|
160
|
+
<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
|
161
|
+
<span class="ruby-identifier">extend</span> <span class="ruby-constant">Spec</span><span class="ruby-operator">::</span><span class="ruby-constant">Example</span><span class="ruby-operator">::</span><span class="ruby-constant">ExampleGroupMethods</span>
|
162
|
+
<span class="ruby-identifier">include</span> <span class="ruby-constant">Spec</span><span class="ruby-operator">::</span><span class="ruby-constant">Example</span><span class="ruby-operator">::</span><span class="ruby-constant">ExampleMethods</span>
|
163
|
+
|
164
|
+
<span class="ruby-keyword kw">class</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>
|
165
|
+
|
166
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scenario_methods</span>; [<span class="ruby-identifier">:Given</span>, <span class="ruby-identifier">:When</span>, <span class="ruby-identifier">:Then</span>, <span class="ruby-identifier">:And</span>] <span class="ruby-keyword kw">end</span>
|
167
|
+
|
168
|
+
<span class="ruby-comment cmt"># Creates a scenario example within a feature (see Spectie::Main#Feature).</span>
|
169
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">Scenario</span>(<span class="ruby-identifier">description</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">backtrace</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">implementation</span>)
|
170
|
+
<span class="ruby-identifier">example</span>(<span class="ruby-identifier">description</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">backtrace</span>) <span class="ruby-keyword kw">do</span>
|
171
|
+
<span class="ruby-identifier">instance_eval</span> <span class="ruby-operator">&</span><span class="ruby-identifier">implementation</span>
|
172
|
+
<span class="ruby-keyword kw">end</span>
|
173
|
+
<span class="ruby-keyword kw">end</span>
|
174
|
+
|
175
|
+
<span class="ruby-comment cmt"># Disables a scenario.</span>
|
176
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xScenario</span>(<span class="ruby-identifier">description</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-operator">&</span><span class="ruby-identifier">implementation</span>)
|
177
|
+
<span class="ruby-identifier">xexample</span> <span class="ruby-identifier">description</span>, <span class="ruby-identifier">options</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">implementation</span>
|
178
|
+
<span class="ruby-keyword kw">end</span>
|
179
|
+
|
180
|
+
<span class="ruby-keyword kw">end</span>
|
181
|
+
|
182
|
+
<span class="ruby-identifier">scenario_methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">scenario_method</span><span class="ruby-operator">|</span>
|
183
|
+
<span class="ruby-identifier">method</span> = <span class="ruby-value str">"def \#{scenario_method}(statement, *args, &block)\nsend statement, *args, &block\nend\n"</span>
|
184
|
+
|
185
|
+
<span class="ruby-identifier">class_eval</span> <span class="ruby-identifier">method</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>
|
186
|
+
<span class="ruby-keyword kw">end</span>
|
187
|
+
|
188
|
+
<span class="ruby-keyword kw">end</span>
|
189
|
+
<span class="ruby-keyword kw">end</span>
|
190
|
+
</pre>
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div id="method-M000010" class="method-detail">
|
196
|
+
<a name="M000010"></a>
|
197
|
+
|
198
|
+
<div class="method-heading">
|
199
|
+
<a href="#M000010" class="method-signature">
|
200
|
+
<span class="method-name">scenario_methods</span><span class="method-args">()</span>
|
201
|
+
</a>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div class="method-description">
|
205
|
+
<p><a class="source-toggle" href="#"
|
206
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
207
|
+
<div class="method-source-code" id="M000010-source">
|
208
|
+
<pre>
|
209
|
+
<span class="ruby-comment cmt"># File lib/spectie/story_example_group_methods.rb, line 11</span>
|
210
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scenario_methods</span>; [<span class="ruby-identifier">:Given</span>, <span class="ruby-identifier">:When</span>, <span class="ruby-identifier">:Then</span>, <span class="ruby-identifier">:And</span>] <span class="ruby-keyword kw">end</span>
|
211
|
+
</pre>
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div id="method-M000012" class="method-detail">
|
217
|
+
<a name="M000012"></a>
|
218
|
+
|
219
|
+
<div class="method-heading">
|
220
|
+
<a href="#M000012" class="method-signature">
|
221
|
+
<span class="method-name">xScenario</span><span class="method-args">(description, options={}, &implementation)</span>
|
222
|
+
</a>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<div class="method-description">
|
226
|
+
<p>
|
227
|
+
Disables a scenario.
|
228
|
+
</p>
|
229
|
+
<p><a class="source-toggle" href="#"
|
230
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
231
|
+
<div class="method-source-code" id="M000012-source">
|
232
|
+
<pre>
|
233
|
+
<span class="ruby-comment cmt"># File lib/spectie/story_example_group_methods.rb, line 21</span>
|
234
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xScenario</span>(<span class="ruby-identifier">description</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-operator">&</span><span class="ruby-identifier">implementation</span>)
|
235
|
+
<span class="ruby-identifier">xexample</span> <span class="ruby-identifier">description</span>, <span class="ruby-identifier">options</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">implementation</span>
|
236
|
+
<span class="ruby-keyword kw">end</span>
|
237
|
+
</pre>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
|
243
|
+
</div>
|
244
|
+
|
245
|
+
|
246
|
+
</div>
|
247
|
+
|
248
|
+
|
249
|
+
<div id="validator-badges">
|
250
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
</body>
|
254
|
+
</html>
|
data/rdoc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thu, 22 Oct 2009 23:08:43 -0500
|
@@ -0,0 +1,266 @@
|
|
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
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README.rdoc</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README.rdoc</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README.rdoc
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Sun Oct 18 22:53:25 -0500 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<h1><a href="../classes/Spectie.html">Spectie</a></h1>
|
73
|
+
<p>
|
74
|
+
<a href="../classes/Spectie.html">Spectie</a> (rhymes with
|
75
|
+
"necktie") is a pure Ruby BDD integration testing framework for
|
76
|
+
RSpec.
|
77
|
+
</p>
|
78
|
+
<p>
|
79
|
+
<a href="../classes/Spectie.html">Spectie</a> was written with the
|
80
|
+
following beliefs:
|
81
|
+
</p>
|
82
|
+
<ul>
|
83
|
+
<li>Business stakeholders or analysts are often not writing comprehensive (or
|
84
|
+
any) acceptance criteria.
|
85
|
+
|
86
|
+
</li>
|
87
|
+
<li>Business stakeholders or analysts are usually unwilling or unable to follow
|
88
|
+
a strict format for writing the acceptance criteria that they <em>are</em>
|
89
|
+
writing.
|
90
|
+
|
91
|
+
</li>
|
92
|
+
<li>On many projects, the communication with the business stakeholders or
|
93
|
+
analysts are accessible enough that written acceptance criteria is not
|
94
|
+
necessary, but discussed requirements still need to be implemented, and
|
95
|
+
therefore need to be tested.
|
96
|
+
|
97
|
+
</li>
|
98
|
+
<li>Good developers recognize the benefits of top-down, BDD-style integration
|
99
|
+
testing in helping to ensure that the code that is written to implement a
|
100
|
+
feature directly satisfies business requirements, and doesn‘t get
|
101
|
+
over-engineered or over-complicated.
|
102
|
+
|
103
|
+
</li>
|
104
|
+
<li>Good developers love Ruby.
|
105
|
+
|
106
|
+
</li>
|
107
|
+
</ul>
|
108
|
+
<p>
|
109
|
+
<a href="../classes/Spectie.html">Spectie</a> tries to strike the proper
|
110
|
+
balance between writing readable tests, and just getting your work done in
|
111
|
+
the most efficient way possible. It does this by providing a consistent
|
112
|
+
structure for writing your integration test code in a BDD fashion, with the
|
113
|
+
breakdown of features, scenarios, and their given/when/then statements.
|
114
|
+
However, a little bit of syntactic sugar goes a long way to aid in the
|
115
|
+
understanding of code, while too much can add unnecessary complexity and
|
116
|
+
actually decrease maintainability. So, <a
|
117
|
+
href="../classes/Spectie.html">Spectie</a> keeps things pretty close to the
|
118
|
+
underlying technology at all times, since most of the time, it‘s a
|
119
|
+
developer that‘s <b>really</b> writing the tests.
|
120
|
+
</p>
|
121
|
+
<p>
|
122
|
+
With these ideas in mind, what <a
|
123
|
+
href="../classes/Spectie.html">Spectie</a> provides is:
|
124
|
+
</p>
|
125
|
+
<ul>
|
126
|
+
<li>A small number of methods on top of RSpec for making your integration tests
|
127
|
+
readable. This isn‘t much more than "Given/When/Then".
|
128
|
+
|
129
|
+
</li>
|
130
|
+
<li>A configuration and mapping layer for different integration testing code,
|
131
|
+
such as what‘s provided by ActionController‘s integration.rb,
|
132
|
+
or the Ruby client for Selenium.
|
133
|
+
|
134
|
+
</li>
|
135
|
+
<li>Common functionality for supported integration testing solutions, such as
|
136
|
+
the option to restart the Selenium browser between tests, or simply clear
|
137
|
+
the cookies.
|
138
|
+
|
139
|
+
</li>
|
140
|
+
</ul>
|
141
|
+
<p>
|
142
|
+
Advantages of having your integration tests written with <a
|
143
|
+
href="../classes/Spectie.html">Spectie</a>:
|
144
|
+
</p>
|
145
|
+
<ul>
|
146
|
+
<li>It‘s Ruby.
|
147
|
+
|
148
|
+
</li>
|
149
|
+
<li>If you‘re familiar with RSpec already, all the same functionality is
|
150
|
+
available.
|
151
|
+
|
152
|
+
</li>
|
153
|
+
<li>All new syntax beyond RSpec is kept to a minimum, and exists solely to
|
154
|
+
facilitate developer-driven BDD.
|
155
|
+
|
156
|
+
</li>
|
157
|
+
<li>Use familiar methods for code navigation and reuse.
|
158
|
+
|
159
|
+
</li>
|
160
|
+
</ul>
|
161
|
+
<h2>Example</h2>
|
162
|
+
<h3>Rails</h3>
|
163
|
+
<pre>
|
164
|
+
Feature "Compelling Feature" do
|
165
|
+
Scenario "As a user, I would like to use a compelling feature" do
|
166
|
+
Given :i_have_an_account
|
167
|
+
And :i_have_logged_in
|
168
|
+
|
169
|
+
When :i_access_a_compelling_feature
|
170
|
+
|
171
|
+
Then :i_am_presented_with_stunning_results
|
172
|
+
end
|
173
|
+
|
174
|
+
def i_have_an_account
|
175
|
+
@user = create_user
|
176
|
+
end
|
177
|
+
|
178
|
+
def i_have_logged_in
|
179
|
+
log_in_as @user
|
180
|
+
end
|
181
|
+
|
182
|
+
def i_access_a_compelling_feature
|
183
|
+
get compelling_feature_path
|
184
|
+
response.should be_success
|
185
|
+
end
|
186
|
+
|
187
|
+
def i_am_presented_with_stunning_results
|
188
|
+
response.should have_text("Simply stunning!")
|
189
|
+
end
|
190
|
+
end
|
191
|
+
</pre>
|
192
|
+
<h2>Installation</h2>
|
193
|
+
<h3>Gem</h3>
|
194
|
+
<pre>
|
195
|
+
sudo gem install spectie
|
196
|
+
</pre>
|
197
|
+
<h3>Rails plugin</h3>
|
198
|
+
<pre>
|
199
|
+
script/plugin install git://github.com/ryankinderman/spectie.git
|
200
|
+
</pre>
|
201
|
+
<h3>Git</h3>
|
202
|
+
<pre>
|
203
|
+
git clone git://github.com/ryankinderman/spectie.git
|
204
|
+
</pre>
|
205
|
+
<h2>Configuration</h2>
|
206
|
+
<h3>Ruby on Rails</h3>
|
207
|
+
<p>
|
208
|
+
In <em>spec/spec_helper.rb</em>, after <tt>require
|
209
|
+
‘spec/rails‘</tt>, add:
|
210
|
+
</p>
|
211
|
+
<pre>
|
212
|
+
require 'spectie/rails'
|
213
|
+
</pre>
|
214
|
+
<p>
|
215
|
+
That‘s it. <a href="../classes/Spectie.html">Spectie</a> registers
|
216
|
+
itself with RSpec, so you can run your integration tests with the usual
|
217
|
+
<tt>rake spec:integration</tt> command. Also, all of the usual methods in a
|
218
|
+
<a
|
219
|
+
href="http://api.rubyonrails.org/classes/ActionController/Integration/Session.html">Rails
|
220
|
+
integration testing session</a> are available for you to use as well.
|
221
|
+
</p>
|
222
|
+
<h3>Selenium</h3>
|
223
|
+
<p>
|
224
|
+
TODO
|
225
|
+
</p>
|
226
|
+
<h2>Author</h2>
|
227
|
+
<p>
|
228
|
+
Ryan Kinderman (ryan@kinderman.net)
|
229
|
+
</p>
|
230
|
+
<h2>Copyright</h2>
|
231
|
+
<p>
|
232
|
+
Copyright (c) 2009 Ryan Kinderman. See LICENSE for details.
|
233
|
+
</p>
|
234
|
+
|
235
|
+
</div>
|
236
|
+
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
</div>
|
242
|
+
|
243
|
+
|
244
|
+
<!-- if includes -->
|
245
|
+
|
246
|
+
<div id="section">
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<!-- if method_list -->
|
256
|
+
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
|
261
|
+
<div id="validator-badges">
|
262
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
</body>
|
266
|
+
</html>
|