Sha256: 90bc084ca138170a814401a6cf50a2a89d37de9509498314927fc8cd1c8aebdd

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Ldp::Resource::BinarySource do
  let(:client) { double }
  let(:uri) { 'http://example.com/foo/bar' }
  let(:content) { 'somecontent' }
  subject { described_class.new(client, uri, content) }

  it "should not display content to inspect" do
    expect(subject.inspect).to match /subject=\"http:\/\/example\.com\/foo\/bar\"/
    expect(subject.inspect).not_to match /somecontent/
  end

  describe '#described_by' do
    context 'without a description' do
      before do
        allow(client).to receive(:head).and_return(double(links: { }))
      end

      it 'retrieves the description object' do
        expect(subject.described_by).to eq nil
      end
    end

    context 'with a description' do
      before do
        allow(client).to receive(:head).and_return(double(links: { 'describedby' => ['http://example.com/foo/bar/desc']}))
        allow(client).to receive(:find_or_initialize).with('http://example.com/foo/bar/desc').and_return(desc)
      end

      let(:desc) { double }

      it 'retrieves the description object' do
        expect(subject.described_by).to eq desc
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ldp-0.6.1 spec/lib/ldp/resource/binary_source_spec.rb
ldp-0.6.0 spec/lib/ldp/resource/binary_source_spec.rb
ldp-0.5.0 spec/lib/ldp/resource/binary_source_spec.rb