Sha256: acf9743443152c54b9fc4d4100494afa3494613d31ab77687c7aae3b4e88c3c8

Contents?: true

Size: 852 Bytes

Versions: 1

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Protobuf3Fixer::GenerationHelpers do
  it 'creates a timestamp proto' do
    test_time = Time.now
    expect(
      Protobuf3Fixer::GenerationHelpers.create_timestamp(test_time)
    ).to have_attributes(
      seconds: test_time.to_i,
      nanos: test_time.nsec
    )
  end

  it 'creates a date proto from a date' do
    test_date = Date.today
    expect(
      Protobuf3Fixer::GenerationHelpers.create_date(test_date)
    ).to have_attributes(
      year: test_date.year,
      month: test_date.month,
      day: test_date.day
    )
  end

  it 'creates a date proto from a string' do
    test_date = '2019-10-12'
    expect(
      Protobuf3Fixer::GenerationHelpers.create_date(test_date)
    ).to have_attributes(
      year: 2019,
      month: 10,
      day: 12
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hermes_messenger_of_the_gods-2.0.0 vendor/cache/Protobuf3Fixer-5f9f1a2d2da9/spec/generation_helpers_spec.rb