Sha256: 4c5cf7fab7041a6e58308fb9c027a22b616ef9b0bf83329a7e6ead63f5f7c994
Contents?: true
Size: 958 Bytes
Versions: 17
Compression:
Stored size: 958 Bytes
Contents
require 'pp' require File.dirname(__FILE__) + '/../../../test_helper' require File.dirname(__FILE__) + '/../../../../lib/gov_uk_date_fields/gov_uk_date_fields' class OverrideErrorClashEmployeeTest < ActiveSupport::TestCase def setup @employee = OverrideErrorClashEmployee.new(name: 'John', dob: nil, joined: nil) end def test_presence_error_messages_generated @employee.valid? assert_equal ["Can't be blank"], @employee.errors[:dob] assert_equal ["Can't be blank"], @employee.errors[:joined] end def test_invalid_day_overrides_cant_be_blank_message @employee.dob_mm = '77' assert_false @employee.valid? assert_equal ["Invalid date"], @employee.errors[:dob] assert_equal ["Can't be blank"], @employee.errors[:joined] end def test_valid_dates_generate_no_errors_at_all @employee.dob_dd = '15' @employee.dob_mm = '8' @employee.dob_yyyy = '2016' assert_empty @employee.errors[:dob] end end
Version data entries
17 entries across 17 versions & 1 rubygems