Sha256: 3bdf5b3e629a80a97bd9a6041e94d79e45fcb57ebed4227c938953041c735cff

Contents?: true

Size: 743 Bytes

Versions: 9

Compression:

Stored size: 743 Bytes

Contents

require 'helper'

describe Plucky::Normalizers::CriteriaHashKey do
  subject {
    described_class.new
  }

  context "with a string" do
    it "returns symbol" do
      subject.call('foo').should eq(:foo)
    end
  end

  context "with a symbol" do
    it "returns symbol" do
      subject.call(:foo).should eq(:foo)
    end
  end

  context "with :id" do
    it "returns :_id" do
      subject.call(:id).should eq(:_id)
    end
  end

  it "returns key if something weird" do
    subject.call(['crazytown']).should eq(['crazytown'])
  end

  SymbolOperators.each do |operator|
    context "with #{operator} symbol operator" do
      it "returns field" do
        subject.call(:age.send(operator)).should eq(:age)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
plucky-0.8.0 spec/plucky/normalizers/criteria_hash_key_spec.rb
plucky-0.7.0 spec/plucky/normalizers/criteria_hash_key_spec.rb
plucky-0.6.6 spec/plucky/normalizers/criteria_hash_key_spec.rb
plucky-0.6.5 spec/plucky/normalizers/criteria_hash_key_spec.rb
plucky-0.6.4 spec/plucky/normalizers/criteria_hash_key_spec.rb
plucky-0.6.3 spec/plucky/normalizers/criteria_hash_key_spec.rb
plucky-0.6.2 spec/plucky/normalizers/criteria_hash_key_spec.rb
plucky-0.6.1 spec/plucky/normalizers/criteria_hash_key_spec.rb
plucky-0.6.0 spec/plucky/normalizers/criteria_hash_key_spec.rb