Sha256: 32e65c72279915a1d4c4d329e86bcfe98e91c588b80cc0e393f6478314e076a2

Contents?: true

Size: 1013 Bytes

Versions: 1

Compression:

Stored size: 1013 Bytes

Contents

require 'spec_helper'

shared_examples_for 'a name filterable target set' do |target_type, test_data|

  describe 'name filters' do

    it 'should filter by exact name' do
      gs = CQL::Repository.new(test_data[:exact_name][:fixture_location])

      expected_results = test_data[:exact_name][:expected_results]

      expected_results.each do |matched_name, expected|
        result = gs.query do
          select name
          from target_type
          with name matched_name
        end

        expect(result).to eq(expected)
      end
    end

    it 'should filter by regexp' do
      gs = CQL::Repository.new(test_data[:regexp][:fixture_location])

      expected_results = test_data[:regexp][:expected_results]

      expected_results.each do |matched_name, expected|
        result = gs.query do
          select name
          from target_type
          with name matched_name
        end

        expect(result).to eq(expected)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cql-0.3.0 spec/name_filterable_specs.rb