ExamSimple 1.0.0
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.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Exam.gemspec +28 -0
- data/Gemfile +8 -0
- data/Guardfile +41 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/README.rdoc +0 -0
- data/Rakefile +24 -0
- data/doc/prct10.pdf +0 -0
- data/doc/prct11.pdf +0 -0
- data/doc/prct5.pdf +0 -0
- data/doc/prct6.pdf +0 -0
- data/doc/prct7.pdf +0 -0
- data/doc/prct8.pdf +0 -0
- data/doc/prct9.pdf +0 -0
- data/doc/test/index.html +467 -0
- data/html/Exam.html +316 -0
- data/html/Examui.html +230 -0
- data/html/List.html +469 -0
- data/html/Object.html +119 -0
- data/html/Question.html +357 -0
- data/html/README_rdoc.html +82 -0
- data/html/TrueOrFalse.html +169 -0
- data/html/created.rid +10 -0
- data/html/fonts.css +167 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +102 -0
- data/html/js/darkfish.js +140 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +580 -0
- data/html/table_of_contents.html +159 -0
- data/lib/Exam.rb +2 -0
- data/lib/Exam/base.rb +5 -0
- data/lib/Exam/examen.rb +37 -0
- data/lib/Exam/examui.rb +27 -0
- data/lib/Exam/list.rb +106 -0
- data/lib/Exam/question.rb +44 -0
- data/lib/Exam/quiz.rb +52 -0
- data/lib/Exam/trueorfalse.rb +15 -0
- data/lib/Exam/version.rb +5 -0
- data/spec/Exam_spec.rb +392 -0
- data/spec/spec_helper.rb +98 -0
- metadata +226 -0
data/lib/Exam/version.rb
ADDED
data/spec/Exam_spec.rb
ADDED
@@ -0,0 +1,392 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'Exam'
|
4
|
+
|
5
|
+
class Question
|
6
|
+
describe Exam do
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
@q = Question.new(:qt => '1+1=', :r1 => 2, :wrong => [3,5,7])
|
10
|
+
end
|
11
|
+
|
12
|
+
context "Simple_Selection" do
|
13
|
+
|
14
|
+
it ":Debe existir una pregunta" do
|
15
|
+
expect(@q.qt)== '1+1='
|
16
|
+
end
|
17
|
+
|
18
|
+
it ":Deben existir opciones de respuesta" do
|
19
|
+
expect(@q.r1)== 2
|
20
|
+
expect(@q.wrong)== [3,5,7]
|
21
|
+
end
|
22
|
+
|
23
|
+
it ":Debe existir un grado de dificultad por defecto" do
|
24
|
+
expect(@q.difficulty)== 1
|
25
|
+
end
|
26
|
+
|
27
|
+
it ":Debe permitir dar valor a la dificultad" do
|
28
|
+
a = Question.new(:qt => '1+1=', :r1 => 2, :wrong => [3,5,7], :difficulty => 3)
|
29
|
+
expect(a.difficulty).to eq(3)
|
30
|
+
end
|
31
|
+
|
32
|
+
it ":Se debe invocar un método para obtener la dificultad" do
|
33
|
+
expect(@q).to respond_to :difficulty
|
34
|
+
end
|
35
|
+
|
36
|
+
it ":Se debe invocar un método para obtener la pregunta" do
|
37
|
+
expect(@q).to respond_to :qt
|
38
|
+
end
|
39
|
+
|
40
|
+
it ":Se debe invocar a un método para obtener las opciones de respuesta" do
|
41
|
+
expect(@q).to respond_to :r1
|
42
|
+
expect(@q).to respond_to :wrong
|
43
|
+
end
|
44
|
+
|
45
|
+
it ":Se deben mostrar por la pantalla la pregunta y las opciones" do
|
46
|
+
expect(@q).to respond_to :to_s
|
47
|
+
end
|
48
|
+
|
49
|
+
it ":Se pueden comparar las preguntas" do
|
50
|
+
p = Question.new(:qt => "1+2=", :r1 => 3, :wrong => [1, 2, 4], :difficulty => 2)
|
51
|
+
expect(@q<p).to eq(true)
|
52
|
+
expect(@q>p).to eq(false)
|
53
|
+
expect(@q<=p).to eq(true)
|
54
|
+
expect(@q>=p).to eq(false)
|
55
|
+
expect(@q==p).to eq(false)
|
56
|
+
end
|
57
|
+
|
58
|
+
it ":Debe existir el módulo Comparable" do
|
59
|
+
expect(@q).to be_kind_of (Comparable)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class TrueOrFalse
|
67
|
+
describe Exam do
|
68
|
+
|
69
|
+
before :each do
|
70
|
+
@q = TrueOrFalse.new(:qt => '¿Es verdad que 2+2=4 ?', :r1 => true)
|
71
|
+
end
|
72
|
+
|
73
|
+
context "TrueOrFalse" do
|
74
|
+
|
75
|
+
it "*Debe ser una instancia de la clase Question" do
|
76
|
+
expect(@q).instance_of? (Question)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "*Debe existir una pregunta" do
|
80
|
+
expect(@q.qt)== '¿Es verdad que 2+2=4 ?'
|
81
|
+
end
|
82
|
+
|
83
|
+
it "*Deben existir opciones de respuesta" do
|
84
|
+
expect(@q.r1)== "Cierto"
|
85
|
+
expect(@q.wrong)== "Falso"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "*Debe existir un grado de dificultad por defecto" do
|
89
|
+
expect(@q.difficulty)== 1
|
90
|
+
end
|
91
|
+
|
92
|
+
it "*Debe permitir dar valor a la dificultad" do
|
93
|
+
a = TrueOrFalse.new(:qt => '1+1=', :r1 => 2, :wrong => [3,5,7], :difficulty => 3)
|
94
|
+
expect(a.difficulty).to eq(3)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "*Se debe invocar un método para obtener la dificultad" do
|
98
|
+
expect(@q).to respond_to :difficulty
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
it "*Se debe invocar un método para obtener la pregunta" do
|
103
|
+
expect(@q).to respond_to :qt
|
104
|
+
end
|
105
|
+
|
106
|
+
it "*Se debe invocar a un método para obtener las opciones de respuesta" do
|
107
|
+
expect(@q).to respond_to :r1
|
108
|
+
expect(@q).to respond_to :wrong
|
109
|
+
end
|
110
|
+
|
111
|
+
it "*Se deben mostrar por la pantalla la pregunta y las opciones" do
|
112
|
+
expect(@q).to respond_to :to_s
|
113
|
+
end
|
114
|
+
|
115
|
+
it "*Debe existir el módulo Comparable" do
|
116
|
+
expect(@q).to be_kind_of (Comparable)
|
117
|
+
end
|
118
|
+
|
119
|
+
it "*Se pueden comparar las preguntas" do
|
120
|
+
p = TrueOrFalse.new(:qt => "¿1+2=3?", :r1 => true, :difficulty => 2)
|
121
|
+
expect(@q<p).to eq(true)
|
122
|
+
expect(@q>p).to eq(false)
|
123
|
+
expect(@q<=p).to eq(true)
|
124
|
+
expect(@q>=p).to eq(false)
|
125
|
+
expect(@q==p).to eq(false)
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
class List
|
133
|
+
describe Exam do
|
134
|
+
|
135
|
+
before :each do
|
136
|
+
@q = Question.new(:qt => '2+2=', :r1 => 4, :wrong => [2,5,8])
|
137
|
+
@n = Node.new (@q)
|
138
|
+
@l = List.new(@q)
|
139
|
+
end
|
140
|
+
|
141
|
+
context "Node" do
|
142
|
+
it "#Debe existir un Nodo de la lista con sus datos y su siguiente" do
|
143
|
+
expect(@n.value)==@q
|
144
|
+
expect(@n.next)==nil
|
145
|
+
expect(@n.prev)==nil
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
context "List" do
|
150
|
+
|
151
|
+
it "#Se extrae el primer elemento de la lista" do
|
152
|
+
expect(@l).to respond_to :pop
|
153
|
+
expect(@l.pop)==@q
|
154
|
+
end
|
155
|
+
|
156
|
+
it "#Se puede insertar un elemento" do
|
157
|
+
a = @q
|
158
|
+
expect(@l).to respond_to :push
|
159
|
+
expect(@l.push(a))==a
|
160
|
+
end
|
161
|
+
|
162
|
+
it "#Se pueden insertar varios elementos" do
|
163
|
+
a = [@q, @q, @q]
|
164
|
+
expect(@l).to respond_to :push
|
165
|
+
expect(@l.push(a))==a
|
166
|
+
end
|
167
|
+
|
168
|
+
it "#Debe existir una Lista con su cabeza" do
|
169
|
+
expect(@l).to respond_to :head
|
170
|
+
end
|
171
|
+
|
172
|
+
it "#Debe mostrarse correctamente" do
|
173
|
+
text = "\n¿Cuál es la salida del siguiente código Ruby?\nclass Xyz\n\sdef pots\n\s\s@nice\n\send\nend\n\nxyz = Xyz.new\np xyz.pots"
|
174
|
+
list = List.new(Question.new(:qt => text, :r1 =>"nil", :wrong => ["#<Xyz:0xa000208>","0","Ninguna de las anteriores"]))
|
175
|
+
|
176
|
+
text = "La siguiente definición de un hash en Ruby es válida:\nhash_raro = {\n\s[1, 2, 3] => Object.new(),\nHash.new => :toto\n}"
|
177
|
+
list.push(TrueOrFalse.new(:qt => text, :r1 => false))
|
178
|
+
|
179
|
+
text = %Q{¿Cuál es la salida del siguiente código Ruby?\nclass Array\n\sdef say_hi\n\s\s"HEY!"\n\send\nend\n p [1, "bob"].say_hi}
|
180
|
+
list.push(Question.new(:qt => text, :r1 =>"HEY!", :wrong => ["1","bob","Ninguna de las anteriores"]))
|
181
|
+
|
182
|
+
text = "¿Cuál es el tipo del objeto en el siguiente código Ruby?\nclass Objeto\nend"
|
183
|
+
list.push(Question.new(:qt => text, :r1 =>"Una instancia de la clase Class", :wrong => ["Una Constante", "Un Objeto", "Ninguna de las anteriores"]))
|
184
|
+
|
185
|
+
text = "Es apropiado que una clase Tablero herede de una clase Juego"
|
186
|
+
list.push(TrueOrFalse.new(:qt => text, :r1 => false))
|
187
|
+
|
188
|
+
expect(list.to_s).to match(/(\d+-(.|\s|\n)+)+/)
|
189
|
+
end
|
190
|
+
|
191
|
+
it "#Debe existir el modulo Enumerable" do
|
192
|
+
expect(@l).to be_kind_of (Enumerable)
|
193
|
+
end
|
194
|
+
|
195
|
+
it "#Debe poder ordenarse" do
|
196
|
+
a = TrueOrFalse.new(:qt => "Es apropiado que una clase Tablero herede de una clase Juego", :r1 => false, :difficulty => 0)
|
197
|
+
@l.push(a)
|
198
|
+
expect(@l.sort).to eq([a, @q])
|
199
|
+
end
|
200
|
+
|
201
|
+
it "#Debe conocer el nodo de mayor dificultad" do
|
202
|
+
p = TrueOrFalse.new(:qt => "¿1+2=3?", :r1 => true, :difficulty => 2)
|
203
|
+
@l.push(p)
|
204
|
+
expect(@l.max).to eq(p)
|
205
|
+
end
|
206
|
+
|
207
|
+
it "#Debe conocer el nodo de menor dificultad" do
|
208
|
+
p = TrueOrFalse.new(:qt => "¿1+2=3?", :r1 => true, :difficulty => 2)
|
209
|
+
@l.push(p)
|
210
|
+
expect(@l.min).to eq(@q)
|
211
|
+
end
|
212
|
+
|
213
|
+
it "#Debe poder usarse all?" do
|
214
|
+
p = TrueOrFalse.new(:qt => "¿1+2=3?", :r1 => true, :difficulty => 2)
|
215
|
+
@l.push(p)
|
216
|
+
expect(@l.all?{|x| x.difficulty >= 1}).to eq(true)
|
217
|
+
end
|
218
|
+
|
219
|
+
it "#Debe poder usar any?" do
|
220
|
+
p = TrueOrFalse.new(:qt => "¿1+2=3?", :r1 => true, :difficulty => 2)
|
221
|
+
@l.push(p)
|
222
|
+
expect(@l.any?{|x| x.difficulty <= 0}).to eq(false)
|
223
|
+
end
|
224
|
+
|
225
|
+
it "#Debe poder contar las repeticiones de un mismo nodo" do
|
226
|
+
p = TrueOrFalse.new(:qt => "¿1+2=3?", :r1 => true, :difficulty => 2)
|
227
|
+
@l.push(p)
|
228
|
+
expect(@l.count(p))==1
|
229
|
+
end
|
230
|
+
|
231
|
+
it "#Debe tener un método inverter" do
|
232
|
+
expect(@l).to respond_to :inverter
|
233
|
+
end
|
234
|
+
|
235
|
+
it "#Debe tener un método invert que sea privado" do
|
236
|
+
expect(@l.private_methods.include? :invert).to eq(true)
|
237
|
+
end
|
238
|
+
|
239
|
+
it "#Debe ser capaz de invertir la lista" do
|
240
|
+
a = Question.new(:qt => '1+2=', :r1 => 3, :wrong => [2,5,8], :difficulty => 2)
|
241
|
+
@l.push(a)
|
242
|
+
expect(@l.inverter.pop).to eq(a)
|
243
|
+
expect(@l.inverter {false}).to eq(nil)
|
244
|
+
expect((@l.inverter {|p| p.difficulty == 2}).pop).to eq(a)
|
245
|
+
listaAux = @l.inverter {|p| p.difficulty == 2}
|
246
|
+
listaAux.pop
|
247
|
+
expect(listaAux.head == nil).to eq(true)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
class Exam
|
254
|
+
describe Exam do
|
255
|
+
|
256
|
+
before :each do
|
257
|
+
@q = Question.new(:qt => '2+2=', :r1 => 4, :wrong => [2,5,8])
|
258
|
+
@e = Exam.new(@q)
|
259
|
+
end
|
260
|
+
|
261
|
+
context "Exam" do
|
262
|
+
|
263
|
+
it "-Debe tener un atributo lista" do
|
264
|
+
expect(@e).to respond_to :exam
|
265
|
+
end
|
266
|
+
|
267
|
+
it "-Debe mostrar por pantalla el examen" do
|
268
|
+
expect(@e).to respond_to :to_s
|
269
|
+
end
|
270
|
+
|
271
|
+
it "-Debe mostrarse correctamente el examen" do
|
272
|
+
expect(@e.to_s).to match(/(\d+-(.|\s|\n)+)+/)
|
273
|
+
end
|
274
|
+
|
275
|
+
it "-Se puede insertar uno o varios elementos" do
|
276
|
+
expect(@e).to respond_to :push
|
277
|
+
end
|
278
|
+
|
279
|
+
it "-Debe tener un método que gestione las respuesta correctas" do
|
280
|
+
expect(@e).to respond_to :right
|
281
|
+
end
|
282
|
+
|
283
|
+
it "-Debe tener un método que devuelva un array con las respuestas correctas" do
|
284
|
+
@e.push(@q)
|
285
|
+
x = @e.right
|
286
|
+
expect(x[0])==@q.r1
|
287
|
+
expect(x[1])==@q.r1
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
class Examui
|
294
|
+
describe Exam do
|
295
|
+
|
296
|
+
before :each do
|
297
|
+
@q = Question.new(:qt => '2+2=', :r1 => 4, :wrong => [2,5,8])
|
298
|
+
@u = Examui.new(@q)
|
299
|
+
end
|
300
|
+
|
301
|
+
context "Exam" do
|
302
|
+
|
303
|
+
it "~Debe tener un atributo del tipo examen" do
|
304
|
+
expect(@u).to respond_to :examui
|
305
|
+
end
|
306
|
+
|
307
|
+
it "~Debe tener un método para comprobar si las respuestas dadas por el usuario son correctas" do
|
308
|
+
expect(@u).to respond_to :compare
|
309
|
+
end
|
310
|
+
|
311
|
+
it "~El método debe poder comparar una o más respuetas" do
|
312
|
+
@u.examui.push(@q)
|
313
|
+
res = [4, 4]
|
314
|
+
comp = @u.compare(res)
|
315
|
+
expect(comp[0])==true
|
316
|
+
expect(comp[1])==true
|
317
|
+
end
|
318
|
+
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
|
324
|
+
class Quiz
|
325
|
+
describe Quiz do
|
326
|
+
|
327
|
+
before :each do
|
328
|
+
@q = Quiz.new("Cuestionario LPP 05/12/2014") do
|
329
|
+
question "¿Cuantos argumentos de tipo bloque puede recibir un metodo?",
|
330
|
+
right => "1",
|
331
|
+
wrong => "2",
|
332
|
+
wrong => "muchos",
|
333
|
+
wrong => "los que defina el usuario"
|
334
|
+
|
335
|
+
question "En Ruby los bloques son objetos que contienen codigo",
|
336
|
+
wrong => "Cierto",
|
337
|
+
right => "Falso"
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
context "Quiz" do
|
342
|
+
|
343
|
+
it "~Debe tener un atributo del tipo examen" do
|
344
|
+
expect(@q).to respond_to :exam
|
345
|
+
expect(@q.exam.instance_of?Exam).to eq(true)
|
346
|
+
end
|
347
|
+
|
348
|
+
it "~Debe tener un nombre para el examen" do
|
349
|
+
expect(@q).to respond_to :name
|
350
|
+
expect(@q.name)=="Cuestionario LPP 05/12/2014"
|
351
|
+
end
|
352
|
+
|
353
|
+
it "~Debe tener una variable de clase que usaremos de contador" do
|
354
|
+
expect(@q).to respond_to :counter
|
355
|
+
expect(@q.counter)==2
|
356
|
+
end
|
357
|
+
|
358
|
+
it "~Debe tener un método right" do
|
359
|
+
expect(@q).to respond_to :right
|
360
|
+
end
|
361
|
+
|
362
|
+
it "~Debe tener un método wrong" do
|
363
|
+
expect(@q).to respond_to :wrong
|
364
|
+
end
|
365
|
+
|
366
|
+
it "~Debe tener un método question" do
|
367
|
+
expect(@q).to respond_to :question
|
368
|
+
end
|
369
|
+
|
370
|
+
it "~Debe tener un método to_s" do
|
371
|
+
expect(@q).to respond_to :to_s
|
372
|
+
end
|
373
|
+
|
374
|
+
it "~Debe tener un método run" do
|
375
|
+
expect(@q).to respond_to :run
|
376
|
+
end
|
377
|
+
|
378
|
+
it "~El método right debe devolver un símbolo" do
|
379
|
+
expect(@q.right.instance_of?Symbol).to eq(true)
|
380
|
+
end
|
381
|
+
|
382
|
+
it "~El método wrong debe devolver un array" do
|
383
|
+
expect(@q.wrong.instance_of?Array).to eq(true)
|
384
|
+
end
|
385
|
+
|
386
|
+
it "~El método question debe leer preguntas" do
|
387
|
+
expect(@q.question("3+4=", @q.right => "7", @q.wrong => "1")).to be_instance_of(Exam)
|
388
|
+
end
|
389
|
+
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
|
17
|
+
|
18
|
+
require 'coveralls'
|
19
|
+
Coveralls.wear!
|
20
|
+
|
21
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
22
|
+
RSpec.configure do |config|
|
23
|
+
# rspec-expectations config goes here. You can use an alternate
|
24
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
25
|
+
# assertions if you prefer.
|
26
|
+
config.expect_with :rspec do |expectations|
|
27
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
28
|
+
# and `failure_message` of custom matchers include text for helper methods
|
29
|
+
# defined using `chain`, e.g.:
|
30
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
31
|
+
# # => "be bigger than 2 and smaller than 4"
|
32
|
+
# ...rather than:
|
33
|
+
# # => "be bigger than 2"
|
34
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
35
|
+
end
|
36
|
+
|
37
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
38
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
39
|
+
config.mock_with :rspec do |mocks|
|
40
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
41
|
+
# a real object. This is generally recommended, and will default to
|
42
|
+
# `true` in RSpec 4.
|
43
|
+
mocks.verify_partial_doubles = true
|
44
|
+
end
|
45
|
+
|
46
|
+
# The settings below are suggested to provide a good initial experience
|
47
|
+
# with RSpec, but feel free to customize to your heart's content.
|
48
|
+
=begin
|
49
|
+
# These two settings work together to allow you to limit a spec run
|
50
|
+
# to individual examples or groups you care about by tagging them with
|
51
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
52
|
+
# get run.
|
53
|
+
config.filter_run :focus
|
54
|
+
config.run_all_when_everything_filtered = true
|
55
|
+
|
56
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
57
|
+
# For more details, see:
|
58
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
59
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
60
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
61
|
+
config.disable_monkey_patching!
|
62
|
+
|
63
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
64
|
+
# be too noisy due to issues in dependencies.
|
65
|
+
config.warnings = true
|
66
|
+
|
67
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
68
|
+
# file, and it's useful to allow more verbose output when running an
|
69
|
+
# individual spec file.
|
70
|
+
if config.files_to_run.one?
|
71
|
+
# Use the documentation formatter for detailed output,
|
72
|
+
# unless a formatter has already been configured
|
73
|
+
# (e.g. via a command-line flag).
|
74
|
+
config.default_formatter = 'doc'
|
75
|
+
end
|
76
|
+
|
77
|
+
# Print the 10 slowest examples and example groups at the
|
78
|
+
# end of the spec run, to help surface which specs are running
|
79
|
+
# particularly slow.
|
80
|
+
config.profile_examples = 10
|
81
|
+
|
82
|
+
# Run specs in random order to surface order dependencies. If you find an
|
83
|
+
# order dependency and want to debug it, you can fix the order by providing
|
84
|
+
# the seed, which is printed after each run.
|
85
|
+
# --seed 1234
|
86
|
+
config.order = :random
|
87
|
+
|
88
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
89
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
90
|
+
# test failures related to randomization by passing the same `--seed` value
|
91
|
+
# as the one that triggered the failure.
|
92
|
+
Kernel.srand config.seed
|
93
|
+
=end
|
94
|
+
config.run_all_when_everything_filtered = true
|
95
|
+
config.filter_run :focus
|
96
|
+
|
97
|
+
config.order = 'random'
|
98
|
+
end
|