Sha256: a3d31321194abc6199365707ff554cb0e4db5c85839f895e46bb74231f158e4b

Contents?: true

Size: 760 Bytes

Versions: 8

Compression:

Stored size: 760 Bytes

Contents

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::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

8 entries across 8 versions & 1 rubygems

Version Path
active-triples-0.7.6 spec/active_triples/extension_strategy_spec.rb
active-triples-0.7.5 spec/active_triples/extension_strategy_spec.rb
active-triples-0.7.4 spec/active_triples/extension_strategy_spec.rb
active-triples-0.7.3 spec/active_triples/extension_strategy_spec.rb
active-triples-0.7.2 spec/active_triples/extension_strategy_spec.rb
active-triples-0.7.1 spec/active_triples/extension_strategy_spec.rb
active-triples-0.8.1 spec/active_triples/extension_strategy_spec.rb
active-triples-0.8.0 spec/active_triples/extension_strategy_spec.rb