Sha256: 7ece01509a68575cea09c37e0ae244a6952b2609943922ca30ba155cb504e13b

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

# frozen_string_literal: true

require 'rom/lint/spec'
require 'rom/files/gateway'
require 'shared/rom/files/media_relation'

RSpec.describe ROM::Files::Gateway do
  include_context 'media relation'

  subject(:gateway_instance) { ROM::Gateway.setup(identifier, uri) }
  let(:gateway) { described_class }
  let(:identifier) { :files }

  it_behaves_like "a rom gateway"

  describe '#use_logger' do
    let(:logger) { Logger.new(STDOUT) }
    it 'sets logger' do
      gateway_instance.use_logger(logger)
      expect(gateway_instance.logger).to eq logger
    end
  end

  describe '#dataset?' do
    subject { gateway_instance.dataset?(relation) }

    context 'with existing relation' do
      let(:relation) { :media }

      it { is_expected.to be true }
    end

    context 'with non-existing relation' do
      let(:relation) { :not_here }

      it { is_expected.to be false }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-files-0.2.0 spec/lib/rom/files/gateway_spec.rb