Sha256: 618e9a51c0e11340eb387d5e96de49a8a6396625f96ac1968507477fb21f836e

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe ActiveFedora::WithMetadata::MetadataNode do
  let(:generated_schema) { Class.new(described_class) }

  let(:file) { ActiveFedora::File.new }
  let(:node) { generated_schema.new(file) }
  let(:book) { RDF::URI.new('http://example.com/ns/Book') }

  describe "#changed_attributes" do
    subject { node.changed_attributes }

    context "when type is not set" do
      it { is_expected.to eq({}) }
    end

    context "when type is set" do
      before do
        generated_schema.configure type: book
      end

      it { is_expected.to eq('type' => true) }
    end
  end

  describe "changes_for_update" do
    let(:changes_for_update) { node.send(:changes_for_update) }
    subject { changes_for_update }

    context "when type is not set" do
      it { is_expected.to eq({}) }
    end

    context "when type is set" do
      before do
        generated_schema.configure type: book
      end

      it "is expected to have the rdf type statement" do
        expect(changes_for_update[::RDF.type]).to be_kind_of RDF::Queryable::Enumerator
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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