Sha256: 5c6fda160df7ee4d5d1bc0256179a545e56c9233441c9c208cb6831e7cba1b25

Contents?: true

Size: 675 Bytes

Versions: 2

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe LocaSMS::Helpers::DateTimeHelper do # rubocop:disable RSpec/FilePath
  subject(:helper) { described_class }

  describe '.parse' do
    let(:expected) { Time.parse '1977-03-14 14:12:00' }

    def try_for(value)
      helper.parse(value) == expected
    end

    it { try_for DateTime.parse('1977-03-14 14:12:00') }
    it { try_for Time.parse('1977-03-14 14:12:00') }
    it { try_for '1977-03-14 14:12:00' }
    it { try_for 227_207_520 }
  end

  describe '.split' do
    it 'breaks a date into date and time' do
      expect(helper.split('1977-03-14 14:12:00')).to eq(%w[14/03/1977 14:12])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locasms-1.0.0 spec/lib/locasms/helpers/date_time_helper_spec.rb
locasms-0.5.0 spec/lib/locasms/helpers/date_time_helper_spec.rb