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

Version Path
gov_uk_date_fields-4.2.0 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-3.2.0 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-3.2.0.rc3 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-3.2.0.rc2 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-3.2.0.rc1 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-4.1.0 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-4.0.1 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-4.0.0 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-3.1.0 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-3.0.0 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-2.2.0 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-2.1.1 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-2.1.0 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-2.0.3 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-2.0.2 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-1.2.3 test/dummy/test/models/overrride_error_clash_employee_test.rb
gov_uk_date_fields-1.2.2 test/dummy/test/models/overrride_error_clash_employee_test.rb