prct5 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.coveralls.yml +1 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +7 -0
- data/Guardfile +39 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +21 -0
- data/lib/int_list_resp.rb +15 -0
- data/lib/lista_respuesta.rb +39 -0
- data/lib/multirespuesta.rb +30 -0
- data/lib/prct5/version.rb +3 -0
- data/lib/prct5.rb +5 -0
- data/prct5.gemspec +28 -0
- data/prct6.pdf +0 -0
- data/report.html +352 -0
- data/spec/exam_spec.rb +29 -0
- data/spec/examen.rb +63 -0
- data/spec/interfaz.rb +48 -0
- data/spec/lista_enlazada.rb +136 -0
- data/spec/lista_respuesta.rb +36 -0
- data/spec/multirespuesta.rb +36 -0
- data/spec/node_spec.rb +91 -0
- data/spec/prct5_spec.rb +82 -0
- data/spec/preg2.rb +31 -0
- data/spec/preg2_spec.rb +53 -0
- data/spec/quiz1.rb +114 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/verdadero_falso.rb +13 -0
- data/spec/verdadero_falso_spec.rb +35 -0
- metadata +203 -0
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :bundler do
|
5
|
+
watch('Gemfile')
|
6
|
+
# Uncomment next line if your Gemfile contains the `gemspec' command.
|
7
|
+
# watch(/^.+\.gemspec/)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
11
|
+
# rspec may be run, below are examples of the most common uses.
|
12
|
+
# * bundler: 'bundle exec rspec'
|
13
|
+
# * bundler binstubs: 'bin/rspec'
|
14
|
+
# * spring: 'bin/rsspec' (This will use spring if running and you have
|
15
|
+
# installed the spring binstubs per the docs)
|
16
|
+
# * zeus: 'zeus rspec' (requires the server to be started separetly)
|
17
|
+
# * 'just' rspec: 'rspec'
|
18
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
19
|
+
watch(%r{^spec/.+_spec\.rb$})
|
20
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
21
|
+
watch('spec/spec_helper.rb') { "spec" }
|
22
|
+
|
23
|
+
# Rails example
|
24
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
25
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
26
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
27
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
28
|
+
watch('config/routes.rb') { "spec/routing" }
|
29
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
30
|
+
watch('spec/rails_helper.rb') { "spec" }
|
31
|
+
|
32
|
+
# Capybara features specs
|
33
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
34
|
+
|
35
|
+
# Turnip features and steps
|
36
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
37
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
38
|
+
end
|
39
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Carlos
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Prct5
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'prct5'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install prct5
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + 'lib'
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
task :spec do
|
9
|
+
sh "rspec -I. spec/prct5_spec.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
task :doc do
|
13
|
+
sh "rspec -I. spec/prct5_spec.rb --format documentation"
|
14
|
+
end
|
15
|
+
|
16
|
+
desc"Salida con formato html"
|
17
|
+
task :html do
|
18
|
+
sh "rspec -I. spec/prct5_spec.rb --format html --out report.html"
|
19
|
+
end
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "lista_enlazada.rb"
|
2
|
+
|
3
|
+
|
4
|
+
describe ListaEnlazada do
|
5
|
+
before :each do
|
6
|
+
@nodo1 = Struct.new("¿Cuál es la salida del código Ruby?",@nodo2)
|
7
|
+
@nodo2 = Struct.new("¿Es válida la definición de un hash en Ruby?",@nodo3)
|
8
|
+
@nodo3 = Struct.new("¿Cuál es la salida del código Ruby?",@nodo4)
|
9
|
+
@nodo4 = Struct.new("¿Cuál es el tipo de objeto siguiente?",@nodo5)
|
10
|
+
@nodo5 = Struct.new("¿Apropiado que Tablero herede de clase Juego?",nil)
|
11
|
+
end
|
12
|
+
describe "Respuesta" do
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "multirespuesta.rb"
|
2
|
+
require "lista_enlazada.rb"
|
3
|
+
|
4
|
+
describe MultiRespuesta do
|
5
|
+
before :each do
|
6
|
+
@resp = [5]
|
7
|
+
pregunta1 = "Cual es la salida del siguiente codigo en ruby?\n\tclass Xyz\n\t\tdef pots\n\t\t\t@nice\n\t\tend?\n\tend?\n\txyz = Xyz.new?\n\tp xyz.pots"
|
8
|
+
pregunta2 = "La siguiente definicion de un hash en Ruby es valida:\n\thash_raro = {\n\t\t[1,2,3] => Object.new(),\n\t\tHash.new => :toto\n\t}"
|
9
|
+
pregunta3 = "Cual es la salida del siguiente codigo Ruby?\n\tclass Array\n\t\tdef say_hi\n\t\t\t\"Hey!\"\n\t\tend\n\tend\n\tp [1, \"bob\"].say_hi"
|
10
|
+
pregunta4 = "Cual es el tipo de objeto en el siguiente codigo Ruby?\n\tclass Objeto\n\tend"
|
11
|
+
pregunta5 = "Es apropiado que una clase Tablero herede de una clase Juego"
|
12
|
+
preguntas = [pregunta1,pregunta2,pregunta3,pregunta4,pregunta5]
|
13
|
+
numeros = [4,2,4,4,2]
|
14
|
+
respuestas1 = ["#<Xyz:0xa000208>","nil","0","Ninguna de las anteriores"]
|
15
|
+
respuestas2 = ["Cierto","Falso"]
|
16
|
+
respuestas3 = ["1","Bob","HEY!","Ninguna de las anteriores"]
|
17
|
+
respuestas4 = ["Una instancia de la clase Class","Una constante","Un objeto","Ninguna de las anteriores"]
|
18
|
+
respuestas5 = ["Cierto","Falso"]
|
19
|
+
for i in 0..@resp.length
|
20
|
+
@resp[i] = MultiRespuesta.new("#{i}.-)#{preguntas[i]}",numeros[i],nil)
|
21
|
+
case i
|
22
|
+
when 1
|
23
|
+
@resp[i].introducir_resp(respuestas1)
|
24
|
+
when 2
|
25
|
+
@resp[i].introducir_resp(respuestas2)
|
26
|
+
when 3
|
27
|
+
@resp[i].introducir_resp(respuestas3)
|
28
|
+
when 4
|
29
|
+
@resp[i].introducir_resp(respuestas4)
|
30
|
+
when 5
|
31
|
+
@resp[i].introducir_resp(respuestas5)
|
32
|
+
end
|
33
|
+
@resp[i] = @resp[i].to_s
|
34
|
+
end
|
35
|
+
@lista = ListaEnlazada.new(@resp)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
#@lista sería una lista con todas las preguntas y respuestas introducidas en formato MultiRespuesta
|
39
|
+
#Hay que aplicar to_s para que lo que le llegue a ListaEnlazada sea un array de valores, aunque estos valores sean strings enormes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class MultiRespuesta
|
2
|
+
attr_reader :preg, :num, :resp, :correcta
|
3
|
+
attr_writer :preg, :num, :resp, :correcta
|
4
|
+
|
5
|
+
def initialize(preg,num,correcta)
|
6
|
+
@resp = []
|
7
|
+
@num = num
|
8
|
+
@preg = preg
|
9
|
+
@correcta = correcta
|
10
|
+
end
|
11
|
+
def introducir_resp(resp)
|
12
|
+
for i in 0..(@num.to_i - 1)
|
13
|
+
@resp[i] = resp[i]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
def to_s
|
17
|
+
puts "#{@preg}?"
|
18
|
+
for i in 0..(@num.to_i - 1)
|
19
|
+
puts"#{i+1})#{@resp[i]}"
|
20
|
+
end
|
21
|
+
print "Introduzca su respuesta"
|
22
|
+
end
|
23
|
+
def correccion(respuesta_usuario)
|
24
|
+
if(respuesta_usuario == @correcta)
|
25
|
+
return true
|
26
|
+
else
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/prct5.rb
ADDED
data/prct5.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'prct5/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "prct5"
|
8
|
+
spec.version = Prct5::VERSION
|
9
|
+
spec.authors = ["Carlos"]
|
10
|
+
spec.email = ["joseka1234@gmail.com"]
|
11
|
+
spec.description = %q{"Gema sobre preguntas examen"}
|
12
|
+
spec.summary = %q{"Preg Examen"}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency 'rspec', '~>2.11'
|
24
|
+
spec.add_development_dependency "guard"
|
25
|
+
spec.add_development_dependency "guard-rspec"
|
26
|
+
spec.add_development_dependency "guard-bundler"
|
27
|
+
spec.add_development_dependency "coveralls"
|
28
|
+
end
|
data/prct6.pdf
ADDED
Binary file
|
data/report.html
ADDED
@@ -0,0 +1,352 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>RSpec results</title>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<meta http-equiv="Expires" content="-1" />
|
7
|
+
<meta http-equiv="Pragma" content="no-cache" />
|
8
|
+
<style type="text/css">
|
9
|
+
body {
|
10
|
+
margin: 0;
|
11
|
+
padding: 0;
|
12
|
+
background: #fff;
|
13
|
+
font-size: 80%;
|
14
|
+
}
|
15
|
+
</style>
|
16
|
+
<script type="text/javascript">
|
17
|
+
// <![CDATA[
|
18
|
+
|
19
|
+
function addClass(element_id, classname) {
|
20
|
+
document.getElementById(element_id).className += (" " + classname);
|
21
|
+
}
|
22
|
+
|
23
|
+
function removeClass(element_id, classname) {
|
24
|
+
var elem = document.getElementById(element_id);
|
25
|
+
var classlist = elem.className.replace(classname,'');
|
26
|
+
elem.className = classlist;
|
27
|
+
}
|
28
|
+
|
29
|
+
function moveProgressBar(percentDone) {
|
30
|
+
document.getElementById("rspec-header").style.width = percentDone +"%";
|
31
|
+
}
|
32
|
+
|
33
|
+
function makeRed(element_id) {
|
34
|
+
removeClass(element_id, 'passed');
|
35
|
+
removeClass(element_id, 'not_implemented');
|
36
|
+
addClass(element_id,'failed');
|
37
|
+
}
|
38
|
+
|
39
|
+
function makeYellow(element_id) {
|
40
|
+
var elem = document.getElementById(element_id);
|
41
|
+
if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
|
42
|
+
if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
|
43
|
+
removeClass(element_id, 'passed');
|
44
|
+
addClass(element_id,'not_implemented');
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
function apply_filters() {
|
50
|
+
var passed_filter = document.getElementById('passed_checkbox').checked;
|
51
|
+
var failed_filter = document.getElementById('failed_checkbox').checked;
|
52
|
+
var pending_filter = document.getElementById('pending_checkbox').checked;
|
53
|
+
|
54
|
+
assign_display_style("example passed", passed_filter);
|
55
|
+
assign_display_style("example failed", failed_filter);
|
56
|
+
assign_display_style("example not_implemented", pending_filter);
|
57
|
+
|
58
|
+
assign_display_style_for_group("example_group passed", passed_filter);
|
59
|
+
assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
|
60
|
+
assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
|
61
|
+
}
|
62
|
+
|
63
|
+
function get_display_style(display_flag) {
|
64
|
+
var style_mode = 'none';
|
65
|
+
if (display_flag == true) {
|
66
|
+
style_mode = 'block';
|
67
|
+
}
|
68
|
+
return style_mode;
|
69
|
+
}
|
70
|
+
|
71
|
+
function assign_display_style(classname, display_flag) {
|
72
|
+
var style_mode = get_display_style(display_flag);
|
73
|
+
var elems = document.getElementsByClassName(classname)
|
74
|
+
for (var i=0; i<elems.length;i++) {
|
75
|
+
elems[i].style.display = style_mode;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
|
80
|
+
var display_style_mode = get_display_style(display_flag);
|
81
|
+
var subgroup_style_mode = get_display_style(subgroup_flag);
|
82
|
+
var elems = document.getElementsByClassName(classname)
|
83
|
+
for (var i=0; i<elems.length;i++) {
|
84
|
+
var style_mode = display_style_mode;
|
85
|
+
if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
|
86
|
+
elems[i].style.display = subgroup_style_mode;
|
87
|
+
} else {
|
88
|
+
elems[i].style.display = display_style_mode;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
// ]]>
|
94
|
+
</script>
|
95
|
+
<style type="text/css">
|
96
|
+
#rspec-header {
|
97
|
+
background: #65C400; color: #fff; height: 4em;
|
98
|
+
}
|
99
|
+
|
100
|
+
.rspec-report h1 {
|
101
|
+
margin: 0px 10px 0px 10px;
|
102
|
+
padding: 10px;
|
103
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
104
|
+
font-size: 1.8em;
|
105
|
+
position: absolute;
|
106
|
+
}
|
107
|
+
|
108
|
+
#label {
|
109
|
+
float:left;
|
110
|
+
}
|
111
|
+
|
112
|
+
#display-filters {
|
113
|
+
float:left;
|
114
|
+
padding: 28px 0 0 40%;
|
115
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
116
|
+
}
|
117
|
+
|
118
|
+
#summary {
|
119
|
+
float:right;
|
120
|
+
padding: 5px 10px;
|
121
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
122
|
+
text-align: right;
|
123
|
+
}
|
124
|
+
|
125
|
+
#summary p {
|
126
|
+
margin: 0 0 0 2px;
|
127
|
+
}
|
128
|
+
|
129
|
+
#summary #totals {
|
130
|
+
font-size: 1.2em;
|
131
|
+
}
|
132
|
+
|
133
|
+
.example_group {
|
134
|
+
margin: 0 10px 5px;
|
135
|
+
background: #fff;
|
136
|
+
}
|
137
|
+
|
138
|
+
dl {
|
139
|
+
margin: 0; padding: 0 0 5px;
|
140
|
+
font: normal 11px "Lucida Grande", Helvetica, sans-serif;
|
141
|
+
}
|
142
|
+
|
143
|
+
dt {
|
144
|
+
padding: 3px;
|
145
|
+
background: #65C400;
|
146
|
+
color: #fff;
|
147
|
+
font-weight: bold;
|
148
|
+
}
|
149
|
+
|
150
|
+
dd {
|
151
|
+
margin: 5px 0 5px 5px;
|
152
|
+
padding: 3px 3px 3px 18px;
|
153
|
+
}
|
154
|
+
|
155
|
+
dd .duration {
|
156
|
+
padding-left: 5px;
|
157
|
+
text-align: right;
|
158
|
+
right: 0px;
|
159
|
+
float:right;
|
160
|
+
}
|
161
|
+
|
162
|
+
dd.example.passed {
|
163
|
+
border-left: 5px solid #65C400;
|
164
|
+
border-bottom: 1px solid #65C400;
|
165
|
+
background: #DBFFB4; color: #3D7700;
|
166
|
+
}
|
167
|
+
|
168
|
+
dd.example.not_implemented {
|
169
|
+
border-left: 5px solid #FAF834;
|
170
|
+
border-bottom: 1px solid #FAF834;
|
171
|
+
background: #FCFB98; color: #131313;
|
172
|
+
}
|
173
|
+
|
174
|
+
dd.example.pending_fixed {
|
175
|
+
border-left: 5px solid #0000C2;
|
176
|
+
border-bottom: 1px solid #0000C2;
|
177
|
+
color: #0000C2; background: #D3FBFF;
|
178
|
+
}
|
179
|
+
|
180
|
+
dd.example.failed {
|
181
|
+
border-left: 5px solid #C20000;
|
182
|
+
border-bottom: 1px solid #C20000;
|
183
|
+
color: #C20000; background: #FFFBD3;
|
184
|
+
}
|
185
|
+
|
186
|
+
|
187
|
+
dt.not_implemented {
|
188
|
+
color: #000000; background: #FAF834;
|
189
|
+
}
|
190
|
+
|
191
|
+
dt.pending_fixed {
|
192
|
+
color: #FFFFFF; background: #C40D0D;
|
193
|
+
}
|
194
|
+
|
195
|
+
dt.failed {
|
196
|
+
color: #FFFFFF; background: #C40D0D;
|
197
|
+
}
|
198
|
+
|
199
|
+
|
200
|
+
#rspec-header.not_implemented {
|
201
|
+
color: #000000; background: #FAF834;
|
202
|
+
}
|
203
|
+
|
204
|
+
#rspec-header.pending_fixed {
|
205
|
+
color: #FFFFFF; background: #C40D0D;
|
206
|
+
}
|
207
|
+
|
208
|
+
#rspec-header.failed {
|
209
|
+
color: #FFFFFF; background: #C40D0D;
|
210
|
+
}
|
211
|
+
|
212
|
+
|
213
|
+
.backtrace {
|
214
|
+
color: #000;
|
215
|
+
font-size: 12px;
|
216
|
+
}
|
217
|
+
|
218
|
+
a {
|
219
|
+
color: #BE5C00;
|
220
|
+
}
|
221
|
+
|
222
|
+
/* Ruby code, style similar to vibrant ink */
|
223
|
+
.ruby {
|
224
|
+
font-size: 12px;
|
225
|
+
font-family: monospace;
|
226
|
+
color: white;
|
227
|
+
background-color: black;
|
228
|
+
padding: 0.1em 0 0.2em 0;
|
229
|
+
}
|
230
|
+
|
231
|
+
.ruby .keyword { color: #FF6600; }
|
232
|
+
.ruby .constant { color: #339999; }
|
233
|
+
.ruby .attribute { color: white; }
|
234
|
+
.ruby .global { color: white; }
|
235
|
+
.ruby .module { color: white; }
|
236
|
+
.ruby .class { color: white; }
|
237
|
+
.ruby .string { color: #66FF00; }
|
238
|
+
.ruby .ident { color: white; }
|
239
|
+
.ruby .method { color: #FFCC00; }
|
240
|
+
.ruby .number { color: white; }
|
241
|
+
.ruby .char { color: white; }
|
242
|
+
.ruby .comment { color: #9933CC; }
|
243
|
+
.ruby .symbol { color: white; }
|
244
|
+
.ruby .regex { color: #44B4CC; }
|
245
|
+
.ruby .punct { color: white; }
|
246
|
+
.ruby .escape { color: white; }
|
247
|
+
.ruby .interp { color: white; }
|
248
|
+
.ruby .expr { color: white; }
|
249
|
+
|
250
|
+
.ruby .offending { background-color: gray; }
|
251
|
+
.ruby .linenum {
|
252
|
+
width: 75px;
|
253
|
+
padding: 0.1em 1em 0.2em 0;
|
254
|
+
color: #000000;
|
255
|
+
background-color: #FFFBD3;
|
256
|
+
}
|
257
|
+
|
258
|
+
</style>
|
259
|
+
</head>
|
260
|
+
<body>
|
261
|
+
<div class="rspec-report">
|
262
|
+
|
263
|
+
<div id="rspec-header">
|
264
|
+
<div id="label">
|
265
|
+
<h1>RSpec Code Examples</h1>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div id="display-filters">
|
269
|
+
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
|
270
|
+
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
|
271
|
+
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div id="summary">
|
275
|
+
<p id="totals"> </p>
|
276
|
+
<p id="duration"> </p>
|
277
|
+
</div>
|
278
|
+
</div>
|
279
|
+
|
280
|
+
|
281
|
+
<div class="results">
|
282
|
+
<div id="div_group_1" class="example_group passed">
|
283
|
+
<dl style="margin-left: 0px;">
|
284
|
+
<dt id="example_group_1" class="passed">MultiRespuesta</dt>
|
285
|
+
</dl>
|
286
|
+
</div>
|
287
|
+
<div id="div_group_2" class="example_group passed">
|
288
|
+
<dl style="margin-left: 15px;">
|
289
|
+
<dt id="example_group_2" class="passed">#Introducir resuestas</dt>
|
290
|
+
<script type="text/javascript">moveProgressBar('9.0');</script>
|
291
|
+
<dd class="example passed"><span class="passed_spec_name">Respuestas correctas</span><span class='duration'>0.00055s</span></dd>
|
292
|
+
</dl>
|
293
|
+
</div>
|
294
|
+
<div id="div_group_3" class="example_group passed">
|
295
|
+
<dl style="margin-left: 15px;">
|
296
|
+
<dt id="example_group_3" class="passed">#Respuesta correcta? si</dt>
|
297
|
+
<script type="text/javascript">moveProgressBar('18.1');</script>
|
298
|
+
<dd class="example passed"><span class="passed_spec_name">Respuesta correcta (Programa funciona correctamente)</span><span class='duration'>0.00010s</span></dd>
|
299
|
+
</dl>
|
300
|
+
</div>
|
301
|
+
<div id="div_group_4" class="example_group passed">
|
302
|
+
<dl style="margin-left: 15px;">
|
303
|
+
<dt id="example_group_4" class="passed">#Introducir numero de respuestas</dt>
|
304
|
+
<script type="text/javascript">moveProgressBar('27.2');</script>
|
305
|
+
<dd class="example passed"><span class="passed_spec_name">Numero de respuestas correctas</span><span class='duration'>0.00010s</span></dd>
|
306
|
+
</dl>
|
307
|
+
</div>
|
308
|
+
<div id="div_group_5" class="example_group passed">
|
309
|
+
<dl style="margin-left: 15px;">
|
310
|
+
<dt id="example_group_5" class="passed">#Introducir pregunta</dt>
|
311
|
+
<script type="text/javascript">moveProgressBar('36.3');</script>
|
312
|
+
<dd class="example passed"><span class="passed_spec_name">Introduccion de pregunta correcto</span><span class='duration'>0.00010s</span></dd>
|
313
|
+
</dl>
|
314
|
+
</div>
|
315
|
+
<div id="div_group_6" class="example_group passed">
|
316
|
+
<dl style="margin-left: 15px;">
|
317
|
+
<dt id="example_group_6" class="passed">#respuesta correcta</dt>
|
318
|
+
<script type="text/javascript">moveProgressBar('45.4');</script>
|
319
|
+
<dd class="example passed"><span class="passed_spec_name">La respuesta correcta es</span><span class='duration'>0.00014s</span></dd>
|
320
|
+
</dl>
|
321
|
+
</div>
|
322
|
+
<div id="div_group_7" class="example_group passed">
|
323
|
+
<dl style="margin-left: 15px;">
|
324
|
+
<dt id="example_group_7" class="passed">#Respuesta correcta? no</dt>
|
325
|
+
<script type="text/javascript">moveProgressBar('54.5');</script>
|
326
|
+
<dd class="example passed"><span class="passed_spec_name">Respuesta incorrecta (Programa funciona correctamente)</span><span class='duration'>0.00010s</span></dd>
|
327
|
+
</dl>
|
328
|
+
</div>
|
329
|
+
<div id="div_group_8" class="example_group passed">
|
330
|
+
<dl style="margin-left: 15px;">
|
331
|
+
<dt id="example_group_8" class="passed">#Existen getters?</dt>
|
332
|
+
<script type="text/javascript">moveProgressBar('63.6');</script>
|
333
|
+
<dd class="example passed"><span class="passed_spec_name">Responde al getter de introducir_resp</span><span class='duration'>0.00010s</span></dd>
|
334
|
+
<script type="text/javascript">moveProgressBar('72.7');</script>
|
335
|
+
<dd class="example passed"><span class="passed_spec_name">Responde al getter de num</span><span class='duration'>0.00010s</span></dd>
|
336
|
+
<script type="text/javascript">moveProgressBar('81.8');</script>
|
337
|
+
<dd class="example passed"><span class="passed_spec_name">Responde al getter de correcta</span><span class='duration'>0.00010s</span></dd>
|
338
|
+
<script type="text/javascript">moveProgressBar('90.9');</script>
|
339
|
+
<dd class="example passed"><span class="passed_spec_name">Responde al getter de resp</span><span class='duration'>0.00010s</span></dd>
|
340
|
+
<script type="text/javascript">moveProgressBar('100.0');</script>
|
341
|
+
<dd class="example passed"><span class="passed_spec_name">Responde al getter de preg</span><span class='duration'>0.00010s</span></dd>
|
342
|
+
</dl>
|
343
|
+
</div>
|
344
|
+
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0.00415 seconds</strong>";</script>
|
345
|
+
<script type="text/javascript">document.getElementById('totals').innerHTML = "11 examples, 0 failures";</script>
|
346
|
+
</div>
|
347
|
+
</div>
|
348
|
+
</body>
|
349
|
+
</html>
|
350
|
+
|
351
|
+
Randomized with seed 64382
|
352
|
+
|
data/spec/exam_spec.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'examen'
|
3
|
+
|
4
|
+
|
5
|
+
describe Examen do
|
6
|
+
before :each do
|
7
|
+
pregunta1 = "Cual es la salida del siguiente codigo en ruby?\n\tclass Xyz\n\t\tdef pots\n\t\t\t@nice\n\t\tend?\n\tend?\n\txyz = Xyz.new?\n\tp xyz.pots"
|
8
|
+
respuestas1 = ["#<Xyz:0xa000208>","nil","0","Ninguna de las anteriores"]
|
9
|
+
@resp = MultiRespuesta.new(pregunta1,4,1)
|
10
|
+
@resp.introducir_resp(respuestas1)
|
11
|
+
@Examen = Examen.new(@resp)
|
12
|
+
end
|
13
|
+
describe "pregunta correcta" do
|
14
|
+
it "Valor de pregunta1 correcto" do
|
15
|
+
@Examen.getPreg(@Examen.head.siguiente).should eq ("Cual es la salida del siguiente codigo en ruby?\n\tclass Xyz\n\t\tdef pots\n\t\t\t@nice\n\t\tend?\n\tend?\n\txyz = Xyz.new?\n\tp xyz.pots")
|
16
|
+
end
|
17
|
+
it "Valor respuesta correcta" do
|
18
|
+
@Examen.getCorrecta(@Examen.head.siguiente).should eq (1)
|
19
|
+
end
|
20
|
+
it "Valor numero respuesta" do
|
21
|
+
@Examen.getNum(@Examen.head.siguiente).should eq (4)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
describe "funciona inverse" do
|
25
|
+
it "muestra inverso" do
|
26
|
+
@Examen.inverse.should eq (true)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|