Sha256: ac63bcaf6c21cfb791abed55953982b438f57fa40432250650da9fe7f6b5e08d

Contents?: true

Size: 797 Bytes

Versions: 7

Compression:

Stored size: 797 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

RSpec.describe ActiveTriples::ExtensionStrategy do
  subject { described_class }

  describe ".apply" do
    it "should copy the property to the asset" do
      asset = build_asset
      property = build_property("name", {:predicate => RDF::Vocab::DC.title})

      subject.apply(asset, property)

      expect(asset).to have_received(:property).with(property.name, property.to_h)
    end

    def build_asset
      object_double(ActiveTriples::Resource, :property => nil)
    end

    def build_property(name, options)
      property = object_double(ActiveTriples::Property.new(:name => nil))
      allow(property).to receive(:name).and_return(name)
      allow(property).to receive(:to_h).and_return(options)
      property
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active-triples-0.11.0 spec/active_triples/extension_strategy_spec.rb
active-triples-0.10.2 spec/active_triples/extension_strategy_spec.rb
active-triples-0.10.1 spec/active_triples/extension_strategy_spec.rb
active-triples-0.10.0 spec/active_triples/extension_strategy_spec.rb
active-triples-0.9.0 spec/active_triples/extension_strategy_spec.rb
active-triples-0.8.3 spec/active_triples/extension_strategy_spec.rb
active-triples-0.8.2 spec/active_triples/extension_strategy_spec.rb