hydra-collections 2.0.4 → 2.0.5

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: 0848c18173f62f89254d85e85b584440db5c9360
4
- data.tar.gz: f1f144ffa8fbc44c61ab2ad810c89ce8e7b18f38
3
+ metadata.gz: d18580cc6f615f6c2db8d172eafc3295c15112d2
4
+ data.tar.gz: 62d0fcd015fe10ddbea811c97d510ea851834af2
5
5
  SHA512:
6
- metadata.gz: 025f951414c29038af78092e552353de53181095da0f5fe6c16831a4a12e7d6e8c6de5fb30f68cab3f75e44bae2ee95d830c13a6455821339dd800332de82031
7
- data.tar.gz: 7825b8ed470364197333795a2edd070df64a4935734864721a4914cf82970df572db73142fb33e031f8594045656ccc8b84754a9fe86647fff941b8ee9145a1e
6
+ metadata.gz: c2a9e3f91da266b5d23af91de3ff2ae4aae0252d69fb3c7feed87e9323f953528b053f9d8399418377832084e8ea212466d14370098251af22d0c3564ff77a5a
7
+ data.tar.gz: 0d571aa1c5108c78d46e4d6d6dc0e75c76d1b07fe77105774a068a12da2642f7e5ed3d6b2cf8d3b50fbf5af49312ab9d27a8bacfcb7e80f0ff0ca8579971864e
@@ -1,16 +1,3 @@
1
- # Copyright © 2013 The Pennsylvania State University
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
1
  class Collection < ActiveFedora::Base
15
2
  include Hydra::Collection
16
3
  end
@@ -1,4 +1,3 @@
1
-
2
1
  module Hydra
3
2
  module Collection
4
3
  extend ActiveSupport::Concern
@@ -11,7 +10,7 @@ module Hydra
11
10
  has_metadata "descMetadata", type: Hydra::CollectionRdfDatastream
12
11
  has_metadata "properties", type: Hydra::Datastream::Properties
13
12
 
14
- has_and_belongs_to_many :members, :property => :has_collection_member, :class_name => "ActiveFedora::Base" , :after_remove => :update_member
13
+ has_and_belongs_to_many :members, property: :has_collection_member, class_name: "ActiveFedora::Base" , after_remove: :update_member
15
14
 
16
15
  has_attributes :depositor, datastream: :properties, multiple: false
17
16
 
@@ -44,6 +43,8 @@ module Hydra
44
43
 
45
44
  # TODO: Use solr atomic updates to accelerate this process
46
45
  def update_member member
46
+ # because the member may have its collections cached, reload that cache so that it indexes the correct fields.
47
+ member.collections(true) if member.respond_to? :collections
47
48
  member.update_index
48
49
  end
49
50
 
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Collections
3
- VERSION = "2.0.4"
3
+ VERSION = "2.0.5"
4
4
  end
5
5
  end
@@ -2,8 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe CollectionsController, :type => :controller do
4
4
  before(:all) do
5
+ CollectionsController.configure_blacklight do |config|
6
+ config.default_solr_params = {:qf => 'label_tesim'}
7
+ end
8
+
5
9
  @user = FactoryGirl.find_or_create(:user)
6
- # CollectionsController.config.default_solr_params = {:qf => 'title_tesim'}
10
+
7
11
  class GenericFile < ActiveFedora::Base
8
12
  include Hydra::Collections::Collectible
9
13
 
@@ -103,10 +103,9 @@ describe CollectionsHelper, :type => :helper do
103
103
  it "should create a button with my text" do
104
104
  str = button_for_remove_selected_from_collection @collection, "Remove My Button"
105
105
  doc = Nokogiri::HTML(str)
106
- form = doc.xpath('//form').first
107
- expect(form.attr('action')).to eq("#{collections.collection_path(@collection.pid)}")
108
- i = form.children[3]
109
- expect(i.attr('value')).to eq("Remove My Button")
106
+ form = doc.css('form').first
107
+ expect(form.attr('action')).to eq collections.collection_path(@collection.id)
108
+ expect(form.css('input[type="submit"]').attr('value').value).to eq "Remove My Button"
110
109
  end
111
110
  end
112
111
 
@@ -1,17 +1,3 @@
1
- # Copyright © 2013 The Pennsylvania State University
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
1
  require 'spec_helper'
16
2
 
17
3
  describe Collection, :type => :model do
@@ -71,6 +57,9 @@ describe Collection, :type => :model do
71
57
  it "should allow files to be removed" do
72
58
  @collection.members = [@gf1, @gf2]
73
59
  @collection.save
60
+
61
+ expect(@gf1.collections).to eq [@collection] # This line forces the "collections" to be cached.
62
+ # We need to ensure that deleting causes the collection to be flushed.
74
63
  solr_doc_before_remove = ActiveFedora::SolrInstanceLoader.new(ActiveFedora::Base, @gf1.pid).send(:solr_doc)
75
64
  expect(solr_doc_before_remove["collection_tesim"]).to eq([@collection.pid])
76
65
  @collection.reload.members.delete(@gf1)
data/spec/spec_helper.rb CHANGED
@@ -20,6 +20,7 @@ RSpec.configure do |config|
20
20
  config.include Devise::TestHelpers, :type => :controller
21
21
  config.before(:each, :type=>"controller") { @routes = Hydra::Collections::Engine.routes }
22
22
  config.include EngineRoutes, :type => :controller
23
+ config.infer_spec_type_from_file_location!
23
24
  end
24
25
 
25
26
  module FactoryGirl
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-collections
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carolyn Cole
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-04 00:00:00.000000000 Z
11
+ date: 2014-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blacklight
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.2.2
190
+ rubygems_version: 2.4.1
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: A rails engine for managing Hydra Collections
@@ -214,3 +214,4 @@ test_files:
214
214
  - spec/support/db/migrate/20111101221803_create_searches.rb
215
215
  - spec/support/lib/generators/test_app_generator.rb
216
216
  - spec/support/lib/tasks/rspec.rake
217
+ has_rdoc: