mundo-pepino 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +339 -0
- data/History.txt +4 -0
- data/Manifest.txt +21 -0
- data/README.markdown +492 -0
- data/Rakefile +54 -0
- data/cucumber.yml +1 -0
- data/init.rb +1 -0
- data/lib/mundo_pepino.rb +241 -0
- data/lib/mundo_pepino/definitions/es_ES.rb +420 -0
- data/lib/mundo_pepino/resources_history.rb +214 -0
- data/lib/mundo_pepino/version.rb +10 -0
- data/lib/mundo_pepino/visits_history.rb +13 -0
- data/lib/mundo_pepino_es_ES.rb +2 -0
- data/mundo-pepino.gemspec +34 -0
- data/rails_generators/caracteristica/USAGE +16 -0
- data/rails_generators/caracteristica/caracteristica_generator.rb +126 -0
- data/rails_generators/caracteristica/templates/caracteristica.erb +31 -0
- data/rails_generators/mundo_pepino/USAGE +13 -0
- data/rails_generators/mundo_pepino/mundo_pepino_generator.rb +21 -0
- data/rails_generators/mundo_pepino/templates/mundo_pepino.rake +7 -0
- data/rails_generators/mundo_pepino/templates/mundo_pepino_es_ES.rb +47 -0
- metadata +107 -0
data/COPYING
ADDED
@@ -0,0 +1,339 @@
|
|
1
|
+
GNU GENERAL PUBLIC LICENSE
|
2
|
+
Version 2, June 1991
|
3
|
+
|
4
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies
|
7
|
+
of this license document, but changing it is not allowed.
|
8
|
+
|
9
|
+
Preamble
|
10
|
+
|
11
|
+
The licenses for most software are designed to take away your
|
12
|
+
freedom to share and change it. By contrast, the GNU General Public
|
13
|
+
License is intended to guarantee your freedom to share and change free
|
14
|
+
software--to make sure the software is free for all its users. This
|
15
|
+
General Public License applies to most of the Free Software
|
16
|
+
Foundation's software and to any other program whose authors commit to
|
17
|
+
using it. (Some other Free Software Foundation software is covered by
|
18
|
+
the GNU Lesser General Public License instead.) You can apply it to
|
19
|
+
your programs, too.
|
20
|
+
|
21
|
+
When we speak of free software, we are referring to freedom, not
|
22
|
+
price. Our General Public Licenses are designed to make sure that you
|
23
|
+
have the freedom to distribute copies of free software (and charge for
|
24
|
+
this service if you wish), that you receive source code or can get it
|
25
|
+
if you want it, that you can change the software or use pieces of it
|
26
|
+
in new free programs; and that you know you can do these things.
|
27
|
+
|
28
|
+
To protect your rights, we need to make restrictions that forbid
|
29
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30
|
+
These restrictions translate to certain responsibilities for you if you
|
31
|
+
distribute copies of the software, or if you modify it.
|
32
|
+
|
33
|
+
For example, if you distribute copies of such a program, whether
|
34
|
+
gratis or for a fee, you must give the recipients all the rights that
|
35
|
+
you have. You must make sure that they, too, receive or can get the
|
36
|
+
source code. And you must show them these terms so they know their
|
37
|
+
rights.
|
38
|
+
|
39
|
+
We protect your rights with two steps: (1) copyright the software, and
|
40
|
+
(2) offer you this license which gives you legal permission to copy,
|
41
|
+
distribute and/or modify the software.
|
42
|
+
|
43
|
+
Also, for each author's protection and ours, we want to make certain
|
44
|
+
that everyone understands that there is no warranty for this free
|
45
|
+
software. If the software is modified by someone else and passed on, we
|
46
|
+
want its recipients to know that what they have is not the original, so
|
47
|
+
that any problems introduced by others will not reflect on the original
|
48
|
+
authors' reputations.
|
49
|
+
|
50
|
+
Finally, any free program is threatened constantly by software
|
51
|
+
patents. We wish to avoid the danger that redistributors of a free
|
52
|
+
program will individually obtain patent licenses, in effect making the
|
53
|
+
program proprietary. To prevent this, we have made it clear that any
|
54
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
55
|
+
|
56
|
+
The precise terms and conditions for copying, distribution and
|
57
|
+
modification follow.
|
58
|
+
|
59
|
+
GNU GENERAL PUBLIC LICENSE
|
60
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61
|
+
|
62
|
+
0. This License applies to any program or other work which contains
|
63
|
+
a notice placed by the copyright holder saying it may be distributed
|
64
|
+
under the terms of this General Public License. The "Program", below,
|
65
|
+
refers to any such program or work, and a "work based on the Program"
|
66
|
+
means either the Program or any derivative work under copyright law:
|
67
|
+
that is to say, a work containing the Program or a portion of it,
|
68
|
+
either verbatim or with modifications and/or translated into another
|
69
|
+
language. (Hereinafter, translation is included without limitation in
|
70
|
+
the term "modification".) Each licensee is addressed as "you".
|
71
|
+
|
72
|
+
Activities other than copying, distribution and modification are not
|
73
|
+
covered by this License; they are outside its scope. The act of
|
74
|
+
running the Program is not restricted, and the output from the Program
|
75
|
+
is covered only if its contents constitute a work based on the
|
76
|
+
Program (independent of having been made by running the Program).
|
77
|
+
Whether that is true depends on what the Program does.
|
78
|
+
|
79
|
+
1. You may copy and distribute verbatim copies of the Program's
|
80
|
+
source code as you receive it, in any medium, provided that you
|
81
|
+
conspicuously and appropriately publish on each copy an appropriate
|
82
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
83
|
+
notices that refer to this License and to the absence of any warranty;
|
84
|
+
and give any other recipients of the Program a copy of this License
|
85
|
+
along with the Program.
|
86
|
+
|
87
|
+
You may charge a fee for the physical act of transferring a copy, and
|
88
|
+
you may at your option offer warranty protection in exchange for a fee.
|
89
|
+
|
90
|
+
2. You may modify your copy or copies of the Program or any portion
|
91
|
+
of it, thus forming a work based on the Program, and copy and
|
92
|
+
distribute such modifications or work under the terms of Section 1
|
93
|
+
above, provided that you also meet all of these conditions:
|
94
|
+
|
95
|
+
a) You must cause the modified files to carry prominent notices
|
96
|
+
stating that you changed the files and the date of any change.
|
97
|
+
|
98
|
+
b) You must cause any work that you distribute or publish, that in
|
99
|
+
whole or in part contains or is derived from the Program or any
|
100
|
+
part thereof, to be licensed as a whole at no charge to all third
|
101
|
+
parties under the terms of this License.
|
102
|
+
|
103
|
+
c) If the modified program normally reads commands interactively
|
104
|
+
when run, you must cause it, when started running for such
|
105
|
+
interactive use in the most ordinary way, to print or display an
|
106
|
+
announcement including an appropriate copyright notice and a
|
107
|
+
notice that there is no warranty (or else, saying that you provide
|
108
|
+
a warranty) and that users may redistribute the program under
|
109
|
+
these conditions, and telling the user how to view a copy of this
|
110
|
+
License. (Exception: if the Program itself is interactive but
|
111
|
+
does not normally print such an announcement, your work based on
|
112
|
+
the Program is not required to print an announcement.)
|
113
|
+
|
114
|
+
These requirements apply to the modified work as a whole. If
|
115
|
+
identifiable sections of that work are not derived from the Program,
|
116
|
+
and can be reasonably considered independent and separate works in
|
117
|
+
themselves, then this License, and its terms, do not apply to those
|
118
|
+
sections when you distribute them as separate works. But when you
|
119
|
+
distribute the same sections as part of a whole which is a work based
|
120
|
+
on the Program, the distribution of the whole must be on the terms of
|
121
|
+
this License, whose permissions for other licensees extend to the
|
122
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123
|
+
|
124
|
+
Thus, it is not the intent of this section to claim rights or contest
|
125
|
+
your rights to work written entirely by you; rather, the intent is to
|
126
|
+
exercise the right to control the distribution of derivative or
|
127
|
+
collective works based on the Program.
|
128
|
+
|
129
|
+
In addition, mere aggregation of another work not based on the Program
|
130
|
+
with the Program (or with a work based on the Program) on a volume of
|
131
|
+
a storage or distribution medium does not bring the other work under
|
132
|
+
the scope of this License.
|
133
|
+
|
134
|
+
3. You may copy and distribute the Program (or a work based on it,
|
135
|
+
under Section 2) in object code or executable form under the terms of
|
136
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
137
|
+
|
138
|
+
a) Accompany it with the complete corresponding machine-readable
|
139
|
+
source code, which must be distributed under the terms of Sections
|
140
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141
|
+
|
142
|
+
b) Accompany it with a written offer, valid for at least three
|
143
|
+
years, to give any third party, for a charge no more than your
|
144
|
+
cost of physically performing source distribution, a complete
|
145
|
+
machine-readable copy of the corresponding source code, to be
|
146
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147
|
+
customarily used for software interchange; or,
|
148
|
+
|
149
|
+
c) Accompany it with the information you received as to the offer
|
150
|
+
to distribute corresponding source code. (This alternative is
|
151
|
+
allowed only for noncommercial distribution and only if you
|
152
|
+
received the program in object code or executable form with such
|
153
|
+
an offer, in accord with Subsection b above.)
|
154
|
+
|
155
|
+
The source code for a work means the preferred form of the work for
|
156
|
+
making modifications to it. For an executable work, complete source
|
157
|
+
code means all the source code for all modules it contains, plus any
|
158
|
+
associated interface definition files, plus the scripts used to
|
159
|
+
control compilation and installation of the executable. However, as a
|
160
|
+
special exception, the source code distributed need not include
|
161
|
+
anything that is normally distributed (in either source or binary
|
162
|
+
form) with the major components (compiler, kernel, and so on) of the
|
163
|
+
operating system on which the executable runs, unless that component
|
164
|
+
itself accompanies the executable.
|
165
|
+
|
166
|
+
If distribution of executable or object code is made by offering
|
167
|
+
access to copy from a designated place, then offering equivalent
|
168
|
+
access to copy the source code from the same place counts as
|
169
|
+
distribution of the source code, even though third parties are not
|
170
|
+
compelled to copy the source along with the object code.
|
171
|
+
|
172
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173
|
+
except as expressly provided under this License. Any attempt
|
174
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175
|
+
void, and will automatically terminate your rights under this License.
|
176
|
+
However, parties who have received copies, or rights, from you under
|
177
|
+
this License will not have their licenses terminated so long as such
|
178
|
+
parties remain in full compliance.
|
179
|
+
|
180
|
+
5. You are not required to accept this License, since you have not
|
181
|
+
signed it. However, nothing else grants you permission to modify or
|
182
|
+
distribute the Program or its derivative works. These actions are
|
183
|
+
prohibited by law if you do not accept this License. Therefore, by
|
184
|
+
modifying or distributing the Program (or any work based on the
|
185
|
+
Program), you indicate your acceptance of this License to do so, and
|
186
|
+
all its terms and conditions for copying, distributing or modifying
|
187
|
+
the Program or works based on it.
|
188
|
+
|
189
|
+
6. Each time you redistribute the Program (or any work based on the
|
190
|
+
Program), the recipient automatically receives a license from the
|
191
|
+
original licensor to copy, distribute or modify the Program subject to
|
192
|
+
these terms and conditions. You may not impose any further
|
193
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
194
|
+
You are not responsible for enforcing compliance by third parties to
|
195
|
+
this License.
|
196
|
+
|
197
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
198
|
+
infringement or for any other reason (not limited to patent issues),
|
199
|
+
conditions are imposed on you (whether by court order, agreement or
|
200
|
+
otherwise) that contradict the conditions of this License, they do not
|
201
|
+
excuse you from the conditions of this License. If you cannot
|
202
|
+
distribute so as to satisfy simultaneously your obligations under this
|
203
|
+
License and any other pertinent obligations, then as a consequence you
|
204
|
+
may not distribute the Program at all. For example, if a patent
|
205
|
+
license would not permit royalty-free redistribution of the Program by
|
206
|
+
all those who receive copies directly or indirectly through you, then
|
207
|
+
the only way you could satisfy both it and this License would be to
|
208
|
+
refrain entirely from distribution of the Program.
|
209
|
+
|
210
|
+
If any portion of this section is held invalid or unenforceable under
|
211
|
+
any particular circumstance, the balance of the section is intended to
|
212
|
+
apply and the section as a whole is intended to apply in other
|
213
|
+
circumstances.
|
214
|
+
|
215
|
+
It is not the purpose of this section to induce you to infringe any
|
216
|
+
patents or other property right claims or to contest validity of any
|
217
|
+
such claims; this section has the sole purpose of protecting the
|
218
|
+
integrity of the free software distribution system, which is
|
219
|
+
implemented by public license practices. Many people have made
|
220
|
+
generous contributions to the wide range of software distributed
|
221
|
+
through that system in reliance on consistent application of that
|
222
|
+
system; it is up to the author/donor to decide if he or she is willing
|
223
|
+
to distribute software through any other system and a licensee cannot
|
224
|
+
impose that choice.
|
225
|
+
|
226
|
+
This section is intended to make thoroughly clear what is believed to
|
227
|
+
be a consequence of the rest of this License.
|
228
|
+
|
229
|
+
8. If the distribution and/or use of the Program is restricted in
|
230
|
+
certain countries either by patents or by copyrighted interfaces, the
|
231
|
+
original copyright holder who places the Program under this License
|
232
|
+
may add an explicit geographical distribution limitation excluding
|
233
|
+
those countries, so that distribution is permitted only in or among
|
234
|
+
countries not thus excluded. In such case, this License incorporates
|
235
|
+
the limitation as if written in the body of this License.
|
236
|
+
|
237
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
238
|
+
of the General Public License from time to time. Such new versions will
|
239
|
+
be similar in spirit to the present version, but may differ in detail to
|
240
|
+
address new problems or concerns.
|
241
|
+
|
242
|
+
Each version is given a distinguishing version number. If the Program
|
243
|
+
specifies a version number of this License which applies to it and "any
|
244
|
+
later version", you have the option of following the terms and conditions
|
245
|
+
either of that version or of any later version published by the Free
|
246
|
+
Software Foundation. If the Program does not specify a version number of
|
247
|
+
this License, you may choose any version ever published by the Free Software
|
248
|
+
Foundation.
|
249
|
+
|
250
|
+
10. If you wish to incorporate parts of the Program into other free
|
251
|
+
programs whose distribution conditions are different, write to the author
|
252
|
+
to ask for permission. For software which is copyrighted by the Free
|
253
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254
|
+
make exceptions for this. Our decision will be guided by the two goals
|
255
|
+
of preserving the free status of all derivatives of our free software and
|
256
|
+
of promoting the sharing and reuse of software generally.
|
257
|
+
|
258
|
+
NO WARRANTY
|
259
|
+
|
260
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268
|
+
REPAIR OR CORRECTION.
|
269
|
+
|
270
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278
|
+
POSSIBILITY OF SUCH DAMAGES.
|
279
|
+
|
280
|
+
END OF TERMS AND CONDITIONS
|
281
|
+
|
282
|
+
How to Apply These Terms to Your New Programs
|
283
|
+
|
284
|
+
If you develop a new program, and you want it to be of the greatest
|
285
|
+
possible use to the public, the best way to achieve this is to make it
|
286
|
+
free software which everyone can redistribute and change under these terms.
|
287
|
+
|
288
|
+
To do so, attach the following notices to the program. It is safest
|
289
|
+
to attach them to the start of each source file to most effectively
|
290
|
+
convey the exclusion of warranty; and each file should have at least
|
291
|
+
the "copyright" line and a pointer to where the full notice is found.
|
292
|
+
|
293
|
+
<one line to give the program's name and a brief idea of what it does.>
|
294
|
+
Copyright (C) <year> <name of author>
|
295
|
+
|
296
|
+
This program is free software; you can redistribute it and/or modify
|
297
|
+
it under the terms of the GNU General Public License as published by
|
298
|
+
the Free Software Foundation; either version 2 of the License, or
|
299
|
+
(at your option) any later version.
|
300
|
+
|
301
|
+
This program is distributed in the hope that it will be useful,
|
302
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304
|
+
GNU General Public License for more details.
|
305
|
+
|
306
|
+
You should have received a copy of the GNU General Public License along
|
307
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309
|
+
|
310
|
+
Also add information on how to contact you by electronic and paper mail.
|
311
|
+
|
312
|
+
If the program is interactive, make it output a short notice like this
|
313
|
+
when it starts in an interactive mode:
|
314
|
+
|
315
|
+
Gnomovision version 69, Copyright (C) year name of author
|
316
|
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317
|
+
This is free software, and you are welcome to redistribute it
|
318
|
+
under certain conditions; type `show c' for details.
|
319
|
+
|
320
|
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321
|
+
parts of the General Public License. Of course, the commands you use may
|
322
|
+
be called something other than `show w' and `show c'; they could even be
|
323
|
+
mouse-clicks or menu items--whatever suits your program.
|
324
|
+
|
325
|
+
You should also get your employer (if you work as a programmer) or your
|
326
|
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327
|
+
necessary. Here is a sample; alter the names:
|
328
|
+
|
329
|
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330
|
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331
|
+
|
332
|
+
<signature of Ty Coon>, 1 April 1989
|
333
|
+
Ty Coon, President of Vice
|
334
|
+
|
335
|
+
This General Public License does not permit incorporating your program into
|
336
|
+
proprietary programs. If your program is a subroutine library, you may
|
337
|
+
consider it more useful to permit linking proprietary applications with the
|
338
|
+
library. If this is what you want to do, use the GNU Lesser General
|
339
|
+
Public License instead of this License.
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
COPYING
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.markdown
|
5
|
+
Rakefile
|
6
|
+
cucumber.yml
|
7
|
+
init.rb
|
8
|
+
lib/mundo_pepino.rb
|
9
|
+
lib/mundo_pepino/definitions/es_ES.rb
|
10
|
+
lib/mundo_pepino/resources_history.rb
|
11
|
+
lib/mundo_pepino/version.rb
|
12
|
+
lib/mundo_pepino/visits_history.rb
|
13
|
+
lib/mundo_pepino_es_ES.rb
|
14
|
+
mundo-pepino.gemspec
|
15
|
+
rails_generators/caracteristica/USAGE
|
16
|
+
rails_generators/caracteristica/caracteristica_generator.rb
|
17
|
+
rails_generators/caracteristica/templates/caracteristica.erb
|
18
|
+
rails_generators/mundo_pepino/USAGE
|
19
|
+
rails_generators/mundo_pepino/mundo_pepino_generator.rb
|
20
|
+
rails_generators/mundo_pepino/templates/mundo_pepino.rake
|
21
|
+
rails_generators/mundo_pepino/templates/mundo_pepino_es_ES.rb
|
data/README.markdown
ADDED
@@ -0,0 +1,492 @@
|
|
1
|
+
# MundoPepino
|
2
|
+
|
3
|
+
## What's in this world...
|
4
|
+
|
5
|
+
Expresing our app behaviour with a natural language has to deal with the fact that **one sentence can be expresed in many different ways**.
|
6
|
+
|
7
|
+
This fact can easily drive us towards an **explosion of the step definitions** making the maintenance of our app more difficult.
|
8
|
+
|
9
|
+
At the same time, to describe an app **there is a group of sentences that we're very likely to need**, like for example those which refer to posible interactions of the user while browsing a site.
|
10
|
+
|
11
|
+
Currently `script/generate cucumber` give to **English** cucumberists (or *cucus*, or *cucunuts*, or *cooks* ;) a proposal for some of those common steps in `step_definitions/webrat_steps.rb`.
|
12
|
+
|
13
|
+
MundoPepino will be an already implemented set of step definitions frequently needed while writing a feature in **Spanish**, hopefully with all the `script/generate cucumber` proposals translated inside.
|
14
|
+
|
15
|
+
Bon appetit!
|
16
|
+
|
17
|
+
## Toma de contacto
|
18
|
+
|
19
|
+
Asumiendo que tenemos instaladas las gema de **cucumber**, **rspec**, **rspec-rails**, **webrat** (más información sobre las dependencias más abajo y [en la documentacion oficial](http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails)) y (como no) **rails** (2.x):
|
20
|
+
|
21
|
+
rails mi_app; cd mi_app
|
22
|
+
script/plugin install git://github.com/nando/string-mapper.git
|
23
|
+
script/plugin install git://github.com/nando/mundo-pepino.git
|
24
|
+
script/generate cucumber
|
25
|
+
script/generate mundo_pepino
|
26
|
+
script/generate caracteristica Orchard Huerto name:string:nombre area:integer:área longitude:string:longitud latitude:string:latitud used:boolean:usado
|
27
|
+
script/generate scaffold Orchard name:string area:integer longitude:string latitude:string used:boolean
|
28
|
+
rake db:migrate
|
29
|
+
rake caracteristicas
|
30
|
+
|
31
|
+
En este punto deberíamos obtener dos errores, ambos debidos a que el *scaffold* genera las vistas en inglés y el generador de *caracteristica* los espera en castellano. El primero es el botón "Create" y el segundo el enlace "Destroy":
|
32
|
+
|
33
|
+
$EDITOR app/views/orchards/index.html.erb # "Borrar" en lugar de "Destroy"
|
34
|
+
$EDITOR app/views/orchards/new.html.erb # "Crear" en lugar de "Create"
|
35
|
+
rake caracteristicas
|
36
|
+
|
37
|
+
Ahora sí, los escenarios deberían ser válidos, sin errores ni definiciones pendientes.
|
38
|
+
|
39
|
+
La intención del generador de características es más didáctica que pragmática. Ofrece un ejemplo simple que podemos toquetear para probar el plugin. Por otro lado se limita a hacer exactamente lo mismo que hace `generate feature` exceptuando el hecho de que no genera un fichero de **definiciones específicas** para la nueva *caracteristica* (ya que las utilizadas están comprendidas dentro de las **definiciones genéricas** ya implementadas en MundoPepino).
|
40
|
+
|
41
|
+
Dentro del plugin, en `features/support/app` está la aplicación que el MundoPepino utiliza para probarse a si mismo. En particular la característica `features/mundo-pepino.feature` pretente ser un compendio de escenarios que muestren las posibilidades que ofrece.
|
42
|
+
|
43
|
+
## Instalación
|
44
|
+
|
45
|
+
$ script/plugin install git://github.com/nando/mundo-pepino.git
|
46
|
+
|
47
|
+
### Dependencias
|
48
|
+
|
49
|
+
Las clásicas gemas o plugins de **cucumber**, **webrat**, **rspec** y **rspec-rails**. Por ejemplo:
|
50
|
+
|
51
|
+
gem install term-ansicolor treetop diff-lcs nokogiri # dependencias de Cucumber
|
52
|
+
git clone git://github.com/aslakhellesoy/cucumber.git vendor/plugins/cucumber
|
53
|
+
git clone git://github.com/brynary/webrat.git vendor/plugins/webrat
|
54
|
+
git clone git://github.com/dchelimsky/rspec.git vendor/plugins/rspec
|
55
|
+
git clone git://github.com/dchelimsky/rspec-rails.git vendor/plugins/rspec-rails
|
56
|
+
|
57
|
+
Además necesitamos instalar como plugin StringMapper (ver más abajo).
|
58
|
+
|
59
|
+
Si hacemos uso de alguno de los pasos que hacen referencia a la selección de un mes como parte de una fecha en un formulario es necesaria la instalación del módulo ruby-locale.
|
60
|
+
|
61
|
+
#### [StringMapper](http://github.com/nando/string-mapper)
|
62
|
+
|
63
|
+
StringMapper es una extensión de la clase String para obtener modelos, números, nombres de campo, etc. a partir de sus nombres en castellano.
|
64
|
+
|
65
|
+
script/plugin install git://github.com/nando/string-mapper.git
|
66
|
+
|
67
|
+
#### [FixtureReplacement](http://replacefixtures.rubyforge.org/)
|
68
|
+
|
69
|
+
De fábrica MundoPepino utiliza ActiveRecord para incorporar a la BBDD los datos que soliciten los escenarios.
|
70
|
+
|
71
|
+
Opcionalmente MundoPepino puede utilizar FixtureReplacement haciendo dicha tarea más simple y permitiéndo que los textos se centren en los objetivos de los escenarios sin preocuparse por el modelo de datos subyacente.
|
72
|
+
|
73
|
+
Para ello por un lado tenemos que instalar el plugin:
|
74
|
+
|
75
|
+
script/plugin install http://thmadb.com/public_svn/plugins/fixture_replacement2/
|
76
|
+
script/generate fixture_replacement
|
77
|
+
|
78
|
+
...y por otro, al final de `env.rb` (que el generador de cucumber deja dentro del directorio ''features/support'') tenemos que incluir FixtureReplacement como módulo de nuestro *mundo pepino* (más sobre esto en [A Whole New World](http://wiki.github.com/aslakhellesoy/cucumber/a-whole-new-world)):
|
79
|
+
|
80
|
+
class MiMundo < MundoPepino
|
81
|
+
include FixtureReplacement
|
82
|
+
end
|
83
|
+
|
84
|
+
World do
|
85
|
+
MiMundo.new
|
86
|
+
end
|
87
|
+
|
88
|
+
#### [FactoryGirl](http://github.com/thoughtbot/factory_girl/)
|
89
|
+
|
90
|
+
Otra opción es utilizar FactoryGirl
|
91
|
+
|
92
|
+
Para ello por un lado tenemos que instalar la gema (para más información sobre FactoryGirl consultar (aquí)[http://github.com/thoughtbot/factory_girl/]):
|
93
|
+
|
94
|
+
gem install thoughtbot-factory_girl --source http://gems.github.com
|
95
|
+
|
96
|
+
...y por otro, al final de `env.rb` (que el generador de cucumber deja dentro del directorio ''features/support'') tenemos que requerir la librería seguida de la definición de nuestras factorias:
|
97
|
+
|
98
|
+
require 'factory_girl'
|
99
|
+
require File.expand_path(File.dirname(__FILE__) + '/app/db/factories')
|
100
|
+
|
101
|
+
También se debe incluir un fichero donde se definan las factories a utilizar en nuestro mundo-pepino, como ejemplo consultar el fichero de factories que se encuentra en el directorio ''features/support/app/db/factories''
|
102
|
+
|
103
|
+
#### [ruby-locale](http://ruby-locale.sourceforge.net/)
|
104
|
+
|
105
|
+
Para los pasos que hacen referencia a la selección de un mes en una fecha la implementación actual (de Webrat) busca en nuestro HTML un mes cuyo nombre sea el devuelto por **strftime('%B')** en una instancia de Time creada a partir de la fecha facilitada. En Ruby esto es sinonimo del nombre del mes en inglés.
|
106
|
+
|
107
|
+
**ruby-locale** es un (viejo) módulo que añade **soporte para locales en Ruby** al que se hace referencia [desde el wiki de Rails](http://wiki.rubyonrails.org/rails/pages/HowToOutputDatesInAnotherLanguage/). Instalándolo en el sistema tendremos la posibilidad de que strftime('%B') devuelva el nombre del mes en castellano.
|
108
|
+
|
109
|
+
Para instalarlo nos bajamos [su código fuente](http://sourceforge.net/project/platformdownload.php?group_id=68254) y lo compilamos e instalamos en el sistema:
|
110
|
+
|
111
|
+
ruby extconf.rb
|
112
|
+
make
|
113
|
+
sudo make install
|
114
|
+
irb
|
115
|
+
irb> require 'locale'
|
116
|
+
=> true
|
117
|
+
irb> Time.now.strftime('%B')
|
118
|
+
=> "January"
|
119
|
+
irb> Locale.setlocale(Locale::LC_TIME, "es_ES.UTF-8")
|
120
|
+
=> "es_ES"
|
121
|
+
irb> Time.now.strftime('%B')
|
122
|
+
=> "enero"
|
123
|
+
|
124
|
+
Por último, para que los helpers de Rails relacionados con la selección de fechas muestren los meses en castellano es necesario hacer uso de la opción **:use\_month\_names**, pasándole en la misma un array con los nombres de los doce meses que deseamos utilizar. Por ejemplo, en algún punto de nuestra aplicación definimos el array con los meses con:
|
125
|
+
|
126
|
+
Meses = %w(enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre)
|
127
|
+
|
128
|
+
Y posteriormente en las vistas llamamos al helper con algo parecido a:
|
129
|
+
|
130
|
+
<%= pepino.datetime_select :harvested_at, :use_month_names => Meses %>
|
131
|
+
|
132
|
+
## Uso
|
133
|
+
|
134
|
+
Para utilizar MundoPepino en una aplicación en la que todavía no estamos utilizando Cucumber lo más cómodo es comenzar utilizando los generadores (de forma similar a como se describe más arriba en *Toma de contacto*). Algo como:
|
135
|
+
|
136
|
+
cd miapp-sin-cucumber
|
137
|
+
script/plugin install git://github.com/nando/string-mapper.git
|
138
|
+
script/plugin install git://github.com/nando/mundo-pepino.git
|
139
|
+
script/generate mundo_pepino
|
140
|
+
script/generate caracteristica Model Modelo name:string:nombre used:boolean:usado
|
141
|
+
|
142
|
+
Aquí ya deberíamos poder lanzar `rake caracteristicas`, obteniendo eso sí los errores pertinentes relacionados con implementación concreta de nuestro controlador. El fichero `gestion_de_modelo.feature` (que podemos renombrar por algo más chulo) nos servirá de patrón para escribir nuestra /característica/.
|
143
|
+
|
144
|
+
Para utilizar MundoPepino en una aplicación en la que ya estamos utilizando Cucumber, al final de `features/support/env.rb` (o equivalente) incorporamos lo siguiente:
|
145
|
+
|
146
|
+
require 'mundo_pepino'
|
147
|
+
String.model_mappings = {} # Mapeo castellano-inglés de modelos
|
148
|
+
String.field_mappings = {} # Mapeo castellano-inglés de campos
|
149
|
+
|
150
|
+
World do
|
151
|
+
MundoPepino.new
|
152
|
+
end
|
153
|
+
|
154
|
+
Es recomendable también vaciar el contenido de la BBDD antes de comenzar la evaluación de un nuevo escenario para que los datos que pueda haber de otros escenarios no alteren su resultado. La función *Before* nos puede ayudar para conseguirlo, haciendo algo como:
|
155
|
+
|
156
|
+
Before do
|
157
|
+
MiModelo.destroy_all
|
158
|
+
MiOtroModelo.destroy_all # etc.
|
159
|
+
end
|
160
|
+
|
161
|
+
*Before* se ejecutará antes de cada escenario y que los //Antecetentes// ((Background)[http://wiki.github.com/aslakhellesoy/cucumber/background]) de los mismos si los hubiese.
|
162
|
+
|
163
|
+
### generate mundo\_pepino
|
164
|
+
|
165
|
+
rails_root$ script/generate mundo_pepino
|
166
|
+
create caracteristicas/support
|
167
|
+
create caracteristicas/support/mundo_pepino_env.rb
|
168
|
+
exists lib/tasks
|
169
|
+
create lib/tasks/mundo_pepino.rake
|
170
|
+
|
171
|
+
El principio de `mundo_pepino_env.rb` es el contenido del `env.rb` generado por `generate cucumber`, tras el cual añade lo siguiente:
|
172
|
+
|
173
|
+
require 'mundo_pepino' # Cargamos MundoPepino...
|
174
|
+
MundoPepino::ModelsToClean = [] # Array con los modelos que serán limpiados
|
175
|
+
# antes de lanzar cada escenario.
|
176
|
+
String.model_mappings = {} # Hash con el mapeo de los modelos a partir
|
177
|
+
# de sus equivalencias en castellano.
|
178
|
+
String.field_mappings = {} # Hash con el mapeo de los campos.
|
179
|
+
class MiMundo < MundoPepino # Ejemplo de uso del MundoPepio con herencia.
|
180
|
+
# include FixtureReplacement # FR listo para entrar en acción. Meter aquí
|
181
|
+
# def mi_funcion; ...; end # las funciones específicas que necesitemos
|
182
|
+
end # desde nuestras definiciones.
|
183
|
+
Before do # La limpieza de modelos propiamente dicha...
|
184
|
+
MundoPepino::ModelsToClean.each { |model| model.destroy_all }
|
185
|
+
end # ...se realizará antes de cada escenario.
|
186
|
+
World do # Finalmente le pedimos a Cucumber que
|
187
|
+
MiMundo.new # utilice una instancia de nuestro mundo como
|
188
|
+
end # ámbito local de nuestros escenarios.
|
189
|
+
|
190
|
+
Por otro lado `mundo_pepino.rake` añade una tarea llamada **caracteristicas** que lanza con la opción `--language es` todos los ficheros con extensión `.feature` que tengamos dentro del directorio `caracteristicas`.
|
191
|
+
|
192
|
+
### generate caracteristica
|
193
|
+
|
194
|
+
Se trata del generador equivalente a `script/generate feature` de Cucumber:
|
195
|
+
|
196
|
+
$ script/generate caracteristica Orchard Huerto name:string:nombre area:integer:área used:boolean:usado
|
197
|
+
model_cleaning added Orchard (Orchard.destroy_all call before each scenario)
|
198
|
+
model_mapping added /huertos?$/i => Orchard
|
199
|
+
field_mapping added /nombres?$/i => :name
|
200
|
+
field_mapping added /áreas?$/i => :area
|
201
|
+
field_mapping added /usados?$/i => :used
|
202
|
+
create caracteristicas/gestion_de_huertos.feature
|
203
|
+
|
204
|
+
El fichero `gestion_de_huertos.feature` tendría:
|
205
|
+
|
206
|
+
Característica: Gestión de Huertos
|
207
|
+
Para [beneficio]
|
208
|
+
Como [sujeto]
|
209
|
+
Quiero [característica/comportamiento]
|
210
|
+
|
211
|
+
Escenario: Añadir un/a nuevo/a Huerto
|
212
|
+
Dado que visito la página de nuevo/a Huerto
|
213
|
+
Cuando relleno nombre con "nombre 0"
|
214
|
+
Y relleno área con "0"
|
215
|
+
Y relleno usado con "true"
|
216
|
+
Y pulso el botón "Crear"
|
217
|
+
Entonces debería ver el texto "nombre 0"
|
218
|
+
Y debería ver el texto "0"
|
219
|
+
Y debería ver el texto "true"
|
220
|
+
|
221
|
+
Escenario: Borrar Huerto
|
222
|
+
Dado que tenemos los/las siguientes Huertos:
|
223
|
+
|nombre|área|usado|
|
224
|
+
|nombre 1|1|false|
|
225
|
+
|nombre 2|2|true|
|
226
|
+
|nombre 3|3|false|
|
227
|
+
|nombre 4|4|true|
|
228
|
+
Cuando borro el/la Huerto en la tercera posición
|
229
|
+
Entonces debería ver una tabla con los siguientes contenidos:
|
230
|
+
|nombre|área|usado|
|
231
|
+
|nombre 1|1|false|
|
232
|
+
|nombre 2|2|true|
|
233
|
+
|nombre 4|4|true|
|
234
|
+
|
235
|
+
A diferencia de `generate feature` aquí no se crea un fichero `step_definitions.rb` con definiciones e implementaciones específicas ya que las mismas se encuentran dentro de las tratadas genéricamente dentro del MundoPepino.
|
236
|
+
|
237
|
+
### Relación con modelo utilizando un nombre que no se corresponde con el mismo
|
238
|
+
Con un ejemplo se entiende mejor, creo. Tenemos un modelo User y un modelo Garden y este último "belongs_to :author, class_name => 'User'", de tal forma que //a_garden.author// nos devuelve un User.
|
239
|
+
|
240
|
+
Bien, pues para que la siguiente característica funcione correctamente:
|
241
|
+
|
242
|
+
Dado que tenemos un usuario llamado "Fidel"
|
243
|
+
Y que tenemos un jardín cuyo autor es "Fidel"
|
244
|
+
|
245
|
+
Tengo que meter los siguentes mapeos en nuestro entorno:
|
246
|
+
* En el mapeo de modelos (model_mappings):
|
247
|
+
|
248
|
+
/^autor(es)?$/i => User
|
249
|
+
|
250
|
+
* En el mapeo de campos (field_mappings):
|
251
|
+
|
252
|
+
/^autor(es)?$/i => :author
|
253
|
+
|
254
|
+
* Un mapeo adicional entre el nombre del campo en inglés y su modelo asociado (relation_model_mappings):
|
255
|
+
|
256
|
+
'author' => User
|
257
|
+
|
258
|
+
Con estos mapeos también deberían funcionar el resto de definiciones de MP en las que se haga referencia a una relación.
|
259
|
+
|
260
|
+
## Definiciones implementadas en MundoPepino
|
261
|
+
|
262
|
+
**Cada definición** existente en MundoPepino tiene **al menos un escenario** que comprueba:
|
263
|
+
* por un lado que la expresión regular *machea* las posibles formas de expresarla,
|
264
|
+
* y por otro que la implementación lleva a cabo lo que se supone que debe hacer.
|
265
|
+
|
266
|
+
Para todos los escenarios podríamos tener una narrativa genérica que expresase algo como lo siguiente:
|
267
|
+
|
268
|
+
Característica: implementación de pasos habituales
|
269
|
+
Para escribir sólo la definición de los pasos específicos de mi proyecto
|
270
|
+
Como usuario de Cucumber
|
271
|
+
Quiero tener los pasos más habituales definidos, implementados y bien documentados
|
272
|
+
|
273
|
+
Sin embargo cada definición ha sido separada en un fichero `.feature` específico para poder enlazarlas desde este índice.
|
274
|
+
|
275
|
+
|
276
|
+
Como **convención general** los nombres correspondientes a modelos y campos pueden ir sin comillas pero los valores deben ir entre comillas (simples o dobles). Por ejemplo:
|
277
|
+
|
278
|
+
Dado que tenemos un artículo que tiene como título "Título del artículo"
|
279
|
+
|
280
|
+
En el ejemplo, "artículo" y "título" hacen referencia a un modelo y a un campo respectivamente y no van entre comillas (aunque podrían ir si quisiéramos) mientras que "Título del artículo" es el valor que se asignará en "título" y como tal va entrecomillado (y si quitásemos sus comillas la expresión no sería reconocida o lo sería incorrectamente).
|
281
|
+
|
282
|
+
MundoPepino soporta el uso de **claves I18n** en lugar de literales "a pincho" (o "hardcoded") en la mayoría de interacciones con el navegador (p.e. "Cuando pincho en el botón app.send" en lugar de "Cuando pincho en el botón 'Enviar'") así como en las comprobaciones de existencia de textos (p.e. "Debería ver el texto 'activerecord.models.user'" en lugar de "Debería ver el texto 'Usuario'").
|
283
|
+
|
284
|
+
Se puede utilizar la interpolación separando el hash con los parámetros de la clave con una coma sin espacios. Por ejemplo:
|
285
|
+
|
286
|
+
Entonces debería ver la etiqueta H1 con el valor "app.users.new_friend,{:name => 'Lucas'}"
|
287
|
+
|
288
|
+
|
289
|
+
### Dado el contexto (Givens)
|
290
|
+
|
291
|
+
Convenciones generales:
|
292
|
+
|
293
|
+
* utilización de "que" para comenzar todas las definiciones para evitar falta de concordancia de género y número (p.e. "Dado **que** tenemos tres personas")
|
294
|
+
* creación de nuevos recursos utilizando verbo **tener** en tercena persona plural (p.e. "Dado que **tenemos** tres lechugas")
|
295
|
+
* asignación de valores con el verbo **tener** en tercera persona (p.e. "Dado que dichas Acelgas **tienen** como variedad Amarilla de Lyon")
|
296
|
+
* todas las definiciones para "Cuando algo ocurre" (o *Then's*, ver más abajo) son válidas también como "Dado el contexto" incorporándoles el prefijo "que" (p.e. "Dado que visito la portada").
|
297
|
+
|
298
|
+
|
299
|
+
#### Creación de uno o varios registros asignándoles opcionalmente un nombre
|
300
|
+
Dado que tenemos Un Producto llamado "Acelgas"
|
301
|
+
[más ejemplos](master/features/es_ES/contexto-creacion-simple.feature)
|
302
|
+
|
303
|
+
#### Creación de uno o varios registros con un valor en un campo
|
304
|
+
Dado que tenemos un huerto cuya área es de "1200" metros cuadrados
|
305
|
+
[más ejemplos](master/features/es_ES/contexto-creacion-con-asignacion.feature)
|
306
|
+
|
307
|
+
#### Creación de uno o varios recursos a partir de una **step table**
|
308
|
+
Dado que tenemos el siguiente Huerto:
|
309
|
+
| nombre | área | latitud | latitud | abono |
|
310
|
+
| Secano-1 | 35 | N 40° 44 | W 003° 48 | FSF-315 |
|
311
|
+
[más ejemplos](master/features/es_ES/contexto-creacion-desde-step-table.feature)
|
312
|
+
|
313
|
+
#### Asignación de un valor en un campo de un recurso concreto
|
314
|
+
Dado que el Tomate "A" tiene como variedad "Raf"
|
315
|
+
[más ejemplos](master/features/es_ES/contexto-asignacion-de-valor-en-recurso.feature)
|
316
|
+
|
317
|
+
#### Asignación de un valor en un campo del último (o últimos) recurso mencionado
|
318
|
+
Dado que dichas Acelgas tienen como Variedad "Gigante carmesí"
|
319
|
+
[más ejemplos](master/features/es_ES/contexto-asignacion-de-valor-en-recurso-mencionado.feature)
|
320
|
+
|
321
|
+
#### Asignación simple a un campo **has\_many** (normal o polimórfico) del último recurso mencionado
|
322
|
+
Dado que dicho Huerto tiene Tres Bancales "Acelgas, Tomates y Pepinos"
|
323
|
+
[más ejemplos (has_many normal)](master/features/es_ES/contexto-asignacion-has-many-simple.feature) -
|
324
|
+
[más ejemplos (has_many polimórfico)](master/features/es_ES/contexto-asignacion-has-many-polymorphic-simple.feature)
|
325
|
+
[más ejemplos (has_many through)](master/features/es_ES/contexto-asignacion-has-many-through-simple.feature)
|
326
|
+
|
327
|
+
#### Asignación en campo **has\_many** (normal o polimórfico) del último recurso mencionado desde una step-table
|
328
|
+
Dado que dicho Huerto tiene los siguientes Bancales:
|
329
|
+
| nombre | longitud | cultivo | matas |
|
330
|
+
| A-01 | 12 | Patatas | 16 |
|
331
|
+
| A-02 | 12 | Tomates | 18 |
|
332
|
+
[más ejemplos (has_many normal)](master/features/es_ES/contexto-asignacion-has-many-desde-fit-table.feature) -
|
333
|
+
[más ejemplos (has_many polimórfico)](master/features/es_ES/contexto-asignacion-has-many-polymorphic-desde-fit-table.feature)
|
334
|
+
[más ejemplos (has_many through)](master/features/es_ES/contexto-asignacion-has-many-through-desde-fit-table.feature)
|
335
|
+
|
336
|
+
### Cuando algo ocurre (Whens)
|
337
|
+
|
338
|
+
Convenciones generales:
|
339
|
+
|
340
|
+
* frases escritas en tiempo presente en primera persona del singular
|
341
|
+
* todas las definiciones son válidas también para definir contexto (en "Dados" o "Givens") incorporándoles el prefijo "que" (p.e. "Dado que visito la portada").
|
342
|
+
|
343
|
+
#### Solicitud de una URL específica opcionalmente indicada con un nombre coloquial
|
344
|
+
Cuando visito la portada
|
345
|
+
[más ejemplos](master/features/es_ES/cuando-visito-url-especifica.feature)
|
346
|
+
#### Solicitud de la URL asociada a un recurso concreto
|
347
|
+
Cuando visito la página del huerto "H-01"
|
348
|
+
[más ejemplos](master/features/es_ES/cuando-visito-url-de-recurso-especifico.feature)
|
349
|
+
#### Solicitud de la URL asociada al último recurso definido
|
350
|
+
Cuando visito su página
|
351
|
+
[más ejemplos](master/features/es_ES/cuando-visito-url-de-recurso-mencionado.feature)
|
352
|
+
#### Solicitud de la URL del índice (index) de un tipo de recurso (modelo)
|
353
|
+
Cuando visito la página de Tomates
|
354
|
+
[más ejemplos](master/features/es_ES/cuando-visito-url-de-indice-de-tipo-de-recurso.feature)
|
355
|
+
#### Solicitud de la URL de creación de un recurso
|
356
|
+
Cuando visito la página de creación de Tomate
|
357
|
+
[más ejemplos](master/features/es_ES/cuando-visito-url-de-creacion.feature)
|
358
|
+
#### Solicitud de la URL de edición de un recurso
|
359
|
+
Cuando visito la página de edición del huerto "H-01"
|
360
|
+
[más ejemplos](master/features/es_ES/cuando-visito-url-de-edicion.feature)
|
361
|
+
#### Pincho en un enlace \*
|
362
|
+
Cuando pulso el enlace "Volver"
|
363
|
+
[más ejemplos](master/features/es_ES/cuando-pulso-el-enlace.feature)
|
364
|
+
#### Pincho/pulso un bóton (*submit*) \*
|
365
|
+
Cuando pulso en el botón Enviar
|
366
|
+
[más ejemplos](master/features/es_ES/cuando-pulso-el-boton.feature)
|
367
|
+
#### Adjunto un fichero (*file*) \*
|
368
|
+
Cuando adjunto el fichero "images/cucumber.jpg" en Fotografía actual
|
369
|
+
[más ejemplos](master/features/es_ES/cuando-adjunto-el-fichero.feature)
|
370
|
+
#### Elijo una opción (*radiobutton*) \*
|
371
|
+
Cuando elijo el color "VERDE"
|
372
|
+
[más ejemplos](master/features/es_ES/cuando-elijo-de-radiobutton.feature)
|
373
|
+
#### Marco (o desmarco) una casilla (*checkbox*) \*
|
374
|
+
Cuando marco "color verde"
|
375
|
+
[más ejemplos](master/features/es_ES/cuando-marco-el-checkbox.feature)
|
376
|
+
#### Relleno/completo un campo con un texto (*text* o *textarea*) \*
|
377
|
+
Cuando completo 'nombre' con 'Wadus'
|
378
|
+
[más ejemplos](master/features/es_ES/cuando-relleno-el-campo.feature)
|
379
|
+
#### Relleno/completo varios campos (*text* o *textarea*) desde una step-table \*
|
380
|
+
Cuando completo:
|
381
|
+
| Campo | Valor |
|
382
|
+
| Nombre | Lechuga |
|
383
|
+
| Color | Verde |
|
384
|
+
[más ejemplos](master/features/es_ES/cuando-relleno-los-campos.feature)
|
385
|
+
#### Selecciono opción/opciones
|
386
|
+
##### Selecciono una opción de una lista (*select*) \*
|
387
|
+
Cuando selecciono "Hortalizas" en el listado de "Tipos de cultivo"
|
388
|
+
##### Selecciono fecha y hora sin especificar en que campo \*
|
389
|
+
Cuando selecciono 1 de septiembre de 1998, 12:46 como fecha y hora
|
390
|
+
##### Selecciono fecha y hora para un campo concreto \*
|
391
|
+
Cuando selecciono 2 de mayo de 1998, 12:46 como fecha y hora de "Cosechado"
|
392
|
+
##### Selecciono una hora sin especificar en que campo \*
|
393
|
+
Cuando selecciono 6:45PM como hora
|
394
|
+
##### Selecciono una hora para un campo concreto \*
|
395
|
+
Cuando selecciono 2:45PM como hora del "café"
|
396
|
+
##### Selecciono fecha sin especificar en que campo \*
|
397
|
+
Cuando selecciono 1 de septiembre de 1998 como fecha
|
398
|
+
##### Selecciono fecha para un campo concreto \*
|
399
|
+
Cuando selecciono 2 de marzo de 2009 como fecha para el comienzo de la poda
|
400
|
+
[más ejemplos](master/features/es_ES/cuando-selecciono-en-listado.feature)
|
401
|
+
|
402
|
+
#### Borro el enésimo recurso desde la página de su índice (index) \*\*
|
403
|
+
Cuando borro el Bancal en 6ª posición
|
404
|
+
[más ejemplos](master/features/es_ES/cuando-borro-el-enesimo-recurso.feature)
|
405
|
+
|
406
|
+
### Entonces pasa (Thens)
|
407
|
+
|
408
|
+
Convenciones generales:
|
409
|
+
|
410
|
+
* frases escritas en primera persona del singular (excepto comprobaciones en bbdd)
|
411
|
+
* para expresar que algo es visible utiliza "veo" o "debo ver" (o "no veo" y "no debo ver")
|
412
|
+
* las comprobaciones del contenido de la base de datos se escriben haciendo una referencia explícita a la misma en primera persona del plural ("tenemos en base de datos") o en tercera del singular ("tiene en base de datos"). Esta verbosidad es intencionada debido a que [dichas comprobaciones están desaconsejadas](http://github.com/aslakhellesoy/cucumber/wikis/given-when-then), haciendo así menos limpio y un poco más costoso su uso.
|
413
|
+
|
414
|
+
#### Veo (o no) un texto \*
|
415
|
+
Entonces debo ver el texto "IVA incluido"
|
416
|
+
[más ejemplos](master/features/es_ES/veo-el-texto.feature)
|
417
|
+
#### Veo (o no) una serie de textos expresados en una step-table (sin cabeceras)
|
418
|
+
Entonces debo ver los siguientes textos:
|
419
|
+
| Muestras de tomate |
|
420
|
+
| Restos de lechuga |
|
421
|
+
| Treinta kilos de melones |
|
422
|
+
[más ejemplos](master/features/es_ES/veo-los-siguientes-textos.feature)
|
423
|
+
#### Veo (o no) una etiqueta/selector opcionalmente con un contenido concreto
|
424
|
+
Entonces no debo ver la etiqueta "div.title a" con el valor "Surco"
|
425
|
+
[más ejemplos](master/features/es_ES/veo-etiqueta-con-valor.feature)
|
426
|
+
|
427
|
+
#### Veo (o no) varios selectores opcionalmente determinados valores (step-table)
|
428
|
+
Entonces debería ver los siguientes selectores:
|
429
|
+
| Selector | Valor |
|
430
|
+
| h1 | Mundo Pepino |
|
431
|
+
[más ejemplos]/master/features/es_ES/veo-etiquetas-con-valores.feature
|
432
|
+
#### Leo (o no) un texto, quitando las etiquetas HTML
|
433
|
+
Entonces debo leer el texto "IVA incluido"
|
434
|
+
[más ejemplos](master/features/es_ES/leo-el-texto.feature)
|
435
|
+
#### Leo (o no), quitando las etiquetas HTML, una serie de textos expresados en una step-table
|
436
|
+
Entonces debo leer los siguientes textos:
|
437
|
+
| Muestras de tomate |
|
438
|
+
| Restos de lechuga |
|
439
|
+
[más ejemplos](master/features/es_ES/leo-los-siguientes-textos.feature)
|
440
|
+
#### Veo (o no) un enlace a una URL específica (opcionalmente indicada con un nombre coloquial)
|
441
|
+
Entonces debo ver un enlace a la página de recuperación de contraseña
|
442
|
+
[más ejemplos](master/features/es_ES/veo-enlace-a-url-especifica)
|
443
|
+
#### Veo (o no) un enlace a una URL relativa a una visitada con anterioridad
|
444
|
+
Entonces debo ver un enlace a la siguiente página
|
445
|
+
[más ejemplos](master/features/es_ES/veo-enlace-a-url-relativa)
|
446
|
+
#### Veo marcada (o desmarcada) una casilla (*checkbox*) \*
|
447
|
+
Entonces veo marcado "Acepto las condiciones del servicio"
|
448
|
+
[más ejemplos](master/features/es_ES/veo-el-checkbox.feature)
|
449
|
+
|
450
|
+
#### Veo una tabla con determinados valores en sus celdas \*
|
451
|
+
Entonces veo la tabla "bancales" con el siguiente contenido:
|
452
|
+
| nombre | longitud | cultivo | matas |
|
453
|
+
| A-01 | 12 | Patatas | 16 |
|
454
|
+
| A-02 | 12 | Tomates | 18 |
|
455
|
+
[más ejemplos](master/features/es_ES/veo-una-tabla-con-determinado-contenido.feature)
|
456
|
+
|
457
|
+
#### Veo un formulario con determinados campos convenientemente etiquetados \*
|
458
|
+
Entonces veo un formulario con los siguientes campos:
|
459
|
+
| Etiqueta | Tipo |
|
460
|
+
| Login | textfield |
|
461
|
+
| Contraseña | password |
|
462
|
+
| Entrar | submit |
|
463
|
+
[más ejemplos](master/features/es_ES/veo-un-formulario-con-los-siguientes-campos.feature)
|
464
|
+
|
465
|
+
|
466
|
+
#### Tenemos en BBDD uno o más registros de un modelo opcionalmente con un nombre concreto
|
467
|
+
Entonces tenemos en la base de datos un Abono llamado "FSF-03"
|
468
|
+
[más ejemplos](master/features/es_ES/tenemos-en-bbdd-registros.feature)
|
469
|
+
|
470
|
+
#### Tenemos en BBDD un valor en un campo de un registro concreto
|
471
|
+
Entonces el Huerto "H-02" tiene en base de datos como Área "2" hectáreas
|
472
|
+
[más ejemplos](master/features/es_ES/tenemos-en-bbdd-valor-en-campo-de-registro.feature)
|
473
|
+
|
474
|
+
#### Tenemos en BBDD un valor en un campo del registro mencionando anteriormente
|
475
|
+
Entonces tiene en base de datos como Área "2" hectáreas
|
476
|
+
[más ejemplos](master/features/es_ES/tenemos-en-bbdd-valor-en-campo-de-registro-mencionado.feature)
|
477
|
+
|
478
|
+
#### Tenemos en BBDD una asociación **has\_many** en un registro concreto
|
479
|
+
Entonces el Huerto "H-02" tiene en base de datos un Bancal "A"
|
480
|
+
[más ejemplos](master/features/es_ES/tenemos-en-bbdd-asocioacion-has-many-en-registro.feature)
|
481
|
+
|
482
|
+
#### Tenemos en BBDD una asociación **has\_many** en un registro mencionando anteriormente
|
483
|
+
Entonces tiene en base de datos un Bancal "B"
|
484
|
+
[más ejemplos](master/features/es_ES/tenemos-en-bbdd-asocioacion-has-many-en-registro-mencionado.feature)
|
485
|
+
|
486
|
+
(\*) Los **asteriscos** al final de la definición hacen referencia a las **definiciones oficialmente comunes** generadas en inglés por `script/generate cucumber`. Dos asteríscos (\*\*) hacen referencia a una definición presente en la feature autogenerada por `script/generate feature`.
|
487
|
+
|
488
|
+
## License
|
489
|
+
|
490
|
+
Copyright 2008, The Cocktail Experience. Fernando García Samblas <fernando.garcia at the-cocktail.com>
|
491
|
+
|
492
|
+
This is free software released under the GPL License (see license agreement in COPYING).
|