gov_uk_date_fields 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,7 +34,7 @@ class DirectorTest < ActiveSupport::TestCase
34
34
 
35
35
  def test_creating_a_new_director_with_invalid_dates_is_valid_when_validation_disabled
36
36
  e = Director.new(name: 'Stephen', dob_dd: '13', dob_mm: 'XXX', dob_yyyy: '1963')
37
- assert_equal nil, e.dob
37
+ assert_nil e.dob
38
38
  assert_true e.valid?
39
39
  end
40
40
 
@@ -53,7 +53,7 @@ class EmployeeTest < ActiveSupport::TestCase
53
53
 
54
54
  def test_that_nil_can_be_assigned_to_a_date_field
55
55
  @employee.dob = nil
56
- assert_equal nil, @employee.dob
56
+ assert_nil @employee.dob
57
57
  assert_equal '', @employee.dob_dd
58
58
  assert_equal '', @employee.dob_mm
59
59
  assert_equal '', @employee.dob_yyyy
@@ -118,7 +118,7 @@ class EmployeeTest < ActiveSupport::TestCase
118
118
 
119
119
  def test_creating_a_new_employee_with_invalid_dates_is_invalid
120
120
  e = Employee.new(name: 'Stephen', dob_dd: '13', dob_mm: 'XXX', dob_yyyy: '1963')
121
- assert_equal nil, e.dob
121
+ assert_nil e.dob
122
122
  assert_false e.valid?
123
123
  end
124
124
 
@@ -13,7 +13,7 @@ module GovUkDateFields
13
13
 
14
14
  def test_new_raises_error_if_called_from_outside_class
15
15
  err = assert_raise NoMethodError do
16
- fd = FormDate.new(2,3,2015)
16
+ FormDate.new(2,3,2015)
17
17
  end
18
18
  assert_equal "private method `new' called for GovUkDateFields::FormDate:Class", err.message
19
19
  end
@@ -81,11 +81,8 @@ module GovUkDateFields
81
81
  assert_equal '', fd.dd
82
82
  assert_equal '', fd.mm
83
83
  assert_equal '', fd.yyyy
84
- assert_equal nil, fd.date
84
+ assert_nil fd.date
85
85
  assert_true fd.valid?, "fd.valid?"
86
86
  end
87
-
88
-
89
-
90
87
  end
91
88
  end
@@ -46,4 +46,20 @@ class GovUkDateFieldsTest < ActiveSupport::TestCase
46
46
  )
47
47
  assert_html_equal(date_fields.raw_output, fixture)
48
48
  end
49
+
50
+ test 'date_fields with custom i18n_attribute' do
51
+ date_fields = GovUkDateFields::FormFields.new(
52
+ @form_builder, :employee, :dob, i18n_attribute: :custom_i18n_attribute
53
+ )
54
+
55
+ assert_match(
56
+ /<h1 class="govuk-fieldset__heading">A custom legend<\/h1>/,
57
+ date_fields.raw_output
58
+ )
59
+
60
+ assert_match(
61
+ /<span class="govuk-hint" id="employee_dob_hint">A custom hint<\/span>/,
62
+ date_fields.raw_output
63
+ )
64
+ end
49
65
  end
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: 4.0.0
4
+ version: 4.0.1
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: 2019-03-11 00:00:00.000000000 Z
12
+ date: 2019-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails