active-fedora 9.2.0.rc1 → 9.2.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8342f8e77df84a1256f26396de99577f34010d2a
4
- data.tar.gz: 87203d5509bac4250d9a8c02082b31a310de971f
3
+ metadata.gz: bada647c029b7bff0f7068d8226fe256996f091a
4
+ data.tar.gz: 1c240deeaff193cdca424a8ec0d9c01ab2aefd13
5
5
  SHA512:
6
- metadata.gz: 407aab67f7584c962bc16c24b0a9f8fc8c25b7d25c7c5d92dd83ee7dbad9cc75b4800fdb7c267790ea4c0879fccc03bcc52da344601e3596b3e4f3214e462dd2
7
- data.tar.gz: c23c707171608bc46666cfa2c45b45313cf7fdfedc4e656b3b50458565888b35625fd3e3acc5efc77b80fa6b19aa72226d2c2a62870a6343325b89b2bbb929e5
6
+ metadata.gz: e402d06c32089846dc47542963fccdcf38e512e10c203fb27220e6a7df1e770c805a9aa8435f50729abec853fea9fc83263c20ae885530132236a96cd9024376
7
+ data.tar.gz: ef787677ed7601618bdf0c989f2298fff0bf43da788a01f5ac94031f296e1f7e1ee2bb8bf0c3b436a37c30d4e169cce19474520529a1957179a33610510c8cf3
@@ -1,3 +1,6 @@
1
+ v9.2.0.rc2
2
+ 2015-06-30: Allow the FixityService to accept an RDF::URI [Justin Coyne]
3
+
1
4
  v9.2.0.rc1
2
5
  2015-06-30: Refactor CollectionAssociation#reset [Justin Coyne]
3
6
 
@@ -4,10 +4,10 @@ module ActiveFedora
4
4
 
5
5
  attr_accessor :target, :response
6
6
 
7
- # Accepts an Fedora resource such as File.ldp_resource.subject
7
+ # @param [String, RDF::URI] target url for a Fedora resource
8
8
  def initialize target
9
9
  raise ArgumentError, 'You must provide a uri' unless target
10
- @target = target
10
+ @target = target.to_s
11
11
  end
12
12
 
13
13
  # Executes a fixity check on Fedora and saves the Faraday::Response.
@@ -23,23 +23,23 @@ module ActiveFedora
23
23
 
24
24
  private
25
25
 
26
- def get_fixity_response_from_fedora
27
- uri = target + "/fcr:fixity"
28
- ActiveFedora.fedora.connection.get(encoded_url(uri))
29
- end
30
-
31
- def fixity_graph
32
- ::RDF::Graph.new << ::RDF::Reader.for(:ttl).new(response.body)
33
- end
26
+ def get_fixity_response_from_fedora
27
+ uri = target + "/fcr:fixity"
28
+ ActiveFedora.fedora.connection.get(encoded_url(uri))
29
+ end
34
30
 
35
- # See https://jira.duraspace.org/browse/FCREPO-1247
36
- def encoded_url uri
37
- if uri.match("fcr:versions")
38
- uri.gsub(/fcr:versions/,"fcr%3aversions")
39
- else
40
- uri
31
+ def fixity_graph
32
+ ::RDF::Graph.new << ::RDF::Reader.for(:ttl).new(response.body)
41
33
  end
42
- end
43
34
 
35
+ # See https://jira.duraspace.org/browse/FCREPO-1247
36
+ # @param [String] uri
37
+ def encoded_url uri
38
+ if uri.match("fcr:versions")
39
+ uri.gsub(/fcr:versions/,"fcr%3aversions")
40
+ else
41
+ uri
42
+ end
43
+ end
44
44
  end
45
45
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "9.2.0.rc1"
2
+ VERSION = "9.2.0.rc2"
3
3
  end
@@ -2,32 +2,44 @@ require 'spec_helper'
2
2
 
3
3
  describe ActiveFedora::FixityService do
4
4
 
5
- subject { ActiveFedora::FixityService.new("http://path/to/resource") }
5
+ let(:service) { described_class.new(uri) }
6
+ let(:uri) { RDF::URI("http://path/to/resource") }
6
7
 
7
- it { is_expected.to respond_to(:target) }
8
- it { is_expected.to respond_to(:response) }
8
+ describe "the instance" do
9
+ subject { described_class.new(uri) }
10
+ it { is_expected.to respond_to(:response) }
11
+ end
12
+
13
+ describe "initialize" do
14
+ context "with a string" do
15
+ let(:uri) { 'http://path/to/resource' }
16
+ subject { service.target }
17
+ it { is_expected.to eq 'http://path/to/resource' }
18
+ end
19
+
20
+ context "with an RDF::URI" do
21
+ subject { service.target }
22
+ it { is_expected.to eq 'http://path/to/resource' }
23
+ end
24
+ end
9
25
 
10
26
  describe "#check" do
11
27
  before do
12
- expect(subject).to receive(:get_fixity_response_from_fedora).and_return(response)
28
+ allow(service).to receive(:get_fixity_response_from_fedora).and_return(response)
13
29
  end
30
+ subject { service.check }
14
31
  context "with a passing result" do
15
32
  let(:response) do
16
33
  instance_double("Response", body: '<subject> <http://fedora.info/definitions/v4/repository#status> "SUCCESS"^^<http://www.w3.org/2001/XMLSchema#string> .')
17
34
  end
18
- specify "returns true" do
19
- expect(subject.check).to be true
20
- end
21
-
35
+ it { is_expected.to be true }
22
36
  end
23
37
 
24
38
  context "with a failing result" do
25
39
  let(:response) do
26
40
  instance_double("Response", body: '<subject> <http://fedora.info/definitions/v4/repository#status> "BAD_CHECKSUM"^^<http://www.w3.org/2001/XMLSchema#string> .')
27
41
  end
28
- specify "returns false" do
29
- expect(subject.check).to be false
30
- end
42
+ it { is_expected.to be false }
31
43
  end
32
44
  end
33
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-fedora
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.0.rc1
4
+ version: 9.2.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-30 00:00:00.000000000 Z
13
+ date: 2015-07-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr