hydra-works 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56fe0f1919fdd32fe127f5d3e0fc759eb781d74d
4
- data.tar.gz: a6f9183d56fd7911150ca4ce152bb5280471135c
3
+ metadata.gz: 8cefb87e089349c82c73439d52e233d4bb75a7d3
4
+ data.tar.gz: db102c0181dbb73a50e18980d97567466446bd8b
5
5
  SHA512:
6
- metadata.gz: 98a261ed13442400b6f41cb607d4b32e0f9fe8297ddd463d919ee1b69e19cb5704c1d41659566ad0f77b2f521b3ec140f3990b7eddc8b78af203bafbfc562eff
7
- data.tar.gz: 65a823283ea04b931451b685c8dc19bed6b666ea18199cc7a23c6140e463c243c2eb6b1afa5b47e8df18b2eea0d4839acb632eaf2df3d6ff812162d94169d3e3
6
+ metadata.gz: 020a75d61769ec1ec016b6a08faab106c620684f3648836cf70d2764b447a754ea1127259f4eaca6fe36dea5ac219d423caf61f4898adc39aa6bd18b7fcb03c8
7
+ data.tar.gz: 10995a20095c6b0690c957b4fa31fbf3f9ce90b62f2107a90666db92fc98cbef43a97323bccb64f1eb8a1ab63632aa65cff9868b91e29da350753c8378f8a8c5
data/.gitignore CHANGED
@@ -16,6 +16,7 @@ spec/internal
16
16
  mkmf.log
17
17
  jetty
18
18
  fcrepo4-data
19
+ fcrepo4-test-data/
19
20
  .DS_Store
20
21
  .ruby-gemset
21
22
  .ruby-version
@@ -78,3 +78,7 @@ RSpec/InstanceVariable:
78
78
  RSpec/DescribedClass:
79
79
  Exclude:
80
80
  - spec/hydra/works/models/concerns/generic_file/characterization_spec.rb
81
+
82
+ RSpec/AnyInstance:
83
+ Exclude:
84
+ - spec/hydra/works/services/persist_derivatives_spec.rb
data/Rakefile CHANGED
@@ -4,30 +4,26 @@ require 'rspec/core/rake_task'
4
4
  require 'rubocop/rake_task'
5
5
  require 'solr_wrapper'
6
6
  require 'fcrepo_wrapper'
7
+ require 'active_fedora/rake_support'
7
8
 
8
- desc 'Run style checker'
9
- RuboCop::RakeTask.new(:rubocop) do |task|
10
- task.requires << 'rubocop-rspec'
11
- task.fail_on_error = true
12
- end
9
+ namespace :works do
10
+ desc 'Run style checker'
11
+ RuboCop::RakeTask.new(:rubocop) do |task|
12
+ task.requires << 'rubocop-rspec'
13
+ task.fail_on_error = true
14
+ end
13
15
 
14
- desc 'Run test suite and style checker'
15
- task :spec do
16
- Rake::Task['rubocop'].invoke
17
- RSpec::Core::RakeTask.new(:spec)
18
- end
16
+ RSpec::Core::RakeTask.new(:rspec)
19
17
 
20
- desc 'Spin up Solr & Fedora and run the test suite'
21
- task :ci do
22
- solr_params = { port: 8983, verbose: true, managed: true }
23
- fcrepo_params = { port: 8984, verbose: true, managed: true }
24
- SolrWrapper.wrap(solr_params) do |solr|
25
- solr.with_collection(name: 'hydra-test', dir: File.join(File.expand_path('.', File.dirname(__FILE__)), 'solr', 'config')) do
26
- FcrepoWrapper.wrap(fcrepo_params) do
27
- Rake::Task['spec'].invoke
28
- end
18
+ desc 'Start up Solr & FCRepo and run the test suite'
19
+ task :spec do
20
+ with_test_server do
21
+ Rake::Task['works:rspec'].invoke
29
22
  end
30
23
  end
31
24
  end
32
25
 
26
+ desc 'Spin up Solr & Fedora and run the test suite'
27
+ task ci: ['works:rubocop', 'works:spec']
28
+
33
29
  task default: :ci
@@ -18,6 +18,7 @@ module Hydra::Works
18
18
 
19
19
  included do
20
20
  type [Hydra::PCDM::Vocab::PCDMTerms.Object, Vocab::WorksTerms.Work]
21
+ before_destroy :remove_from_parents
21
22
  end
22
23
 
23
24
  def works
@@ -70,5 +71,16 @@ module Hydra::Works
70
71
  def in_works
71
72
  ordered_by.select { |parent| parent.class.included_modules.include?(Hydra::Works::WorkBehavior) }.to_a
72
73
  end
74
+
75
+ private
76
+
77
+ # Remove this object from parent works or collections
78
+ def remove_from_parents
79
+ ordered_by.each do |parent|
80
+ parent.ordered_members.delete(self) # Delete the list node
81
+ parent.members.delete(self) # Delete the indirect container Proxy
82
+ parent.save! # record the changes to the ordered members
83
+ end
84
+ end
73
85
  end
74
86
  end
@@ -57,13 +57,13 @@ module Hydra::Works
57
57
  # @param object for mimetype to be determined. Attempts to use methods: :mime_type, :content_type, and :path.
58
58
  def determine_mime_type(file)
59
59
  if file.respond_to? :mime_type
60
- return file.mime_type
60
+ file.mime_type
61
61
  elsif file.respond_to? :content_type
62
- return file.content_type
62
+ file.content_type
63
63
  elsif file.respond_to? :path
64
- return Hydra::PCDM::GetMimeTypeForFile.call(file.path)
64
+ Hydra::PCDM::GetMimeTypeForFile.call(file.path)
65
65
  else
66
- return 'application/octet-stream'
66
+ 'application/octet-stream'
67
67
  end
68
68
  end
69
69
 
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Works
3
- VERSION = '0.7.0'.freeze
3
+ VERSION = '0.7.1'.freeze
4
4
  end
5
5
  end
@@ -69,6 +69,15 @@ describe Hydra::Works::Collection do
69
69
  it 'returns only works' do
70
70
  expect(subject).to eq [work1, work2]
71
71
  end
72
+
73
+ context "after deleting a member" do
74
+ before do
75
+ collection.save
76
+ work1.destroy
77
+ collection.reload
78
+ end
79
+ it { is_expected.to eq [work2] }
80
+ end
72
81
  end
73
82
  end
74
83
 
@@ -207,7 +207,7 @@ describe Hydra::Works::Work do
207
207
  end
208
208
  end
209
209
 
210
- describe 'should have parent work and collection accessors' do
210
+ describe 'parent work and collection accessors' do
211
211
  let(:collection1) { Hydra::Works::Collection.new }
212
212
  before do
213
213
  collection1.ordered_members << work2
@@ -93,8 +93,8 @@ describe Hydra::Works::CharacterizationService do
93
93
  allow(characterization).to receive(:characterize).and_return(fits_response)
94
94
  end
95
95
 
96
- it 'does not explode with an error.' do
97
- expect { described_class.run(file_set) }.to_not raise_error
96
+ it 'does not explode with an error' do
97
+ expect { described_class.run(file_set) }.not_to raise_error
98
98
  end
99
99
  end
100
100
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-works
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-05 00:00:00.000000000 Z
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hydra-pcdm
@@ -340,3 +340,4 @@ test_files:
340
340
  - spec/hydra/works_spec.rb
341
341
  - spec/spec_helper.rb
342
342
  - spec/support/file_set_helper.rb
343
+ has_rdoc: