Sha256: 8a450607f7304d68e54093a6a32cb9744f0e817dbac59298fd2ed511118dddfe

Contents?: true

Size: 1.16 KB

Versions: 10

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

require "spec_helper"

module Trailblazer
  class Finder
    module Utils
      describe Splitter do
        describe ".initialize" do
          it "sets key and value" do
            splitter = described_class.new "attribute_eq", "value"
            expect(splitter.key).to eq "attribute_eq"
            expect(splitter.value).to eq "value"
          end
        end

        describe ".split_key" do
          it "checks if specified split key exists" do
            splitter = described_class.new "attribute_eq", "value"
            expect(splitter.split_key("random")).to eq false
            expect(splitter.split_key("eq")).to eq true
          end

          it "fills field value when split key exists" do
            splitter = described_class.new "attribute_eq", "value"
            splitter.split_key("eq")
            expect(splitter.field).to eq "attribute"
          end

          it "fills predicate value when split key exists" do
            splitter = described_class.new "attribute_eq", "value"
            splitter.split_key("eq")
            expect(splitter.predicate).to eq :eq
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
trailblazer-finder-0.70.0 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.50.0 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.10.3 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.10.2 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.10.1 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.10.0 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.3.0 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.2.7 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.2.6 spec/trailblazer/finder/utils/splitter_spec.rb
trailblazer-finder-0.2.5 spec/trailblazer/finder/utils/splitter_spec.rb