Sha256: 442e905250619653b291edb5d02be853fe1bec0a6c37832c7efb5b57dea54430

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe ModelDate, 'filters:date' do
  it do
    expected = Time.new(1984, 10, 23, 0, 0, 0, 0)

    expect(described_class.create(date: '1984-10-23').date).to eq expected
  end

  it do
    expected = Time.new(1984, 10, 23, 0, 0, 0, 0)

    expect(described_class.create(date_format: '84/10/23').date_format).to eq expected
  end

  it do
    hours    = ActiveSupport::TimeZone['Brasilia'].utc_offset / 3600.0
    expected = Time.new(1984, 10, 23, 0, 0, 0, 0) + (hours.hours * -1)

    expect(described_class.create(date_time_zone: '1984-10-23').date_time_zone).to eq expected
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
normalizy-1.3.0 spec/normalizy/extensions/filters/date_spec.rb
normalizy-1.2.0 spec/normalizy/extensions/filters/date_spec.rb