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.8 spec/unit/fixity_service_spec.rb
active-fedora-9.2.0.rc1 spec/unit/fixity_service_spec.rb
active-fedora-9.1.2 spec/unit/fixity_service_spec.rb
active-fedora-9.1.1 spec/unit/fixity_service_spec.rb
active-fedora-9.1.0 spec/unit/fixity_service_spec.rb
active-fedora-9.1.0.rc1 spec/unit/fixity_service_spec.rb
active-fedora-9.0.6 spec/unit/fixity_service_spec.rb
active-fedora-9.0.5 spec/unit/fixity_service_spec.rb
active-fedora-9.0.4 spec/unit/fixity_service_spec.rb
active-fedora-9.0.3 spec/unit/fixity_service_spec.rb
active-fedora-9.0.2 spec/unit/fixity_service_spec.rb
active-fedora-9.0.1 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.rc3 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.rc2 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.rc1 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.beta8 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.beta7 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.beta6 spec/unit/fixity_service_spec.rb
active-fedora-9.0.0.beta5 spec/unit/fixity_service_spec.rb