hydra-core 6.5.2 → 7.0.0.pre1

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/hydra/controller.rb +2 -0
  3. data/app/controllers/concerns/hydra/controller/download_behavior.rb +18 -19
  4. data/{lib → app/models/concerns}/hydra/model_methods.rb +0 -0
  5. data/app/models/concerns/hydra/models.rb +5 -0
  6. data/{lib → app/models/concerns}/hydra/models/file_asset.rb +0 -0
  7. data/{lib → app/models/concerns}/hydra/solr.rb +0 -0
  8. data/hydra-core.gemspec +3 -2
  9. data/lib/generators/hydra/head_generator.rb +4 -11
  10. data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +17 -24
  11. data/lib/hydra-core.rb +3 -33
  12. data/lib/hydra-head/engine.rb +1 -0
  13. data/lib/hydra-head/version.rb +1 -1
  14. data/spec/controllers/catalog_controller_spec.rb +1 -1
  15. data/spec/controllers/downloads_controller_spec.rb +24 -12
  16. data/spec/lib/model_methods_spec.rb +3 -3
  17. data/spec/support/app/models/generic_content.rb +21 -0
  18. data/spec/support/lib/generators/test_app_generator.rb +5 -8
  19. data/spec/support/spec/fixtures/hydra_test_generic_content.foxml.xml +138 -0
  20. data/spec/test_app_templates/Gemfile.extra +4 -0
  21. data/tasks/rspec.rake +1 -0
  22. metadata +24 -30
  23. data/app/helpers/facets_helper.rb +0 -4
  24. data/app/helpers/hydra/facets_helper_behavior.rb +0 -25
  25. data/lib/hydra-head/routes.rb +0 -46
  26. data/lib/hydra/controller.rb +0 -7
  27. data/lib/hydra/global_configurable.rb +0 -46
  28. data/lib/hydra/model_mixins/common_metadata.rb +0 -24
  29. data/lib/hydra/model_mixins/solr_document_extension.rb +0 -33
  30. data/lib/hydra/models.rb +0 -7
  31. data/spec/helpers/facets_helper_spec.rb +0 -26
  32. data/spec/lib/global_configurable_spec.rb +0 -98
  33. data/spec/lib/solr_document_extension_spec.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc393c7c2006c1b4640304025e401d3920a08e68
4
- data.tar.gz: 3406224bbbc5f743ef6d0398707c61c147a3414d
3
+ metadata.gz: 1cf9361903147e9724ae37d21f4a890a84a031ff
4
+ data.tar.gz: afe9fc4f220f71e8148ab55ea68e920a31a19784
5
5
  SHA512:
6
- metadata.gz: a78f797300a1fd710b4d09e109218696e79a196213ba24cc32c02ad0f7263ce723c86c22262cb1485a007c09b06cc1143e8cfa9c4f18bf71aefecef44d13c4f7
7
- data.tar.gz: 331ea9537f156be69613d7bcfd9494721a6b602519bc62a94e62a21d8ba902e7c1f3bf2369f8aae92434762891637e18aaa09c6a6faa64be7c74358779329399
6
+ metadata.gz: 601bc533781382961b862b46f294b9c4dd13bb2a55ed4dc33fa4a5622d76323e914a2332df218bddecda4d662466c7bcb2c3e3ff2f14c39e5b7d2cf24f75e39b
7
+ data.tar.gz: e23f48c1de6975b59eda986938c83a06e7ee2e2b7a7a27bf35d2cca2c62e083e05c82bdbb22dea6baf4826d207c27df4598f8d6bf28fb8094998259f6f7faed6
@@ -0,0 +1,2 @@
1
+ module Hydra::Controller
2
+ end
@@ -2,24 +2,20 @@ module Hydra
2
2
  module Controller
3
3
  module DownloadBehavior
4
4
  extend ActiveSupport::Concern
5
+ extend Deprecation
5
6
 
6
7
  included do
7
8
  before_filter :load_asset
8
9
  before_filter :load_datastream
10
+ before_filter :authorize_download!
9
11
  end
10
12
 
11
13
  # Responds to http requests to show the datastream
12
14
  def show
13
- if can_download?
14
- if datastream.new?
15
- render_404
16
- else
17
- # we can now examine asset and determine if we should send_content, or some other action.
18
- send_content (asset)
19
- end
20
- else
21
- logger.info "Can not read #{params[asset_param_key]}"
22
- raise Hydra::AccessDenied.new("You do not have sufficient access privileges to read this document, which has been marked private.", :read, params[asset_param_key])
15
+ if datastream.new?
16
+ render_404
17
+ else
18
+ send_content
23
19
  end
24
20
  end
25
21
 
@@ -46,6 +42,15 @@ module Hydra
46
42
  @ds = datastream_to_show
47
43
  end
48
44
 
45
+ # Customize the :download ability in your Ability class, or override this method
46
+ def authorize_download!
47
+ if self.respond_to?(:can_download?)
48
+ Deprecation.warn(DownloadBehavior, "The `can_download?' method is deprecated and will not be supported in hydra-head 8.0. Implement special authorization behavior by customizing the :download permission on ActiveFedora::Datastream in your Ability class.", caller)
49
+ current_ability.send(can_download? ? :can : :cannot, :download, ActiveFedora::Datastream, dsid: datastream.dsid, pid: datastream.pid)
50
+ end
51
+ authorize! :download, datastream
52
+ end
53
+
49
54
  def asset
50
55
  @asset
51
56
  end
@@ -54,14 +59,6 @@ module Hydra
54
59
  @ds
55
60
  end
56
61
 
57
- # Override this method to enforce access controls. By default it allows
58
- # any datastream on an object the current user has read access to.
59
- # @return [Boolean] can the curent user view this object/datastream
60
- def can_download?
61
- can? :read, datastream.pid
62
- end
63
-
64
-
65
62
  # Override this method to change which datastream is shown.
66
63
  # Loads the datastream specified by the HTTP parameter `:datastream_id`.
67
64
  # If this object does not have a datastream by that name, return the default datastream
@@ -75,7 +72,9 @@ module Hydra
75
72
  end
76
73
 
77
74
  # Handle the HTTP show request
78
- def send_content(asset)
75
+ def send_content(asset_ = nil)
76
+ Deprecation.warn(DownloadBehavior, "The `asset' parameter of the `send_content' method is deprecated and will be removed from Hydra::Controller::DownloadBehavior in hydra-head 8.0", caller) if asset_
77
+
79
78
  response.headers['Accept-Ranges'] = 'bytes'
80
79
 
81
80
  if request.head?
@@ -0,0 +1,5 @@
1
+ module Hydra
2
+ module Models
3
+ end
4
+ end
5
+
@@ -19,9 +19,10 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.required_ruby_version = '>= 1.9.3'
21
21
 
22
+
22
23
  gem.add_dependency "rails", '>= 3.2.3', '< 5'
23
- gem.add_dependency "blacklight", '~> 4.7'
24
- gem.add_dependency "active-fedora", '~> 6.7'
24
+ gem.add_dependency "blacklight", '~> 4.0'
25
+ gem.add_dependency "active-fedora"
25
26
  gem.add_dependency 'block_helpers'
26
27
  gem.add_dependency 'deprecation', ">= 0.0.5"
27
28
  gem.add_dependency 'hydra-access-controls', version
@@ -48,8 +48,10 @@ class HeadGenerator < Rails::Generators::Base
48
48
  # Initializers
49
49
  file_path = "config/initializers/hydra_config.rb"
50
50
  copy_file "config/initializers/hydra_config.rb", file_path
51
- insert_into_file file_path, :after => '# specify the user model' do
52
- "\n config[:user_model] = '#{model_name.classify}'"
51
+ unless model_name == 'user'
52
+ insert_into_file file_path, :after => 'Hydra.configure do |config|' do
53
+ "\n config.user_model = '#{model_name.classify}'"
54
+ end
53
55
  end
54
56
 
55
57
  copy_file "config/initializers/action_dispatch_http_upload_monkey_patch.rb", "config/initializers/action_dispatch_http_upload_monkey_patch.rb"
@@ -79,14 +81,5 @@ class HeadGenerator < Rails::Generators::Base
79
81
  puts " \e[31mFailure\e[0m Hydra requires a user object in order to apply access controls. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails -g hydra:head client"
80
82
  end
81
83
  end
82
-
83
- # Inject call to HydraHead.add_routes in config/routes.rb
84
- def inject_hydra_routes
85
- insert_into_file "config/routes.rb", :after => 'Blacklight.add_routes(self)' do
86
- "\n # Add Hydra routes. For options, see API docs for HydraHead.routes"
87
- "\n HydraHead.add_routes(self)"
88
- end
89
- end
90
-
91
84
  end # HeadGenerator
92
85
  end # Hydra
@@ -1,28 +1,21 @@
1
- # The following lines determine which user attributes your hydrangea app will use
2
- # This configuration allows you to use the out of the box ActiveRecord associations between users and user_attributes
3
- # It also allows you to specify your own user attributes
4
- # The easiest way to override these methods would be to create your own module to include in User
5
- # For example you could create a module for your local LDAP instance called MyLocalLDAPUserAttributes:
6
- # User.send(:include, MyLocalLDAPAttributes)
7
- # As long as your module includes methods for full_name, affiliation, and photo the personalization_helper should function correctly
8
- #
9
-
10
1
  # windows doesn't properly require hydra-head (from the gemfile), so we need to require it explicitly here:
11
2
  require 'hydra/head' unless defined? Hydra
12
3
 
13
- if Hydra.respond_to?(:configure)
14
- Hydra.configure(:shared) do |config|
15
- # This specifies the solr field names of permissions-related fields.
16
- # You only need to change these values if you've indexed permissions by some means other than the Hydra's built-in tooling.
17
- # If you change these, you must also update the permissions request handler in your solrconfig.xml to return those values
18
- indexer = Solrizer::Descriptor.new(:string, :stored, :indexed, :multivalued)
19
- config[:permissions] = {
20
- :discover => {:group =>ActiveFedora::SolrService.solr_name("discover_access_group", indexer), :individual=>ActiveFedora::SolrService.solr_name("discover_access_person", indexer)},
21
- :read => {:group =>ActiveFedora::SolrService.solr_name("read_access_group", indexer), :individual=>ActiveFedora::SolrService.solr_name("read_access_person", indexer)},
22
- :edit => {:group =>ActiveFedora::SolrService.solr_name("edit_access_group", indexer), :individual=>ActiveFedora::SolrService.solr_name("edit_access_person", indexer)},
23
- :owner => ActiveFedora::SolrService.solr_name("depositor", indexer),
24
- :embargo_release_date => ActiveFedora::SolrService.solr_name("embargo_release_date", Solrizer::Descriptor.new(:date, :stored, :indexed))
25
- }
26
-
27
- end
4
+ Hydra.configure do |config|
5
+ # This specifies the solr field names of permissions-related fields.
6
+ # You only need to change these values if you've indexed permissions by some means other than the Hydra's built-in tooling.
7
+ # If you change these, you must also update the permissions request handler in your solrconfig.xml to return those values
8
+ #
9
+ # config.permissions.discover.group = ActiveFedora::SolrService.solr_name("discover_access_group", :symbol)
10
+ # config.permissions.discover.individual = ActiveFedora::SolrService.solr_name("discover_access_person", :symbol)
11
+ # config.permissions.read.group = ActiveFedora::SolrService.solr_name("read_access_group", :symbol)
12
+ # config.permissions.read.individual = ActiveFedora::SolrService.solr_name("read_access_person", :symbol)
13
+ # config.permissions.edit.group = ActiveFedora::SolrService.solr_name("edit_access_group", :symbol)
14
+ # config.permissions.edit.individual = ActiveFedora::SolrService.solr_name("edit_access_person", :symbol)
15
+ #
16
+ # config.permissions.embargo_release_date = ActiveFedora::SolrService.solr_name("embargo_release_date", Solrizer::Descriptor.new(:date, :stored, :indexed))
17
+ # }
18
+ #
19
+ # specify the user model
20
+ # config.user_model = '#{model_name.classify}'
28
21
  end
@@ -1,41 +1,11 @@
1
1
  require 'hydra-access-controls'
2
-
3
- module Hydra
4
- extend ActiveSupport::Autoload
5
- autoload :GlobalConfigurable
6
- extend GlobalConfigurable
7
- autoload :Controller
8
- autoload :ModelMethods
9
- autoload :RepositoryController
10
- autoload :Solr
11
- module ModelMixins
12
- # ModelMixins already loaded by hydra-access-controls
13
- autoload :SolrDocumentExtension
14
- end
15
- autoload :Models
16
- end
2
+ require 'deprecation'
17
3
 
18
4
  module HydraHead
5
+ extend Deprecation
19
6
  require 'hydra-head/engine' if defined?(Rails)
20
- require 'hydra-head/routes'
21
- # If you put this in your application's routes.rb, it will add the Hydra Head routes to the app.
22
- # The hydra:head generator puts this in routes.rb for you by default.
23
- # See {HydraHead::Routes} for information about how to modify which routes are generated.
24
- # @example
25
- # # in config/routes.rb
26
- # MyAppName::Application.routes.draw do
27
- # Blacklight.add_routes(self)
28
- # HydraHead.add_routes(self)
29
- # end
30
7
  def self.add_routes(router, options = {})
31
- HydraHead::Routes.new(router, options).draw
8
+ Deprecation.warn HydraHead, "add_routes has been removed." # remove this warning in hydra-head 8
32
9
  end
33
10
  end
34
11
 
35
- ActiveSupport.on_load(:after_initialize) do
36
- begin
37
- SolrDocument.use_extension Hydra::ModelMixins::SolrDocumentExtension
38
- rescue NameError
39
- logger.warn "Couldn't find SolrDocument"
40
- end
41
- end
@@ -6,6 +6,7 @@ module HydraHead
6
6
 
7
7
  config.autoload_paths += %W(
8
8
  #{config.root}/app/controllers/concerns
9
+ #{config.root}/app/models/concerns
9
10
  )
10
11
 
11
12
  # Load rake tasks
@@ -1,4 +1,4 @@
1
1
  module HydraHead
2
- VERSION = "6.5.2"
2
+ VERSION = "7.0.0.pre1"
3
3
  end
4
4
 
@@ -56,7 +56,7 @@ describe CatalogController do
56
56
  before(:all) do
57
57
  fq = "read_access_group_ssim:public OR edit_access_group_ssim:public OR discover_access_group_ssim:public"
58
58
  solr_opts = {:fq=>fq}
59
- response = ActiveFedora::SolrService.instance.conn.get('select', :params=>solr_opts)
59
+ response = Blacklight.solr.get('select', :params=> solr_opts)
60
60
  @public_only_results = Blacklight::SolrResponse.new(response, solr_opts)
61
61
  end
62
62
 
@@ -102,7 +102,7 @@ describe DownloadsController do
102
102
  stub_ds.stub(:pid).and_return('changeme:test')
103
103
  stub_file = double('stub object', datastreams: {'webm' => stub_ds}, pid:'changeme:test', label: "MyVideo.webm")
104
104
  ActiveFedora::Base.should_receive(:load_instance_from_solr).with('changeme:test').and_return(stub_file)
105
- controller.stub(:can?).with(:read, 'changeme:test').and_return(true)
105
+ controller.stub(:authorize!).with(:download, stub_ds).and_return(true)
106
106
  controller.stub(:log_download)
107
107
  end
108
108
  it "head request" do
@@ -145,17 +145,6 @@ describe DownloadsController do
145
145
  end
146
146
  end
147
147
 
148
- describe "when not logged in as reader" do
149
- describe "show" do
150
- before do
151
- sign_in User.new.tap {|u| u.email = 'email2@example.com'; u.password = 'password'; u.save}
152
- end
153
- it "should deny access" do
154
- lambda { get "show", :id =>@obj.pid }.should raise_error Hydra::AccessDenied
155
- end
156
- end
157
- end
158
-
159
148
  describe "overriding the default asset param key" do
160
149
  before do
161
150
  Rails.application.routes.draw do
@@ -172,5 +161,28 @@ describe DownloadsController do
172
161
  end
173
162
  end
174
163
 
164
+ describe "overriding the can_download? method" do
165
+ before { sign_in @user }
166
+ context "current_ability.can? returns true / can_download? returns false" do
167
+ it "should authorize according to can_download?" do
168
+ controller.current_ability.can?(:download, @obj.datastreams['buzz']).should be_true
169
+ controller.stub(:can_download?).and_return(false)
170
+ expect { get :show, id: @obj, datastream_id: 'buzz' }.to raise_error(CanCan::AccessDenied)
171
+ end
172
+ end
173
+ context "current_ability.can? returns false / can_download? returns true" do
174
+ before do
175
+ @obj.rightsMetadata.clear_permissions!
176
+ @obj.save
177
+ end
178
+ it "should authorize according to can_download?" do
179
+ controller.current_ability.can?(:download, @obj.datastreams['buzz']).should be_false
180
+ controller.stub(:can_download?).and_return(true)
181
+ get :show, id: @obj, datastream_id: 'buzz'
182
+ response.should be_successful
183
+ end
184
+ end
185
+ end
186
+
175
187
  end
176
188
  end
@@ -6,7 +6,7 @@ describe Hydra::ModelMethods do
6
6
  class TestModel < ActiveFedora::Base
7
7
  include Hydra::AccessControls::Permissions
8
8
  include Hydra::ModelMethods
9
- has_metadata :name => "properties", :type => Hydra::Datastream::Properties
9
+ has_metadata "properties", type: Hydra::Datastream::Properties
10
10
  end
11
11
  end
12
12
 
@@ -15,12 +15,12 @@ describe Hydra::ModelMethods do
15
15
  describe "apply_depositor_metadata" do
16
16
  it "should add edit access" do
17
17
  subject.apply_depositor_metadata('naomi')
18
- subject.rightsMetadata.individuals.should == {'naomi' => 'edit'}
18
+ subject.rightsMetadata.users.should == {'naomi' => 'edit'}
19
19
  end
20
20
  it "should not overwrite people with edit access" do
21
21
  subject.rightsMetadata.permissions({:person=>"jessie"}, 'edit')
22
22
  subject.apply_depositor_metadata('naomi')
23
- subject.rightsMetadata.individuals.should == {'naomi' => 'edit', 'jessie' =>'edit'}
23
+ subject.rightsMetadata.users.should == {'naomi' => 'edit', 'jessie' =>'edit'}
24
24
  end
25
25
  it "should set depositor" do
26
26
  subject.apply_depositor_metadata('chris')
@@ -0,0 +1,21 @@
1
+ # GenericContent: EXAMPLE Model that conforms to the Hydra genericContent and genericMetadata cModels
2
+ require 'deprecation'
3
+ class GenericContent < ActiveFedora::Base
4
+ extend Deprecation
5
+
6
+ # Uses the Hydra Rights Metadata Schema for tracking access permissions & copyright
7
+ # FIXME: should this have "include Hydra::ModelMixins::CommonMetadata" instead?
8
+ has_metadata :name => "rightsMetadata", :type => Hydra::Datastream::RightsMetadata
9
+
10
+ # A place to put extra metadata values, e.g. the user id of the object depositor (for permissions)
11
+ has_metadata :name => "properties", :type => Hydra::Datastream::Properties
12
+
13
+ # adds helpful methods for basic hydra objects.
14
+ # FIXME: redundate with GenericContent include above??
15
+ include Hydra::ModelMethods
16
+
17
+ def initialize( attrs={} )
18
+ Deprecation.warn(GenericContent, "GenericContent is deprecated and will be removed in hydra-head 5.x")
19
+ super
20
+ end
21
+ end
@@ -3,19 +3,16 @@ require 'rails/generators'
3
3
  class TestAppGenerator < Rails::Generators::Base
4
4
  source_root File.expand_path("../../../../support", __FILE__)
5
5
 
6
- # Inject call to Hydra::BatchEdit.add_routes in config/routes.rb
7
- def inject_routes
8
- insert_into_file "config/routes.rb", :after => '.draw do' do
9
- "\n # Add HydraHead routes."
10
- "\n HydraHead.add_routes(self)"
11
- end
12
- end
13
-
14
6
  def copy_test_fixtures
7
+ copy_file "app/models/generic_content.rb"
8
+
15
9
  # Download controller
16
10
  copy_file "app/controllers/downloads_controller.rb"
17
11
 
18
12
  copy_file "spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml"
13
+
14
+ # For testing Hydra::SubmissionWorkflow
15
+ copy_file "spec/fixtures/hydra_test_generic_content.foxml.xml"
19
16
  end
20
17
 
21
18
  def copy_rspec_rake_task
@@ -0,0 +1,138 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <foxml:digitalObject VERSION="1.1" PID="hydra:test_generic_content" xmlns:foxml="info:fedora/fedora-system:def/foxml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
3
+ <foxml:objectProperties>
4
+ <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
5
+ <foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE=""/>
6
+ <foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
7
+ <foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2011-07-14T01:28:47.221Z"/>
8
+ <foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2011-07-14T01:30:56.432Z"/>
9
+ </foxml:objectProperties>
10
+ <foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
11
+ <foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2011-07-14T01:28:47.221Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="341">
12
+ <foxml:xmlContent>
13
+ <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
14
+ <dc:identifier>hydra:test_generic_content</dc:identifier>
15
+ <dc:description>A test object using the GenericContent (active)fedora model</dc:description>
16
+ </oai_dc:dc>
17
+ </foxml:xmlContent>
18
+ </foxml:datastreamVersion>
19
+ </foxml:datastream>
20
+ <foxml:datastream ID="descMetadata" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
21
+ <foxml:datastreamVersion ID="descMetadata.1" LABEL="" CREATED="2011-07-14T01:30:13.169Z" MIMETYPE="text/xml" SIZE="1552">
22
+ <foxml:xmlContent>
23
+ <mods xmlns="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.3" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd">
24
+ <titleInfo lang="">
25
+ <title>generic content</title>
26
+ </titleInfo>
27
+ <name type="personal">
28
+ <namePart type="given">Orlob</namePart>
29
+ <namePart type="family">Gryphon</namePart>
30
+ <affiliation>Fantasy</affiliation>
31
+ <role>
32
+ <roleTerm authority="marcrelator" type="text"/>
33
+ </role>
34
+ <description>Mythical Creatures</description>
35
+ </name>
36
+ <typeOfResource/>
37
+ <genre authority="marcgt"/>
38
+ <language>
39
+ <languageTerm authority="iso639-2b" type="code"/>
40
+ </language>
41
+ <physicalDescription>
42
+ <extent/>
43
+ </physicalDescription>
44
+ <abstract>A test object using the GenericContent (active)fedora model</abstract>
45
+ <subject>
46
+ <topic>flying creatures</topic>
47
+ </subject>
48
+ <relatedItem type="host">
49
+ <titleInfo>
50
+ <title/>
51
+ </titleInfo>
52
+ <identifier type="issn"/>
53
+ <originInfo>
54
+ <publisher/>
55
+ <dateIssued/>
56
+ </originInfo>
57
+ <part>
58
+ <detail type="volume">
59
+ <number/>
60
+ </detail>
61
+ <detail type="number">
62
+ <number/>
63
+ </detail>
64
+ <extent unit="pages">
65
+ <start/>
66
+ <end/>
67
+ </extent>
68
+ <date/>
69
+ </part>
70
+ </relatedItem>
71
+ <location>
72
+ <url/>
73
+ </location>
74
+ </mods>
75
+ </foxml:xmlContent>
76
+ </foxml:datastreamVersion>
77
+ </foxml:datastream>
78
+ <foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
79
+ <foxml:datastreamVersion ID="RELS-EXT.0" LABEL="" CREATED="2011-07-14T01:28:49.031Z" MIMETYPE="text/xml" SIZE="277">
80
+ <foxml:xmlContent>
81
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
82
+ <rdf:Description rdf:about="info:fedora/hydra:test_generic_content">
83
+ <hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/afmodel:GenericContent"/>
84
+ </rdf:Description>
85
+ </rdf:RDF>
86
+ </foxml:xmlContent>
87
+ </foxml:datastreamVersion>
88
+ </foxml:datastream>
89
+ <foxml:datastream ID="rightsMetadata" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
90
+ <foxml:datastreamVersion ID="rightsMetadata.1" LABEL="" CREATED="2011-07-14T01:30:56.432Z" MIMETYPE="text/xml" SIZE="777">
91
+ <foxml:xmlContent>
92
+ <rightsMetadata xmlns="http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1" version="0.1">
93
+ <copyright>
94
+ <human/>
95
+ <machine>
96
+ <uvalicense>no</uvalicense>
97
+ </machine>
98
+ </copyright>
99
+ <access type="discover">
100
+ <human/>
101
+ <machine/>
102
+ </access>
103
+ <access type="read">
104
+ <human/>
105
+ <machine>
106
+ <group>researcher</group>
107
+ <group>public</group>
108
+ <group>patron</group>
109
+ <group>donor</group>
110
+ </machine>
111
+ </access>
112
+ <access type="edit">
113
+ <human/>
114
+ <machine>
115
+ <person>archivist1</person>
116
+ <group>archivist</group>
117
+ <group>admin_policy_object_editor</group>
118
+ </machine>
119
+ </access>
120
+ <embargo>
121
+ <human/>
122
+ <machine/>
123
+ </embargo>
124
+ </rightsMetadata>
125
+ </foxml:xmlContent>
126
+ </foxml:datastreamVersion>
127
+ </foxml:datastream>
128
+ <foxml:datastream ID="properties" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
129
+ <foxml:datastreamVersion ID="properties.0" LABEL="" CREATED="2011-07-14T01:28:49.367Z" MIMETYPE="text/xml" SIZE="99">
130
+ <foxml:xmlContent>
131
+ <fields>
132
+ <collection>generic_content</collection>
133
+ <depositor>archivist1</depositor>
134
+ </fields>
135
+ </foxml:xmlContent>
136
+ </foxml:datastreamVersion>
137
+ </foxml:datastream>
138
+ </foxml:digitalObject>
@@ -0,0 +1,4 @@
1
+ group :develop do
2
+ gem 'active-fedora', github: "projecthydra/active_fedora"
3
+ end
4
+
@@ -26,6 +26,7 @@ task :generate do
26
26
  puts "Updating gemfile"
27
27
  `echo " gem 'hydra-access-controls', :path=>'../../../hydra-access-controls'" >> spec/internal/Gemfile`
28
28
  `echo " gem 'hydra-core', :path=>'../../', :require=>'hydra-core'" >> spec/internal/Gemfile`
29
+ `echo " eval File.read('../test_app_templates/Gemfile.extra'), nil, '../test_app_templates/Gemfile.extra'" >> spec/internal/Gemfile`
29
30
  `echo " gem 'factory_girl_rails'" >> spec/internal/Gemfile`
30
31
  puts "Copying generator"
31
32
  `cp -r spec/support/lib/generators spec/internal/lib`
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.5.2
4
+ version: 7.0.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield,
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-07 00:00:00.000000000 Z
12
+ date: 2014-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -37,28 +37,28 @@ dependencies:
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '4.7'
40
+ version: '4.0'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '4.7'
47
+ version: '4.0'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: active-fedora
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
- version: '6.7'
54
+ version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '6.7'
61
+ version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: block_helpers
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -93,14 +93,14 @@ dependencies:
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 6.5.2
96
+ version: 7.0.0.pre1
97
97
  type: :runtime
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 6.5.2
103
+ version: 7.0.0.pre1
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: jettywrapper
106
106
  requirement: !ruby/object:Gem::Requirement
@@ -182,13 +182,16 @@ extra_rdoc_files: []
182
182
  files:
183
183
  - .gitignore
184
184
  - Rakefile
185
+ - app/controllers/concerns/hydra/controller.rb
185
186
  - app/controllers/concerns/hydra/controller/controller_behavior.rb
186
187
  - app/controllers/concerns/hydra/controller/download_behavior.rb
187
188
  - app/controllers/concerns/hydra/controller/upload_behavior.rb
188
189
  - app/helpers/blacklight_helper.rb
189
- - app/helpers/facets_helper.rb
190
190
  - app/helpers/hydra/blacklight_helper_behavior.rb
191
- - app/helpers/hydra/facets_helper_behavior.rb
191
+ - app/models/concerns/hydra/model_methods.rb
192
+ - app/models/concerns/hydra/models.rb
193
+ - app/models/concerns/hydra/models/file_asset.rb
194
+ - app/models/concerns/hydra/solr.rb
192
195
  - app/models/file_asset.rb
193
196
  - app/models/hydra/datastream/properties.rb
194
197
  - app/models/mods_asset.rb
