Sha256: 35159c3e5a808563bf2d3064e0e0c92556cdb0d603d8c0e9fe6df65104ca6b9a

Contents?: true

Size: 929 Bytes

Versions: 3

Compression:

Stored size: 929 Bytes

Contents

require_relative '../../test_helper'
require 'msip/formato_fecha_helper'

module Msip
  class FormatoFechaHelperTest < ActionView::TestCase

    include FormatoFechaHelper

    test "simple1" do
      d = Date.strptime('2017-12-18', '%Y-%m-%d')
      f1 = fecha_estandar_local(d)
      f2 = fecha_estandar_local('2017-12-18')
      assert_equal f1, f2
    end

    test "simple2" do
      Rails.application.config.x.formato_fecha = 'dd/M/yyyy'
      f1 = fecha_local_estandar('03/May/2018')
      assert_equal f1, '2018-05-03'
    end

    test "simple3" do
      Rails.application.config.x.formato_fecha = 'dd-M-yyyy'
      f1 = fecha_local_estandar('03-May-2018')
      assert_equal f1, '2018-05-03'
    end

    test "adivina" do
      Rails.application.config.x.formato_fecha = 'dd-M-yyyy'
      f1 = reconoce_adivinando_locale('2-ene.-19')
      assert_equal f1.to_s, '2019-01-02'
    end




  end  # class
end    # module

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
msip-2.2.0.alfa3 test/helpers/msip/formato_fecha_helper_test.rb
msip-2.2.0.alfa2 test/helpers/msip/formato_fecha_helper_test.rb
msip-2.2a2 test/helpers/msip/formato_fecha_helper_test.rb