Sha256: 7c22eb39078d3893a15f00e21d4ddc4a1fbb1499403cc7d1582b08a3e78cbe2f

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 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_present
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active-fedora-11.1.4 spec/unit/with_metadata/metadata_node_spec.rb
active-fedora-11.1.3 spec/unit/with_metadata/metadata_node_spec.rb
active-fedora-11.1.2 spec/unit/with_metadata/metadata_node_spec.rb
active-fedora-11.1.1 spec/unit/with_metadata/metadata_node_spec.rb
active-fedora-11.1.0 spec/unit/with_metadata/metadata_node_spec.rb
active-fedora-11.0.1 spec/unit/with_metadata/metadata_node_spec.rb
active-fedora-11.0.0 spec/unit/with_metadata/metadata_node_spec.rb