@@ -212,16 +215,7 @@ files:
212
215
  - lib/generators/hydra/templates/config/solr.yml
213
216
  - lib/hydra-core.rb
214
217
  - lib/hydra-head/engine.rb
215
- - lib/hydra-head/routes.rb
216
218
  - lib/hydra-head/version.rb
217
- - lib/hydra/controller.rb
218
- - lib/hydra/global_configurable.rb
219
- - lib/hydra/model_methods.rb
220
- - lib/hydra/model_mixins/common_metadata.rb
221
- - lib/hydra/model_mixins/solr_document_extension.rb
222
- - lib/hydra/models.rb
223
- - lib/hydra/models/file_asset.rb
224
- - lib/hydra/solr.rb
225
219
  - lib/railties/active-fedora.rake
226
220
  - lib/railties/hydra-fixtures.rake
227
221
  - lib/railties/hydra_jetty.rake
@@ -231,12 +225,9 @@ files:
231
225
  - spec/controllers/downloads_controller_spec.rb
232
226
  - spec/factories.rb
233
227
  - spec/helpers/blacklight_helper_spec.rb
234
- - spec/helpers/facets_helper_spec.rb
235
228
  - spec/helpers/upload_behavior_spec.rb
236
229
  - spec/lib/catalog_spec.rb
237
- - spec/lib/global_configurable_spec.rb
238
230
  - spec/lib/model_methods_spec.rb
239
- - spec/lib/solr_document_extension_spec.rb
240
231
  - spec/models/file_asset_spec.rb
241
232
  - spec/models/mods_asset_spec.rb
242
233
  - spec/models/solr_document_spec.rb
@@ -245,6 +236,7 @@ files:
245
236
  - spec/spec.opts
246
237
  - spec/spec_helper.rb
247
238
  - spec/support/app/controllers/downloads_controller.rb
239
+ - spec/support/app/models/generic_content.rb
248
240
  - spec/support/app/models/sample.rb
249
241
  - spec/support/app/models/solr_document.rb
250
242
  - spec/support/db/migrate/20111101221803_create_searches.rb
@@ -252,7 +244,9 @@ files:
252
244
  - spec/support/lib/tasks/rspec.rake
253
245
  - spec/support/matchers/helper_matcher.rb
254
246
  - spec/support/matchers/solr_matchers.rb
247
+ - spec/support/spec/fixtures/hydra_test_generic_content.foxml.xml
255
248
  - spec/support/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml
249
+ - spec/test_app_templates/Gemfile.extra
256
250
  - spec/unit/hydra-head-engine_spec.rb
257
251
  - spec/unit/hydra-head_spec.rb
258
252
  - tasks/hydra-head-fixtures.rake
@@ -273,12 +267,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
273
267
  version: 1.9.3
274
268
  required_rubygems_version: !ruby/object:Gem::Requirement
275
269
  requirements:
276
- - - '>='
270
+ - - '>'
277
271
  - !ruby/object:Gem::Version
278
- version: '0'
272
+ version: 1.3.1
279
273
  requirements: []
280
274
  rubyforge_project:
281
- rubygems_version: 2.0.14
275
+ rubygems_version: 2.1.11
282
276
  signing_key:
283
277
  specification_version: 4
284
278
  summary: Hydra-Head Rails Engine (requires Rails3)
@@ -289,12 +283,9 @@ test_files:
289
283
  - spec/controllers/downloads_controller_spec.rb
290
284
  - spec/factories.rb
291
285
  - spec/helpers/blacklight_helper_spec.rb
292
- - spec/helpers/facets_helper_spec.rb
293
286
  - spec/helpers/upload_behavior_spec.rb
294
287
  - spec/lib/catalog_spec.rb
295
- - spec/lib/global_configurable_spec.rb
296
288
  - spec/lib/model_methods_spec.rb
297
- - spec/lib/solr_document_extension_spec.rb
298
289
  - spec/models/file_asset_spec.rb
299
290
  - spec/models/mods_asset_spec.rb
300
291
  - spec/models/solr_document_spec.rb
@@ -303,6 +294,7 @@ test_files:
303
294
  - spec/spec.opts
304
295
  - spec/spec_helper.rb
305
296
  - spec/support/app/controllers/downloads_controller.rb
297
+ - spec/support/app/models/generic_content.rb
306
298
  - spec/support/app/models/sample.rb
307
299
  - spec/support/app/models/solr_document.rb
308
300
  - spec/support/db/migrate/20111101221803_create_searches.rb
@@ -310,7 +302,9 @@ test_files:
310
302
  - spec/support/lib/tasks/rspec.rake
311
303
  - spec/support/matchers/helper_matcher.rb
312
304
  - spec/support/matchers/solr_matchers.rb
305
+ - spec/support/spec/fixtures/hydra_test_generic_content.foxml.xml
313
306
  - spec/support/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml
307
+ - spec/test_app_templates/Gemfile.extra
314
308
  - spec/unit/hydra-head-engine_spec.rb
315
309
  - spec/unit/hydra-head_spec.rb
316
310
  has_rdoc:
