Sha256: efd3b1627120df92c4aa882cefd1dc6d26b5c5eafadd29ab8db5442a1ded4895

Contents?: true

Size: 788 Bytes

Versions: 18

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

class ApiParamsTest < ActiveSupport::TestCase
  describe '#format_datetime' do
    let(:params) { JobInvocationComposer::ApiParams.allocate }

    it 'leaves empty string as is' do
      assert_equal params.send(:format_datetime, ''), ''
    end

    it 'honors explicitly supplied time zone' do
      Time.use_zone(ActiveSupport::TimeZone['America/New_York']) do
        assert_equal '2022-07-08 08:53', params.send(:format_datetime, '2022-07-08 12:53:20 UTC')
      end
    end

    it 'implicitly honors current user\'s time zone' do
      Time.use_zone(ActiveSupport::TimeZone['America/New_York']) do
        assert_equal '2022-07-08 12:53', params.send(:format_datetime, '2022-07-08 12:53:20')
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
foreman_remote_execution-14.1.1 test/unit/api_params_test.rb
foreman_remote_execution-14.0.2 test/unit/api_params_test.rb
foreman_remote_execution-14.0.1 test/unit/api_params_test.rb
foreman_remote_execution-13.2.6 test/unit/api_params_test.rb
foreman_remote_execution-14.0.0 test/unit/api_params_test.rb
foreman_remote_execution-13.2.5 test/unit/api_params_test.rb
foreman_remote_execution-13.2.4 test/unit/api_params_test.rb
foreman_remote_execution-13.2.3 test/unit/api_params_test.rb
foreman_remote_execution-13.2.2 test/unit/api_params_test.rb
foreman_remote_execution-12.0.7 test/unit/api_params_test.rb
foreman_remote_execution-13.2.1 test/unit/api_params_test.rb
foreman_remote_execution-13.2.0 test/unit/api_params_test.rb
foreman_remote_execution-13.0.0 test/unit/api_params_test.rb
foreman_remote_execution-12.0.5 test/unit/api_params_test.rb
foreman_remote_execution-12.0.4 test/unit/api_params_test.rb
foreman_remote_execution-12.0.1 test/unit/api_params_test.rb
foreman_remote_execution-12.0.2 test/unit/api_params_test.rb
foreman_remote_execution-12.0.0 test/unit/api_params_test.rb