Sha256: 1070b5b16fe79213c264108a41d5d3c8174f6d033b641fbb32acc1aa7df0144b

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'
require 'rdf/isomorphic'

include RDF::Isomorphic

module Ddr::Models
  RSpec.describe DescriptiveMetadata do

    let(:obj) { FactoryGirl.build(:item) }

    describe "terminology" do
      subject { described_class.unqualified_names }
      it { is_expected.to_not include(:license) }
      it "should have a term for each term name in the RDF::DC vocab, except :license" do
        expect(subject).to include(*(Ddr::Vocab::Vocabulary.term_names(RDF::DC) - [:license]))
      end
      it "should have a term for each term name in the DukeTerms vocab" do
        expect(subject).to include(*Ddr::Vocab::Vocabulary.term_names(Ddr::Vocab::DukeTerms))
      end
    end
    describe "using the set_values and add_value methods" do
      let(:ds) { described_class.new(obj) }
      before { ds.type = ["Photograph"] }
      describe "#set_values" do
        it "should set the values of the term to those supplied" do
          ds.set_values :type, [ "Image", "Still Image" ]
          expect(ds.type).to eq([ "Image", "Still Image" ])
        end
      end
      describe "#add_value" do
        it "should add the supplied value to those of the term" do
          ds.add_value :type, "Image"
          expect(ds.type).to eq([ "Photograph", "Image" ])
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddr-models-3.0.0.alpha.2 spec/models/descriptive_metadata_spec.rb
ddr-models-3.0.0.alpha.1 spec/models/descriptive_metadata_spec.rb