Sha256: 14c41b8314dd1d83397c5ad5ed56e03f82b8db860f94a6c2dffbe0c13870c94a

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

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

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

  specify 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

  specify 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.1.1 spec/normalizy/extensions/filters/date_spec.rb
normalizy-1.1.0 spec/normalizy/extensions/filters/date_spec.rb