Sha256: 9f60c91de4a1ae6861bebf1d312be5f4c5f86b8ea8d61b4d97afc7f048ce356e

Contents?: true

Size: 1.23 KB

Versions: 21

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe ActiveFedora::Base do
  describe ".update_index" do
    before do
      mock_conn = double("SolrConnection")
      expect(mock_conn).to receive(:add) do |_, opts|
        expect(opts).to eq(params: { softCommit: true })
      end
      mock_ss = double("SolrService")
      allow(mock_ss).to receive(:conn).and_return(mock_conn)
      allow(ActiveFedora::SolrService).to receive(:instance).and_return(mock_ss)
    end

    it "makes the solr_document with to_solr and add it" do
      expect(subject).to receive(:to_solr)
      subject.update_index
    end
  end

  describe ".delete" do
    before do
      allow(subject).to receive(:new_record?).and_return(false)
      allow(ActiveFedora.fedora.connection).to receive(:delete)
    end

    it "deletes object from repository and index" do
      expect(ActiveFedora::SolrService).to receive(:delete).with(nil)
      subject.delete
    end
  end

  describe "to_class_uri" do
    before :all do
      module SpecModel
        class CamelCased < ActiveFedora::Base
        end
      end
    end

    after :all do
      SpecModel.send(:remove_const, :CamelCased)
    end
    subject { SpecModel::CamelCased.to_class_uri }

    it { should == 'SpecModel::CamelCased' }
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
active-fedora-9.7.3 spec/unit/base_extra_spec.rb
active-fedora-9.7.2 spec/unit/base_extra_spec.rb
active-fedora-9.13.0 spec/unit/base_extra_spec.rb
active-fedora-9.12.0 spec/unit/base_extra_spec.rb
active-fedora-9.11.0 spec/unit/base_extra_spec.rb
active-fedora-9.10.4 spec/unit/base_extra_spec.rb
active-fedora-9.10.3 spec/unit/base_extra_spec.rb
active-fedora-9.10.2 spec/unit/base_extra_spec.rb
active-fedora-9.10.1 spec/unit/base_extra_spec.rb
active-fedora-9.10.0 spec/unit/base_extra_spec.rb
active-fedora-9.10.0.pre2 spec/unit/base_extra_spec.rb
active-fedora-9.10.0.pre1 spec/unit/base_extra_spec.rb
active-fedora-9.9.1 spec/unit/base_extra_spec.rb
active-fedora-9.9.0 spec/unit/base_extra_spec.rb
active-fedora-9.8.2 spec/unit/base_extra_spec.rb
active-fedora-9.8.1 spec/unit/base_extra_spec.rb
active-fedora-9.8.0 spec/unit/base_extra_spec.rb
active-fedora-9.7.1 spec/unit/base_extra_spec.rb
active-fedora-9.7.0 spec/unit/base_extra_spec.rb
active-fedora-9.6.2 spec/unit/base_extra_spec.rb