Sha256: cc91b10744463a647051f0952e69fa06554a30507052650b3c5ba73f7ace987d

Contents?: true

Size: 962 Bytes

Versions: 33

Compression:

Stored size: 962 Bytes

Contents

require 'spec_helper'

describe "Checking fixity" do

  before(:all) do
    class MockAFBase < ActiveFedora::Base
      contains "data", autocreate: true
    end
  end

  after(:all) do
    Object.send(:remove_const, :MockAFBase)
  end

  subject do
    obj = MockAFBase.create
    obj.data.content = "some content"
    obj.save
    obj.data
  end

  context "with a valid resource" do
    it "should return true for a successful fixity check" do
      expect(subject.check_fixity).to be true
    end
  end
  context "when no uri has been set" do
    subject { ActiveFedora::File.new }
    it "should raise an error" do
      expect { subject.check_fixity }.to raise_error(ArgumentError, "You must provide a uri")
    end
  end
  context "with missing resource" do
    subject { ActiveFedora::File.new(ActiveFedora::Base.id_to_uri('123')) }
    it "should raise an error" do
      expect { subject.check_fixity }.to raise_error(Ldp::NotFound)
    end
  end

end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
active-fedora-9.0.8 spec/integration/file_fixity_spec.rb
active-fedora-9.5.0 spec/integration/file_fixity_spec.rb
active-fedora-9.4.3 spec/integration/file_fixity_spec.rb
active-fedora-9.4.2 spec/integration/file_fixity_spec.rb
active-fedora-9.4.1 spec/integration/file_fixity_spec.rb
active-fedora-9.4.0 spec/integration/file_fixity_spec.rb
active-fedora-9.3.0 spec/integration/file_fixity_spec.rb
active-fedora-9.2.1 spec/integration/file_fixity_spec.rb
active-fedora-9.2.0 spec/integration/file_fixity_spec.rb
active-fedora-9.2.0.rc2 spec/integration/file_fixity_spec.rb
active-fedora-9.2.0.rc1 spec/integration/file_fixity_spec.rb
active-fedora-9.1.2 spec/integration/file_fixity_spec.rb
active-fedora-9.1.1 spec/integration/file_fixity_spec.rb
active-fedora-9.1.0 spec/integration/file_fixity_spec.rb
active-fedora-9.1.0.rc1 spec/integration/file_fixity_spec.rb
active-fedora-9.0.6 spec/integration/file_fixity_spec.rb
active-fedora-9.0.5 spec/integration/file_fixity_spec.rb
active-fedora-9.0.4 spec/integration/file_fixity_spec.rb
active-fedora-9.0.3 spec/integration/file_fixity_spec.rb
active-fedora-9.0.2 spec/integration/file_fixity_spec.rb