Sha256: 16d48b2331689ed6ed75e1411a553e73315889b430528afbbd95f10ffdd51827

Contents?: true

Size: 1.01 KB

Versions: 24

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe ActiveFedora::FixityService do

  subject { ActiveFedora::FixityService.new("http://path/to/resource") }

  it { is_expected.to respond_to(:target) }
  it { is_expected.to respond_to(:response) }

  describe "#check" do
    before do
      expect(subject).to receive(:get_fixity_response_from_fedora).and_return(response)
    end
    context "with a passing result" do
      let(:response) do
        instance_double("Response", body: '<subject> <http://fedora.info/definitions/v4/repository#status> "SUCCESS"^^<http://www.w3.org/2001/XMLSchema#string> .')
      end
      specify "returns true" do
        expect(subject.check).to be true
      end

    end

    context "with a failing result" do
      let(:response) do
        instance_double("Response", body: '<subject> <http://fedora.info/definitions/v4/repository#status> "BAD_CHECKSUM"^^<http://www.w3.org/2001/XMLSchema#string> .')
      end
      specify "returns false" do
        expect(subject.check).to be false
      end
    end
  end

end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
active-fedora-9.0.0.beta4 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.beta3 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.beta2 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.beta1 spec/unit/fixity_service_spec.rb