Sha256: 00ca6bfc93c4e3ebd25cf1200f47b0da326e78c6f788964e779971db7d7f1c2d

Contents?: true

Size: 978 Bytes

Versions: 23

Compression:

Stored size: 978 Bytes

Contents

require 'spec_helper'

describe Krikri::Enrichments::WebResourceURI do
  it_behaves_like 'a field enrichment'
  
  describe '#enrich_value' do
    it 'with a string returns the original value' do
      value = 'moomin'
      expect(subject.enrich_value(value)).to eq value
    end

    it 'with a date returns the original value' do
      value = Date.today
      expect(subject.enrich_value(value)).to eq value
    end

    it 'with a resource returns the original value' do
      value = build(:aggregation)
      expect(subject.enrich_value(value)).to eq value
    end

    context 'with a WebResource' do
      let(:web_resource) { build(:web_resource) }
      
      it 'returns nil for blank node' do
        expect(subject.enrich_value(web_resource)).to be_nil
      end

      it 'retains value with URI' do
        web_resource.set_subject!('http://example.org/moomin')
        expect(subject.enrich_value(web_resource)).to eq web_resource
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
krikri-0.15.2 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.15.1 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.15.0 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.14.0 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.13.2 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.13.1 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.13.0 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.12.4 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.12.3 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.12.1 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.12.0 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.12.0.pre.rc.1 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.11.2 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.11.1 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.11.0 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.10.1 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.10.0 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.9.0 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.8.9 spec/lib/krikri/enrichments/web_resource_uri_spec.rb
krikri-0.8.8 spec/lib/krikri/enrichments/web_resource_uri_spec.rb