Sha256: d86dcbb2b1ddf7e55f72626ef656f4d2a202759217310a300d5dc9dcf85df944
Contents?: true
Size: 1010 Bytes
Versions: 13
Compression:
Stored size: 1010 Bytes
Contents
require 'pp' require File.dirname(__FILE__) + '/../../../test_helper' require File.dirname(__FILE__) + '/../../../../lib/gov_uk_date_fields/gov_uk_date_fields' class OmitErrorClashEmployeeTest < ActiveSupport::TestCase def setup @employee = OmitErrorClashEmployee.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_does_not_add_invalid_date_message_to_cant_be_blank_message @employee.dob_dd = '32' @employee.joined_mm = '77' assert_false @employee.valid? assert_equal ["can't be blank"], @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
13 entries across 13 versions & 1 rubygems