Sha256: c78dbbcf2575b0a2a7c116b6ed050f2cab5422f32c3f4a389daf43cd40f7f70a
Contents?: true
Size: 1.43 KB
Versions: 17
Compression:
Stored size: 1.43 KB
Contents
# frozen_string_literal: true require_relative './operators/eq' require_relative './operators/ne' require_relative './operators/in' require_relative './operators/nin' (WCC::Contentful::Store::Query::Interface::OPERATORS - %i[eq ne in nin]).each do |op| RSpec.shared_examples "supports :#{op} operator" do it 'TODO' end end RSpec.shared_examples 'operators' do |feature_set| supported_operators = if feature_set.nil? WCC::Contentful::Store::Query::Interface::OPERATORS .each_with_object({}) { |k, h| h[k] = 'pending' } elsif feature_set.is_a?(Array) WCC::Contentful::Store::Query::Interface::OPERATORS .each_with_object({}) { |k, h| h[k] = feature_set.include?(k.to_sym) } elsif feature_s.is_a?(Hash) feature_set else raise ArgumentError, 'Please provide a hash or array of operators to test' end supported_operators.each do |op, value| next if value it "does not support :#{op}" do expect { subject.find_all(content_type: 'test') .apply('name' => { op => 'test' }) .to_a }.to raise_error do |ex| expect(ex.to_s).to match(/not supported/) end end end supported_operators.each do |op, value| # rubocop:disable Style/CombinableLoops next unless value it_behaves_like "supports :#{op} operator" do before { pending(":#{op} operator to be implemented") } if value == 'pending' end end end
Version data entries
17 entries across 17 versions & 1 rubygems