Sha256: 82734423a39827d887551aa05a8addff98b9b9657292c57d2b4ee6ff80e01818

Contents?: true

Size: 818 Bytes

Versions: 59

Compression:

Stored size: 818 Bytes

Contents

require "spec_helper"

describe Mongoid::Extensions::Regexp do

  describe ".demongoize" do

    let(:value) do
      Regexp.demongoize(/[^abc]/)
    end

    it "returns the provided value" do
      expect(value).to eq(/[^abc]/)
    end
  end

  describe ".mongoize" do

    context "when providing a regex" do

      let(:value) do
        Regexp.mongoize(/[^abc]/)
      end

      it "returns the provided value" do
        expect(value).to eq(/[^abc]/)
      end
    end

    context "when providing a string" do

      let(:value) do
        Regexp.mongoize("[^abc]")
      end

      it "returns the provided value as a regex" do
        expect(value).to eq(/[^abc]/)
      end
    end
  end

  describe "#mongoize" do

    it "returns self" do
      expect(/[^abc]/.mongoize).to eq(/[^abc]/)
    end
  end
end

Version data entries

59 entries across 54 versions & 6 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mongoid-5.0.2/spec/mongoid/extensions/regexp_spec.rb
mongoid-5.0.2 spec/mongoid/extensions/regexp_spec.rb
mongoid-5.0.1 spec/mongoid/extensions/regexp_spec.rb
mongoid-5.0.0 spec/mongoid/extensions/regexp_spec.rb
mongoid-5.0.0.rc0 spec/mongoid/extensions/regexp_spec.rb
mongoid-5.0.0.beta spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.2 spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.1 spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.0 spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.0.rc2 spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.0.rc1 spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.0.beta2 spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.0.beta1 spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.0.alpha2 spec/mongoid/extensions/regexp_spec.rb
mongoid-4.0.0.alpha1 spec/mongoid/extensions/regexp_spec.rb
sepastian-mongoid-rails4-4.0.1.alpha spec/mongoid/extensions/regexp_spec.rb
sepastian-mongoid-rails4-4.0.0.alpha spec/mongoid/extensions/regexp_spec.rb
mongoid_heroku_stable-4.0.0 spec/mongoid/extensions/regexp_spec.rb
mongoid_rails4-4.0.0 spec/mongoid/extensions/regexp_spec.rb