2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe GitlabSchema.types['Time'] do
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:iso) { "2018-06-04T15:23:50+02:00" }
|
|
|
|
let(:time) { Time.parse(iso) }
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
specify { expect(described_class.graphql_name).to eq('Time') }
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
it 'coerces Time object into ISO 8601' do
|
|
|
|
expect(described_class.coerce_isolated_result(time)).to eq(iso)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'coerces an ISO-time into Time object' do
|
|
|
|
expect(described_class.coerce_isolated_input(iso)).to eq(time)
|
|
|
|
end
|
|
|
|
end
|