Sha256: 79ffe140b41b50e2cf680e9e716a5be436f8dfc90208778d594c7f7835ead098

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe GraphTypes::DateTimeType, '.formatted' do
  let!(:value) { Time.local 2017 }
  let!(:field) { described_class.fields['formatted'] }

  specify { expect(field.type.to_s).to eq 'String' }

  describe ':strftime' do
    let(:argument) { field.arguments['strftime'] }

    specify { expect(argument.type.to_s).to     eq 'String' }
    specify { expect(argument.default_value).to eq '%FT%T%Z' }

    describe '.resolve' do
      subject { field.resolve value, { strftime: '%d/%m/%Y' }, nil }

      specify { expect(subject).to eq '01/01/2017' }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graph_types-0.2.0 spec/lib/graph_types/types/data_time_type_spec.rb
graph_types-0.1.0 spec/lib/graph_types/data_time_type_spec.rb