biblio_alu0100845235 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +9 -0
- data/.travis.yml +6 -0
- data/= +0 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +6 -0
- data/Guardfile +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +7 -0
- data/Rakefile +7 -0
- data/biblio.gemspec +34 -0
- data/biblio.rb +12 -0
- data/biblio_spec.1.rb +478 -0
- data/biblio_spec.rb +535 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/doc/=.html +97 -0
- data/doc/Biblio.html +109 -0
- data/doc/CODE_OF_CONDUCT_md.html +127 -0
- data/doc/Cita.html +278 -0
- data/doc/Edocumento.html +275 -0
- data/doc/Gemfile.html +104 -0
- data/doc/Gemfile_lock.html +204 -0
- data/doc/Guardfile.html +182 -0
- data/doc/LICENSE_txt.html +119 -0
- data/doc/Libro.html +391 -0
- data/doc/List.html +591 -0
- data/doc/Object.html +116 -0
- data/doc/Periodico.html +218 -0
- data/doc/Publicacion.html +321 -0
- data/doc/README_md.html +115 -0
- data/doc/Rakefile.html +103 -0
- data/doc/Referencia.html +467 -0
- data/doc/Revista.html +275 -0
- data/doc/biblio_gemspec.html +132 -0
- data/doc/bin/setup.html +103 -0
- data/doc/created.rid +30 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +590 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +125 -0
- data/doc/js/darkfish.js +161 -0
- data/doc/js/jquery.js +4 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +228 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +294 -0
- data/lib/biblio/cita.rb +30 -0
- data/lib/biblio/edocumento.rb +34 -0
- data/lib/biblio/libro.rb +62 -0
- data/lib/biblio/list.rb +133 -0
- data/lib/biblio/node.rb +2 -0
- data/lib/biblio/periodico.rb +28 -0
- data/lib/biblio/publicacion.rb +23 -0
- data/lib/biblio/referencia.rb +84 -0
- data/lib/biblio/revista.rb +34 -0
- data/lib/biblio/version.rb +3 -0
- data/lib/biblio.rb +17 -0
- data/spec_helper.1.rb +2 -0
- data/spec_helper.rb +4 -0
- metadata +228 -0
data/biblio_spec.rb
ADDED
@@ -0,0 +1,535 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Biblio do
|
5
|
+
before :each do
|
6
|
+
@b1 = Libro.new(["Dave Thomas", "Andy Hunt", "Chad Fowler"], "programming ruby 1.9 & 2.0: the Pragmatic Programmers Guide", "The Facets of Ruby", "Pragmatic Bookshelf", 4, "07/07/2013", ["978-1937785499", "1937785491"])
|
7
|
+
@b2 = Libro.new(["Scott Chacon"], "Pro Git 2009th Edition", "Pro", "Apress" , 2009, "27/08/2009", ["978-1430218333", "1430218339"])
|
8
|
+
@b3 = Libro.new(["David Flanagan", "Yukihiro Matsumoto"], "The Ruby Programming Language", nil, "O'Reilly Media", 1, "04/02/2008", ["0596516177", "978-0596516178"])
|
9
|
+
@b4 = Libro.new(["David Chelimsky", "Dave Astels", "Bryan Helmkamp", "Dan North", "Zach Dennis", "Aslak Helleson"], "The RSpec Book: Behaviour Driven Development with RSpec, Cucumber, and Friends", "The Facets of Ruby", "Pragmatic Bookshelf", 1, "25/12/2010", ["1934356379", "978-1934356371"])
|
10
|
+
@b5 = Libro.new(["Richard E"], "Silverman Git Pocket Guide", nil, "O'Reilly Media", 1, "02/08/2013", ["1449325866", "978-1449325862"])
|
11
|
+
|
12
|
+
@p1 = Periodico.new(["autor"], "Titulo", "Periodico", "07/07/2013", 1, nil, "123456789")
|
13
|
+
@p2 = Periodico.new(["autor1", "autor2"], "Titulo2", "Periodico2", "08/08/2013", 1, 2, "123456789")
|
14
|
+
@p3 = Periodico.new(["autor"], "Titulo3", "Periodico3", "08/08/2013", 1, 100, "123456789")
|
15
|
+
|
16
|
+
@r1 = Revista.new(["autor"], "Titulo", "Revista", "07/07/2013", 10, 1, nil, "123456789")
|
17
|
+
@r2 = Revista.new(["autor1", "autor2"], "Titulo2", "Revista2", "08/08/2013", 11, 1, 2, "123456789")
|
18
|
+
@r3 = Revista.new(["autor"], "Titulo3", "Revista3", "08/08/2013", 12, 1, 100, "123456789")
|
19
|
+
|
20
|
+
@e1 = Edocumento.new(["autor"], "Titulo", "Revista", "07/07/2013", 1, nil, "123456789", "http://www.hola.com")
|
21
|
+
@e2 = Edocumento.new(["autor1", "autor2"], "Titulo2", "Revista2", "08/08/2013", 1, 2, "123456789", "http://www.hastaluego.com")
|
22
|
+
@e3 = Edocumento.new(["autor"], "Titulo3", "Revista3", "08/08/2013", 1, 100, "123456789", "http://www.chao.com")
|
23
|
+
|
24
|
+
@l1 = List.new
|
25
|
+
@l2 = List.new(@b1)
|
26
|
+
@l3 = List.new(@p2)
|
27
|
+
@l3.push_back(@p1)
|
28
|
+
|
29
|
+
|
30
|
+
# Practica 10
|
31
|
+
@r11 = Revista.new(["autor apellido"], "Titulo", "Revista", "07/07/2013", 10, 1, nil, "123456789")
|
32
|
+
@r12 = Revista.new(["autor apellido", "autor2 apellido2"], "Titulo2", "Revista2", "08/08/2013", 11, 1, 2, "123456789")
|
33
|
+
@r13 = Revista.new(["autor apellido", "autor2 apellido2"], "Titulo3", "Revista2", "07/09/2013", 11, 1, 2, "123456789")
|
34
|
+
@r14 = Revista.new(["autor apellido"], "Titulo3", "Revista3", "08/08/2013", 12, 1, 100, "123456789")
|
35
|
+
@bx = Libro.new(["Dave Thomas", "Andy Hunt", "Chad Fowler"], "the Pragmatic Programmers Guide", "The Facets of Ruby", "Pragmatic Bookshelf", 4, "08/08/2013", ["978-1937785499", "1937785491"])
|
36
|
+
|
37
|
+
@l10 = List.new
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "Comprobacion de la herencia de Libro" do
|
41
|
+
it "Test herencia lista" do
|
42
|
+
expect(@b1.is_a?Object).to be true
|
43
|
+
expect(@b1.is_a?Referencia).to be true
|
44
|
+
expect(@b1.instance_of?Libro).to be true
|
45
|
+
expect(@b2.is_a?Object).to be true
|
46
|
+
expect(@b2.is_a?Referencia).to be true
|
47
|
+
expect(@b2.instance_of?Libro).to be true
|
48
|
+
expect(@b3.is_a?Object).to be true
|
49
|
+
expect(@b3.is_a?Referencia).to be true
|
50
|
+
expect(@b3.instance_of?Libro).to be true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "Comprobacion de la herencia de Periodico" do
|
55
|
+
it "Test herencia lista" do
|
56
|
+
expect(@p1.is_a?Object).to be true
|
57
|
+
expect(@p1.is_a?Referencia).to be true
|
58
|
+
expect(@p1.is_a?Publicacion).to be true
|
59
|
+
expect(@p1.instance_of?Periodico).to be true
|
60
|
+
expect(@p2.is_a?Object).to be true
|
61
|
+
expect(@p2.is_a?Referencia).to be true
|
62
|
+
expect(@p2.is_a?Publicacion).to be true
|
63
|
+
expect(@p2.instance_of?Periodico).to be true
|
64
|
+
expect(@p3.is_a?Object).to be true
|
65
|
+
expect(@p3.is_a?Referencia).to be true
|
66
|
+
expect(@p3.is_a?Publicacion).to be true
|
67
|
+
expect(@p3.instance_of?Periodico).to be true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "Comprobacion de la herencia de Revista" do
|
72
|
+
it "Test herencia lista" do
|
73
|
+
expect(@r1.is_a?Object).to be true
|
74
|
+
expect(@r1.is_a?Referencia).to be true
|
75
|
+
expect(@r1.is_a?Publicacion).to be true
|
76
|
+
expect(@r1.instance_of?Revista).to be true
|
77
|
+
expect(@r2.is_a?Object).to be true
|
78
|
+
expect(@r2.is_a?Referencia).to be true
|
79
|
+
expect(@r2.is_a?Publicacion).to be true
|
80
|
+
expect(@r2.instance_of?Revista).to be true
|
81
|
+
expect(@r3.is_a?Object).to be true
|
82
|
+
expect(@r3.is_a?Referencia).to be true
|
83
|
+
expect(@r3.is_a?Publicacion).to be true
|
84
|
+
expect(@r3.instance_of?Revista).to be true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "Comprobacion de la herencia de Documento Electronico" do
|
89
|
+
it "Test herencia lista" do
|
90
|
+
expect(@e1.is_a?Object).to be true
|
91
|
+
expect(@e1.is_a?Referencia).to be true
|
92
|
+
expect(@e1.is_a?Publicacion).to be true
|
93
|
+
expect(@e1.instance_of?Edocumento).to be true
|
94
|
+
expect(@e2.is_a?Object).to be true
|
95
|
+
expect(@e2.is_a?Referencia).to be true
|
96
|
+
expect(@e2.is_a?Publicacion).to be true
|
97
|
+
expect(@e2.instance_of?Edocumento).to be true
|
98
|
+
expect(@e3.is_a?Object).to be true
|
99
|
+
expect(@e3.is_a?Referencia).to be true
|
100
|
+
expect(@e3.is_a?Publicacion).to be true
|
101
|
+
expect(@e3.instance_of?Edocumento).to be true
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "Comprobacion de la herencia de la lista" do
|
106
|
+
it "Test herencia lista" do
|
107
|
+
expect(@l1.is_a?Object).to be true
|
108
|
+
expect(@l1.instance_of?List).to be true
|
109
|
+
expect(@l2.is_a?Object).to be true
|
110
|
+
expect(@l2.instance_of?List).to be true
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
describe "Comprobacion de una correcta construccion de Libro" do
|
116
|
+
it "Existe al menos un autor" do
|
117
|
+
expect(@b1.autores).not_to eq(nil)
|
118
|
+
expect(@b2.autores).not_to eq(nil)
|
119
|
+
expect(@b3.autores).not_to eq(nil)
|
120
|
+
end
|
121
|
+
it "Existe titulo" do
|
122
|
+
expect(@b1.titulo).not_to eq(nil)
|
123
|
+
expect(@b2.titulo).not_to eq(nil)
|
124
|
+
expect(@b3.titulo).not_to eq(nil)
|
125
|
+
end
|
126
|
+
it "Existe o no una serie" do
|
127
|
+
expect(@b1.serie).not_to eq(nil)
|
128
|
+
expect(@b2.serie).not_to eq(nil)
|
129
|
+
expect(@b3.serie).to eq(nil)
|
130
|
+
end
|
131
|
+
it "Existe editorial" do
|
132
|
+
expect(@b1.editorial).not_to eq(nil)
|
133
|
+
expect(@b2.editorial).not_to eq(nil)
|
134
|
+
expect(@b3.editorial).not_to eq(nil)
|
135
|
+
end
|
136
|
+
it "Existe edicion" do
|
137
|
+
expect(@b1.n_edicion).not_to eq(nil)
|
138
|
+
expect(@b2.n_edicion).not_to eq(nil)
|
139
|
+
expect(@b3.n_edicion).not_to eq(nil)
|
140
|
+
end
|
141
|
+
it "Existe fecha" do
|
142
|
+
expect(@b1.fecha_publicacion).not_to eq(nil)
|
143
|
+
expect(@b2.fecha_publicacion).not_to eq(nil)
|
144
|
+
expect(@b3.fecha_publicacion).not_to eq(nil)
|
145
|
+
end
|
146
|
+
it "Existe isbn" do
|
147
|
+
expect(@b1.isbn).not_to eq(nil)
|
148
|
+
expect(@b2.isbn).not_to eq(nil)
|
149
|
+
expect(@b3.isbn).not_to eq(nil)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe "Comprobacion de una correcta construccion de Periodico" do
|
154
|
+
it "Existe al menos un autor" do
|
155
|
+
expect(@p1.autores).not_to eq(nil)
|
156
|
+
expect(@p2.autores).not_to eq(nil)
|
157
|
+
expect(@p3.autores).not_to eq(nil)
|
158
|
+
end
|
159
|
+
it "Existe titulo" do
|
160
|
+
expect(@p1.titulo).not_to eq(nil)
|
161
|
+
expect(@p2.titulo).not_to eq(nil)
|
162
|
+
expect(@p3.titulo).not_to eq(nil)
|
163
|
+
end
|
164
|
+
it "Existe editorial" do
|
165
|
+
expect(@p1.editorial).not_to eq(nil)
|
166
|
+
expect(@p2.editorial).not_to eq(nil)
|
167
|
+
expect(@p3.editorial).not_to eq(nil)
|
168
|
+
end
|
169
|
+
it "Existe fecha" do
|
170
|
+
expect(@p1.fecha_publicacion).not_to eq(nil)
|
171
|
+
expect(@p2.fecha_publicacion).not_to eq(nil)
|
172
|
+
expect(@p3.fecha_publicacion).not_to eq(nil)
|
173
|
+
end
|
174
|
+
it "Existe pagina de inicio" do
|
175
|
+
expect(@p1.pinicio).not_to eq(nil)
|
176
|
+
expect(@p2.pinicio).not_to eq(nil)
|
177
|
+
expect(@p3.pinicio).not_to eq(nil)
|
178
|
+
end
|
179
|
+
it "Existe pagina de fin" do
|
180
|
+
expect(@p1.pfin).to eq(nil)
|
181
|
+
expect(@p2.pfin).not_to eq(nil)
|
182
|
+
expect(@p3.pfin).not_to eq(nil)
|
183
|
+
end
|
184
|
+
it "Existe issn" do
|
185
|
+
expect(@p1.issn).not_to eq(nil)
|
186
|
+
expect(@p2.issn).not_to eq(nil)
|
187
|
+
expect(@p3.issn).not_to eq(nil)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe "Comprobacion de una correcta construccion de Revista" do
|
192
|
+
it "Existe al menos un autor" do
|
193
|
+
expect(@r1.autores).not_to eq(nil)
|
194
|
+
expect(@r2.autores).not_to eq(nil)
|
195
|
+
expect(@r3.autores).not_to eq(nil)
|
196
|
+
end
|
197
|
+
it "Existe titulo" do
|
198
|
+
expect(@r1.titulo).not_to eq(nil)
|
199
|
+
expect(@r2.titulo).not_to eq(nil)
|
200
|
+
expect(@r3.titulo).not_to eq(nil)
|
201
|
+
end
|
202
|
+
it "Existe editorial" do
|
203
|
+
expect(@r1.editorial).not_to eq(nil)
|
204
|
+
expect(@r2.editorial).not_to eq(nil)
|
205
|
+
expect(@r3.editorial).not_to eq(nil)
|
206
|
+
end
|
207
|
+
it "Existe fecha" do
|
208
|
+
expect(@r1.fecha_publicacion).not_to eq(nil)
|
209
|
+
expect(@r2.fecha_publicacion).not_to eq(nil)
|
210
|
+
expect(@r3.fecha_publicacion).not_to eq(nil)
|
211
|
+
end
|
212
|
+
it "Existe pagina de inicio" do
|
213
|
+
expect(@r1.pinicio).not_to eq(nil)
|
214
|
+
expect(@r2.pinicio).not_to eq(nil)
|
215
|
+
expect(@r3.pinicio).not_to eq(nil)
|
216
|
+
end
|
217
|
+
it "Existe pagina de fin" do
|
218
|
+
expect(@r1.pfin).to eq(nil)
|
219
|
+
expect(@r2.pfin).not_to eq(nil)
|
220
|
+
expect(@r3.pfin).not_to eq(nil)
|
221
|
+
end
|
222
|
+
it "Existe issn" do
|
223
|
+
expect(@r1.issn).not_to eq(nil)
|
224
|
+
expect(@r2.issn).not_to eq(nil)
|
225
|
+
expect(@r3.issn).not_to eq(nil)
|
226
|
+
end
|
227
|
+
it "Existe numero de revista" do
|
228
|
+
expect(@r1.numero).not_to eq(nil)
|
229
|
+
expect(@r2.numero).not_to eq(nil)
|
230
|
+
expect(@r3.numero).not_to eq(nil)
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
describe "Comprobacion de una correcta construccion de Documento Electronico" do
|
235
|
+
it "Existe al menos un autor" do
|
236
|
+
expect(@e1.autores).not_to eq(nil)
|
237
|
+
expect(@e2.autores).not_to eq(nil)
|
238
|
+
expect(@e3.autores).not_to eq(nil)
|
239
|
+
end
|
240
|
+
it "Existe titulo" do
|
241
|
+
expect(@e1.titulo).not_to eq(nil)
|
242
|
+
expect(@e2.titulo).not_to eq(nil)
|
243
|
+
expect(@e3.titulo).not_to eq(nil)
|
244
|
+
end
|
245
|
+
it "Existe editorial" do
|
246
|
+
expect(@e1.editorial).not_to eq(nil)
|
247
|
+
expect(@e2.editorial).not_to eq(nil)
|
248
|
+
expect(@e3.editorial).not_to eq(nil)
|
249
|
+
end
|
250
|
+
it "Existe fecha" do
|
251
|
+
expect(@e1.fecha_publicacion).not_to eq(nil)
|
252
|
+
expect(@e2.fecha_publicacion).not_to eq(nil)
|
253
|
+
expect(@e3.fecha_publicacion).not_to eq(nil)
|
254
|
+
end
|
255
|
+
it "Existe pagina de inicio" do
|
256
|
+
expect(@e1.pinicio).not_to eq(nil)
|
257
|
+
expect(@e2.pinicio).not_to eq(nil)
|
258
|
+
expect(@e3.pinicio).not_to eq(nil)
|
259
|
+
end
|
260
|
+
it "Existe pagina de fin" do
|
261
|
+
expect(@e1.pfin).to eq(nil)
|
262
|
+
expect(@e2.pfin).not_to eq(nil)
|
263
|
+
expect(@e3.pfin).not_to eq(nil)
|
264
|
+
end
|
265
|
+
it "Existe issn" do
|
266
|
+
expect(@e1.issn).not_to eq(nil)
|
267
|
+
expect(@e2.issn).not_to eq(nil)
|
268
|
+
expect(@e3.issn).not_to eq(nil)
|
269
|
+
end
|
270
|
+
it "Existe numero de revista" do
|
271
|
+
expect(@e1.url).not_to eq(nil)
|
272
|
+
expect(@e2.url).not_to eq(nil)
|
273
|
+
expect(@e3.url).not_to eq(nil)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
describe "Comprobacion de un correcto funcionamiento de los metodos de Libro" do
|
278
|
+
it "Test metodo autor" do
|
279
|
+
expect(@b1.autores).to eq(["Fowler, C.", "Hunt, A.", "Thomas, D."])
|
280
|
+
expect(@b2.autores).to eq(["Chacon, S."])
|
281
|
+
expect(@b3.autores).to eq(["Flanagan, D.", "Matsumoto, Y."])
|
282
|
+
end
|
283
|
+
it "Test metodo titulo" do
|
284
|
+
expect(@b1.titulo).to eq("Programming Ruby 1.9 & 2.0: The Pragmatic Programmers Guide")
|
285
|
+
expect(@b2.titulo).to eq("Pro Git 2009th Edition")
|
286
|
+
expect(@b3.titulo).to eq("The Ruby Programming Language")
|
287
|
+
end
|
288
|
+
it "Test metodo serie" do
|
289
|
+
expect(@b1.serie).to eq("The Facets of Ruby")
|
290
|
+
expect(@b2.serie).to eq("Pro")
|
291
|
+
expect(@b3.serie).to eq(nil)
|
292
|
+
end
|
293
|
+
it "Test metodo editorial" do
|
294
|
+
expect(@b1.editorial).to eq("Pragmatic Bookshelf")
|
295
|
+
expect(@b2.editorial).to eq("Apress")
|
296
|
+
expect(@b3.editorial).to eq("O'Reilly Media")
|
297
|
+
end
|
298
|
+
it "Test metodo edicion" do
|
299
|
+
expect(@b1.n_edicion).to eq(4)
|
300
|
+
expect(@b2.n_edicion).to eq(2009)
|
301
|
+
expect(@b3.n_edicion).to eq(1)
|
302
|
+
end
|
303
|
+
it "Test metodo fecha" do
|
304
|
+
expect(@b1.fecha_publicacion.to_s).to eq("2013-07-07")
|
305
|
+
expect(@b2.fecha_publicacion.to_s).to eq("2009-08-27")
|
306
|
+
expect(@b3.fecha_publicacion.to_s).to eq("2008-02-04")
|
307
|
+
end
|
308
|
+
it "Test metodo isbn" do
|
309
|
+
expect(@b1.isbn).to eq(["978-1937785499", "1937785491"])
|
310
|
+
expect(@b2.isbn).to eq(["978-1430218333", "1430218339"])
|
311
|
+
expect(@b3.isbn).to eq(["0596516177", "978-0596516178"])
|
312
|
+
end
|
313
|
+
it "Test metodo to_s (nos devuelve una referencia formateada)" do
|
314
|
+
expect(@b1.to_s).to eq(@b1.to_s)
|
315
|
+
expect(@b2.to_s).to eq(@b2.to_s)
|
316
|
+
expect(@b3.to_s).to eq(@b3.to_s)
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
describe "Lanzamiento de errores al construir Libro" do
|
321
|
+
it "Debe haber un autor" do
|
322
|
+
expect { Libro.new(nil, "titulo", "serie", "editorial", 1, "1-1-1991", ["isbn1", "isbn2"]) }.to raise_error(ArgumentError)
|
323
|
+
end
|
324
|
+
it "Debe haber un titulo" do
|
325
|
+
expect { Libro.new(["autor1"] , nil, "serie", "editorial", 1, "1-1-1991", ["isbn1", "isbn2"]) }.to raise_error(ArgumentError)
|
326
|
+
end
|
327
|
+
it "Debe haber una editorial" do
|
328
|
+
expect { Libro.new(["autor1","autor2","autor3"], "titulo", "serie",nil , 1, "1-1-1991", ["isbn1", "isbn2"]) }.to raise_error(ArgumentError)
|
329
|
+
end
|
330
|
+
it "Debe haber una edicion" do
|
331
|
+
expect { Libro.new(["autor1","autor2","autor3"], "titulo", "serie", "editorial",nil , "1-1-1991", ["isbn1", "isbn2"]) }.to raise_error(ArgumentError)
|
332
|
+
end
|
333
|
+
it "Debe haber una fecha de publicacion" do
|
334
|
+
expect { Libro.new(["autor1","autor2","autor3"], "titulo", "serie", "editorial", 1,nil , ["isbn1", "isbn2"]) }.to raise_error(ArgumentError)
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
describe "Comprobacion de una correcta construccion de la lista" do
|
339
|
+
it "Existe al menos un Nodo" do
|
340
|
+
expect(@l1.front).not_to eq(nil)
|
341
|
+
expect(@l2.front).not_to eq(nil)
|
342
|
+
end
|
343
|
+
it "Los nodos tienen un valor, un sucesor y un predecesor" do
|
344
|
+
expect(@l1.front.value).to eq(nil)
|
345
|
+
expect(@l1.front.next).to eq(nil)
|
346
|
+
expect(@l1.front.previous).to eq(nil)
|
347
|
+
expect(@l1.end.value).to eq(nil)
|
348
|
+
expect(@l1.end.next).to eq(nil)
|
349
|
+
expect(@l1.end.previous).to eq(nil)
|
350
|
+
expect(@l2.front.value).not_to eq(nil)
|
351
|
+
expect(@l2.front.next).to eq(nil)
|
352
|
+
expect(@l2.front.previous).to eq(nil)
|
353
|
+
expect(@l2.end.value).not_to eq(nil)
|
354
|
+
expect(@l2.end.next).to eq(nil)
|
355
|
+
expect(@l2.end.previous).to eq(nil)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
describe "Comprobacion del funcionamiento del enlace entre Nodos" do
|
360
|
+
it "Test enlace nodos" do
|
361
|
+
expect(@l1.front.value).to eq(nil)
|
362
|
+
expect(@l2.front.value).to eq(@b1)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
describe "Comprobacion del funcionamiento de los metodos de la lista" do
|
367
|
+
it "Se inserta un elemento al principo de la lista" do
|
368
|
+
@l1.push_front(@b3)
|
369
|
+
expect(@l1.front.value).to eq(@b3)
|
370
|
+
@l2.push_front(@b3)
|
371
|
+
expect(@l2.front.value).to eq(@b3)
|
372
|
+
end
|
373
|
+
it "Se inserta un elemento al final de la lista" do
|
374
|
+
@l1.push_back(@b1)
|
375
|
+
expect(@l1.get_pos(@l1.size-1).value).to eq(@b1)
|
376
|
+
@l2.push_back(@b2)
|
377
|
+
expect(@l2.get_pos(@l2.size-1).value).to eq(@b2)
|
378
|
+
end
|
379
|
+
it "Se extrae el primer elemento de la lista" do
|
380
|
+
expect(@l1.pop_front).to eq(nil)
|
381
|
+
expect(@l2.pop_front).to eq(@b1)
|
382
|
+
end
|
383
|
+
it "Se extrae el ultimo elemento de la lista" do
|
384
|
+
expect(@l1.pop_back).to eq(nil)
|
385
|
+
expect(@l2.pop_back).to eq(@b1)
|
386
|
+
end
|
387
|
+
it "Se inserta un elemento a la lista" do
|
388
|
+
@l1.insert(0, @b1)
|
389
|
+
expect(@l1.front.value).to eq(@b1)
|
390
|
+
end
|
391
|
+
it "Se insertan varios elementos a la lista" do
|
392
|
+
@l1.insert(0, @b1)
|
393
|
+
expect(@l1.front.value).to eq(@b1)
|
394
|
+
@l1.insert(1, @b2)
|
395
|
+
expect(@l1.get_pos(1).value).to eq(@b2)
|
396
|
+
@l1.insert(2, @b3)
|
397
|
+
expect(@l1.get_pos(2).value).to eq(@b3)
|
398
|
+
end
|
399
|
+
end
|
400
|
+
|
401
|
+
describe "Comprobacion de las comparaciones" do
|
402
|
+
it "Test mayor que" do
|
403
|
+
expect(@b1 > @b2).to be true
|
404
|
+
expect(@b3 > @b2).to be true
|
405
|
+
end
|
406
|
+
it "Test mayor o igual que" do
|
407
|
+
expect(@b1 >= @b2).to be true
|
408
|
+
expect(@b3 >= @b2).to be true
|
409
|
+
end
|
410
|
+
it "Test menor que" do
|
411
|
+
expect(@b2 < @b1).to be true
|
412
|
+
expect(@b2 < @b3).to be true
|
413
|
+
end
|
414
|
+
it "Test menor o igual que" do
|
415
|
+
expect(@b2 <= @b1).to be true
|
416
|
+
expect(@b2 <= @b3).to be true
|
417
|
+
expect(@b3 <= @b3).to be true
|
418
|
+
end
|
419
|
+
it "Test igual que" do
|
420
|
+
expect(@b1 == @b1).to be true
|
421
|
+
expect(@b2 == @b2).to be true
|
422
|
+
end
|
423
|
+
it "Test distinto que" do
|
424
|
+
expect(@b3 != @b2).to be true
|
425
|
+
expect(@b1 != @b2).to be true
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
describe "Comprobacion Enumerable" do
|
430
|
+
it "comprobrando el metodo all? con un bloque vacio" do
|
431
|
+
expect(@l1.all?).to eq(true)
|
432
|
+
expect(@l2.all?).to eq(true)
|
433
|
+
end
|
434
|
+
it "comprobrando el metodo any?" do
|
435
|
+
expect(@l1.any?).to eq(false)
|
436
|
+
expect(@l2.any?).to eq(true)
|
437
|
+
end
|
438
|
+
it "comprobrando el metodo collect" do
|
439
|
+
expect(@l1.map{|i| i}).to eq([])
|
440
|
+
expect(@l2.map{|i| i}).to eq([@b1])
|
441
|
+
expect(@l2.collect{|i| i}).to eq([@b1])
|
442
|
+
end
|
443
|
+
it "comprobrando el metodo count" do
|
444
|
+
expect(@l1.count).to eq(0)
|
445
|
+
expect(@l2.count).to eq(1)
|
446
|
+
expect(@l3.count).to eq(2)
|
447
|
+
end
|
448
|
+
it "comprobrando el metodo detect" do
|
449
|
+
expect(@l3.detect {|i| i == @b3}).to eq(nil)
|
450
|
+
expect(@l3.detect {|i| i == @p2}).to eq(@p2)
|
451
|
+
expect(@l3.find {|i| i == @b3}).to eq(nil)
|
452
|
+
expect(@l3.find {|i| i == @p1}).to eq(@p1)
|
453
|
+
end
|
454
|
+
it "comprobrando drop" do
|
455
|
+
expect(@l3.drop(1)).to eq([@p1])
|
456
|
+
end
|
457
|
+
it "comprobrando max" do
|
458
|
+
expect(@l3.max).to eq(@p2)
|
459
|
+
end
|
460
|
+
it "comprobrando min" do
|
461
|
+
expect(@l3.min).to eq(@p1)
|
462
|
+
end
|
463
|
+
it "comprobrando sort" do
|
464
|
+
expect(@l3.sort).to eq([@p1,@p2])
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
#@r11 = Revista.new(["autor apellido"], "Titulo", "Revista", "07/07/2013", 10, 1, nil, "123456789")
|
469
|
+
#@r12 = Revista.new(["autor apellido", "autor2 apellido2"], "Titulo2", "Revista2", "08/08/2013", 11, 1, 2, "123456789")
|
470
|
+
#@r13 = Revista.new(["autor apellido", "autor2 apellido2"], "Titulo3", "Revista2", "07/09/2013", 11, 1, 2, "123456789")
|
471
|
+
#@r14 = Revista.new(["autor apellido"], "Titulo3", "Revista3", "08/08/2013", 12, 1, 100, "123456789")
|
472
|
+
|
473
|
+
describe "Comprobacion con las comparaciones de las Citas" do
|
474
|
+
it "Test mayor que" do
|
475
|
+
expect(@r12 > @r11).to be true
|
476
|
+
expect(@r13 > @r12).to be true
|
477
|
+
expect(@r14 > @r11).to be true
|
478
|
+
end
|
479
|
+
it "Test mayor o igual que" do
|
480
|
+
expect(@r12 >= @r11).to be true
|
481
|
+
expect(@r13 >= @r12).to be true
|
482
|
+
expect(@r14 >= @r11).to be true
|
483
|
+
end
|
484
|
+
it "Test menor que" do
|
485
|
+
expect(@r11 < @r12).to be true
|
486
|
+
expect(@r12 < @r13).to be true
|
487
|
+
expect(@r11 < @r14).to be true
|
488
|
+
end
|
489
|
+
it "Test menor o igual que" do
|
490
|
+
expect(@r11 <= @r12).to be true
|
491
|
+
expect(@r12 <= @r13).to be true
|
492
|
+
expect(@r11 <= @r14).to be true
|
493
|
+
end
|
494
|
+
it "Test igual que" do
|
495
|
+
expect(@r11 == @r11).to be true
|
496
|
+
expect(@r12 == @r12).to be true
|
497
|
+
end
|
498
|
+
it "Test distinto que" do
|
499
|
+
expect(@r13 != @r12).to be true
|
500
|
+
expect(@r11 != @r14).to be true
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
504
|
+
#@b1 = Libro.new(["Dave Thomas", "Andy Hunt", "Chad Fowler"], "programming ruby 1.9 & 2.0: the Pragmatic Programmers Guide", "The Facets of Ruby", "Pragmatic Bookshelf", 4, "07/07/2013", ["978-1937785499", "1937785491"])
|
505
|
+
#@b2 = Libro.new(["Scott Chacon"], "Pro Git 2009th Edition", "Pro", "Apress" , 2009, "27/08/2009", ["978-1430218333", "1430218339"])
|
506
|
+
#@b3 = Libro.new(["David Flanagan", "Yukihiro Matsumoto"], "The Ruby Programming Language", nil, "O'Reilly Media", 1, "04/02/2008", ["0596516177", "978-0596516178"])
|
507
|
+
#@bx = Libro.new(["Dave Thomas", "Andy Hunt", "Chad Fowler"], "the Pragmatic Programmers Guide", "The Facets of Ruby", "Pragmatic Bookshelf", 4, "08/08/2013", ["978-1937785499", "1937785491"])
|
508
|
+
|
509
|
+
describe "Comprobacion de un correcto funcionamiento del formateo de Citas" do
|
510
|
+
it "Test metodo autor" do
|
511
|
+
expect(@b1.autores).to eq(["Fowler, C.", "Hunt, A.", "Thomas, D."])
|
512
|
+
expect(@b2.autores).to eq(["Chacon, S."])
|
513
|
+
expect(@b3.autores).to eq(["Flanagan, D.", "Matsumoto, Y."])
|
514
|
+
end
|
515
|
+
it "Test metodo titulo" do
|
516
|
+
expect(@b1.titulo).to eq("Programming Ruby 1.9 & 2.0: The Pragmatic Programmers Guide")
|
517
|
+
expect(@b2.titulo).to eq("Pro Git 2009th Edition")
|
518
|
+
expect(@b3.titulo).to eq("The Ruby Programming Language")
|
519
|
+
end
|
520
|
+
it "Test metodo to_s (nos devuelve una referencia formateada)" do
|
521
|
+
expect(@b1.to_s).to eq("Fowler, C., Hunt, A., Thomas, D..\n\tProgramming Ruby 1.9 & 2.0: The Pragmatic Programmers Guide\n\tThe Facets of Ruby\n\tPragmatic Bookshelf; 4 edición (07, July 2013)\n\tISBN-13: 978-1937785499\n\tISBN-10: 1937785491\n\t")
|
522
|
+
expect(@b2.to_s).to eq("Chacon, S..\n\tPro Git 2009th Edition\n\tPro\n\tApress; 2009 edición (27, August 2009)\n\tISBN-13: 978-1430218333\n\tISBN-10: 1430218339\n\t")
|
523
|
+
end
|
524
|
+
it "Test de formateo al existir dos referencias en las que solo varia el titulo" do
|
525
|
+
expect(@b1 < @bx).to be true
|
526
|
+
expect(@b1.to_s).to eq("Fowler, C., Hunt, A., Thomas, D..\n\tProgramming Ruby 1.9 & 2.0: The Pragmatic Programmers Guide\n\tThe Facets of Ruby\n\tPragmatic Bookshelf; 4 edición (07, July 2013 JUL)\n\tISBN-13: 978-1937785499\n\tISBN-10: 1937785491\n\t")
|
527
|
+
expect(@bx.to_s).to eq("Fowler, C., Hunt, A., Thomas, D..\n\tThe Pragmatic Programmers Guide\n\tThe Facets of Ruby\n\tPragmatic Bookshelf; 4 edición (08, August 2013 AGO)\n\tISBN-13: 978-1937785499\n\tISBN-10: 1937785491\n\t")
|
528
|
+
end
|
529
|
+
it "Test de la lista de citas" do
|
530
|
+
@l10.push_front(@b1)
|
531
|
+
@l10.push_front(@bx)
|
532
|
+
expect(@l10.sort).to eq([@b1,@bx])
|
533
|
+
end
|
534
|
+
end
|
535
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "biblio"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/doc/=.html
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>= - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
</script>
|
12
|
+
|
13
|
+
<script src="./js/jquery.js"></script>
|
14
|
+
<script src="./js/darkfish.js"></script>
|
15
|
+
|
16
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<body id="top" role="document" class="file">
|
22
|
+
<nav role="navigation">
|
23
|
+
<div id="project-navigation">
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
+
<h2>
|
26
|
+
<a href="./index.html" rel="home">Home</a>
|
27
|
+
</h2>
|
28
|
+
|
29
|
+
<div id="table-of-contents-navigation">
|
30
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
31
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
32
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
+
<form action="#" method="get" accept-charset="utf-8">
|
38
|
+
<div id="search-field-wrapper">
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
46
|
+
aria-busy="false" aria-expanded="false"
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
+
</form>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<div id="project-metadata">
|
56
|
+
<div id="fileindex-section" class="nav-section">
|
57
|
+
<h3>Pages</h3>
|
58
|
+
|
59
|
+
<ul class="link-list">
|
60
|
+
|
61
|
+
<li><a href="./=.html">=</a>
|
62
|
+
|
63
|
+
<li><a href="./CODE_OF_CONDUCT_md.html">CODE_OF_CONDUCT</a>
|
64
|
+
|
65
|
+
<li><a href="./Gemfile.html">Gemfile</a>
|
66
|
+
|
67
|
+
<li><a href="./Gemfile_lock.html">Gemfile.lock</a>
|
68
|
+
|
69
|
+
<li><a href="./Guardfile.html">Guardfile</a>
|
70
|
+
|
71
|
+
<li><a href="./LICENSE_txt.html">LICENSE</a>
|
72
|
+
|
73
|
+
<li><a href="./README_md.html">README</a>
|
74
|
+
|
75
|
+
<li><a href="./Rakefile.html">Rakefile</a>
|
76
|
+
|
77
|
+
<li><a href="./biblio_gemspec.html">biblio.gemspec</a>
|
78
|
+
|
79
|
+
<li><a href="./bin/setup.html">setup</a>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
</nav>
|
86
|
+
|
87
|
+
<main role="main" aria-label="Page =">
|
88
|
+
</main>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<footer id="validator-badges" role="contentinfo">
|
93
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
94
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
95
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
96
|
+
</footer>
|
97
|
+
|