Sha256: 04b260348b798ebda9a87544b63a0b38fa5c4d84980be336090c090b9e8b49c9

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe ActiveFedora::Base do
  subject(:object) { described_class.new }
  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(object).to receive(:to_solr)
      object.update_index
    end
  end

  describe ".delete" do
    before do
      allow(object).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)
      object.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

6 entries across 6 versions & 1 rubygems

Version Path
active-fedora-11.0.0.rc7 spec/unit/base_extra_spec.rb
active-fedora-11.0.0.rc6 spec/unit/base_extra_spec.rb
active-fedora-11.0.0.rc5 spec/unit/base_extra_spec.rb
active-fedora-11.0.0.rc4 spec/unit/base_extra_spec.rb
active-fedora-11.0.0.rc3 spec/unit/base_extra_spec.rb
active-fedora-11.0.0.rc2 spec/unit/base_extra_spec.rb