@@ -1,4 +0,0 @@
1
- module FacetsHelper
2
- include Hydra::FacetsHelperBehavior
3
-
4
- end
@@ -1,25 +0,0 @@
1
- module Hydra
2
- module FacetsHelperBehavior
3
- include Blacklight::FacetsHelperBehavior
4
-
5
- # Removing the [remove] link and label class from the default selected facet display
6
- def render_selected_facet_value(facet_solr_field, item)
7
- content_tag(:span, render_facet_value(facet_solr_field, item, :suppress_link => true), :class => "selected")
8
- end
9
-
10
- # Override to remove the label class (easier integration with bootstrap)
11
- # and handles arrays
12
- def render_facet_value(facet_solr_field, item, options ={})
13
- if item.is_a? Array
14
- render_array_facet_value(facet_solr_field, item, options)
15
- end
16
-
17
- (link_to_unless(options[:suppress_link], facet_display_value(facet_solr_field, item), add_facet_params_and_redirect(facet_solr_field, item.value), :class=>"facet_select") + " " + render_facet_count(item.hits)).html_safe
18
- end
19
-
20
- def render_array_facet_value(facet_solr_field, item, options)
21
- (link_to_unless(options[:suppress_link], facet_display_value(facet_solr_field, item[0]), add_facet_params_and_redirect(facet_solr_field, item[0]), :class=>"facet_select") + " (" + format_num(item[1]) + ")").html_safe
22
- end
23
- end
24
- end
25
-
@@ -1,46 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- module HydraHead
3
- class Routes
4
-
5
- def initialize(router, options)
6
- @router = router
7
- @options = options
8
- end
9
-
10
- def draw
11
- route_sets.each do |r|
12
- self.send(r)
13
- end
14
- end
15
-
16
- protected
17
-
18
- def add_routes &blk
19
- @router.instance_exec(@options, &blk)
20
- end
21
-
22
- def route_sets
23
- (@options[:only] || default_route_sets) - (@options[:except] || [])
24
- end
25
-
26
- def default_route_sets
27
- [:assets_with_all_nested_routes]
28
- end
29
-
30
- module RouteSets
31
- def assets_with_all_nested_routes
32
- add_routes do |options|
33
- namespace :hydra do
34
- resources :file_assets
35
- resources :assets do
36
- resources :file_assets
37
- end
38
- end
39
- end
40
- end
41
- end
42
-
43
- include RouteSets
44
-
45
- end
46
- end
@@ -1,7 +0,0 @@
1
- module Hydra::Controller
2
- autoload :AssetsControllerBehavior, 'hydra/controller/assets_controller_behavior'
3
- autoload :ControllerBehavior, 'hydra/controller/controller_behavior'
4
- autoload :UploadBehavior, 'hydra/controller/upload_behavior'
5
- autoload :DownloadBehavior, 'hydra/controller/download_behavior'
6
- autoload :FileAssetsBehavior, 'hydra/controller/file_assets_behavior'
7
- end
@@ -1,46 +0,0 @@
1
- module Hydra::GlobalConfigurable
2
-
3
- # The config environment name used by the #config method
4
- #
5
- # Example:
6
- # class MyThing
7
- # extend Hydra::GlobalConfigurable
8
- # end
9
- #
10
- # Now MyThing.config will be the result of:
11
- # MyThing.configure(:production) {|config|}
12
- #
13
- # You set shared attributes by leaving the first argument blank or passing the :shared value:
14
- # MyThing.configure {|config|}
15
- # or
16
- # MyThing.configure(:shared) {|config|}
17
-
18
- # sets the @configs variable to a new Hash with empty Hash for :shared key and @config to nil
19
- def reset_configs!
20
- @config = nil
21
- @configs = {:shared=>{}}
22
- end
23
-
24
- # A hash of all environment configs
25
- # The key is the environment name, the value a Hash
26
- def configs
27
- @configs ? @configs : (reset_configs! and @configs)
28
- end
29
-
30
- # The main config accessor. It merges the current configs[::Rails.env]
31
- # with configs[:shared] and lazy-loads @config to the result.
32
- def config
33
- @config ||= configs[:shared].merge(configs[::Rails.env] ||= {})
34
- end
35
- alias_method :blacklight_config, :config
36
-
37
- # Accepts a value for the environment to configure and a block
38
- # A hash is yielded to the block
39
- # If the "env" != :shared,
40
- # the hash is created by deep cloning the :shared environment config.
41
- # This makes it possible to create defaults in the :shared config
42
- def configure(env = :shared, &blk)
43
- configs[env] = {}
44
- yield configs[env]
45
- end
46
- end
@@ -1,24 +0,0 @@
1
- # Include this into models that you want to conform to the Hydra commonMetadata cModel
2
- # See https://wiki.duraspace.org/display/hydra/Hydra+objects%2C+content+models+%28cModels%29+and+disseminators#Hydraobjects%2Ccontentmodels%28cModels%29anddisseminators-models
3
- #
4
- # Explicitly declares:
5
- # rightsMetadata datastream using Hydra::RightsMetadata Terminology
6
- #
7
- # Does not explicitly declare:
8
- # descMetadata datastream -- should be declared by a more specific mixin like Hydra::ModelMixins::ModsObject
9
- # DC datastream -- Handled by ActiveFedora::Base
10
- # RELS-EXT datastream -- Handled by ActiveFedora::Base & ActiveFedora::RelsExtDatastream
11
- # optional datastreams (contentMetadata, technicalMetadata, provenanceMetadata, sourceMetadata)
12
- #
13
- module Hydra::ModelMixins
14
- module CommonMetadata
15
- extend Deprecation
16
- extend ActiveSupport::Concern
17
-
18
- included do
19
- # Uses the Hydra Rights Metadata Schema for tracking access permissions & copyright
20
- has_metadata "rightsMetadata", type: Hydra::Datastream::RightsMetadata
21
- Deprecation.warn(CommonMetadata, "Hydra::ModelMixins::CommonMetadata is deprecated and will be removed in hydra-head 7. Use Hydra::AccessControls::Permissions instead.", caller(1))
22
- end
23
- end
24
- end
@@ -1,33 +0,0 @@
1
- module Hydra::ModelMixins
2
- module SolrDocumentExtension
3
- extend Deprecation
4
- self.deprecation_horizon = 'hydra-head 7.0.0'
5
-
6
- def document_type display_type = CatalogController.blacklight_config.show.display_type
7
- type = self.fetch(:medium_t, nil)
8
-
9
- type ||= self.fetch(display_type, nil) if display_type
10
-
11
- type.first.to_s.gsub("info:fedora/afmodel:","").gsub("Hydrangea","").gsub(/^Generic/,"")
12
- end
13
- deprecation_deprecate :document_type
14
-
15
- def get_person_from_role(role, opts={})
16
- i = 0
17
- while i < 10
18
- persons_roles = self["person_#{i}_role_t"].map{|w|w.strip.downcase} unless self["person_#{i}_role_t"].nil?
19
- if persons_roles and persons_roles.include?(role.downcase)
20
- return {:first=>self["person_#{i}_first_name_t"], :last=>self["person_#{i}_last_name_t"]}
21
- end
22
- i += 1
23
- end
24
- end
25
- deprecation_deprecate :get_person_from_role
26
-
27
- def get_file_asset_count()
28
- ActiveFedora::Base.count(:conditions=>"is_part_of_t:#{ActiveFedora::Base.quote_for_solr(id)}")
29
- end
30
- deprecation_deprecate :get_file_asset_count
31
- end
32
- end
33
-
@@ -1,7 +0,0 @@
1
- module Hydra
2
- module Models
3
- extend ActiveSupport::Autoload
4
- autoload :FileAsset
5
- end
6
- end
7
-
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FacetsHelper do
4
- let(:blacklight_config) { Blacklight::Configuration.new }
5
-
6
- before(:each) do
7
- helper.stub(:blacklight_config).and_return blacklight_config
8
- end
9
-
10
-
11
- describe "render_selected_facet_value" do
12
- it "should be html_safe and not have the remove link" do
13
- item = double("item", :value=>'two', :hits=>9)
14
- ret_val = helper.render_selected_facet_value("one", item)
15
- ret_val.should == "<span class=\"selected\">two <span class=\"count\">9</span></span>"
16
- ret_val.should be_html_safe
17
- end
18
- it "should use facet_display_value" do
19
- item = double("item", :value=>'two', :hits=>9)
20
- helper.stub(:facet_display_value).and_return('four')
21
- ret_val = helper.render_selected_facet_value("one", item)
22
- ret_val.should == "<span class=\"selected\">four <span class=\"count\">9</span></span>"
23
- end
24
- end
25
- end
26
-
@@ -1,98 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
-
4
- describe Hydra::GlobalConfigurable do
5
-
6
- class TestConfig
7
- extend Hydra::GlobalConfigurable
8
- end
9
-
10
- before(:each) do
11
- TestConfig.reset_configs!
12
- end
13
-
14
- it "should respond to configure" do
15
- TestConfig.respond_to? :configure
16
- end
17
-
18
- describe "the default state" do
19
- describe "config" do
20
- it "should be a Hash" do
21
- TestConfig.config.should be_a Hash
22
- end
23
- end
24
- describe "configs[:shared]" do
25
- it "should be a Hash" do
26
- TestConfig.configs[:shared].should be_a Hash
27
- end
28
- end
29
- end
30
-
31
- describe "configs[:shared]" do
32
- it "should not have the values of its members altered by other environments" do
33
- TestConfig.configure do |config|
34
- config[:key] = ":shared value"
35
- end
36
- TestConfig.configure(::Rails.env) do |config|
37
- config[:key] = ":test value"
38
- end
39
- TestConfig.config[:key].should == ":test value"
40
- TestConfig.configs[:shared][:key].should == ":shared value"
41
- TestConfig.configs[::Rails.env][:key].should == ":test value"
42
- end
43
- end
44
-
45
- describe "the #configure method behavior" do
46
- it "requires a block" do
47
- lambda{TestConfig.configure}.should raise_error(LocalJumpError)
48
- end
49
- it "yields a hash" do
50
- TestConfig.configure{|config| config.should be_a(Hash) }
51
- end
52
- it "should clear the configs if reset_configs! is called" do
53
- TestConfig.configure do |config|
54
- config[:asdf] = 'asdf'
55
- end
56
- TestConfig.configs[:shared][:asdf].should == 'asdf'
57
- TestConfig.reset_configs!
58
- TestConfig.configs[:shared][:asdf].should == nil
59
- end
60
-
61
- it "should merge settings from the :shared environment" do
62
- TestConfig.configure do |config|
63
- config[:app_id] = 'Blacklight'
64
- config[:mode] = :shared!
65
- end
66
- TestConfig.configure(::Rails.env) do |config|
67
- config[:mode] = ::Rails.env
68
- end
69
- TestConfig.config[:app_id].should == 'Blacklight'
70
- TestConfig.config[:mode].should_not == :shared!
71
- TestConfig.config[:mode].should == ::Rails.env
72
- end
73
- end
74
-
75
- describe "config" do
76
- it "should return an empty Hash if nothing was configured" do
77
- TestConfig.config.should == {}
78
- end
79
-
80
- it "should return only what is in configs[:shared] if no other environment was configured" do
81
- TestConfig.configure(:shared) do |config|
82
- config[:foo] = 'bar'
83
- config[:baz] = 'dang'
84
- end
85
- TestConfig.config.should == {:foo => 'bar', :baz => 'dang'}
86
- TestConfig.config.should == TestConfig.configs[:shared]
87
- end
88
-
89
- it "should return a merge of configs[:shared] and configs[RAILS_ENV]" do
90
- TestConfig.configure(:shared) do |config|
91
- config[:foo] = 'bar'
92
- config[:baz] = 'dang'
93
- end
94
- end
95
- end
96
-
97
-
98
- end
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Hydra::ModelMixins::SolrDocumentExtension do
4
- before do
5
- @doc = SolrDocument.new(:id=>'changeme:99')
6
- end
7
-
8
- it "should get_file_asset_count" do
9
- Deprecation.stub(:warn).and_return(nil)
10
- mock_result = {'response'=>{'numFound'=>0}}
11
- ActiveFedora::SolrService.should_receive(:query).with("is_part_of_t:\"changeme\\:99\"", :rows=>0, :raw=>true).and_return(mock_result)
12
- @doc.get_file_asset_count.should == 0
13
- end
14
- end