Sha256: 35d56b355b9fbaca0a63f855a62875c7b88ce7538972eea3f1786b69eaa58a98

Contents?: true

Size: 860 Bytes

Versions: 6

Compression:

Stored size: 860 Bytes

Contents

require "spec_helper"

describe MakeTaggable::Utils do
  describe "#like_operator" do
    it "should return 'ILIKE' when the adapter is PostgreSQL" do
      allow(MakeTaggable::Utils.connection).to receive(:adapter_name) { "PostgreSQL" }
      expect(MakeTaggable::Utils.like_operator).to eq("ILIKE")
    end

    it "should return 'LIKE' when the adapter is not PostgreSQL" do
      allow(MakeTaggable::Utils.connection).to receive(:adapter_name) { "MySQL" }
      expect(MakeTaggable::Utils.like_operator).to eq("LIKE")
    end
  end

  describe "#sha_prefix" do
    it "should return a consistent prefix for a given word" do
      expect(MakeTaggable::Utils.sha_prefix("kittens")).to eq(MakeTaggable::Utils.sha_prefix("kittens"))
      expect(MakeTaggable::Utils.sha_prefix("puppies")).not_to eq(MakeTaggable::Utils.sha_prefix("kittens"))
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
make_taggable-0.7.1 spec/make_taggable/utils_spec.rb
make_taggable-0.7.0 spec/make_taggable/utils_spec.rb
make_taggable-0.6.6 spec/make_taggable/utils_spec.rb
make_taggable-0.6.5 spec/make_taggable/utils_spec.rb
make_taggable-0.6.4 spec/make_taggable/utils_spec.rb
make_taggable-0.6.3 spec/make_taggable/utils_spec.rb