gov_uk_date_fields 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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/lib/gov_uk_date_fields/acts_as_gov_uk_date.rb +122 -0
- data/lib/gov_uk_date_fields/form_builder.rb +12 -0
- data/lib/gov_uk_date_fields/form_date.rb +127 -0
- data/lib/gov_uk_date_fields/form_fields.rb +49 -0
- data/lib/gov_uk_date_fields/gov_uk_date_fields.rb +2 -0
- data/lib/gov_uk_date_fields/version.rb +3 -0
- data/lib/gov_uk_date_fields.rb +7 -0
- data/lib/tasks/gov_uk_date_fields_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/employees.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/assets/stylesheets/employees.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/employees_controller.rb +58 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/employees_helper.rb +2 -0
- data/test/dummy/app/models/employee.rb +6 -0
- data/test/dummy/app/views/employees/_form.html.erb +29 -0
- data/test/dummy/app/views/employees/edit.html.erb +6 -0
- data/test/dummy/app/views/employees/index.html.erb +31 -0
- data/test/dummy/app/views/employees/new.html.erb +5 -0
- data/test/dummy/app/views/employees/show.html.erb +19 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +25 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +85 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +57 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20150901103114_create_employees.rb +11 -0
- data/test/dummy/db/schema.rb +27 -0
- data/test/dummy/log/development.log +995 -0
- data/test/dummy/log/test.log +15943 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/controllers/employees_controller_test.rb +72 -0
- data/test/dummy/test/fixtures/employees.yml +11 -0
- data/test/dummy/test/models/employee_test.rb +126 -0
- data/test/dummy/test/models/form_date_test.rb +91 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/3Btcwr72V3UVSQF4sqr__CCT-XdxN0CTruFn7z9Y_XU.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/4OGvKM5VGFrmfgpNVn-OVfpy9d666yTUyc-FSiWvwYo.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/54EGGKsdgfn0vxxv75SqN98eDhg-ilqjdIkfD08lvrI.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/AAh5PqvwSFjiY74WrVS1iZDEIaV1Esq-U2wnk7iS4us.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/AUA1UWYic4L73QsfyqeOPHldlfFq_8j9hAToBfr-f1Q.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/AX3L2fGpRF9VevxsOcMT3K8MFiRGjRX81JBxvrH7IIc.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/DWiSprTdmJSiF4eYqRLDfLfWLyF-m0Mk3TOoLQXKKW0.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/EQgy9RTV-4e0cBODgHM06wYW7K5ZQPT7QCEd9rw3WOM.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/GeZkOF3Y0RVsr_bLJpt8e98qLe6tl2fanP3g8Au3Ki4.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/MnCiEhJG594IyEZWxHbFmmj3VVVPj_s6mBDi22R6d4g.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/QZXYupcseg74D7COWs8-uMvEFMzcF0D2kyZbe9TQ77s.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/RLkYXASUya0cLJBhEdan7n0Pd7bxb0bB0Fisje2uDAo.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/SOd3-ZZMlfAqcde7u4GC6nyLGyBlZn5GOsNbUpmTKYw.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/SRehtTwxOp9802ZoUXpvNaoiTUAAop3BKwD0zbFqDtE.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/X9Q9imgKEWoA7sXby5p60U-hJ2dz87Ml_BLtvx3zhic.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ZIi2WsAMg6MivpM37KPVAEt0WF2kOpptOZnB8I13ypQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/aCaKUaA2zFHYb85d3HsEaLzqqcySgu1RNprCoAsVud0.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/aGW0bSYiiwQK9bzVhmWulwv3CPsg3QsaBf3OmDxJgow.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ihA_BDp1Rs5WPDQas3L0pgMqmZCcgqozdQxu48rJb68.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/kTqBP8zzCc8f2JqGQTi3DXs7nGsbgDuRg0jrPG8ZNPk.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/oV4rrfh_yARJFyFf415eIZDk0XSRN6pCO9JMJFhb0RI.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/tYWKJ-uJLzUiu_GSiw8U9c-NoKsmluXyJoybViJqqSo.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/uHgfxDUpQd144IiQx-xG6kwowy8G1sR4iyD9DNL0tC0.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/1AsHbcbPJPOX9onZq50MxoxSn1pMnQpGVvG_UYQ13wo.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/3Btcwr72V3UVSQF4sqr__CCT-XdxN0CTruFn7z9Y_XU.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/67JJWCc_sYvRYPdITY7j_FNQfhBfvZo5G1sv2dZxIto.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AUA1UWYic4L73QsfyqeOPHldlfFq_8j9hAToBfr-f1Q.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AX3L2fGpRF9VevxsOcMT3K8MFiRGjRX81JBxvrH7IIc.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/DNMjaCc-VmsemKVl4YidF-CXIU3genqy7Al84AF5ElQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/DWiSprTdmJSiF4eYqRLDfLfWLyF-m0Mk3TOoLQXKKW0.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/EkdXohJZf4lGY8JzYoG_7LRxdszy4Swv_1-52AbtQWA.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/FqGh56sHucOsjlGrWDO9yNwycTG0LgUKZ16k23kduns.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/GeZkOF3Y0RVsr_bLJpt8e98qLe6tl2fanP3g8Au3Ki4.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/PlM8l5Qld5XuE05WoFYFeHkdTOQlgQDeWcqChn7HrHY.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/SRehtTwxOp9802ZoUXpvNaoiTUAAop3BKwD0zbFqDtE.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/SrsOoZyuToCzWj-6-unzyuiaqTY_AaQ6OkmF1__p2pA.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/Ve3Ff6BHeMiuu3shpU83x1W5kvA_9uYsJb4QTBpa_cg.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/gGf5sYnraHtF9zAKHfpmAFfXs91eHz803uWElSZo8hU.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/gQ3aDX081uviJlrMPWuDlBeI9mU60eQkKBT_tdRmfHA.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ihA_BDp1Rs5WPDQas3L0pgMqmZCcgqozdQxu48rJb68.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/qw9GAqewo2ndJbMp6cn6aiyI5zrb6Dc2AnBVBmpTAO8.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/sjCpIVBR5YqsLCchRCDqeG_WK3Jn7Q3nlWVKNIwerDw.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/tYWKJ-uJLzUiu_GSiw8U9c-NoKsmluXyJoybViJqqSo.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uHgfxDUpQd144IiQx-xG6kwowy8G1sR4iyD9DNL0tC0.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uk3t8-0_vMYlXEFPI-zH6U2ONI0NwBrJJrQM2yq_fjQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/zwMKri38-QDk453A_5RE9PYaTcHIoT73wl79q5P0qfI.cache +1 -0
- data/test/gov_uk_date_fields_test.rb +7 -0
- data/test/test_helper.rb +31 -0
- metadata +306 -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
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
|
2
|
+
|
|
3
|
+
class EmployeesControllerTest < ActionController::TestCase
|
|
4
|
+
setup do
|
|
5
|
+
@employee = Employee.create(name: 'Stephen', dob: Date.new(1963, 8, 13), joined: Date.new(2014, 4, 1))
|
|
6
|
+
Employee.create(name: 'Tony', dob: Date.new(1965, 5, 17), joined: Date.new(2014, 5, 21))
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
test "should get index" do
|
|
10
|
+
get :index
|
|
11
|
+
assert_response :success
|
|
12
|
+
assert_not_nil assigns(:employees)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
test "should get new" do
|
|
16
|
+
get :new
|
|
17
|
+
assert_response :success
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test "should create employee" do
|
|
21
|
+
assert_difference('Employee.count') do
|
|
22
|
+
post :create, employee: {
|
|
23
|
+
dob_dd: '31',
|
|
24
|
+
dob_mm: '12',
|
|
25
|
+
dob_yyyy: '1965',
|
|
26
|
+
joined_dd: '4',
|
|
27
|
+
joined_mm: 'mar',
|
|
28
|
+
joined_yyyy: '2015',
|
|
29
|
+
name: 'Joe Blow' }
|
|
30
|
+
end
|
|
31
|
+
assert_redirected_to employee_path(assigns(:employee))
|
|
32
|
+
assert_equal 3, Employee.count
|
|
33
|
+
employee = Employee.last
|
|
34
|
+
assert_equal 'Joe Blow', employee.name
|
|
35
|
+
assert_equal Date.new(1965, 12, 31), employee.dob
|
|
36
|
+
assert_equal Date.new(2015, 3, 4), employee.joined
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
test "should show employee" do
|
|
40
|
+
get :show, id: @employee
|
|
41
|
+
assert_response :success
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
test "should get edit" do
|
|
45
|
+
get :edit, id: @employee
|
|
46
|
+
assert_response :success
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
test "should update employee" do
|
|
50
|
+
patch :update, id: @employee, employee: {
|
|
51
|
+
dob_dd: '1',
|
|
52
|
+
dob_mm: '11',
|
|
53
|
+
dob_yyyy: '1981',
|
|
54
|
+
joined_dd: '3',
|
|
55
|
+
joined_mm: 'oct',
|
|
56
|
+
joined_yyyy: '2015',
|
|
57
|
+
name: 'Ioannis Kole' }
|
|
58
|
+
assert_redirected_to employee_path(assigns(:employee))
|
|
59
|
+
e = Employee.find @employee.id
|
|
60
|
+
assert_equal Date.new(1981, 11, 1), e.dob
|
|
61
|
+
assert_equal Date.new(2015, 10, 3), e.joined
|
|
62
|
+
assert_equal 'Ioannis Kole', e.name
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
test "should destroy employee" do
|
|
66
|
+
assert_difference('Employee.count', -1) do
|
|
67
|
+
delete :destroy, id: @employee
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
assert_redirected_to employees_path
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
require 'pp'
|
|
2
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
|
3
|
+
require File.dirname(__FILE__) + '/../../../../lib/gov_uk_date_fields/gov_uk_date_fields'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class EmployeeTest < ActiveSupport::TestCase
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def setup
|
|
10
|
+
@employee = Employee.new(name: 'John', dob: Date.new(1963, 8, 13), joined: Date.new(2014, 4, 21))
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_employee_class_responds_to_acts_as_gov_uk_date
|
|
14
|
+
assert(Employee.respond_to?(:acts_as_gov_uk_date), 'Employee class does not respond to method :gov_uk_date_fields')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_employee_has_class_variable_describing_all_gov_uk_dates
|
|
18
|
+
assert_equal( [ :dob, :joined], Employee._gov_uk_dates)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_employee_instance_has_form_date_instance_variables_for_each_gov_uk_date
|
|
22
|
+
assert @employee.instance_variable_get(:@_dob).is_a?(GovUkDateFields::FormDate)
|
|
23
|
+
assert_equal Date.new(1963, 8, 13), @employee.instance_variable_get(:@_dob).date
|
|
24
|
+
assert_equal '13', @employee.instance_variable_get(:@_dob).dd
|
|
25
|
+
assert_equal '8', @employee.instance_variable_get(:@_dob).mm
|
|
26
|
+
assert_equal '1963', @employee.instance_variable_get(:@_dob).yyyy
|
|
27
|
+
|
|
28
|
+
assert @employee.instance_variable_get(:@_joined).is_a?(GovUkDateFields::FormDate)
|
|
29
|
+
assert_equal Date.new(2014, 4, 21), @employee.instance_variable_get(:@_joined).date
|
|
30
|
+
assert_equal '21', @employee.instance_variable_get(:@_joined).dd
|
|
31
|
+
assert_equal '4', @employee.instance_variable_get(:@_joined).mm
|
|
32
|
+
assert_equal '2014', @employee.instance_variable_get(:@_joined).yyyy
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_that_the_calling_the_field_name_on_employee_will_return_the_date_part_of_the_form_date_object
|
|
36
|
+
assert_equal Date.new(1963, 8, 13), @employee.dob
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_that_we_can_assign_new_dates_to_the_form_date_object
|
|
41
|
+
@employee.dob = Date.new(2014, 12, 25)
|
|
42
|
+
assert_equal Date.new(2014, 12, 25), @employee.instance_variable_get(:@_dob).date
|
|
43
|
+
assert_equal '25', @employee.instance_variable_get(:@_dob).dd
|
|
44
|
+
assert_equal '12', @employee.instance_variable_get(:@_dob).mm
|
|
45
|
+
assert_equal '2014', @employee.instance_variable_get(:@_dob).yyyy
|
|
46
|
+
|
|
47
|
+
@employee.joined = Date.new(2015, 12, 31)
|
|
48
|
+
assert_equal Date.new(2015, 12, 31), @employee.instance_variable_get(:@_joined).date
|
|
49
|
+
assert_equal '31', @employee.instance_variable_get(:@_joined).dd
|
|
50
|
+
assert_equal '12', @employee.instance_variable_get(:@_joined).mm
|
|
51
|
+
assert_equal '2015', @employee.instance_variable_get(:@_joined).yyyy
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_that_nil_can_be_assigned_to_a_date_field
|
|
55
|
+
@employee.dob = nil
|
|
56
|
+
assert_equal nil, @employee.dob
|
|
57
|
+
assert_equal '', @employee.dob_dd
|
|
58
|
+
assert_equal '', @employee.dob_mm
|
|
59
|
+
assert_equal '', @employee.dob_yyyy
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_that_argument_error_is_raised_if_non_date_non_nil_object_assigned_to_date_field
|
|
63
|
+
err = assert_raise ArgumentError do
|
|
64
|
+
@employee.dob = '12/3/1984'
|
|
65
|
+
end
|
|
66
|
+
assert err.is_a?(ArgumentError)
|
|
67
|
+
assert_equal '12/3/1984 is not a Date object', err.message
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def test_that_form_population_values_can_be_extracted_from_the_date_field
|
|
71
|
+
assert_equal '21', @employee.joined_dd
|
|
72
|
+
assert_equal '4', @employee.joined_mm
|
|
73
|
+
assert_equal '2014', @employee.joined_yyyy
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_new_dates_can_be_populated_from_the_form
|
|
78
|
+
@employee.dob_dd = '17'
|
|
79
|
+
@employee.dob_mm = 'jun'
|
|
80
|
+
@employee.dob_yyyy = '1965'
|
|
81
|
+
assert_equal Date.new(1965, 6, 17), @employee.dob
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_valid_dates_raise_no_errors
|
|
86
|
+
assert_true @employee.valid?, '@employee.valid?'
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def test_nil_dates_raise_no_errors
|
|
90
|
+
@employee.dob = nil
|
|
91
|
+
assert_true @employee.valid?, '@employee.valid?'
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def test_invalid_day_raises_error
|
|
95
|
+
@employee.dob_dd = '32'
|
|
96
|
+
assert_false @employee.valid?
|
|
97
|
+
assert_equal ['Invalid date'], @employee.errors[:dob]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def test_createing_a_new_employee_with_valid_dates_is_valid
|
|
101
|
+
e = Employee.new(name: 'Stephen', dob_dd: '13', dob_mm: 'AUG', dob_yyyy: '1963')
|
|
102
|
+
assert_equal Date.new(1963, 8, 13), e.dob
|
|
103
|
+
assert_true e.valid?
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def test_creating_a_new_employee_with_invalid_dates_is_invalid
|
|
107
|
+
e = Employee.new(name: 'Stephen', dob_dd: '13', dob_mm: 'XXX', dob_yyyy: '1963')
|
|
108
|
+
assert_equal nil, e.dob
|
|
109
|
+
assert_false e.valid?
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def test_updating_existing_record_with_valid_dates_is_valid
|
|
113
|
+
@employee.save!
|
|
114
|
+
@employee.update(dob_dd: '17', dob_mm: '5', dob_yyyy: '1965')
|
|
115
|
+
assert_equal Date.new(1965, 5, 17), @employee.dob
|
|
116
|
+
assert_true @employee.valid?
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def test_updating_existing_record_with_invalid_dates_is_invalid
|
|
120
|
+
@employee.save!
|
|
121
|
+
@employee.update(dob_dd: '47', dob_mm: '5', dob_yyyy: '1965')
|
|
122
|
+
assert_equal Date.new(1963, 8, 13), @employee.dob
|
|
123
|
+
assert_false @employee.valid?
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../test_helper'
|
|
2
|
+
require File.dirname(__FILE__) + '/../../../../lib/gov_uk_date_fields/form_date.rb'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
module GovUkDateFields
|
|
6
|
+
class FormDateTest < ActiveSupport::TestCase
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def setup
|
|
10
|
+
@employee = Employee.new(name: 'John', dob: Date.new(1963, 8, 13), joined: Date.new(2014, 4, 21))
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_new_raises_error_if_called_from_outside_class
|
|
15
|
+
err = assert_raise NoMethodError do
|
|
16
|
+
fd = FormDate.new(2,3,2015)
|
|
17
|
+
end
|
|
18
|
+
assert_equal "private method `new' called for GovUkDateFields::FormDate:Class", err.message
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_set_from_date_instantiates_the_attribute_and_is_valid
|
|
22
|
+
FormDate.set_from_date(@employee, :joined, Date.new(2015, 4, 3))
|
|
23
|
+
fd = @employee.instance_variable_get(:@_joined)
|
|
24
|
+
assert_equal '3', fd.dd
|
|
25
|
+
assert_equal '4', fd.mm
|
|
26
|
+
assert_equal '2015', fd.yyyy
|
|
27
|
+
assert_true fd.valid?, 'fd.valid?'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_set_from_date_instantiates_a_nil_object_if_date_is_nil
|
|
31
|
+
FormDate.set_from_date(@employee, :joined, nil)
|
|
32
|
+
fd = @employee.instance_variable_get(:@_joined)
|
|
33
|
+
assert_equal '', fd.dd
|
|
34
|
+
assert_equal '', fd.mm
|
|
35
|
+
assert_equal '', fd.yyyy
|
|
36
|
+
assert_true fd.valid?, 'fd.valid?'
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def test_set_one_date_part_leaves_the_rest_unchanged
|
|
40
|
+
fd = @employee.instance_variable_get(:@_dob)
|
|
41
|
+
assert_equal Date.new(1963, 8, 13), fd.date
|
|
42
|
+
FormDate.set_date_part(:dd, @employee, :dob, '5')
|
|
43
|
+
assert_equal '5', fd.dd
|
|
44
|
+
assert_equal fd.date, Date.new(1963, 8, 5)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_setting_all_three_date_parts_changes_the_date
|
|
48
|
+
fd = @employee.instance_variable_get(:@_dob)
|
|
49
|
+
assert_equal Date.new(1963, 8, 13), fd.date
|
|
50
|
+
FormDate.set_date_part(:dd, @employee, :dob, '17')
|
|
51
|
+
FormDate.set_date_part(:mm, @employee, :dob, '6')
|
|
52
|
+
FormDate.set_date_part(:yyyy, @employee, :dob, '1965')
|
|
53
|
+
assert_equal '17', fd.dd
|
|
54
|
+
assert_equal '6', fd.mm
|
|
55
|
+
assert_equal '1965', fd.yyyy
|
|
56
|
+
assert_equal fd.date, Date.new(1965, 6, 17)
|
|
57
|
+
assert_true fd.valid?, 'fd.valid?'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def test_setting_date_parts_with_invalid_values_marks_date_as_invalid_and_leaves_date_variable_the_same
|
|
61
|
+
fd = @employee.instance_variable_get(:@_dob)
|
|
62
|
+
assert_equal Date.new(1963, 8, 13), fd.date
|
|
63
|
+
assert fd.valid?
|
|
64
|
+
FormDate.set_date_part(:dd, @employee, :dob, '33')
|
|
65
|
+
FormDate.set_date_part(:mm, @employee, :dob, 'abc')
|
|
66
|
+
FormDate.set_date_part(:yyyy, @employee, :dob, '1965')
|
|
67
|
+
assert_equal '33', fd.dd
|
|
68
|
+
assert_equal 'abc', fd.mm
|
|
69
|
+
assert_equal '1965', fd.yyyy
|
|
70
|
+
assert_equal Date.new(1963, 8, 13), fd.date
|
|
71
|
+
assert_false fd.valid?, "fd.valid?"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_setting_all_date_parts_to_nil_sets_date_to_nil_and_is_valid
|
|
75
|
+
fd = @employee.instance_variable_get(:@_dob)
|
|
76
|
+
assert_equal Date.new(1963, 8, 13), fd.date
|
|
77
|
+
assert fd.valid?
|
|
78
|
+
FormDate.set_date_part(:dd, @employee, :dob, '')
|
|
79
|
+
FormDate.set_date_part(:mm, @employee, :dob, '')
|
|
80
|
+
FormDate.set_date_part(:yyyy, @employee, :dob, '')
|
|
81
|
+
assert_equal '', fd.dd
|
|
82
|
+
assert_equal '', fd.mm
|
|
83
|
+
assert_equal '', fd.yyyy
|
|
84
|
+
assert_equal nil, fd.date
|
|
85
|
+
assert_true fd.valid?, "fd.valid?"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
end
|