Sha256: c06f518a2c4b7e2a68a1ca6637926be8d5f32ff758e60ebb136bb377179f0ac3

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

#
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

require 'spec_helper'

describe Dbee::Query::Filters do
  CONFIG = { key_path: 'a.b.c', value: :d }.freeze

  FACTORIES = {
    Dbee::Query::Filters::Contains => CONFIG.merge(type: :contains),
    Dbee::Query::Filters::Equals => CONFIG.merge(type: :equals),
    Dbee::Query::Filters::GreaterThanOrEqualTo => CONFIG.merge(type: :greater_than_or_equal_to),
    Dbee::Query::Filters::GreaterThan => CONFIG.merge(type: :greater_than),
    Dbee::Query::Filters::LessThanOrEqualTo => CONFIG.merge(type: :less_than_or_equal_to),
    Dbee::Query::Filters::LessThan => CONFIG.merge(type: :less_than),
    Dbee::Query::Filters::NotContain => CONFIG.merge(type: :not_contain),
    Dbee::Query::Filters::NotEquals => CONFIG.merge(type: :not_equals),
    Dbee::Query::Filters::NotStartWith => CONFIG.merge(type: :not_start_with),
    Dbee::Query::Filters::StartsWith => CONFIG.merge(type: :starts_with)
  }.freeze

  FACTORIES.each_pair do |constant, config|
    it "should instantiate #{constant} objects" do
      expect(described_class.make(config)).to be_a(constant)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dbee-1.0.0.pre.alpha spec/dbee/query/filters_spec.rb