hydra-head 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -1
- data/Gemfile.lock +17 -3
- data/README.textile +32 -15
- data/app/assets/javascripts/jquery.form.js +932 -531
- data/app/helpers/hydra/facets_helper_behavior.rb +1 -1
- data/app/helpers/hydra/hydra_helper_behavior.rb +1 -1
- data/app/helpers/hydra/javascript_includes_helper_behavior.rb +0 -4
- data/app/models/ability.rb +1 -0
- data/app/models/common_metadata_asset.rb +7 -1
- data/app/models/generic_content.rb +5 -1
- data/app/models/generic_image.rb +7 -3
- data/app/models/hydra/ability.rb +2 -0
- data/app/models/hydra/datastream/common_mods_index_methods.rb +2 -0
- data/app/models/hydra/datastream/mods_article.rb +2 -0
- data/app/models/hydra/datastream/mods_dataset.rb +7 -0
- data/app/models/hydra/datastream/mods_generic_content.rb +2 -0
- data/app/models/hydra/datastream/mods_image.rb +1 -0
- data/app/models/hydra/datastream/properties.rb +6 -1
- data/app/models/hydra/datastream/rights_metadata.rb +1 -0
- data/app/models/hydra/role_mapper_behavior.rb +1 -0
- data/app/models/mods_asset.rb +1 -1
- data/app/models/role_mapper.rb +3 -0
- data/app/models/superuser.rb +6 -0
- data/app/models/user_attribute.rb +6 -0
- data/app/models/uses_default_partials.rb +8 -0
- data/app/views/catalog/_delete_partials/_default.html.erb +2 -9
- data/app/views/catalog/_edit_partials/_default.html.erb +0 -1
- data/app/views/catalog/show.html.erb +1 -1
- data/app/views/generic_content_objects/_edit_description.html.erb +1 -1
- data/app/views/generic_content_objects/_show_description.html.erb +0 -2
- data/app/views/generic_contents/_edit.html.erb +10 -1
- data/app/views/generic_contents/_show.html.erb +0 -2
- data/app/views/generic_images/_edit.html.erb +1 -3
- data/app/views/generic_images/_show.html.erb +0 -2
- data/app/views/hydra/file_assets/_result.html.erb +1 -2
- data/config/fedora.yml +1 -1
- data/fedora_conf/conf/development/fedora.fcfg +1 -1
- data/fedora_conf/conf/test/fedora.fcfg +1 -1
- data/hydra-head.gemspec +2 -1
- data/lib/application_helper.rb +1 -0
- data/lib/generators/hydra/templates/config/fedora.yml +1 -1
- data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +1 -12
- data/lib/hydra-head/routes.rb +1 -1
- data/lib/hydra-head/version.rb +1 -1
- data/lib/hydra/access_controls_enforcement.rb +10 -3
- data/lib/hydra/access_controls_evaluation.rb +2 -1
- data/lib/hydra/assets.rb +3 -0
- data/lib/hydra/assets_controller_helper.rb +4 -0
- data/lib/hydra/catalog.rb +1 -0
- data/lib/hydra/common_mods_index_methods.rb +1 -1
- data/lib/hydra/controller.rb +1 -0
- data/lib/hydra/file_assets.rb +7 -5
- data/lib/hydra/file_assets_helper.rb +4 -32
- data/lib/hydra/generic_content.rb +1 -0
- data/lib/hydra/generic_image.rb +2 -0
- data/lib/hydra/generic_user_attributes.rb +5 -0
- data/lib/hydra/model_methods.rb +4 -3
- data/lib/hydra/model_mixins.rb +1 -0
- data/lib/hydra/model_mixins/common_metadata.rb +1 -0
- data/lib/hydra/model_mixins/mods_object.rb +1 -0
- data/lib/hydra/models/file_asset.rb +4 -0
- data/lib/hydra/mods_article.rb +1 -0
- data/lib/hydra/mods_dataset.rb +1 -0
- data/lib/hydra/mods_generic_content.rb +1 -0
- data/lib/hydra/mods_image.rb +1 -0
- data/lib/hydra/repository_controller.rb +2 -0
- data/lib/hydra/rights_metadata.rb +1 -0
- data/lib/hydra/submission_workflow.rb +1 -0
- data/lib/hydra/superuser_attributes.rb +6 -0
- data/lib/hydra/user.rb +1 -0
- data/lib/mediashelf/active_fedora_helper.rb +2 -0
- data/lib/prev_next_links.rb +6 -0
- data/lib/user_attributes_loader.rb +2 -0
- data/lib/uva/mods_index_methods.rb +1 -0
- data/tasks/hydra-head.rake +9 -1
- data/tasks/hyhead_rspec.rake +2 -2
- data/test_support/etc/Gemfile +2 -1
- data/test_support/features/button_delete_asset.feature +13 -0
- data/test_support/features/file_upload.feature +7 -0
- data/test_support/features/step_definitions/file_list_steps.rb +8 -0
- data/test_support/features/step_definitions/html_validity_steps.rb +42 -45
- data/test_support/spec/controllers/file_assets_controller_spec.rb +12 -17
- data/test_support/spec/helpers/access_controls_enforcement_spec.rb +27 -1
- data/test_support/spec/helpers/assets_controller_helper_spec.rb +3 -3
- data/test_support/spec/integration/file_asset_spec.rb +0 -44
- data/test_support/spec/models/hydra_rights_metadata_spec.rb +3 -1
- data/test_support/spec/spec_helper.rb +16 -0
- data/vendor/cache/factory_girl-2.6.4.gem +0 -0
- data/vendor/cache/jquery-rails-2.0.2.gem +0 -0
- metadata +26 -24
- data/BLACKLIGHT_CONFIG.textile +0 -76
- data/HOW_DO_I.textile +0 -107
- data/HOW_TO_GET_STARTED.textile +0 -588
- data/app/models/audio_asset.rb +0 -8
- data/app/models/image_asset.rb +0 -8
- data/app/models/video_asset.rb +0 -8
- data/fedora/conf/fedora.fcfg +0 -1021
- data/lib/application_controller.rb +0 -24
- data/lib/block_mapper.rb +0 -52
- data/lib/ead_mapper.rb +0 -7
- data/lib/field_maps.rb +0 -507
- data/lib/marc_mapper.rb +0 -131
- data/lib/marc_record_ext.rb +0 -97
- data/test_support/spec/models/audio_asset_spec.rb +0 -23
- data/test_support/spec/models/image_asset_spec.rb +0 -23
- data/test_support/spec/models/video_asset_spec.rb +0 -23
- data/vendor/cache/factory_girl-3.1.1.gem +0 -0
data/tasks/hyhead_rspec.rake
CHANGED
@@ -28,7 +28,7 @@ begin
|
|
28
28
|
namespace :hyhead do
|
29
29
|
|
30
30
|
namespace :spec do
|
31
|
-
[:controllers, :generators, :helpers, :integration, :lib, :mailers, :models, :requests, :routing, :unit, :utilities, :
|
31
|
+
[:controllers, :generators, :helpers, :integration, :lib, :mailers, :models, :requests, :routing, :unit, :utilities, :views].each do |sub|
|
32
32
|
desc "Run the code examples in spec/#{sub}"
|
33
33
|
RSpec::Core::RakeTask.new(sub => spec_prereq) do |t|
|
34
34
|
#RSpec::Core::RakeTask.new(sub) do |t|
|
@@ -51,7 +51,7 @@ rescue LoadError
|
|
51
51
|
# these tasks) even if you don't have rspec installed.
|
52
52
|
desc 'rspec rake tasks not available (rspec not installed)'
|
53
53
|
task :spec do
|
54
|
-
abort 'Rspec rake tasks
|
54
|
+
abort 'Rspec rake tasks not available. Be sure to install rspec gems.'
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
data/test_support/etc/Gemfile
CHANGED
@@ -21,7 +21,7 @@ group :development, :test do
|
|
21
21
|
gem 'mocha'
|
22
22
|
gem 'cucumber-rails', :require => false
|
23
23
|
gem 'capybara'
|
24
|
-
gem 'factory_girl'
|
24
|
+
gem 'factory_girl', '~> 2.6.0'
|
25
25
|
gem 'rest-client'
|
26
26
|
gem 'solrizer-fedora', '>=1.2.5'
|
27
27
|
end
|
@@ -32,5 +32,6 @@ group :assets do
|
|
32
32
|
gem 'sass-rails', '~> 3.2.4'
|
33
33
|
gem 'coffee-rails', '~> 3.2.2'
|
34
34
|
gem 'uglifier', '>= 1.2.3'
|
35
|
+
gem 'jquery-rails', '>= 1.0.12'
|
35
36
|
end
|
36
37
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@delete
|
2
|
+
Feature: Button to delete assets
|
3
|
+
In order delete assets
|
4
|
+
As a person with permissions to the object
|
5
|
+
I want to see an asset being deleted
|
6
|
+
|
7
|
+
Scenario: Deleting a standard asset.
|
8
|
+
Given I am logged in as "archivist1@example.com"
|
9
|
+
When I am on the home page
|
10
|
+
And I follow "Add a Basic MODS Asset"
|
11
|
+
Then I should see "Created a Mods Asset with pid "
|
12
|
+
When I press "Delete This Item"
|
13
|
+
Then I should see "Deleted changeme:"
|
@@ -47,6 +47,13 @@ Feature: Upload file into a document
|
|
47
47
|
When I press "Upload File"
|
48
48
|
Then the page should be HTML5 valid
|
49
49
|
|
50
|
+
Scenario: Downloading files
|
51
|
+
Given I am logged in as "archivist1@example.com"
|
52
|
+
When I am on the edit files page for hydrangea:fixture_mods_article1
|
53
|
+
Then I should see "image.jp2"
|
54
|
+
When I follow "image.jp2"
|
55
|
+
Then I should receive an "image/jp2" file named "image.jp2"
|
56
|
+
|
50
57
|
# Not sure if the file asset list is valid. Will the user ever actually be here?
|
51
58
|
# @nojs
|
52
59
|
# Scenario: Upload files on file assets list page
|
@@ -26,3 +26,11 @@ Then /^I (should|should not) see a link to "([^"]*)" with label "([^"]*)" in the
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
Then /^I should receive an? "([^"]*)" file named "([^"]*)"$/ do |content_type, file|
|
31
|
+
result = page.response_headers['Content-Type'].should == content_type
|
32
|
+
if result
|
33
|
+
result = page.response_headers['Content-Disposition'].should =~ /filename="#{file}"/
|
34
|
+
end
|
35
|
+
result
|
36
|
+
end
|
@@ -3,7 +3,44 @@ require "nokogiri"
|
|
3
3
|
require 'rest_client'
|
4
4
|
|
5
5
|
Then /^the page should be HTML5 valid$/ do
|
6
|
-
response_is_html_valid?(page.
|
6
|
+
response_is_html_valid?(page.source).should be_true
|
7
|
+
end
|
8
|
+
|
9
|
+
class Html5Validator
|
10
|
+
BASE_URI = 'http://html5.validator.nu'
|
11
|
+
HEADERS = { 'Content-Type' => 'text/html; charset=utf-8', 'Content-Encoding' => 'UTF-8' }
|
12
|
+
|
13
|
+
def initialize(text)
|
14
|
+
@text = text
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def valid?
|
19
|
+
errors.empty?
|
20
|
+
end
|
21
|
+
|
22
|
+
def errors
|
23
|
+
validation['messages'].select { |msg| msg['type'] == 'error' }
|
24
|
+
end
|
25
|
+
|
26
|
+
def validation
|
27
|
+
@validation ||= validate!
|
28
|
+
end
|
29
|
+
|
30
|
+
def inspect
|
31
|
+
str = "\n#{validator.errors.length} HTML5 Validation Error(s):\n"
|
32
|
+
errors.each_with_index do |error,i|
|
33
|
+
str << " #{i+1}) #{ error['message'] }\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
str
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def validate!
|
41
|
+
response = RestClient.post "#{BASE_URI}/?out=json", @text, HEADERS
|
42
|
+
JSON.parse(response.body)
|
43
|
+
end
|
7
44
|
end
|
8
45
|
|
9
46
|
private
|
@@ -12,10 +49,8 @@ def response_is_html_valid?(resp)
|
|
12
49
|
begin
|
13
50
|
# http://validator.w3.org/docs/api.html says to sleep for at least 1 second between requests. Just making sure we don't get throttled.
|
14
51
|
sleep(1.0)
|
15
|
-
|
16
|
-
|
17
|
-
:doctype => "HTML5",
|
18
|
-
:fragment => resp)
|
52
|
+
validator = Html5Validator.new(resp)
|
53
|
+
return true if validator.valid?
|
19
54
|
rescue SocketError, RestClient::BadGateway #meaning we're either not connected to the internet or we were throttled by the validator.
|
20
55
|
puts "WARNING: No connection to W3C validator. Page may not be HTML5 valid!"
|
21
56
|
return true
|
@@ -23,45 +58,7 @@ def response_is_html_valid?(resp)
|
|
23
58
|
puts "WARNING: Timeout connecting to W3C validator. Page may not be HTML5 valid!"
|
24
59
|
return true
|
25
60
|
end
|
26
|
-
|
27
|
-
xml = Nokogiri::XML(validator_response)
|
28
|
-
|
29
|
-
#removing namespaces because we really don't care
|
30
|
-
xml.remove_namespaces!
|
31
|
-
|
32
|
-
fault = xml.xpath("//Fault/Code/Subcode/Value").text
|
33
|
-
if fault.present?
|
34
|
-
puts "WARNING: There was an error with the W3C validator. Page may not be HTML5 valid!"
|
35
|
-
puts "FAULT: #{fault}"
|
36
|
-
return true
|
37
|
-
end
|
38
|
-
|
39
|
-
# "true" or "false"
|
40
|
-
valid = xml.xpath("//validity").text
|
41
|
-
error_list = xml.xpath("//errors/errorlist/error")
|
42
|
-
warning_list = xml.xpath("//warnings/warninglist/warning")
|
43
|
-
|
44
|
-
error_count = xml.xpath("//errors/errorcount").text
|
45
|
-
warning_count = xml.xpath("//warnings/warningcount").text
|
46
61
|
|
47
|
-
|
48
|
-
|
49
|
-
error_list.each do |err|
|
50
|
-
errors << {:message => err.xpath("./message").text, :source => err.xpath("./source").text, :line => err.xpath("./line").text, :col => err.xpath("./col").text}
|
51
|
-
end
|
52
|
-
|
53
|
-
warning_list.each do |warn|
|
54
|
-
warnings << warn.xpath("./message").text
|
55
|
-
end
|
56
|
-
|
57
|
-
if valid == "true"
|
58
|
-
return true
|
59
|
-
else
|
60
|
-
text = "\n#{error_count} HTML5 Validation Error(s):\n"
|
61
|
-
errors.each_with_index do |error,i|
|
62
|
-
text << " #{i+1}) Line #{error[:line]}, Column #{error[:col]}: #{error[:message]}\n"
|
63
|
-
end
|
64
|
-
puts text unless errors == []
|
65
|
-
return false
|
66
|
-
end
|
62
|
+
puts validator.inspect
|
63
|
+
return false
|
67
64
|
end
|
@@ -27,22 +27,16 @@ describe Hydra::FileAssetsController do
|
|
27
27
|
xhr :get, :index
|
28
28
|
assigns[:solr_result].should == "solr result"
|
29
29
|
end
|
30
|
-
it "should find all file assets belonging to a given container object if
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
controller.stubs(:load_permissions_from_solr)
|
36
|
-
|
37
|
-
ActiveFedora::Base.expects(:find).with("_PID_", :cast=>true).returns(mock_container)
|
38
|
-
xhr :get, :index, :asset_id=>"_PID_"
|
39
|
-
assigns[:response].should == "assets solr response"
|
40
|
-
assigns[:document_list].should == "assets solr list"
|
30
|
+
it "should find all file assets belonging to a given container object if asset_id is provided" do
|
31
|
+
pid = 'hydrangea:fixture_mods_article3'
|
32
|
+
xhr :get, :index, :asset_id=>pid
|
33
|
+
assigns[:response][:response][:docs].first["id"].should == "hydrangea:fixture_file_asset1"
|
34
|
+
assigns[:document_list].first.id.should == "hydrangea:fixture_file_asset1"
|
41
35
|
|
42
|
-
assigns[:container_response].should == "
|
43
|
-
assigns[:document].should == "
|
44
|
-
assigns[:solr_result].should == "
|
45
|
-
assigns[:container].should ==
|
36
|
+
assigns[:container_response][:response][:docs].first["id"].should == "hydrangea:fixture_mods_article3"
|
37
|
+
assigns[:document].id.should == "hydrangea:fixture_mods_article3"
|
38
|
+
assigns[:solr_result].first["id"].should == "hydrangea:fixture_file_asset1"
|
39
|
+
assigns[:container].should == ModsAsset.find('hydrangea:fixture_mods_article3')
|
46
40
|
end
|
47
41
|
|
48
42
|
end
|
@@ -55,14 +49,15 @@ describe Hydra::FileAssetsController do
|
|
55
49
|
end
|
56
50
|
|
57
51
|
describe "show" do
|
58
|
-
it "should redirect
|
52
|
+
it "should redirect back if current_user does not have read or edit permissions" do
|
59
53
|
mock_user = mock("User")
|
60
54
|
mock_user.stubs(:email).returns("fake_user@example.com")
|
61
55
|
mock_user.stubs(:is_being_superuser?).returns(false)
|
62
56
|
mock_user.stubs(:new_record?).returns(false)
|
63
57
|
controller.stubs(:current_user).returns(mock_user)
|
58
|
+
request.env["HTTP_REFERER"] = "http://example.com/?q=search"
|
64
59
|
get(:show, :id=>"hydrangea:fixture_file_asset1")
|
65
|
-
response.should redirect_to(
|
60
|
+
response.should redirect_to("http://example.com/?q=search")
|
66
61
|
end
|
67
62
|
it "should redirect to index view if the file does not exist" do
|
68
63
|
get(:show, :id=>"example:invalid_object")
|
@@ -16,7 +16,33 @@ describe Hydra::AccessControlsEnforcement do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
19
|
+
describe "enforce_show_permissions" do
|
20
|
+
it "should allow a user w/ edit permissions to view an embargoed object" do
|
21
|
+
user = User.new :email=>'testuser@example.com'
|
22
|
+
user.stubs(:is_being_superuser?).returns false
|
23
|
+
RoleMapper.stubs(:roles).with(user.email).returns(["archivist"])
|
24
|
+
helper.stubs(:current_user).returns(user)
|
25
|
+
helper.stubs(:load_permissions_from_solr).returns("")
|
26
|
+
helper.stubs(:can?).with(:edit, nil).returns(true)
|
27
|
+
helper.stubs(:can?).with(:read, nil).returns(true)
|
28
|
+
@permissions_solr_document = SolrDocument.new({"edit_access_person_t"=>["testuser@example.com"], "embargo_release_date_dt"=>(Date.parse(Time.now.to_s)+2).to_s})
|
29
|
+
helper.send(:enforce_show_permissions, {})
|
30
|
+
flash[:alert].should be_nil
|
31
|
+
end
|
32
|
+
it "should prevent a user w/o edit permissions from viewing an embargoed object" do
|
33
|
+
user = User.new :email=>'testuser@example.com'
|
34
|
+
user.stubs(:is_being_superuser?).returns false
|
35
|
+
RoleMapper.stubs(:roles).with(user.email).returns([])
|
36
|
+
helper.stubs(:current_user).returns(user)
|
37
|
+
helper.stubs(:load_permissions_from_solr).returns("")
|
38
|
+
helper.stubs(:can?).with(:edit, nil).returns(false)
|
39
|
+
helper.stubs(:can?).with(:read, nil).returns(true)
|
40
|
+
helper.stubs(:redirect_to)
|
41
|
+
@permissions_solr_document = SolrDocument.new({"edit_access_person_t"=>["testuser@example.com"], "embargo_release_date_dt"=>(Date.parse(Time.now.to_s)+2).to_s})
|
42
|
+
helper.send(:enforce_show_permissions, {})
|
43
|
+
flash[:alert].should == "This item is under embargo. You do not have sufficient access privileges to read this document."
|
44
|
+
end
|
45
|
+
end
|
20
46
|
describe "apply_gated_discovery" do
|
21
47
|
before(:each) do
|
22
48
|
@stub_user = User.new :email=>'archivist1@example.com'
|
@@ -8,17 +8,17 @@ describe Hydra::AssetsControllerHelper do
|
|
8
8
|
"action"=>"update",
|
9
9
|
"_method"=>"put",
|
10
10
|
"field_selectors"=>{
|
11
|
-
"descMetadata"=>{"person_0_computing_id"=>[{"person"=>"0"}, "computing_id"], "journal_0_issue_start_page"=>[{"journal"=>"0"}, "issue", "start_page"], "person_1_description"=>[{"person"=>"1"}, "description"], "person_1_institution"=>[{"person"=>"1"}, "institution"], "journal_0_origin_info_publisher"=>[{"journal"=>"0"}, "origin_info", "publisher"], "abstract"=>["abstract"], "person_0_last_name"=>[{"person"=>"0"}, "last_name"], "person_0_description"=>[{"person"=>"0"}, "description"], "journal_0_issue_volume"=>[{"journal"=>"0"}, "issue", "volume"], "title_info_main_title"=>["title_info", "main_title"], "location_url"=>["location", "url"], "note"=>["note"], "person_1_last_name"=>[{"person"=>"1"}, "last_name"], "subject_topic"=>["subject", "topic"], "person_0_institution"=>[{"person"=>"0"}, "institution"], "person_1_first_name"=>[{"person"=>"1"}, "first_name"], "person_1"=>[{"person"=>"1"}], "journal_0_title_info_main_title"=>[{"journal"=>"0"}, "title_info", "main_title"], "journal_0_issue_level"=>[{"journal"=>"0"}, "issue", "level"], "journal_0_issue_end_page"=>[{"journal"=>"0"}, "issue", "end_page"], "peer_reviewed"=>["peer_reviewed"], "person_0_first_name"=>[{"person"=>"0"}, "first_name"], "person_1_computing_id"=>[{"person"=>"1"}, "computing_id"], "journal_0_issn"=>[{"journal"=>"0"}, "issn"], "journal_0_issue_publication_date"=>[{"journal"=>"0"}, "issue", "publication_date"]},
|
11
|
+
"descMetadata"=>{"person_0_computing_id"=>[{"person"=>"0"}, "computing_id"], "journal_0_issue_start_page"=>[{"journal"=>"0"}, "issue", "start_page"], "person_1_description"=>[{"person"=>"1"}, "description"], "person_1_institution"=>[{"person"=>"1"}, "institution"], "journal_0_origin_info_publisher"=>[{"journal"=>"0"}, "origin_info", "publisher"], "abstract"=>["abstract"], "person_0_last_name"=>[{"person"=>"0"}, "last_name"], "person_0_description"=>[{"person"=>"0"}, "description"], "journal_0_issue_volume"=>[{"journal"=>"0"}, "issue", "volume"], "title_info_main_title"=>["title_info", "main_title"], "location_url"=>["location", "url"], "note"=>["note"], "person_1_last_name"=>[{"person"=>"1"}, "last_name"], "subject_topic"=>["subject", "topic"], "person_0_institution"=>[{"person"=>"0"}, "institution"], "person_1_first_name"=>[{"person"=>"1"}, "first_name"], "person_1"=>[{"person"=>"1"}], "journal_0_title_info_main_title"=>[{"journal"=>"0"}, "title_info", "main_title"], "journal_0_issue_level"=>[{"journal"=>"0"}, "issue", "level"], "journal_0_issue_end_page"=>[{"journal"=>"0"}, "issue", "end_page"], "peer_reviewed"=>["peer_reviewed"], "person_0_first_name"=>[{"person"=>"0"}, "first_name"], "person_1_computing_id"=>[{"person"=>"1"}, "computing_id"], "journal_0_issn"=>[{"journal"=>"0"}, "issn"], "journal_0_issue_publication_date"=>[{"journal"=>"0"}, "issue", "publication_date"], "subject_topic" => ["subject", "topic", "subject", "topic"]},
|
12
12
|
"rightsMetadata"=>{"embargo_embargo_release_date"=>["embargo", "embargo_release_date"]},
|
13
13
|
"properties"=>{"release_to"=>["release_to"]}
|
14
14
|
},
|
15
15
|
"id"=>"hydrangea:fixture_mods_article3",
|
16
16
|
"controller"=>"assets",
|
17
|
-
"asset"=>{"descMetadata"=>{"person_0_computing_id"=>{"0"=>""}, "journal_0_issue_start_page"=>{"0"=>"195"}, "person_1_description"=>{"0"=>""}, "person_1_institution"=>{"0"=>"Baltimore"}, "journal_0_origin_info_publisher"=>{"0"=>"PUBLISHER"}, "abstract"=>{"0"=>"ABSTRACT"}, "person_0_last_name"=>{"0"=>"Smith"}, "person_0_description"=>{"0"=>""}, "journal_0_issue_volume"=>{"0"=>"2 "}, "title_info_main_title"=>{"0"=>"Test Article"}, "location_url"=>{"0"=>"http://example.com/foo"}, "note"=>{"0"=>""}, "person_1_last_name"=>{"0"=>"Lacks"}, "subject_topic"=>{"0"=>"TOPIC 1", "1"=>"TOPIC 2", "2"=>"CONTROLLED TERM"}, "person_0_institution"=>{"0"=>"FACULTY, UNIVERSITY"}, "person_1_first_name"=>{"0"=>"Henrietta"}, "journal_0_title_info_main_title"=>{"0"=>"The Journal of Mock Object"}, "journal_0_issue_level"=>{"0"=>""}, "journal_0_issue_end_page"=>{"0"=>"230"}, "person_0_first_name"=>{"0"=>"John"}, "person_1_computing_id"=>{"0"=>""}, "journal_0_issn"=>{"0"=>"1234-5678"}, "journal_0_issue_publication_date"=>{"0"=>"FEB. 2007"}}, "rightsMetadata"=>{"embargo_embargo_release_date"=>{"0"=>""}}, "properties"=>{"released"=>{"0"=>"true"}, "release_to"=>{"0"=>"public"}}}
|
17
|
+
"asset"=>{"descMetadata"=>{"person_0_computing_id"=>{"0"=>""}, "journal_0_issue_start_page"=>{"0"=>"195"}, "person_1_description"=>{"0"=>""}, "person_1_institution"=>{"0"=>"Baltimore"}, "journal_0_origin_info_publisher"=>{"0"=>"PUBLISHER"}, "abstract"=>{"0"=>"ABSTRACT"}, "person_0_last_name"=>{"0"=>"Smith"}, "person_0_description"=>{"0"=>""}, "journal_0_issue_volume"=>{"0"=>"2 "}, "title_info_main_title"=>{"0"=>"Test Article"}, "location_url"=>{"0"=>"http://example.com/foo"}, "note"=>{"0"=>""}, "person_1_last_name"=>{"0"=>"Lacks"}, "subject_topic"=>{"0"=>"TOPIC 1", "1"=>"TOPIC 2", "2"=>"CONTROLLED TERM"}, "person_0_institution"=>{"0"=>"FACULTY, UNIVERSITY"}, "person_1_first_name"=>{"0"=>"Henrietta"}, "journal_0_title_info_main_title"=>{"0"=>"The Journal of Mock Object"}, "journal_0_issue_level"=>{"0"=>""}, "journal_0_issue_end_page"=>{"0"=>"230"}, "person_0_first_name"=>{"0"=>"John"}, "person_1_computing_id"=>{"0"=>""}, "journal_0_issn"=>{"0"=>"1234-5678"}, "journal_0_issue_publication_date"=>{"0"=>"FEB. 2007"}, "subject_topic" => {"0"=>"Topic1", "1"=>"Topic2"}}, "rightsMetadata"=>{"embargo_embargo_release_date"=>{"0"=>""}}, "properties"=>{"released"=>{"0"=>"true"}, "release_to"=>{"0"=>"public"}}}
|
18
18
|
}
|
19
19
|
|
20
20
|
expected_sane_params = {
|
21
|
-
"descMetadata"=>{[{:person=>0}, :institution]=>{"0"=>"FACULTY, UNIVERSITY"}, [{:journal=>0}, :title_info, :main_title]=>{"0"=>"The Journal of Mock Object"}, [{:journal=>0}, :issue, :volume]=>{"0"=>"2 "}, [{:journal=>0}, :issn]=>{"0"=>"1234-5678"}, [{:person=>1}, :first_name]=>{"0"=>"Henrietta"}, [{:person=>0}, :last_name]=>{"0"=>"Smith"}, [:location, :url]=>{"0"=>"http://example.com/foo"}, [:subject, :topic]=>{"0"=>"TOPIC 1", "1"=>"TOPIC 2", "2"=>"CONTROLLED TERM"}, [{:person=>0}, :first_name]=>{"0"=>"John"}, [{:person=>1}, :computing_id]=>{"0"=>""}, [{:journal=>0}, :issue, :end_page]=>{"0"=>"230"}, [:note]=>{"0"=>""}, [:title_info, :main_title]=>{"0"=>"Test Article"}, [{:journal=>0}, :issue, :publication_date]=>{"0"=>"FEB. 2007"}, [{:person=>1}, :description]=>{"0"=>""}, [:abstract]=>{"0"=>"ABSTRACT"}, [{:journal=>0}, :issue, :level]=>{"0"=>""}, [{:person=>1}, :institution]=>{"0"=>"Baltimore"}, [{:person=>0}, :computing_id]=>{"0"=>""}, [{:person=>1}, :last_name]=>{"0"=>"Lacks"}, [{:journal=>0}, :issue, :start_page]=>{"0"=>"195"}, [{:person=>0}, :description]=>{"0"=>""}, [{:journal=>0}, :origin_info, :publisher]=>{"0"=>"PUBLISHER"}}, "rightsMetadata"=>{[:embargo, :embargo_release_date]=>{"0"=>""}},
|
21
|
+
"descMetadata"=>{[{:person=>0}, :institution]=>{"0"=>"FACULTY, UNIVERSITY"}, [{:journal=>0}, :title_info, :main_title]=>{"0"=>"The Journal of Mock Object"}, [{:journal=>0}, :issue, :volume]=>{"0"=>"2 "}, [{:journal=>0}, :issn]=>{"0"=>"1234-5678"}, [{:person=>1}, :first_name]=>{"0"=>"Henrietta"}, [{:person=>0}, :last_name]=>{"0"=>"Smith"}, [:location, :url]=>{"0"=>"http://example.com/foo"}, [:subject, :topic]=>{"0"=>"TOPIC 1", "1"=>"TOPIC 2", "2"=>"CONTROLLED TERM"}, [{:person=>0}, :first_name]=>{"0"=>"John"}, [{:person=>1}, :computing_id]=>{"0"=>""}, [{:journal=>0}, :issue, :end_page]=>{"0"=>"230"}, [:note]=>{"0"=>""}, [:title_info, :main_title]=>{"0"=>"Test Article"}, [{:journal=>0}, :issue, :publication_date]=>{"0"=>"FEB. 2007"}, [{:person=>1}, :description]=>{"0"=>""}, [:abstract]=>{"0"=>"ABSTRACT"}, [{:journal=>0}, :issue, :level]=>{"0"=>""}, [{:person=>1}, :institution]=>{"0"=>"Baltimore"}, [{:person=>0}, :computing_id]=>{"0"=>""}, [{:person=>1}, :last_name]=>{"0"=>"Lacks"}, [{:journal=>0}, :issue, :start_page]=>{"0"=>"195"}, [{:person=>0}, :description]=>{"0"=>""}, [{:journal=>0}, :origin_info, :publisher]=>{"0"=>"PUBLISHER"}, [:subject, :topic]=>{"0"=>"Topic1", "1"=>"Topic2"} }, "rightsMetadata"=>{[:embargo, :embargo_release_date]=>{"0"=>""}},
|
22
22
|
"properties"=>{[:release_to]=>{"0"=>"public"}, :released=>{"0"=>"true"}}
|
23
23
|
}
|
24
24
|
helper.stubs(:params).returns(sample_params)
|
@@ -44,50 +44,6 @@ describe FileAsset do
|
|
44
44
|
solr_doc = @file_asset.to_solr
|
45
45
|
solr_doc["title_t"].should == ["testing"]
|
46
46
|
end
|
47
|
-
|
48
|
-
describe "with many kinds of assets" do
|
49
|
-
before(:each) do
|
50
|
-
@image_asset = ImageAsset.new
|
51
|
-
@audio_asset = AudioAsset.new
|
52
|
-
@video_asset = VideoAsset.new
|
53
|
-
@image_asset.save
|
54
|
-
@audio_asset.save
|
55
|
-
@video_asset.save
|
56
|
-
end
|
57
|
-
after do
|
58
|
-
begin
|
59
|
-
@image_asset.delete
|
60
|
-
rescue
|
61
|
-
end
|
62
|
-
begin
|
63
|
-
@audio_asset.delete
|
64
|
-
rescue
|
65
|
-
end
|
66
|
-
begin
|
67
|
-
@video_asset.delete
|
68
|
-
rescue
|
69
|
-
end
|
70
|
-
end
|
71
|
-
it "should not load base fields twice for FileAsset if active_fedora_model is a class that is child of FileAsset" do
|
72
|
-
## It's updating DC and descMetadata, because both have title.
|
73
|
-
@image_asset.update_indexed_attributes({:title=>{0=>"testing"}})
|
74
|
-
#call Solrizer::Indexer.create_document since that produces the problem
|
75
|
-
@image_asset.save
|
76
|
-
solr_doc = ImageAsset.find_by_solr(@image_asset.pid).first
|
77
|
-
solr_doc["title_t"].should == ["testing"]
|
78
|
-
@audio_asset.update_indexed_attributes({:title=>{0=>"testing"}})
|
79
|
-
#call Solrizer::Indexer.create_document since that produces the problem
|
80
|
-
@audio_asset.save
|
81
|
-
solr_doc = AudioAsset.find_by_solr(@audio_asset.pid).first
|
82
|
-
#puts "has_model_s: #{solr_doc['has_model_s'].inspect}"
|
83
|
-
solr_doc["title_t"].should == ["testing"]
|
84
|
-
@video_asset.update_indexed_attributes({:title=>{0=>"testing"}})
|
85
|
-
#call Solrizer::Indexer.create_document since that produces the problem
|
86
|
-
@video_asset.save
|
87
|
-
solr_doc = VideoAsset.find_by_solr(@video_asset.pid).first
|
88
|
-
solr_doc["title_t"].should == ["testing"]
|
89
|
-
end
|
90
|
-
end
|
91
47
|
it "should load base fields for FileAsset for model_only if active_fedora_model is not FileAsset but is not child of FileAsset" do
|
92
48
|
pending "I'm unconvinced as to the usefullness of this test. Why create as one type then reload as another? - Justin"
|
93
49
|
@dummy_file_asset = DummyFileAsset.new
|
@@ -152,9 +152,11 @@ describe Hydra::Datastream::RightsMetadata do
|
|
152
152
|
@sample.embargo_release_date=("2010-12-01")
|
153
153
|
@sample.embargo_release_date(:format=>:solr_date).should == "2010-12-01T23:59:59Z"
|
154
154
|
end
|
155
|
+
|
156
|
+
# this test was returning '' under 1.9 and returning nil under ree and 1.8.7
|
155
157
|
it "should not return anything if the date is empty string" do
|
156
158
|
@sample.update_values({[:embargo,:machine,:date]=>''})
|
157
|
-
@sample.embargo_release_date(:format=>:solr_date).should
|
159
|
+
@sample.embargo_release_date(:format=>:solr_date).should be_blank
|
158
160
|
end
|
159
161
|
end
|
160
162
|
describe "under_embargo?" do
|
@@ -5,6 +5,22 @@
|
|
5
5
|
|
6
6
|
ENV["RAILS_ENV"] ||= 'test'
|
7
7
|
|
8
|
+
|
9
|
+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/
|
10
|
+
require 'simplecov'
|
11
|
+
require 'simplecov-rcov'
|
12
|
+
|
13
|
+
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
14
|
+
SimpleCov.start do
|
15
|
+
add_filter "/test_support/"
|
16
|
+
add_filter "/tmp/"
|
17
|
+
|
18
|
+
add_filter do |source_file|
|
19
|
+
source_file.lines.count < 5
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
8
24
|
#require File.expand_path("../../config/environment", __FILE__)
|
9
25
|
# version that works with our blacklight:spec stuff that calls specs
|
10
26
|
# in a remote directory.
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-head
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-05-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -140,6 +140,22 @@ dependencies:
|
|
140
140
|
- - ! '>='
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: jquery-rails
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
type: :runtime
|
152
|
+
prerelease: false
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
143
159
|
- !ruby/object:Gem::Dependency
|
144
160
|
name: sqlite3
|
145
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,17 +257,17 @@ dependencies:
|
|
241
257
|
requirement: !ruby/object:Gem::Requirement
|
242
258
|
none: false
|
243
259
|
requirements:
|
244
|
-
- -
|
260
|
+
- - ~>
|
245
261
|
- !ruby/object:Gem::Version
|
246
|
-
version:
|
262
|
+
version: 2.6.0
|
247
263
|
type: :development
|
248
264
|
prerelease: false
|
249
265
|
version_requirements: !ruby/object:Gem::Requirement
|
250
266
|
none: false
|
251
267
|
requirements:
|
252
|
-
- -
|
268
|
+
- - ~>
|
253
269
|
- !ruby/object:Gem::Version
|
254
|
-
version:
|
270
|
+
version: 2.6.0
|
255
271
|
- !ruby/object:Gem::Dependency
|
256
272
|
name: solrizer-fedora
|
257
273
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,12 +296,9 @@ files:
|
|
280
296
|
- .gitignore
|
281
297
|
- .gitmodules
|
282
298
|
- .rvmrc
|
283
|
-
- BLACKLIGHT_CONFIG.textile
|
284
299
|
- Gemfile
|
285
300
|
- Gemfile.lock
|
286
301
|
- HISTORY.textile
|
287
|
-
- HOW_DO_I.textile
|
288
|
-
- HOW_TO_GET_STARTED.textile
|
289
302
|
- INSTALL_PREREQ.textile
|
290
303
|
- LICENSE
|
291
304
|
- README.textile
|
@@ -397,7 +410,6 @@ files:
|
|
397
410
|
- app/helpers/personalization_helper.rb
|
398
411
|
- app/helpers/release_process_helper.rb
|
399
412
|
- app/models/ability.rb
|
400
|
-
- app/models/audio_asset.rb
|
401
413
|
- app/models/common_metadata_asset.rb
|
402
414
|
- app/models/file_asset.rb
|
403
415
|
- app/models/generic_content.rb
|
@@ -411,13 +423,11 @@ files:
|
|
411
423
|
- app/models/hydra/datastream/properties.rb
|
412
424
|
- app/models/hydra/datastream/rights_metadata.rb
|
413
425
|
- app/models/hydra/role_mapper_behavior.rb
|
414
|
-
- app/models/image_asset.rb
|
415
426
|
- app/models/mods_asset.rb
|
416
427
|
- app/models/role_mapper.rb
|
417
428
|
- app/models/superuser.rb
|
418
429
|
- app/models/user_attribute.rb
|
419
430
|
- app/models/uses_default_partials.rb
|
420
|
-
- app/models/video_asset.rb
|
421
431
|
- app/views/_add_assets_links.html.erb
|
422
432
|
- app/views/_flash_msg.html.erb
|
423
433
|
- app/views/_user_util_links.html.erb
|
@@ -513,17 +523,12 @@ files:
|
|
513
523
|
- config/solr_mappings.yml
|
514
524
|
- db/migrate/20101105214243_add_user_attributes_table.rb
|
515
525
|
- db/migrate/20101108192527_create_superusers.rb
|
516
|
-
- fedora/conf/fedora.fcfg
|
517
526
|
- fedora_conf/conf/development/fedora.fcfg
|
518
527
|
- fedora_conf/conf/test/fedora.fcfg
|
519
528
|
- hydra-head.gemspec
|
520
529
|
- init.rb
|
521
530
|
- install.rb
|
522
|
-
- lib/application_controller.rb
|
523
531
|
- lib/application_helper.rb
|
524
|
-
- lib/block_mapper.rb
|
525
|
-
- lib/ead_mapper.rb
|
526
|
-
- lib/field_maps.rb
|
527
532
|
- lib/generators/hydra/assets_generator.rb
|
528
533
|
- lib/generators/hydra/cucumber_support_generator.rb
|
529
534
|
- lib/generators/hydra/head_generator.rb
|
@@ -580,8 +585,6 @@ files:
|
|
580
585
|
- lib/hydra/user.rb
|
581
586
|
- lib/hydra/workflow.rb
|
582
587
|
- lib/hydra/workflow/controller.rb
|
583
|
-
- lib/marc_mapper.rb
|
584
|
-
- lib/marc_record_ext.rb
|
585
588
|
- lib/mediashelf/active_fedora_helper.rb
|
586
589
|
- lib/prev_next_links.rb
|
587
590
|
- lib/railties/active-fedora.rake
|
@@ -612,6 +615,7 @@ files:
|
|
612
615
|
- test_support/features/button_add_generic_content.feature
|
613
616
|
- test_support/features/button_add_image.feature
|
614
617
|
- test_support/features/button_add_mods_asset.feature
|
618
|
+
- test_support/features/button_delete_asset.feature
|
615
619
|
- test_support/features/contributor_add.feature
|
616
620
|
- test_support/features/default_partials_edit.feature
|
617
621
|
- test_support/features/default_partials_search_result.feature
|
@@ -699,16 +703,13 @@ files:
|
|
699
703
|
- test_support/spec/lib/common_mods_index_methods_spec.rb
|
700
704
|
- test_support/spec/lib/hydra_submission_workflow_spec.rb
|
701
705
|
- test_support/spec/models/ability_spec.rb
|
702
|
-
- test_support/spec/models/audio_asset_spec.rb
|
703
706
|
- test_support/spec/models/file_asset_spec.rb
|
704
707
|
- test_support/spec/models/generic_content_spec.rb
|
705
708
|
- test_support/spec/models/generic_image_spec.rb
|
706
709
|
- test_support/spec/models/hydra_rights_metadata_spec.rb
|
707
|
-
- test_support/spec/models/image_asset_spec.rb
|
708
710
|
- test_support/spec/models/mods_asset_spec.rb
|
709
711
|
- test_support/spec/models/role_mapper_spec.rb
|
710
712
|
- test_support/spec/models/user_spec.rb
|
711
|
-
- test_support/spec/models/video_asset_spec.rb
|
712
713
|
- test_support/spec/rcov.opts
|
713
714
|
- test_support/spec/spec.opts
|
714
715
|
- test_support/spec/spec_helper.rb
|
@@ -746,7 +747,7 @@ files:
|
|
746
747
|
- vendor/cache/diff-lcs-1.1.3.gem
|
747
748
|
- vendor/cache/equivalent-xml-0.2.9.gem
|
748
749
|
- vendor/cache/erubis-2.7.0.gem
|
749
|
-
- vendor/cache/factory_girl-
|
750
|
+
- vendor/cache/factory_girl-2.6.4.gem
|
750
751
|
- vendor/cache/fastercsv-1.5.4.gem
|
751
752
|
- vendor/cache/ffi-1.0.11.gem
|
752
753
|
- vendor/cache/fssm-0.2.9.gem
|
@@ -757,6 +758,7 @@ files:
|
|
757
758
|
- vendor/cache/i18n-0.6.0.gem
|
758
759
|
- vendor/cache/jettywrapper-1.2.1.gem
|
759
760
|
- vendor/cache/journey-1.0.3.gem
|
761
|
+
- vendor/cache/jquery-rails-2.0.2.gem
|
760
762
|
- vendor/cache/json-1.6.6.gem
|
761
763
|
- vendor/cache/kaminari-0.13.0.gem
|
762
764
|
- vendor/cache/libwebsocket-0.1.3.gem
|
@@ -835,7 +837,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
835
837
|
version: '0'
|
836
838
|
requirements: []
|
837
839
|
rubyforge_project:
|
838
|
-
rubygems_version: 1.8.
|
840
|
+
rubygems_version: 1.8.24
|
839
841
|
signing_key:
|
840
842
|
specification_version: 3
|
841
843
|
summary: Hydra-Head Rails Engine (requires Rails3)
|