gov_uk_date_fields 1.0.6 → 1.0.7
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 +4 -4
- data/lib/gov_uk_date_fields/form_fields.rb +6 -2
- data/lib/gov_uk_date_fields/version.rb +1 -1
- data/test/dummy/log/test.log +355 -0
- data/test/form_fields_test.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 97d3f862b011c12c8cfb47b97019f694a75d20b7
|
|
4
|
+
data.tar.gz: a58ba69eadf26038875b86eb673f4200b68ada9f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 198a6db12b94e8aa753f6bfc8be5c043b4b6403a4d227ef4e378a71081ac4dc50a824ac7163179bfdc9f266fd1200110db6ff880973bbb77cc72bbc1aad9d92e
|
|
7
|
+
data.tar.gz: 60a2391c1e2b3df687dec851ead4135547fc564c18794080e4d12e8681b5c0224ad00274b8d7066fe2c575a04478d1e922274e97ca2c5efb26b32df0c8250e7c
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module GovUkDateFields
|
|
2
2
|
|
|
3
3
|
class FormFields
|
|
4
|
-
VALID_OPTIONS = [:legend_text, :legend_class, :form_hint_text, :id, :placeholders]
|
|
4
|
+
VALID_OPTIONS = [:legend_text, :legend_class, :form_hint_text, :id, :placeholders, :error_messages]
|
|
5
5
|
|
|
6
6
|
DATE_SEGMENTS = {
|
|
7
7
|
day: '_dd',
|
|
@@ -27,6 +27,7 @@ module GovUkDateFields
|
|
|
27
27
|
@form_hint_text = @options[:form_hint_text] || "For example, 31 3 1980"
|
|
28
28
|
@fieldset_required = false
|
|
29
29
|
@fieldset_id = @options[:id]
|
|
30
|
+
@error_messages = @options[:error_messages]
|
|
30
31
|
parse_options
|
|
31
32
|
end
|
|
32
33
|
|
|
@@ -94,7 +95,10 @@ module GovUkDateFields
|
|
|
94
95
|
result = ''
|
|
95
96
|
if error_for_attr?
|
|
96
97
|
result = "<ul>"
|
|
97
|
-
@
|
|
98
|
+
if @error_messages.nil?
|
|
99
|
+
@error_messages = @object.errors[@attribute]
|
|
100
|
+
end
|
|
101
|
+
@error_messages.each do |message|
|
|
98
102
|
result += %Q|<li><span class="error-message">#{message}</span></li>|
|
|
99
103
|
end
|
|
100
104
|
result += "</ul>"
|
data/test/dummy/log/test.log
CHANGED
|
@@ -11935,3 +11935,358 @@ EmployeeTest: test_that_form_population_values_can_be_extracted_from_the_date_fi
|
|
|
11935
11935
|
EmployeeTest: test_that_the_calling_the_field_name_on_employee_will_return_the_date_part_of_the_form_date_object
|
|
11936
11936
|
----------------------------------------------------------------------------------------------------------------
|
|
11937
11937
|
[1m[35m (0.1ms)[0m ROLLBACK
|
|
11938
|
+
[1m[36mActiveRecord::SchemaMigration Load (2.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
11939
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
11940
|
+
-------------------------------------------------------------------------------
|
|
11941
|
+
GovUkDateFieldsTest: test_fieldset_with_error_class_and_supplied_error_messages
|
|
11942
|
+
-------------------------------------------------------------------------------
|
|
11943
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
|
11944
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
11945
|
+
[1m[35m (0.2ms)[0m BEGIN
|
|
11946
|
+
-------------------------------------------------------------------------------
|
|
11947
|
+
GovUkDateFieldsTest: test_fieldset_with_error_class_and_supplied_error_messages
|
|
11948
|
+
-------------------------------------------------------------------------------
|
|
11949
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
|
11950
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
11951
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
11952
|
+
---------------------------------------------------------------
|
|
11953
|
+
GovUkDateFieldsTest: test_fieldset_with_error_class_and_message
|
|
11954
|
+
---------------------------------------------------------------
|
|
11955
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
|
11956
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
11957
|
+
[1m[35m (0.2ms)[0m BEGIN
|
|
11958
|
+
---------------------------------------------------------------
|
|
11959
|
+
GovUkDateFieldsTest: test_fieldset_with_error_class_and_message
|
|
11960
|
+
---------------------------------------------------------------
|
|
11961
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
11962
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
11963
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
11964
|
+
-------------------------------------------------------------------------------
|
|
11965
|
+
GovUkDateFieldsTest: test_fieldset_with_error_class_and_supplied_error_messages
|
|
11966
|
+
-------------------------------------------------------------------------------
|
|
11967
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
11968
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
11969
|
+
[1m[35m (0.2ms)[0m BEGIN
|
|
11970
|
+
---------------------------------------------------------------------------------
|
|
11971
|
+
GovUkDateFields::FormDateTest: test_new_raises_error_if_called_from_outside_class
|
|
11972
|
+
---------------------------------------------------------------------------------
|
|
11973
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
11974
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
11975
|
+
-------------------------------------------------------------------------------
|
|
11976
|
+
GovUkDateFields::FormDateTest: test_set_one_date_part_leaves_the_rest_unchanged
|
|
11977
|
+
-------------------------------------------------------------------------------
|
|
11978
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
11979
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
11980
|
+
----------------------------------------------------------------------------------------------------------------------------------
|
|
11981
|
+
GovUkDateFields::FormDateTest: test_setting_date_parts_with_invalid_values_marks_date_as_invalid_and_leaves_date_variable_the_same
|
|
11982
|
+
----------------------------------------------------------------------------------------------------------------------------------
|
|
11983
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
11984
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
11985
|
+
------------------------------------------------------------------------------------------
|
|
11986
|
+
GovUkDateFields::FormDateTest: test_set_from_date_instantiates_a_nil_object_if_date_is_nil
|
|
11987
|
+
------------------------------------------------------------------------------------------
|
|
11988
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
11989
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
11990
|
+
-----------------------------------------------------------------------------------------
|
|
11991
|
+
GovUkDateFields::FormDateTest: test_set_from_date_instantiates_the_attribute_and_is_valid
|
|
11992
|
+
-----------------------------------------------------------------------------------------
|
|
11993
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
11994
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
11995
|
+
---------------------------------------------------------------------------------
|
|
11996
|
+
GovUkDateFields::FormDateTest: test_setting_all_three_date_parts_changes_the_date
|
|
11997
|
+
---------------------------------------------------------------------------------
|
|
11998
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
11999
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12000
|
+
-----------------------------------------------------------------------------------------------
|
|
12001
|
+
GovUkDateFields::FormDateTest: test_setting_all_date_parts_to_nil_sets_date_to_nil_and_is_valid
|
|
12002
|
+
-----------------------------------------------------------------------------------------------
|
|
12003
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12004
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12005
|
+
-----------------------------------------------------------
|
|
12006
|
+
EmployeeTest: test_new_dates_can_be_populated_from_the_form
|
|
12007
|
+
-----------------------------------------------------------
|
|
12008
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12009
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12010
|
+
-----------------------------------------------------------
|
|
12011
|
+
EmployeeTest: test_that_nil_can_be_assigned_to_a_date_field
|
|
12012
|
+
-----------------------------------------------------------
|
|
12013
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12014
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12015
|
+
---------------------------------------------------------------------
|
|
12016
|
+
EmployeeTest: test_updating_existing_record_with_valid_dates_is_valid
|
|
12017
|
+
---------------------------------------------------------------------
|
|
12018
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12019
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "John"], ["dob", "1963-08-13"], ["joined", "2014-04-21"], ["created_at", "2016-04-29 08:57:00.194956"], ["updated_at", "2016-04-29 08:57:00.194956"]]
|
|
12020
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12021
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12022
|
+
[1m[36mSQL (0.3ms)[0m [1mUPDATE "employees" SET "dob" = $1, "updated_at" = $2 WHERE "employees"."id" = $3[0m [["dob", "1965-05-17"], ["updated_at", "2016-04-29 08:57:00.209064"], ["id", 628]]
|
|
12023
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12024
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12025
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12026
|
+
-------------------------------------------
|
|
12027
|
+
EmployeeTest: test_invalid_day_raises_error
|
|
12028
|
+
-------------------------------------------
|
|
12029
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12030
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12031
|
+
---------------------------------------------------------------------
|
|
12032
|
+
EmployeeTest: test_createing_a_new_employee_with_valid_dates_is_valid
|
|
12033
|
+
---------------------------------------------------------------------
|
|
12034
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12035
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12036
|
+
--------------------------------------------
|
|
12037
|
+
EmployeeTest: test_nil_dates_raise_no_errors
|
|
12038
|
+
--------------------------------------------
|
|
12039
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12040
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12041
|
+
-------------------------------------------------------------------------------------------------------------------
|
|
12042
|
+
EmployeeTest: test_argument_error_is_raised_if_an_object_that_doesnt_respond_to_to_date_is_assigned_to_a_date_field
|
|
12043
|
+
-------------------------------------------------------------------------------------------------------------------
|
|
12044
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12045
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12046
|
+
--------------------------------------------------------------------------
|
|
12047
|
+
EmployeeTest: test_employee_has_class_variable_describing_all_gov_uk_dates
|
|
12048
|
+
--------------------------------------------------------------------------
|
|
12049
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12050
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12051
|
+
-------------------------------------------------------------------------
|
|
12052
|
+
EmployeeTest: test_updating_existing_record_with_invalid_dates_is_invalid
|
|
12053
|
+
-------------------------------------------------------------------------
|
|
12054
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12055
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "John"], ["dob", "1963-08-13"], ["joined", "2014-04-21"], ["created_at", "2016-04-29 08:57:00.218586"], ["updated_at", "2016-04-29 08:57:00.218586"]]
|
|
12056
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12057
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12058
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK TO SAVEPOINT active_record_1[0m
|
|
12059
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12060
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12061
|
+
------------------------------------------------------------------------------------------
|
|
12062
|
+
EmployeeTest: test_employee_instance_has_form_date_instance_variables_for_each_gov_uk_date
|
|
12063
|
+
------------------------------------------------------------------------------------------
|
|
12064
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12065
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12066
|
+
----------------------------------------------
|
|
12067
|
+
EmployeeTest: test_valid_dates_raise_no_errors
|
|
12068
|
+
----------------------------------------------
|
|
12069
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12070
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12071
|
+
-----------------------------------------------------------------------
|
|
12072
|
+
EmployeeTest: test_that_we_can_assign_new_dates_to_the_form_date_object
|
|
12073
|
+
-----------------------------------------------------------------------
|
|
12074
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12075
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12076
|
+
-----------------------------------------------------------------------------------
|
|
12077
|
+
EmployeeTest: test_that_form_population_values_can_be_extracted_from_the_date_field
|
|
12078
|
+
-----------------------------------------------------------------------------------
|
|
12079
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12080
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12081
|
+
------------------------------------------------------------------------
|
|
12082
|
+
EmployeeTest: test_creating_a_new_employee_with_invalid_dates_is_invalid
|
|
12083
|
+
------------------------------------------------------------------------
|
|
12084
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12085
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12086
|
+
----------------------------------------------------------------------------------------------
|
|
12087
|
+
EmployeeTest: test_no_argument_error_is_raised_if_parseable_string_is_assigned_to_a_date_field
|
|
12088
|
+
----------------------------------------------------------------------------------------------
|
|
12089
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12090
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12091
|
+
----------------------------------------------------------------------------------------------------------------
|
|
12092
|
+
EmployeeTest: test_that_the_calling_the_field_name_on_employee_will_return_the_date_part_of_the_form_date_object
|
|
12093
|
+
----------------------------------------------------------------------------------------------------------------
|
|
12094
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12095
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12096
|
+
---------------------------------------------------------------------------------------------------------
|
|
12097
|
+
EmployeeTest: test_that_argument_error_is_raised_if_unparseable_string_object_is_assigned_to_a_date_field
|
|
12098
|
+
---------------------------------------------------------------------------------------------------------
|
|
12099
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12100
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12101
|
+
-----------------------------------------------------------------
|
|
12102
|
+
EmployeeTest: test_employee_class_responds_to_acts_as_gov_uk_date
|
|
12103
|
+
-----------------------------------------------------------------
|
|
12104
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12105
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12106
|
+
-------------------------------------------------------
|
|
12107
|
+
GovUkDateFieldsTest: test_basic_output_without_fieldset
|
|
12108
|
+
-------------------------------------------------------
|
|
12109
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12110
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12111
|
+
-------------------------------------
|
|
12112
|
+
GovUkDateFieldsTest: test_squash_html
|
|
12113
|
+
-------------------------------------
|
|
12114
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12115
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12116
|
+
--------------------------------------------------------
|
|
12117
|
+
GovUkDateFieldsTest: test_fieldset_output_with_form_hint
|
|
12118
|
+
--------------------------------------------------------
|
|
12119
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12120
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12121
|
+
-----------------------------------------------------------
|
|
12122
|
+
GovUkDateFieldsTest: test_fieldset_output_with_legend_class
|
|
12123
|
+
-----------------------------------------------------------
|
|
12124
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12125
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12126
|
+
---------------------------------------------------------------
|
|
12127
|
+
GovUkDateFieldsTest: test_error_raised_if_invalid_options_given
|
|
12128
|
+
---------------------------------------------------------------
|
|
12129
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12130
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12131
|
+
-------------------------------------------------------------
|
|
12132
|
+
GovUkDateFieldsTest: test_placeholder_output_without_fieldset
|
|
12133
|
+
-------------------------------------------------------------
|
|
12134
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12135
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12136
|
+
-------------------------------------------------------------------------------
|
|
12137
|
+
GovUkDateFieldsTest: test_fieldset_with_error_class_and_supplied_error_messages
|
|
12138
|
+
-------------------------------------------------------------------------------
|
|
12139
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12140
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12141
|
+
------------------------------------------
|
|
12142
|
+
GovUkDateFieldsTest: test_fieldset_with_id
|
|
12143
|
+
------------------------------------------
|
|
12144
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12145
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12146
|
+
---------------------------------------------------------------
|
|
12147
|
+
GovUkDateFieldsTest: test_fieldset_with_error_class_and_message
|
|
12148
|
+
---------------------------------------------------------------
|
|
12149
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12150
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12151
|
+
--------------------------------------------------
|
|
12152
|
+
EmployeesControllerTest: test_should_show_employee
|
|
12153
|
+
--------------------------------------------------
|
|
12154
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12155
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["name", "Stephen"], ["dob", "1963-08-13"], ["joined", "2014-04-01"], ["created_at", "2016-04-29 08:57:00.279199"], ["updated_at", "2016-04-29 08:57:00.279199"]]
|
|
12156
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12157
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12158
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", "1965-05-17"], ["joined", "2014-05-21"], ["created_at", "2016-04-29 08:57:00.280771"], ["updated_at", "2016-04-29 08:57:00.280771"]]
|
|
12159
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12160
|
+
Processing by EmployeesController#show as HTML
|
|
12161
|
+
Parameters: {"id"=>"630"}
|
|
12162
|
+
[1m[35mEmployee Load (0.2ms)[0m SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT 1 [["id", 630]]
|
|
12163
|
+
Rendered employees/show.html.erb within layouts/application (1.6ms)
|
|
12164
|
+
Completed 200 OK in 117ms (Views: 113.7ms | ActiveRecord: 0.2ms)
|
|
12165
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
|
12166
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12167
|
+
----------------------------------------------
|
|
12168
|
+
EmployeesControllerTest: test_should_get_index
|
|
12169
|
+
----------------------------------------------
|
|
12170
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12171
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", "1963-08-13"], ["joined", "2014-04-01"], ["created_at", "2016-04-29 08:57:00.402428"], ["updated_at", "2016-04-29 08:57:00.402428"]]
|
|
12172
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12173
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12174
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["name", "Tony"], ["dob", "1965-05-17"], ["joined", "2014-05-21"], ["created_at", "2016-04-29 08:57:00.403674"], ["updated_at", "2016-04-29 08:57:00.403674"]]
|
|
12175
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12176
|
+
Processing by EmployeesController#index as HTML
|
|
12177
|
+
[1m[36mEmployee Load (0.9ms)[0m [1mSELECT "employees".* FROM "employees"[0m
|
|
12178
|
+
Rendered employees/index.html.erb within layouts/application (3.2ms)
|
|
12179
|
+
Completed 200 OK in 6ms (Views: 4.9ms | ActiveRecord: 0.9ms)
|
|
12180
|
+
[1m[35m (0.2ms)[0m ROLLBACK
|
|
12181
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12182
|
+
----------------------------------------------------
|
|
12183
|
+
EmployeesControllerTest: test_should_create_employee
|
|
12184
|
+
----------------------------------------------------
|
|
12185
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12186
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["name", "Stephen"], ["dob", "1963-08-13"], ["joined", "2014-04-01"], ["created_at", "2016-04-29 08:57:00.412398"], ["updated_at", "2016-04-29 08:57:00.412398"]]
|
|
12187
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12188
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12189
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", "1965-05-17"], ["joined", "2014-05-21"], ["created_at", "2016-04-29 08:57:00.413542"], ["updated_at", "2016-04-29 08:57:00.413542"]]
|
|
12190
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12191
|
+
[1m[35m (0.2ms)[0m SELECT COUNT(*) FROM "employees"
|
|
12192
|
+
Processing by EmployeesController#create as HTML
|
|
12193
|
+
Parameters: {"employee"=>{"dob_dd"=>"31", "dob_mm"=>"12", "dob_yyyy"=>"1965", "joined_dd"=>"4", "joined_mm"=>"mar", "joined_yyyy"=>"2015", "name"=>"Joe Blow"}}
|
|
12194
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12195
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Joe Blow"], ["dob", "1965-12-31"], ["joined", "2015-03-04"], ["created_at", "2016-04-29 08:57:00.416530"], ["updated_at", "2016-04-29 08:57:00.416530"]]
|
|
12196
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12197
|
+
Redirected to http://test.host/employees/636
|
|
12198
|
+
Completed 302 Found in 2ms (ActiveRecord: 0.3ms)
|
|
12199
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "employees"
|
|
12200
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "employees"[0m
|
|
12201
|
+
[1m[35mEmployee Load (0.8ms)[0m SELECT "employees".* FROM "employees" ORDER BY "employees"."id" DESC LIMIT 1
|
|
12202
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12203
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12204
|
+
----------------------------------------------------
|
|
12205
|
+
EmployeesControllerTest: test_should_update_employee
|
|
12206
|
+
----------------------------------------------------
|
|
12207
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12208
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", "1963-08-13"], ["joined", "2014-04-01"], ["created_at", "2016-04-29 08:57:00.420961"], ["updated_at", "2016-04-29 08:57:00.420961"]]
|
|
12209
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12210
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12211
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["name", "Tony"], ["dob", "1965-05-17"], ["joined", "2014-05-21"], ["created_at", "2016-04-29 08:57:00.422130"], ["updated_at", "2016-04-29 08:57:00.422130"]]
|
|
12212
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12213
|
+
Processing by EmployeesController#update as HTML
|
|
12214
|
+
Parameters: {"employee"=>{"dob_dd"=>"1", "dob_mm"=>"11", "dob_yyyy"=>"1981", "joined_dd"=>"3", "joined_mm"=>"oct", "joined_yyyy"=>"2015", "name"=>"Ioannis Kole"}, "id"=>"637"}
|
|
12215
|
+
[1m[36mEmployee Load (0.2ms)[0m [1mSELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT 1[0m [["id", 637]]
|
|
12216
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12217
|
+
[1m[36mSQL (0.2ms)[0m [1mUPDATE "employees" SET "name" = $1, "dob" = $2, "joined" = $3, "updated_at" = $4 WHERE "employees"."id" = $5[0m [["name", "Ioannis Kole"], ["dob", "1981-11-01"], ["joined", "2015-10-03"], ["updated_at", "2016-04-29 08:57:00.425159"], ["id", 637]]
|
|
12218
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12219
|
+
Redirected to http://test.host/employees/637
|
|
12220
|
+
Completed 302 Found in 3ms (ActiveRecord: 0.6ms)
|
|
12221
|
+
[1m[36mEmployee Load (0.2ms)[0m [1mSELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT 1[0m [["id", 637]]
|
|
12222
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
12223
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12224
|
+
--------------------------------------------
|
|
12225
|
+
EmployeesControllerTest: test_should_get_new
|
|
12226
|
+
--------------------------------------------
|
|
12227
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12228
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["name", "Stephen"], ["dob", "1963-08-13"], ["joined", "2014-04-01"], ["created_at", "2016-04-29 08:57:00.428691"], ["updated_at", "2016-04-29 08:57:00.428691"]]
|
|
12229
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12230
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12231
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", "1965-05-17"], ["joined", "2014-05-21"], ["created_at", "2016-04-29 08:57:00.429771"], ["updated_at", "2016-04-29 08:57:00.429771"]]
|
|
12232
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12233
|
+
Processing by EmployeesController#new as HTML
|
|
12234
|
+
Rendered employees/_form.html.erb (8.3ms)
|
|
12235
|
+
Rendered employees/new.html.erb within layouts/application (11.8ms)
|
|
12236
|
+
Completed 200 OK in 14ms (Views: 13.9ms | ActiveRecord: 0.0ms)
|
|
12237
|
+
[1m[35m (0.2ms)[0m ROLLBACK
|
|
12238
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
12239
|
+
--------------------------------------------------------------
|
|
12240
|
+
EmployeesControllerTest: test_should_render_gov_uk_date_fields
|
|
12241
|
+
--------------------------------------------------------------
|
|
12242
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12243
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["name", "Stephen"], ["dob", "1963-08-13"], ["joined", "2014-04-01"], ["created_at", "2016-04-29 08:57:00.446611"], ["updated_at", "2016-04-29 08:57:00.446611"]]
|
|
12244
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12245
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12246
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Tony"], ["dob", "1965-05-17"], ["joined", "2014-05-21"], ["created_at", "2016-04-29 08:57:00.447916"], ["updated_at", "2016-04-29 08:57:00.447916"]]
|
|
12247
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12248
|
+
Processing by EmployeesController#edit as HTML
|
|
12249
|
+
Parameters: {"id"=>"641"}
|
|
12250
|
+
[1m[35mEmployee Load (0.2ms)[0m SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT 1 [["id", 641]]
|
|
12251
|
+
Rendered employees/_form.html.erb (1.6ms)
|
|
12252
|
+
Rendered employees/edit.html.erb within layouts/application (2.1ms)
|
|
12253
|
+
Completed 200 OK in 5ms (Views: 4.1ms | ActiveRecord: 0.2ms)
|
|
12254
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12255
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12256
|
+
-----------------------------------------------------
|
|
12257
|
+
EmployeesControllerTest: test_should_destroy_employee
|
|
12258
|
+
-----------------------------------------------------
|
|
12259
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12260
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", "1963-08-13"], ["joined", "2014-04-01"], ["created_at", "2016-04-29 08:57:00.465018"], ["updated_at", "2016-04-29 08:57:00.465018"]]
|
|
12261
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12262
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12263
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["name", "Tony"], ["dob", "1965-05-17"], ["joined", "2014-05-21"], ["created_at", "2016-04-29 08:57:00.466228"], ["updated_at", "2016-04-29 08:57:00.466228"]]
|
|
12264
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12265
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM "employees"[0m
|
|
12266
|
+
Processing by EmployeesController#destroy as HTML
|
|
12267
|
+
Parameters: {"id"=>"643"}
|
|
12268
|
+
[1m[35mEmployee Load (0.1ms)[0m SELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT 1 [["id", 643]]
|
|
12269
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12270
|
+
[1m[35mSQL (0.1ms)[0m DELETE FROM "employees" WHERE "employees"."id" = $1 [["id", 643]]
|
|
12271
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12272
|
+
Redirected to http://test.host/employees
|
|
12273
|
+
Completed 302 Found in 2ms (ActiveRecord: 0.4ms)
|
|
12274
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "employees"
|
|
12275
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
12276
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
12277
|
+
---------------------------------------------
|
|
12278
|
+
EmployeesControllerTest: test_should_get_edit
|
|
12279
|
+
---------------------------------------------
|
|
12280
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
|
12281
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "Stephen"], ["dob", "1963-08-13"], ["joined", "2014-04-01"], ["created_at", "2016-04-29 08:57:00.471347"], ["updated_at", "2016-04-29 08:57:00.471347"]]
|
|
12282
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
|
12283
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
|
12284
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "employees" ("name", "dob", "joined", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"[0m [["name", "Tony"], ["dob", "1965-05-17"], ["joined", "2014-05-21"], ["created_at", "2016-04-29 08:57:00.472497"], ["updated_at", "2016-04-29 08:57:00.472497"]]
|
|
12285
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
|
12286
|
+
Processing by EmployeesController#edit as HTML
|
|
12287
|
+
Parameters: {"id"=>"645"}
|
|
12288
|
+
[1m[36mEmployee Load (0.1ms)[0m [1mSELECT "employees".* FROM "employees" WHERE "employees"."id" = $1 LIMIT 1[0m [["id", 645]]
|
|
12289
|
+
Rendered employees/_form.html.erb (1.4ms)
|
|
12290
|
+
Rendered employees/edit.html.erb within layouts/application (1.6ms)
|
|
12291
|
+
Completed 200 OK in 3ms (Views: 2.5ms | ActiveRecord: 0.1ms)
|
|
12292
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
data/test/form_fields_test.rb
CHANGED
|
@@ -60,6 +60,13 @@ class GovUkDateFieldsTest < ActiveSupport::TestCase
|
|
|
60
60
|
assert_html_equal(date_fields.raw_output, expected_fieldset_output_with_error_class_and_message)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
test 'fieldset with error_class and supplied error messages' do
|
|
64
|
+
@employee.errors[:joined] << "invalid"
|
|
65
|
+
@employee.errors[:joined] << "must_be_in_past"
|
|
66
|
+
date_fields = GovUkDateFields::FormFields.new(@form_builder, :employee, :joined, {legend_text: 'Joining date', id: 'employee_date_joined', error_messages: ['Invalid joining date', 'Joining date must be in the past']})
|
|
67
|
+
assert_html_equal(date_fields.raw_output, expected_fieldset_output_with_error_class_and_message)
|
|
68
|
+
end
|
|
69
|
+
|
|
63
70
|
test "squash_html" do
|
|
64
71
|
html = " <html> This is some text \n <tr> \n <td> <%= dfkhdfh %> </td> </tr>\n</html> "
|
|
65
72
|
expected_result = "<html>This is some text<tr><td><%= dfkhdfh %></td></tr></html>"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gov_uk_date_fields
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stephen Richards
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2016-04-
|
|
12
|
+
date: 2016-04-29 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|