Sha256: 2b7c94b65a185fa6c1375bb23ab2ffd2a5a40789a1f9ad46c696933af86950be

Contents?: true

Size: 752 Bytes

Versions: 6

Compression:

Stored size: 752 Bytes

Contents

require 'spec_helper'

describe MarkMapper::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

6 entries across 6 versions & 1 rubygems

Version Path
mark_mapper-0.0.6 spec/unit/normalizers/criteria_hash_key_spec.rb
mark_mapper-0.0.5 spec/unit/normalizers/criteria_hash_key_spec.rb
mark_mapper-0.0.4 spec/unit/normalizers/criteria_hash_key_spec.rb
mark_mapper-0.0.3 spec/unit/normalizers/criteria_hash_key_spec.rb
mark_mapper-0.0.2 spec/unit/normalizers/criteria_hash_key_spec.rb
mark_mapper-0.0.1 spec/unit/normalizers/criteria_hash_key_spec.rb