Sha256: bbf81a1d806a00678b028a9834e04c46b768678091db96b4fdfd83f2b849369d

Contents?: true

Size: 1.23 KB

Versions: 31

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe Krikri::LDP::Resource do
  before do 
    class DummyResource; include Krikri::LDP::Resource; end
    subject.connection_uri = 'http://localhost:8080/marmotta/ldp'
  end

  subject { DummyResource.new }
  let(:base_uri) { 'http://localhost:8080/marmotta/ldp/container' }
  let(:slug) { 'moomin' }

  it 'has a connection' do
    expect(subject.ldp_connection).to be_a Faraday::Connection
    require 'pry'
    binding.pry
  end
  
  describe '#create' do
    it 'creates ldp resources' do
      require 'pry'
      binding.pry
      expect { subject.create(base_uri, nil) }.not_to raise_error
    end

    it 'accepts slug' do
      expect(subject.create(base_uri, nil, :Slug => slug)
               .env['response_headers']['location'])
        .to eq 'http://localhost:8080/marmotta/ldp/container/moomin'
    end
  end

  describe '#save' do
    it 'is idempotent' do
      first = subject.save(base_uri, nil, :Slug => slug)
      second = subject.save(base_uri, nil, :Slug => slug)

      expect(first.env['response_headers']['location'])
        .to eq second.env['response_headers']['location']
    end
  end

  describe '#exists?' do
    it "knows it doesn't exist" do
      expect(subject).not_to exist
    end
  end
  
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
krikri-0.13.2 spec/ldp/resource_spec.rb~
krikri-0.13.1 spec/ldp/resource_spec.rb~
krikri-0.13.0 spec/ldp/resource_spec.rb~
krikri-0.12.4 spec/ldp/resource_spec.rb~
krikri-0.11.2 spec/ldp/resource_spec.rb~
krikri-0.11.1 spec/ldp/resource_spec.rb~
krikri-0.11.0 spec/ldp/resource_spec.rb~
krikri-0.10.1 spec/ldp/resource_spec.rb~
krikri-0.8.9 spec/ldp/resource_spec.rb~
krikri-0.8.8 spec/ldp/resource_spec.rb~
krikri-0.8.7 spec/ldp/resource_spec.rb~
krikri-0.8.6 spec/ldp/resource_spec.rb~
krikri-0.8.5 spec/ldp/resource_spec.rb~
krikri-0.8.4 spec/ldp/resource_spec.rb~
krikri-0.8.2 spec/ldp/resource_spec.rb~
krikri-0.8.0 spec/ldp/resource_spec.rb~
krikri-0.7.3 spec/ldp/resource_spec.rb~
krikri-0.7.2 spec/ldp/resource_spec.rb~
krikri-0.7.1 spec/ldp/resource_spec.rb~
krikri-0.6.0 spec/ldp/resource_spec.rb~