Sha256: 5d288f74b0e352c40d241ec195a673aa026cae769beee67eaf066dbaf3cb6da7

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

require 'rom/files/schema/inferrer'
require 'shared/rom/files/media_files'

RSpec.describe ROM::Files::Schema::Inferrer do
  include_context 'media files'

  subject(:inferrer) { described_class.new }
  let(:relation_name) { ROM::Relation::Name.new(:media) }
  let(:schema) { ROM::Files::Schema.new(relation_name) }

  its(:attr_class) { is_expected.to eq ROM::Files::Attribute }

  describe '#call' do
    subject(:result) { inferrer.(schema, gateway) }

    it { is_expected.to be_a Hash }
    its([:attributes]) { is_expected.to be_a Array }

    describe '[:attributes]' do
      subject(:attributes) { result[:attributes] }

      it { is_expected.to be_a Array }
      its(:size) { is_expected.to eq 1 }
      its(:first) { is_expected.to be_a ROM::Files::Attribute }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-files-0.2.0 spec/lib/rom/files/schema/inferrer_spec.rb