tin_opener 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +662 -0
- data/README.md +37 -0
- data/Rakefile +33 -0
- data/app/assets/javascripts/tin_opener/application.js +13 -0
- data/app/assets/stylesheets/tin_opener/application.css +15 -0
- data/app/controllers/tin_opener/application_controller.rb +4 -0
- data/app/controllers/tin_opener/data_sets_controller.rb +51 -0
- data/app/controllers/tin_opener/records_controller.rb +62 -0
- data/app/helpers/tin_opener/application_helper.rb +4 -0
- data/app/models/tin_opener/data_set.rb +39 -0
- data/app/models/tin_opener/record.rb +8 -0
- data/app/views/layouts/tin_opener/application.html.erb +14 -0
- data/app/views/tin_opener/data_sets/_form.html.erb +25 -0
- data/app/views/tin_opener/data_sets/edit.html.erb +6 -0
- data/app/views/tin_opener/data_sets/index.html.erb +29 -0
- data/app/views/tin_opener/data_sets/show.html.erb +19 -0
- data/app/views/tin_opener/records/_form.html.erb +24 -0
- data/app/views/tin_opener/records/_record.html.erb +8 -0
- data/app/views/tin_opener/records/edit.html.erb +6 -0
- data/app/views/tin_opener/records/index.html.erb +25 -0
- data/app/views/tin_opener/records/new.html.erb +5 -0
- data/app/views/tin_opener/records/show.html.erb +11 -0
- data/config/routes.rb +7 -0
- data/config/spring.rb +1 -0
- data/db/migrate/20151024183112_enable_hstore.rb +5 -0
- data/db/migrate/20151024183219_create_tin_opener_data_sets.rb +10 -0
- data/db/migrate/20151024194928_create_tin_opener_records.rb +10 -0
- data/lib/tasks/tin_opener_tasks.rake +4 -0
- data/lib/tin_opener/data_file_processor.rb +22 -0
- data/lib/tin_opener/engine.rb +21 -0
- data/lib/tin_opener/version.rb +3 -0
- data/lib/tin_opener.rb +8 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +8 -0
- data/spec/dummy/bin/rake +8 -0
- data/spec/dummy/bin/rspec +7 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/bin/spring +15 -0
- data/spec/dummy/config/application.rb +31 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +18 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/schema.rb +34 -0
- data/spec/dummy/log/development.log +205 -0
- data/spec/dummy/log/test.log +812 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/examples.txt +7 -0
- data/spec/factories/tin_opener_data_sets.rb +6 -0
- data/spec/factories/tin_opener_records.rb +6 -0
- data/spec/fixtures/data_sets/bici_disponibilidad.csv +71 -0
- data/spec/models/tin_opener/data_set_spec.rb +24 -0
- data/spec/models/tin_opener/record_spec.rb +10 -0
- data/spec/rails_helper.rb +68 -0
- data/spec/spec_helper.rb +93 -0
- metadata +324 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
data/spec/examples.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------------------------------ | ------ | --------------- |
|
3
|
+
./spec/models/tin_opener/data_set_spec.rb[1:1:1] | passed | 0.00749 seconds |
|
4
|
+
./spec/models/tin_opener/data_set_spec.rb[1:1:2] | passed | 0.01992 seconds |
|
5
|
+
./spec/models/tin_opener/data_set_spec.rb[1:1:3] | passed | 0.00673 seconds |
|
6
|
+
./spec/models/tin_opener/data_set_spec.rb[1:2:1] | passed | 0.3546 seconds |
|
7
|
+
./spec/models/tin_opener/record_spec.rb[1:1] | passed | 0.02572 seconds |
|
@@ -0,0 +1,71 @@
|
|
1
|
+
DIA ;HORAS_TOTALES_USOS_BICICLETAS;HORAS_TOTALES_DISPONIBILIDAD_BICICLETAS_EN _ANCLAJES;TOTAL_HORAS_SERVICIO_BICICLETAS;MEDIA_BICICLETAS_DISPONIBLES;USOS_ABONADO_ANUAL;USOS_ABONADO_OCASIONAL;TOTAL_USOS
|
2
|
+
10/08/2015;3.991,13;19.894,18;23.885,31;995,22;7.986;189;8.175
|
3
|
+
11/08/2015;4.364,40;19.817,30;24.181,70;1.007,57;8.750;191;8.941
|
4
|
+
12/08/2015;4.633,72;19.725,32;24.359,04;1.014,96;9.132;251;9.383
|
5
|
+
13/08/2015;4.498,85;19.530,97;24.029,82;1.001,24;8.935;236;9.171
|
6
|
+
14/08/2015;4.309,22;22.770,43;27.079,65;1.128,32;8.165;231;8.396
|
7
|
+
15/08/2015;4.156,77;21.431,75;25.588,52;1.066,19;7.000;297;7.297
|
8
|
+
16/08/2015;3.921,48;19.269,10;23.190,58;966,27;6.770;336;7.106
|
9
|
+
17/08/2015;4.139,10;18.910,27;23.049,37;960,39;8.340;200;8.540
|
10
|
+
18/08/2015;4.130,08;19.764,92;23.895,00;995,63;8.790;269;9.059
|
11
|
+
19/08/2015;4.298,80;20.216,48;24.515,28;1.021,47;8.910;227;9.137
|
12
|
+
20/08/2015;4.429,10;20.311,57;24.740,67;1.030,86;9.327;292;9.619
|
13
|
+
21/08/2015;4.288,75;21.897,31;26.186,06;1.091,09;8.737;306;9.043
|
14
|
+
22/08/2015;4.247,52;21.262,88;25.510,40;1.062,93;7.668;475;8.143
|
15
|
+
23/08/2015;4.500,27;18.054,25;22.554,52;939,77;7.911;469;8.380
|
16
|
+
24/08/2015;4.089,20;19.661,07;23.750,27;989,59;8.635;223;8.858
|
17
|
+
25/08/2015;4.406,80;19.250,90;23.657,70;985,74;9.397;212;9.609
|
18
|
+
26/08/2015;4.727,38;18.599,57;23.326,95;971,96;10.135;197;10.332
|
19
|
+
27/08/2015;4.786,27;18.617,77;23.404,04;975,17;10.421;189;10.610
|
20
|
+
28/08/2015;4.808,35;19.826,72;24.635,07;1.026,46;10.309;245;10.554
|
21
|
+
29/08/2015;4.902,48;18.933,37;23.835,85;993,16;9.433;400;9.833
|
22
|
+
30/08/2015;4.264,58;16.590,13;20.854,71;868,95;8.013;309;8.322
|
23
|
+
31/08/2015;4.193,65;17.616,37;21.810,02;908,75;9.601;142;9.743
|
24
|
+
01/09/2015;4.862,37;15.893,35;20.755,72;864,82;11.133;162;11.295
|
25
|
+
02/09/2015;5.299,17;15.529,33;20.828,50;867,85;11.942;158;12.100
|
26
|
+
03/09/2015;5.577,73;15.865,73;21.443,46;893,48;12.919;171;13.090
|
27
|
+
04/09/2015;5.399,38;17.933,35;23.332,73;972,2;12.253;177;12.430
|
28
|
+
05/09/2015;5.619,78;16.950,61;22.570,39;940,43;10.598;454;11.052
|
29
|
+
06/09/2015;6.045,88;14.331,35;20.377,23;849,05;10.629;561;11.190
|
30
|
+
07/09/2015;5.006,28;16.303,12;21.309,40;887,89;10.560;226;10.786
|
31
|
+
08/09/2015;5.602,02;16.734,39;22.336,41;930,68;12.315;194;12.509
|
32
|
+
09/09/2015;5.851,15;17.181,96;23.033,11;959,71;12.863;184;13.047
|
33
|
+
10/09/2015;5.911,82;18.342,10;24.253,92;1.010,58;13.747;164;13.911
|
34
|
+
11/09/2015;6.347,50;20.914,70;27.262,20;1.135,93;13.558;254;13.812
|
35
|
+
12/09/2015;5.990,42;18.784,65;24.775,07;1.032,29;11.419;513;11.932
|
36
|
+
13/09/2015;5.927,62;15.314,63;21.242,25;885,09;10.391;549;10.940
|
37
|
+
14/09/2015;5.101,38;22.461,62;27.563,00;1.148,46;11.076;206;11.282
|
38
|
+
15/09/2015;4.420,27;22.451,68;26.871,95;1.119,66;10.079;106;10.185
|
39
|
+
16/09/2015;3.437,28;22.886,11;26.323,39;1.096,81;7.636;64;7.700
|
40
|
+
17/09/2015;5.186,62;25.263,18;30.449,80;1.268,74;11.823;127;11.950
|
41
|
+
18/09/2015;6.024,15;29.454,90;35.479,05;1.478,29;13.478;199;13.677
|
42
|
+
19/09/2015;6.158,48;27.091,52;33.250,00;1.385,42;12.287;328;12.615
|
43
|
+
20/09/2015;6.386,03;22.464,77;28.850,80;1.202,12;11.685;745;12.430
|
44
|
+
21/09/2015;5.225,35;26.901,23;32.126,58;1.338,61;12.068;230;12.298
|
45
|
+
22/09/2015;5.904,35;27.842,22;33.746,57;1.406,11;13.662;130;13.792
|
46
|
+
23/09/2015;5.701,05;28.433,28;34.134,33;1.422,26;13.555;198;13.753
|
47
|
+
24/09/2015;6.056,50;29.494,80;35.551,30;1.481,30;13.922;183;14.105
|
48
|
+
25/09/2015;6.405,98;31.718,06;38.124,04;1.588,50;14.976;332;15.308
|
49
|
+
26/09/2015;6.680,65;28.258,18;34.938,83;1.455,78;13.485;594;14.079
|
50
|
+
27/09/2015;6.528,42;23.754,89;30.283,31;1.261,80;12.334;714;13.048
|
51
|
+
28/09/2015;5.237,50;25.403,84;30.641,34;1.276,72;11.880;239;12.119
|
52
|
+
29/09/2015;5.341,68;33.301,37;38.643,05;1.610,13;12.505;130;12.635
|
53
|
+
30/09/2015;5.716,17;34.253,27;39.969,44;1.665,39;13.490;137;13.627
|
54
|
+
01/10/2015;5.935,95;34.877,47;40.813,42;1.700,56;13.882;198;14.080
|
55
|
+
02/10/2015;6.523,03;35.153,00;41.676,03;1.736,50;15.009;250;15.259
|
56
|
+
03/10/2015;6.574,25;33.479,02;40.053,27;1.668,89;13.645;538;14.183
|
57
|
+
04/10/2015;5.839,33;32.420,32;38.259,65;1.594,15;11.192;595;11.787
|
58
|
+
05/10/2015;4.313,95;34.913,58;39.227,53;1.634,48;9.810;165;9.975
|
59
|
+
06/10/2015;5.127,22;34.072,05;39.199,27;1.633,30;12.174;144;12.318
|
60
|
+
07/10/2015;5.479,93;35.222,43;40.702,36;1.695,93;12.292;143;12.435
|
61
|
+
08/10/2015;5.821,52;35.344,42;41.165,94;1.715,25;13.045;150;13.195
|
62
|
+
09/10/2015;6.224,43;34.555,30;40.779,73;1.699,16;13.525;241;13.766
|
63
|
+
10/10/2015;5.830,25;33.057,85;38.888,10;1.620,34;11.026;576;11.602
|
64
|
+
11/10/2015;4.809,15;33.199,30;38.008,45;1.583,69;9.000;469;9.469
|
65
|
+
12/10/2015;5.523,72;33.300,05;38.823,77;1.617,66;10.093;533;10.626
|
66
|
+
13/10/2015;3.823,90;36.037,46;39.861,36;1.660,89;8.567;104;8.671
|
67
|
+
14/10/2015;5.203,80;27.033,34;32.237,14;1.343,21;11.423;163;11.586
|
68
|
+
15/10/2015;5.442,45;36.070,35;41.512,80;1.729,70;12.340;142;12.482
|
69
|
+
16/10/2015;5.997,42;35.364,96;41.362,38;1.723,43;13.346;185;13.531
|
70
|
+
17/10/2015;5.026,05;34.026,01;39.052,06;1.627,17;9.709;321;10.030
|
71
|
+
18/10/2015;3.372,28;35.124,73;38.497,01;1.604,04;5.999;232;6.231
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module TinOpener
|
4
|
+
RSpec.describe DataSet, type: :model do
|
5
|
+
let(:data_file) { File.open(File.join('spec', 'fixtures', 'data_sets', 'bici_disponibilidad.csv'), 'r') }
|
6
|
+
let(:data_set) { build :tin_opener_data_set }
|
7
|
+
|
8
|
+
describe "validations" do
|
9
|
+
it { is_expected.to validate_presence_of :name }
|
10
|
+
it { is_expected.to validate_uniqueness_of(:name).scoped_to(:headers) }
|
11
|
+
it { is_expected.to validate_presence_of :headers }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "processing data file" do
|
15
|
+
it "accepts a new data file in CSV format and turns it into a list of records" do
|
16
|
+
data_set.data_file = data_file
|
17
|
+
|
18
|
+
expect do
|
19
|
+
expect(data_set.save).to be_truthy
|
20
|
+
end.to change { Record.count }.from(0).to(70)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module TinOpener
|
4
|
+
RSpec.describe Record, type: :model do
|
5
|
+
let(:data_set) { create :tin_opener_data_set }
|
6
|
+
let(:record) { build :tin_opener_record, data_set: data_set }
|
7
|
+
|
8
|
+
it { is_expected.to validate_presence_of :row_data }
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
require File.expand_path('../dummy/config/environment', __FILE__)
|
4
|
+
# Prevent database truncation if the environment is production
|
5
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
6
|
+
require 'spec_helper'
|
7
|
+
require 'rspec/rails'
|
8
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
9
|
+
|
10
|
+
require 'factory_girl_rails'
|
11
|
+
require 'shoulda-matchers'
|
12
|
+
|
13
|
+
Rails.backtrace_cleaner.remove_silencers!
|
14
|
+
|
15
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
16
|
+
|
17
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
18
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
19
|
+
# run as spec files by default. This means that files in spec/support that end
|
20
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
21
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
22
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
23
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
24
|
+
#
|
25
|
+
# The following line is provided for convenience purposes. It has the downside
|
26
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
27
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
28
|
+
# require only the support files necessary.
|
29
|
+
#
|
30
|
+
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
31
|
+
|
32
|
+
# Checks for pending migrations before tests are run.
|
33
|
+
# If you are not using ActiveRecord, you can remove this line.
|
34
|
+
ActiveRecord::Migration.maintain_test_schema!
|
35
|
+
|
36
|
+
Shoulda::Matchers.configure do |config|
|
37
|
+
config.integrate do |with|
|
38
|
+
with.test_framework :rspec
|
39
|
+
with.library :rails
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
RSpec.configure do |config|
|
44
|
+
config.include FactoryGirl::Syntax::Methods
|
45
|
+
|
46
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
47
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
48
|
+
|
49
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
50
|
+
# examples within a transaction, remove the following line or assign false
|
51
|
+
# instead of true.
|
52
|
+
config.use_transactional_fixtures = true
|
53
|
+
|
54
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
55
|
+
# based on their file location, for example enabling you to call `get` and
|
56
|
+
# `post` in specs under `spec/controllers`.
|
57
|
+
#
|
58
|
+
# You can disable this behaviour by removing the line below, and instead
|
59
|
+
# explicitly tag your specs with their type, e.g.:
|
60
|
+
#
|
61
|
+
# RSpec.describe UsersController, :type => :controller do
|
62
|
+
# # ...
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# The different available types are documented in the features, such as in
|
66
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
67
|
+
config.infer_spec_type_from_file_location!
|
68
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require "codeclimate-test-reporter"
|
2
|
+
CodeClimate::TestReporter.start
|
3
|
+
|
4
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
5
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
6
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
7
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
8
|
+
# files.
|
9
|
+
#
|
10
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
11
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
12
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
13
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
14
|
+
# a separate helper file that requires the additional dependencies and performs
|
15
|
+
# the additional setup, and require it from the spec files that actually need
|
16
|
+
# it.
|
17
|
+
#
|
18
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
19
|
+
# users commonly want.
|
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
|
+
# These two settings work together to allow you to limit a spec run
|
49
|
+
# to individual examples or groups you care about by tagging them with
|
50
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
51
|
+
# get run.
|
52
|
+
config.filter_run :focus
|
53
|
+
config.run_all_when_everything_filtered = true
|
54
|
+
|
55
|
+
# Allows RSpec to persist some state between runs in order to support
|
56
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
57
|
+
# you configure your source control system to ignore this file.
|
58
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
59
|
+
|
60
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
61
|
+
# recommended. For more details, see:
|
62
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
63
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
64
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
65
|
+
config.disable_monkey_patching!
|
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
|