sufia 4.0.0.beta4 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/Gemfile +1 -1
- data/History.md +325 -0
- data/RELEASING.md +1 -0
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/sufia.js +2 -2
- data/app/assets/javascripts/sufia/batch_edit.js +2 -2
- data/app/assets/javascripts/sufia/batch_select_all.js +7 -7
- data/app/assets/stylesheets/{dashboard.css.scss → file-listing.css.scss} +7 -1
- data/app/assets/stylesheets/styles.css.scss +23 -0
- data/app/assets/stylesheets/sufia.css.scss +5 -1
- data/app/controllers/concerns/sufia/catalog.rb +4 -4
- data/app/controllers/concerns/sufia/controller.rb +0 -4
- data/app/controllers/concerns/sufia/my_controller_behavior.rb +1 -5
- data/app/controllers/my/collections_controller.rb +7 -0
- data/app/controllers/my/files_controller.rb +7 -0
- data/app/controllers/my/highlights_controller.rb +7 -0
- data/app/controllers/my/shares_controller.rb +7 -0
- data/app/helpers/sufia/records_helper_behavior.rb +1 -1
- data/app/helpers/sufia/sufia_helper_behavior.rb +2 -2
- data/app/models/concerns/sufia/solr_document_behavior.rb +10 -0
- data/app/views/_user_util_links.html.erb +1 -1
- data/app/views/advanced/index.html.erb +10 -13
- data/app/views/batch/_edit.js.erb +15 -0
- data/app/views/batch/_metadata.html.erb +1 -1
- data/app/views/batch/edit.html.erb +10 -25
- data/app/views/batch_edits/_batch_edits_actions.html.erb +1 -1
- data/app/views/batch_edits/_check_all.html.erb +1 -1
- data/app/views/batch_edits/edit.html.erb +3 -3
- data/app/views/catalog/_document_list.html.erb +6 -1
- data/app/views/catalog/index.html.erb +34 -21
- data/app/views/collections/_action_menu.html.erb +5 -5
- data/app/views/collections/_batch_edits_actions.html.erb +1 -1
- data/app/views/collections/_collection.html.erb +36 -0
- data/app/views/collections/_document_list.html.erb +2 -2
- data/app/views/collections/_edit_descriptions.html.erb +1 -1
- data/app/views/collections/_form.html.erb +11 -8
- data/app/views/collections/_search_collection_dashboard_form.html.erb +1 -1
- data/app/views/collections/_sort_and_per_page.html.erb +1 -1
- data/app/views/dashboard/index.html.erb +1 -1
- data/app/views/generic_files/_descriptions.html.erb +1 -1
- data/app/views/generic_files/_edit.js.erb +22 -0
- data/app/views/generic_files/_extra_fields_modal.html.erb +18 -14
- data/app/views/generic_files/_generic_file.html.erb +36 -0
- data/app/views/generic_files/_media_display.html.erb +4 -0
- data/app/views/generic_files/_permission.html.erb +1 -1
- data/app/views/generic_files/_permission_form.html.erb +40 -36
- data/app/views/generic_files/_rights_modal.html.erb +37 -33
- data/app/views/generic_files/edit.html.erb +13 -30
- data/app/views/generic_files/new.html.erb +3 -3
- data/app/views/generic_files/show.html.erb +3 -7
- data/app/views/generic_files/stats.html.erb +1 -1
- data/app/views/generic_files/upload/_form_fields.html.erb +4 -4
- data/app/views/generic_files/upload/_local_file_import_chooser.html.erb +2 -2
- data/app/views/generic_files/upload/_script_templates.html.erb +2 -2
- data/app/views/homepage/_home_content.html.erb +2 -2
- data/app/views/homepage/_home_header.html.erb +1 -1
- data/app/views/homepage/_sortable_featured.html.erb +1 -1
- data/app/views/layouts/_head_tag_content.html.erb +1 -10
- data/app/views/layouts/error.html.erb +0 -9
- data/app/views/layouts/homepage.html.erb +1 -1
- data/app/views/layouts/sufia-dashboard.html.erb +6 -6
- data/app/views/layouts/sufia-one-column.html.erb +2 -2
- data/app/views/layouts/sufia-two-column.html.erb +2 -2
- data/app/views/mailbox/_notifications.html.erb +1 -1
- data/app/views/mailbox/index.html.erb +1 -1
- data/app/views/my/_batch_edits_actions.html.erb +1 -1
- data/app/views/my/_collection_action_menu.html.erb +4 -4
- data/app/views/my/_did_you_mean.html.erb +2 -7
- data/app/views/my/_document_list.html.erb +1 -1
- data/app/views/my/_facet_layout.html.erb +10 -9
- data/app/views/my/_facet_limit.html.erb +9 -9
- data/app/views/my/_facet_pagination.html.erb +14 -17
- data/app/views/my/_facet_selected.html.erb +1 -1
- data/app/views/my/_facets.html.erb +20 -7
- data/app/views/my/_index_partials/_default_group.html.erb +4 -4
- data/app/views/my/_index_partials/_list_collections.html.erb +1 -1
- data/app/views/my/_index_partials/_list_files.html.erb +2 -2
- data/app/views/my/_results_pagination.html.erb +7 -4
- data/app/views/my/_sort_and_per_page.html.erb +5 -8
- data/app/views/my/facet.html.erb +2 -5
- data/app/views/my/index.html.erb +1 -1
- data/app/views/single_use_links/new_download.html.erb +1 -1
- data/app/views/users/_contributions.html.erb +3 -3
- data/app/views/users/_profile_tabs.html.erb +3 -3
- data/app/views/users/_social_media_info.html.erb +3 -3
- data/app/views/users/_trophy_edit.html.erb +2 -2
- data/app/views/users/_user_info.html.erb +4 -4
- data/app/views/users/edit.html.erb +5 -10
- data/app/views/users/show.html.erb +16 -21
- data/config/locales/sufia.en.yml +7 -6
- data/config/routes.rb +25 -32
- data/lib/generators/sufia/sufia_generator.rb +1 -1
- data/lib/generators/sufia/upgrade400_generator.rb +87 -0
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/catalog_controller_spec.rb +22 -0
- data/spec/features/browse_dashboard_files_spec.rb +22 -11
- data/spec/features/catalog_search_spec.rb +99 -0
- data/spec/features/collection_spec.rb +1 -1
- data/spec/helpers/records_helper_spec.rb +1 -1
- data/spec/helpers/sufia_helper_spec.rb +4 -3
- data/spec/models/generic_file_spec.rb +7 -3
- data/spec/models/solr_document_spec.rb +27 -9
- data/spec/services/noid_spec.rb +16 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/views/batch/edit.html.erb_spec.rb +34 -0
- data/spec/views/my/facet.html.erb_spec.rb +34 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/mime_types.rb +1 -1
- data/sufia-models/app/services/sufia/noid.rb +2 -5
- data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +78 -0
- data/sufia-models/lib/sufia/models/engine.rb +1 -1
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/sufia-models.gemspec +3 -3
- data/sufia.gemspec +1 -1
- data/tasks/sufia-dev.rake +1 -1
- metadata +24 -54
- data/.gitmodules +0 -4
- data/Releasing_sufia.md +0 -6
- data/UpgradeGuide.md +0 -3
- data/app/views/catalog/_bookmark_control.html.erb +0 -24
- data/app/views/catalog/_citation.html.erb +0 -11
- data/app/views/catalog/_constraints.html.erb +0 -6
- data/app/views/catalog/_constraints_element.html.erb +0 -20
- data/app/views/catalog/_did_you_mean.html.erb +0 -10
- data/app/views/catalog/_document.html.erb +0 -19
- data/app/views/catalog/_email_form.html.erb +0 -11
- data/app/views/catalog/_facet_layout.html.erb +0 -12
- data/app/views/catalog/_facet_selected.html.erb +0 -12
- data/app/views/catalog/_facets.html.erb +0 -7
- data/app/views/catalog/_folder_control.html.erb +0 -11
- data/app/views/catalog/_index_default.html.erb +0 -11
- data/app/views/catalog/_index_header_default.html.erb +0 -20
- data/app/views/catalog/_index_partials/_default_group.html.erb +0 -7
- data/app/views/catalog/_index_partials/_list_files.html.erb +0 -37
- data/app/views/catalog/_marc_view.html.erb +0 -33
- data/app/views/catalog/_opensearch_response_metadata.html.erb +0 -2
- data/app/views/catalog/_previous_next_doc.html.erb +0 -6
- data/app/views/catalog/_refworks_form.html.erb +0 -7
- data/app/views/catalog/_results_pagination.html.erb +0 -6
- data/app/views/catalog/_show_default.html.erb +0 -9
- data/app/views/catalog/_show_sidebar.html.erb +0 -1
- data/app/views/catalog/_show_tools.html.erb +0 -46
- data/app/views/catalog/_sms_form.html.erb +0 -21
- data/app/views/catalog/_sort_and_per_page.html.erb +0 -9
- data/app/views/catalog/about.html.erb +0 -0
- data/app/views/catalog/citation.html.erb +0 -1
- data/app/views/catalog/email.erb +0 -1
- data/app/views/catalog/endnote.endnote.erb +0 -1
- data/app/views/catalog/index.atom.builder +0 -109
- data/app/views/catalog/index.rss.builder +0 -19
- data/app/views/catalog/librarian_view.html.erb +0 -3
- data/app/views/catalog/opensearch.json.erb +0 -0
- data/app/views/catalog/opensearch.xml.builder +0 -10
- data/app/views/catalog/send_email_record.erb +0 -0
- data/app/views/catalog/show.endnote.erb +0 -1
- data/app/views/catalog/show.html.erb +0 -40
- data/app/views/catalog/show.refworks.erb +0 -1
- data/app/views/catalog/sms.erb +0 -1
- data/app/views/collections/_button_for_creating_empty_collection.html.erb +0 -3
- data/spec/views/my/facet_limit.html.erb_spec.rb +0 -15
data/lib/sufia/version.rb
CHANGED
@@ -54,5 +54,27 @@ describe CatalogController do
|
|
54
54
|
assigns(:document_list).count.should eql(1)
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
context "with collections" do
|
59
|
+
before do
|
60
|
+
@collection = Collection.new(title:"my collection", tag: 'rocks').tap do |c|
|
61
|
+
c.apply_depositor_metadata('mjg36')
|
62
|
+
c.save!
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
after do
|
67
|
+
@collection.destroy
|
68
|
+
end
|
69
|
+
|
70
|
+
it "finds collections and files" do
|
71
|
+
xhr :get, :index, q:"rocks"
|
72
|
+
expect(response).to be_success
|
73
|
+
doc_list = assigns(:document_list)
|
74
|
+
expect(doc_list.map(&:id)).to match_array [@collection.id, @gf1.id]
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
57
79
|
end
|
58
80
|
end
|
@@ -11,7 +11,7 @@ describe "Browse Dashboard" do
|
|
11
11
|
visit "/dashboard"
|
12
12
|
fill_in "q", with: "PDF"
|
13
13
|
click_button "search-submit-header"
|
14
|
-
page.
|
14
|
+
expect(page).to have_content("Fake Document Title")
|
15
15
|
end
|
16
16
|
|
17
17
|
context "within my files page" do
|
@@ -21,25 +21,23 @@ describe "Browse Dashboard" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should show me some files" do
|
24
|
-
page.
|
25
|
-
page.
|
24
|
+
expect(page).to have_content("Edit File")
|
25
|
+
expect(page).to have_content("Download File")
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should allow you to search your own files" do
|
29
29
|
fill_in "q", with: "PDF"
|
30
30
|
click_button "search-submit-header"
|
31
|
-
page.
|
31
|
+
expect(page).to have_content("Fake Document Title")
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should allow you to browse facets" do
|
35
|
-
pending "Issue #428 is causing this"
|
36
35
|
click_link "more Subjects"
|
37
36
|
click_link "consectetur"
|
38
|
-
save_and_open_page
|
39
37
|
within("#document_#{@fixtures[1].noid}") do
|
40
38
|
click_link "Test Document MP3.mp3"
|
41
39
|
end
|
42
|
-
page.
|
40
|
+
expect(page).to have_content("File Details")
|
43
41
|
end
|
44
42
|
|
45
43
|
it "should allow me to edit files (from the fixtures)" do
|
@@ -47,7 +45,20 @@ describe "Browse Dashboard" do
|
|
47
45
|
click_button "search-submit-header"
|
48
46
|
click_button "Select an action"
|
49
47
|
click_link "Edit File"
|
50
|
-
page.
|
48
|
+
expect(page).to have_content("Edit Fake Wav File.wav")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should refresh the page of files" do
|
52
|
+
click_button "Refresh"
|
53
|
+
expect(page).to have_content("Edit File")
|
54
|
+
expect(page).to have_content("Download File")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should allow me to edit files in batches" do
|
58
|
+
pending "Need to enable javascript testing"
|
59
|
+
first('input#check_all').click
|
60
|
+
click_button('Edit Selected')
|
61
|
+
expect(page).to have_content('3 files')
|
51
62
|
end
|
52
63
|
|
53
64
|
end
|
@@ -58,7 +69,7 @@ describe "Browse Dashboard" do
|
|
58
69
|
end
|
59
70
|
it "should search within my collections" do
|
60
71
|
within(".input-group-btn") do
|
61
|
-
page.
|
72
|
+
expect(page).to have_content("My Collections")
|
62
73
|
end
|
63
74
|
end
|
64
75
|
end
|
@@ -69,7 +80,7 @@ describe "Browse Dashboard" do
|
|
69
80
|
end
|
70
81
|
it "should search within my highlights" do
|
71
82
|
within(".input-group-btn") do
|
72
|
-
page.
|
83
|
+
expect(page).to have_content("My Highlights")
|
73
84
|
end
|
74
85
|
end
|
75
86
|
end
|
@@ -80,7 +91,7 @@ describe "Browse Dashboard" do
|
|
80
91
|
end
|
81
92
|
it "should search within my shares" do
|
82
93
|
within(".input-group-btn") do
|
83
|
-
page.
|
94
|
+
expect(page).to have_content("My Shares")
|
84
95
|
end
|
85
96
|
end
|
86
97
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'catalog searching' do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
@gf1 = GenericFile.new.tap do |f|
|
7
|
+
f.title = 'title 1'
|
8
|
+
f.tag = ["tag1", "tag2"]
|
9
|
+
f.apply_depositor_metadata('jilluser')
|
10
|
+
f.read_groups = ['public']
|
11
|
+
f.save!
|
12
|
+
end
|
13
|
+
@gf2 = GenericFile.new.tap do |f|
|
14
|
+
f.title = 'title 2'
|
15
|
+
f.tag = ["tag2", "tag3"]
|
16
|
+
f.apply_depositor_metadata('jilluser')
|
17
|
+
f.read_groups = ['public']
|
18
|
+
f.save!
|
19
|
+
end
|
20
|
+
@col = Collection.new.tap do |f|
|
21
|
+
f.title = 'title 3'
|
22
|
+
f.tag = ["tag3", "tag4"]
|
23
|
+
f.apply_depositor_metadata('jilluser')
|
24
|
+
f.read_groups = ['public']
|
25
|
+
f.save!
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
after(:all) do
|
30
|
+
User.destroy_all
|
31
|
+
GenericFile.destroy_all
|
32
|
+
Collection.destroy_all
|
33
|
+
end
|
34
|
+
|
35
|
+
before do
|
36
|
+
sign_in :user
|
37
|
+
visit '/'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "finds multiple files" do
|
41
|
+
within('#masthead_controls') do
|
42
|
+
fill_in('search-field-header', with: "tag2")
|
43
|
+
click_button("Go")
|
44
|
+
end
|
45
|
+
expect(page).to have_content('Search Results')
|
46
|
+
expect(page).to have_content(@gf1.title.first)
|
47
|
+
expect(page).to have_content(@gf2.title.first)
|
48
|
+
expect(page).to_not have_content(@col.title)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "finds files and collections" do
|
52
|
+
within('#masthead_controls') do
|
53
|
+
fill_in('search-field-header', with: "tag3")
|
54
|
+
click_button("Go")
|
55
|
+
end
|
56
|
+
expect(page).to have_content('Search Results')
|
57
|
+
expect(page).to have_content(@col.title)
|
58
|
+
expect(page).to have_content(@gf2.title.first)
|
59
|
+
expect(page).to_not have_content(@gf1.title.first)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "finds collections" do
|
63
|
+
within('#masthead_controls') do
|
64
|
+
fill_in('search-field-header', with: "tag4")
|
65
|
+
click_button("Go")
|
66
|
+
end
|
67
|
+
expect(page).to have_content('Search Results')
|
68
|
+
expect(page).to have_content(@col.title)
|
69
|
+
expect(page).to_not have_content(@gf2.title.first)
|
70
|
+
expect(page).to_not have_content(@gf1.title.first)
|
71
|
+
end
|
72
|
+
|
73
|
+
context "many tags" do
|
74
|
+
before do
|
75
|
+
(1..25).each do |i|
|
76
|
+
@gf1.tag << "tag#{i.to_s}"
|
77
|
+
end
|
78
|
+
@gf1.save
|
79
|
+
within('#masthead_controls') do
|
80
|
+
fill_in('search-field-header', with: "tag1")
|
81
|
+
click_button("Go")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it "allows for browsing tags" do
|
86
|
+
expect(page).to have_content('Search Results')
|
87
|
+
within('#facets') do
|
88
|
+
first('a.more_facets_link').click
|
89
|
+
click_link "more Keywords»"
|
90
|
+
end
|
91
|
+
click_link "tag18"
|
92
|
+
expect(page).to have_content "Search Results"
|
93
|
+
click_link @gf1.title[0]
|
94
|
+
expect(page).to have_content "Download"
|
95
|
+
expect(page).to_not have_content "Edit"
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'collection' do
|
4
4
|
def create_collection(title, description)
|
5
|
+
visit '/dashboard'
|
5
6
|
first('#hydra-collection-add').click
|
6
7
|
expect(page).to have_content 'Create New Collection'
|
7
8
|
fill_in('Title', with: title)
|
@@ -50,7 +51,6 @@ describe 'collection' do
|
|
50
51
|
end
|
51
52
|
it "should create collection from the dashboard and include files", js: true do
|
52
53
|
create_collection(title2, description2)
|
53
|
-
|
54
54
|
visit '/dashboard/files'
|
55
55
|
first('input#check_all').click
|
56
56
|
click_button "Add to Collection" # opens the modal
|
@@ -20,7 +20,7 @@ describe RecordsHelper do
|
|
20
20
|
a.attr('data-original-title').should == "Keyword"
|
21
21
|
a.attr('id').should == "generic_file_tag_help"
|
22
22
|
i = a.children.first
|
23
|
-
i.attr('class').should == 'glyphicon glyphicon-question-sign icon
|
23
|
+
i.attr('class').should == 'glyphicon glyphicon-question-sign large-icon'
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "download links" do
|
@@ -57,10 +57,11 @@ describe SufiaHelper do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
context "for an document object" do
|
60
|
-
let(:document) { SolrDocument.new( mime_type_tesim: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') }
|
60
|
+
let(:document) { SolrDocument.new( mime_type_tesim: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', noid_tsi: '1234') }
|
61
61
|
it "should show the default thumbnail" do
|
62
|
-
rendered = helper.sufia_thumbnail_tag(document, {})
|
63
|
-
rendered.should match /src="\/
|
62
|
+
rendered = helper.sufia_thumbnail_tag(document, { width: 90 })
|
63
|
+
rendered.should match /src="\/downloads\/1234\?datastream_id=thumbnail"/
|
64
|
+
rendered.should match /width="90"/
|
64
65
|
end
|
65
66
|
end
|
66
67
|
end
|
@@ -31,15 +31,19 @@ describe GenericFile do
|
|
31
31
|
context "when image?" do
|
32
32
|
it "should be true for jpeg2000" do
|
33
33
|
subject.mime_type = 'image/jp2'
|
34
|
-
subject.
|
34
|
+
expect(subject).to be_image
|
35
35
|
end
|
36
36
|
it "should be true for jpeg" do
|
37
37
|
subject.mime_type = 'image/jpg'
|
38
|
-
subject.
|
38
|
+
expect(subject).to be_image
|
39
39
|
end
|
40
40
|
it "should be true for png" do
|
41
41
|
subject.mime_type = 'image/png'
|
42
|
-
subject.
|
42
|
+
expect(subject).to be_image
|
43
|
+
end
|
44
|
+
it "should be true for tiff" do
|
45
|
+
subject.mime_type = 'image/tiff'
|
46
|
+
expect(subject).to be_image
|
43
47
|
end
|
44
48
|
end
|
45
49
|
context "when pdf?" do
|
@@ -1,21 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe SolrDocument do
|
4
|
-
describe "when mime-type is 'application/mxf'" do
|
5
|
-
before do
|
6
|
-
subject['mime_type_tesim'] = ['application/mxf']
|
7
|
-
end
|
8
|
-
it "should be a video" do
|
9
|
-
subject.should be_video
|
10
|
-
end
|
11
|
-
end
|
12
4
|
|
13
5
|
describe "date_uploaded" do
|
14
6
|
before do
|
15
7
|
subject['desc_metadata__date_uploaded_dtsi'] = '2013-03-14T00:00:00Z'
|
16
8
|
end
|
17
9
|
it "should be a date" do
|
18
|
-
subject.date_uploaded.
|
10
|
+
expect(subject.date_uploaded).to eq '03/14/2013'
|
19
11
|
end
|
20
12
|
end
|
21
13
|
|
@@ -27,4 +19,30 @@ describe SolrDocument do
|
|
27
19
|
expect(subject.to_param).to eq '1v53kn56d'
|
28
20
|
end
|
29
21
|
end
|
22
|
+
|
23
|
+
describe "document types" do
|
24
|
+
class Mimes
|
25
|
+
include Sufia::GenericFile::MimeTypes
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when mime-type is 'office'" do
|
29
|
+
it "should be office document" do
|
30
|
+
Mimes.office_document_mime_types.each do |type|
|
31
|
+
subject['mime_type_tesim'] = [type]
|
32
|
+
expect(subject).to be_office_document
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "when mime-type is 'video'" do
|
38
|
+
it "should be office" do
|
39
|
+
Mimes.video_mime_types.each do |type|
|
40
|
+
subject['mime_type_tesim'] = [type]
|
41
|
+
expect(subject).to be_video
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
30
48
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Sufia::Noid do
|
4
|
+
describe "#namespaceize" do
|
5
|
+
subject { Sufia::Noid.namespaceize(id) }
|
6
|
+
|
7
|
+
context "when the passed in pid doesn't have a namespace" do
|
8
|
+
let(:id) { 'abc123' }
|
9
|
+
it { should eq 'sufia:abc123' }
|
10
|
+
end
|
11
|
+
context "when the passed in pid has a namespace" do
|
12
|
+
let(:id) { 'ksl:abc123' }
|
13
|
+
it { should eq 'ksl:abc123' }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'batch/edit.html.erb' do
|
4
|
+
let( :batch ) {
|
5
|
+
stub_model(Batch, id: '123')
|
6
|
+
}
|
7
|
+
|
8
|
+
let(:generic_file) {
|
9
|
+
content = double('content', versions: [], mimeType: 'application/pdf')
|
10
|
+
stub_model(GenericFile, noid: '123',
|
11
|
+
depositor: 'bob',
|
12
|
+
content: content)
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
before do
|
17
|
+
allow(controller).to receive(:current_user).and_return(stub_model(User))
|
18
|
+
controller.request.path_parameters[:id] = "123"
|
19
|
+
assign :batch, batch
|
20
|
+
assign :generic_file, generic_file
|
21
|
+
render
|
22
|
+
@page = Capybara::Node::Simple.new(rendered)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should draw modal for license" do
|
26
|
+
expect(@page).to have_selector("div#myModal .modal-dialog .modal-content", count: 1)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should draw modal for rights" do
|
30
|
+
expect(@page).to have_selector("div#rightsModal .modal-dialog .modal-content", count: 1)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Note: this is a direct copy of the corresponding test in Blacklight
|
4
|
+
# with changes for "views/my" instead of "views/catalog"
|
5
|
+
|
6
|
+
describe "my/facet.html.erb" do
|
7
|
+
let(:display_facet) { double }
|
8
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
9
|
+
before do
|
10
|
+
blacklight_config.add_facet_field "xyz", label: "Facet title"
|
11
|
+
view.stub(:blacklight_config).and_return(blacklight_config)
|
12
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
13
|
+
stub_template "my/_facet_pagination.html.erb" => "pagination"
|
14
|
+
assign :facet, blacklight_config.facet_fields["xyz"]
|
15
|
+
assign :display_facet, display_facet
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have the facet title" do
|
19
|
+
allow(view).to receive(:render_facet_limit)
|
20
|
+
render
|
21
|
+
expect(rendered).to have_selector "h3", text: "Facet title"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should render facet pagination" do
|
25
|
+
allow(view).to receive(:render_facet_limit)
|
26
|
+
render
|
27
|
+
expect(rendered).to have_content "pagination"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should render the facet limit" do
|
31
|
+
expect(view).to receive(:render_facet_limit).with(display_facet, layout: false)
|
32
|
+
render
|
33
|
+
end
|
34
|
+
end
|
@@ -32,7 +32,7 @@ module Sufia
|
|
32
32
|
|
33
33
|
module ClassMethods
|
34
34
|
def image_mime_types
|
35
|
-
['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif']
|
35
|
+
['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif', 'image/tiff']
|
36
36
|
end
|
37
37
|
|
38
38
|
def pdf_mime_types
|