Sha256: 7520807a89f8076596b1f3ed3c4e6aecee0d5fd1775d2c1216a8dc61076768d2

Contents?: true

Size: 853 Bytes

Versions: 2

Compression:

Stored size: 853 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Bookmark do
  let(:user) { User.create! email: 'xyz@example.com', password: 'xyz12345'}
  subject do
    b = Bookmark.new(user: user)
    b.document = SolrDocument.new(id: 'u001')
    b
  end

  it "is valid" do
    expect(subject).to be_valid
  end

  it "belongs to user" do
    expect(Bookmark.reflect_on_association(:user)).not_to be_nil
  end

  it "is valid after saving" do
    subject.save
    expect(subject).to be_valid
  end
  
  describe "#document_type" do
    it "is the class of the solr document" do
      expect(subject.document_type).to eq SolrDocument
    end
  end
  
  describe "#document" do
    it "is a SolrDocument with just an id field" do
      expect(subject.document).to be_a_kind_of SolrDocument
      expect(subject.document.id).to eq 'u001'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight-6.3.1 spec/models/bookmark_spec.rb
blacklight-6.3.0 spec/models/bookmark_spec.rb