Sha256: 2fd7941f2ca655f7bb1407d207f22b96eb1184ef7065fb2b508aa5651a5d02c2

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe ActiveFedora::ChangeSet do
  let(:change_set) { described_class.new(base, base.resource, base.changed_attributes.keys) }
  subject { change_set }

  context "with an unchanged object" do
    let(:base) { ActiveFedora::Base.new }

    it { is_expected.to be_empty }
  end

  context "with a changed object" do
    before do
      class Library < ActiveFedora::Base
      end

      class Book < ActiveFedora::Base
        belongs_to :library, predicate: ActiveFedora::RDF::RelsExt.hasConstituent
        property :title, predicate: ::RDF::DC.title
      end

      base.library_id = 'foo'
      base.title = ['bar']
    end
    after do
      Object.send(:remove_const, :Library)
      Object.send(:remove_const, :Book)
    end

    let(:base) { Book.create }


    describe "#changes" do
      subject { change_set.changes }

      it { is_expected.to be_kind_of Hash }

      it "should have two elements" do
        expect(subject.size).to eq 2
      end
    end

    it { is_expected.to_not be_empty }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active-fedora-9.0.0.rc3 spec/unit/change_set_spec.rb
active-fedora-9.0.0.rc2 spec/unit/change_set_spec.rb
active-fedora-9.0.0.rc1 spec/unit/change_set_spec.rb
active-fedora-9.0.0.beta8 spec/unit/change_set_spec.rb
active-fedora-9.0.0.beta7 spec/unit/change_set_spec.rb
active-fedora-9.0.0.beta6 spec/unit/change_set_spec.rb
active-fedora-9.0.0.beta5 spec/unit/change_set_spec.rb
active-fedora-9.0.0.beta4 spec/unit/change_set_spec.rb
active-fedora-9.0.0.beta3 spec/unit/change_set_spec.rb
active-fedora-9.0.0.beta2 spec/unit/change_set_spec.rb
active-fedora-9.0.0.beta1 spec/unit/change_set_spec.rb