Sha256: c4380ca6ea0367093f85a848e6fb2a865025f4894a64920a37d726b84450c237

Contents?: true

Size: 1.23 KB

Versions: 13

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
      Object.send(:remove_const, :SpecModel)
    end
    subject { SpecModel::CamelCased.to_class_uri }

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
active-fedora-10.3.0 spec/unit/base_extra_spec.rb
active-fedora-10.3.0.rc2 spec/unit/base_extra_spec.rb
active-fedora-10.3.0.rc1 spec/unit/base_extra_spec.rb
active-fedora-10.2.1 spec/unit/base_extra_spec.rb
active-fedora-10.2.0 spec/unit/base_extra_spec.rb
active-fedora-11.0.0.rc1 spec/unit/base_extra_spec.rb
active-fedora-10.1.0 spec/unit/base_extra_spec.rb
active-fedora-10.1.0.rc1 spec/unit/base_extra_spec.rb
active-fedora-10.0.0 spec/unit/base_extra_spec.rb
active-fedora-10.0.0.beta4 spec/unit/base_extra_spec.rb
active-fedora-10.0.0.beta3 spec/unit/base_extra_spec.rb
active-fedora-10.0.0.beta2 spec/unit/base_extra_spec.rb
active-fedora-10.0.0.beta1 spec/unit/base_extra_spec.rb