Sha256: 76e2df845c987e212b93582e7877270befee7fca8d36b3c76eb98a5b352ca167

Contents?: true

Size: 766 Bytes

Versions: 13

Compression:

Stored size: 766 Bytes

Contents

require 'spec_helper'

describe Object do
  context "bullet_key" do
    it "should return class and id composition" do
      post = Post.first
      expect(post.bullet_key).to eq("Post:#{post.id}")
    end

    if mongoid?
      it "should return class with namesapce and id composition" do
        post = Mongoid::Post.first
        expect(post.bullet_key).to eq("Mongoid::Post:#{post.id}")
      end
    end
  end

  context "primary_key_value" do
    it "should return id" do
      post = Post.first
      expect(post.primary_key_value).to eq(post.id)
    end

    it "should return primary key value" do
      post = Post.first
      Post.primary_key = 'name'
      expect(post.primary_key_value).to eq(post.name)
      Post.primary_key = 'id'
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
bullet_instructure-4.14.8 spec/bullet/ext/object_spec.rb
bullet-4.14.7 spec/bullet/ext/object_spec.rb
bullet_instructure-4.14.7 spec/bullet/ext/object_spec.rb
bullet-4.14.6 spec/bullet/ext/object_spec.rb
bullet-4.14.5 spec/bullet/ext/object_spec.rb
bullet-4.14.4 spec/bullet/ext/object_spec.rb
bullet-4.14.3 spec/bullet/ext/object_spec.rb
bullet-4.14.2 spec/bullet/ext/object_spec.rb
bullet-4.14.0 spec/bullet/ext/object_spec.rb
bullet-4.13.2 spec/bullet/ext/object_spec.rb
bullet-4.13.1 spec/bullet/ext/object_spec.rb
bullet-4.13.0 spec/bullet/ext/object_spec.rb
bullet-4.12.0 spec/bullet/ext/object_spec.rb