Sha256: 7d4b73d5ea9b9c25010a2c1dedc2940d44c9dd9506094435389aae57b7b93f60

Contents?: true

Size: 1.24 KB

Versions: 33

Compression:

Stored size: 1.24 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 "should make 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 "should delete 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

33 entries across 33 versions & 1 rubygems

Version Path
active-fedora-9.0.8 spec/unit/base_extra_spec.rb
active-fedora-9.5.0 spec/unit/base_extra_spec.rb
active-fedora-9.4.3 spec/unit/base_extra_spec.rb
active-fedora-9.4.2 spec/unit/base_extra_spec.rb
active-fedora-9.4.1 spec/unit/base_extra_spec.rb
active-fedora-9.4.0 spec/unit/base_extra_spec.rb
active-fedora-9.3.0 spec/unit/base_extra_spec.rb
active-fedora-9.2.1 spec/unit/base_extra_spec.rb
active-fedora-9.2.0 spec/unit/base_extra_spec.rb
active-fedora-9.2.0.rc2 spec/unit/base_extra_spec.rb
active-fedora-9.2.0.rc1 spec/unit/base_extra_spec.rb
active-fedora-9.1.2 spec/unit/base_extra_spec.rb
active-fedora-9.1.1 spec/unit/base_extra_spec.rb
active-fedora-9.1.0 spec/unit/base_extra_spec.rb
active-fedora-9.1.0.rc1 spec/unit/base_extra_spec.rb
active-fedora-9.0.6 spec/unit/base_extra_spec.rb
active-fedora-9.0.5 spec/unit/base_extra_spec.rb
active-fedora-9.0.4 spec/unit/base_extra_spec.rb
active-fedora-9.0.3 spec/unit/base_extra_spec.rb
active-fedora-9.0.2 spec/unit/base_extra_spec.rb