Sha256: 960afb811b6176163a215d2b7e68718baeb1f7d24f8596f2f33c1e7292b58480

Contents?: true

Size: 1.82 KB

Versions: 1

Compression:

Stored size: 1.82 KB

Contents

# frozen_string_literal: true

require 'rom/files/dataset'
require 'shared/rom/files/media_dataset'

RSpec.describe ROM::Files::Dataset, '#select_append' do
  include_context 'media dataset'

  context 'with blank #include_patterns' do
    let(:dataset) { super().select }

    context '(simple_pattern)' do
      subject { dataset.select_append('*.txt') }

      its(:include_patterns) { is_expected.to eq %w[*.txt] }
    end

    context '(multiple, patterns)' do
      subject { dataset.select_append('*.txt', '*.md') }

      its(:include_patterns) { is_expected.to eq %w[*.txt *.md] }
    end

    context '(glob_pattern)' do
      subject { dataset.select_append('*.{txt,md}') }

      its(:include_patterns) { is_expected.to eq %w[*.{txt,md}] }
    end

    context '(ordered_glob_pattern)' do
      subject { dataset.select_append('*.{md,txt}') }

      its(:include_patterns) { is_expected.to eq %w[*.{md,txt}] }
    end
  end
  context 'after #select' do
    let(:dataset) { super().select('*.txt') }

    context '(duplicate_pattern)' do
      subject { dataset.select_append('*.txt') }

      its(:include_patterns) { is_expected.to eq %w[*.txt] }
    end

    context '(simple_pattern)' do
      subject { dataset.select_append('*.md') }

      its(:include_patterns) { is_expected.to eq %w[*.txt *.md] }
    end

    context '(multiple, duplicated, patterns)' do
      subject { dataset.select_append('*.txt', '*.md') }

      its(:include_patterns) { is_expected.to eq %w[*.txt *.md] }
    end

    context '(glob_pattern)' do
      subject { dataset.select_append('*.{txt,md}') }

      its(:include_patterns) { is_expected.to eq %w[*.txt *.{txt,md}] }
    end

    context '(ordered_glob_pattern)' do
      subject { dataset.select_append('*.{md,txt}') }

      its(:include_patterns) { is_expected.to eq %w[*.txt *.{md,txt}] }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-files-0.2.0 spec/lib/rom/files/dataset/select_append_spec.rb