curate 0.6.1 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +135 -51
- data/app/assets/images/curate/default.png +0 -0
- data/app/assets/stylesheets/layout/positioning.css.scss +4 -0
- data/app/assets/stylesheets/modules/search_results.css.scss +4 -0
- data/app/controllers/concerns/curate/fields_for_add_to_collection.rb +9 -0
- data/app/controllers/curation_concern/base_controller.rb +1 -0
- data/app/controllers/curation_concern/generic_files_controller.rb +1 -0
- data/app/models/concerns/curate/ability.rb +6 -2
- data/app/repository_models/curation_concern/model.rb +1 -1
- data/app/repository_models/generic_file.rb +4 -0
- data/app/views/application/_add_to_collection_gui.html.erb +19 -0
- data/app/views/catalog/_index_partials/_identifier_and_action.html.erb +19 -11
- data/app/views/collections/_collection.html.erb +2 -27
- data/app/views/curate/collections/_form_to_add_member.html.erb +12 -10
- data/app/views/curate/collections/add_member_form.html.erb +4 -2
- data/app/views/curation_concern/base/_collections.html.erb +0 -10
- data/app/views/curation_concern/base/_related_files.html.erb +1 -1
- data/app/views/curation_concern/base/_representative_media.html.erb +8 -0
- data/app/views/curation_concern/base/_thumbnail.html.erb +7 -5
- data/app/views/curation_concern/base/show.html.erb +14 -6
- data/app/views/curation_concern/documents/_document.html.erb +1 -1
- data/app/views/curation_concern/generic_files/_media_display.html.erb +11 -1
- data/app/views/curation_concern/generic_files/show.html.erb +1 -1
- data/app/views/curation_concern/people/_person.html.erb +2 -20
- data/app/views/profiles/_profile.html.erb +2 -27
- data/lib/curate/spec_support.rb +1 -2
- data/lib/curate/version.rb +1 -1
- data/spec/features/catalog_search_spec.rb +0 -30
- data/spec/features/generic_file_spec.rb +2 -1
- data/spec/features/generic_work_spec.rb +0 -10
- data/spec/features/thumbnail_display_spec.rb +5 -2
- data/spec/helpers/curate_helper_spec.rb +27 -0
- data/spec/internal/Gemfile.lock +6 -6
- data/spec/internal/config/initializers/devise.rb +2 -2
- data/spec/internal/config/initializers/secret_token.rb +1 -1
- data/spec/internal/db/development.sqlite3 +0 -0
- data/spec/internal/db/migrate/{20131203200422_devise_create_users.rb → 20131205204122_devise_create_users.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200427_add_devise_guests_to_users.rb → 20131205204126_add_devise_guests_to_users.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200428_create_searches.rb → 20131205204127_create_searches.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200429_create_bookmarks.rb → 20131205204128_create_bookmarks.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200430_remove_editable_fields_from_bookmarks.rb → 20131205204129_remove_editable_fields_from_bookmarks.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200431_add_user_types_to_bookmarks_searches.rb → 20131205204130_add_user_types_to_bookmarks_searches.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200432_acts_as_follower_migration.rb → 20131205204131_acts_as_follower_migration.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200433_add_social_to_users.rb → 20131205204132_add_social_to_users.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200434_create_single_use_links.rb → 20131205204133_create_single_use_links.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200435_add_ldap_attrs_to_user.rb → 20131205204134_add_ldap_attrs_to_user.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200436_add_avatars_to_users.rb → 20131205204135_add_avatars_to_users.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200437_create_checksum_audit_logs.rb → 20131205204136_create_checksum_audit_logs.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200438_create_version_committers.rb → 20131205204137_create_version_committers.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200439_add_groups_to_users.rb → 20131205204138_add_groups_to_users.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200440_create_local_authorities.rb → 20131205204139_create_local_authorities.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200441_create_trophies.rb → 20131205204140_create_trophies.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200450_create_mailboxer.mailboxer_engine.rb → 20131205204152_create_mailboxer.mailboxer_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200451_add_notified_object.mailboxer_engine.rb → 20131205204153_add_notified_object.mailboxer_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200452_add_notification_code.mailboxer_engine.rb → 20131205204154_add_notification_code.mailboxer_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200453_add_attachments.mailboxer_engine.rb → 20131205204155_add_attachments.mailboxer_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200454_rename_receipts_read.mailboxer_engine.rb → 20131205204156_rename_receipts_read.mailboxer_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200455_add_global_notification_support.mailboxer_engine.rb → 20131205204157_add_global_notification_support.mailboxer_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200459_add_terms_of_service_to_user.curate_engine.rb → 20131205204202_add_terms_of_service_to_user.curate_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200460_add_user_force_update_profile.curate_engine.rb → 20131205204203_add_user_force_update_profile.curate_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200461_create_help_requests.curate_engine.rb → 20131205204204_create_help_requests.curate_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200462_add_repository_id_to_user.curate_engine.rb → 20131205204205_add_repository_id_to_user.curate_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200463_create_curate_proxy_deposit_rights.curate_engine.rb → 20131205204206_create_curate_proxy_deposit_rights.curate_engine.rb} +0 -0
- data/spec/internal/db/migrate/{20131203200464_change_display_name_to_name.curate_engine.rb → 20131205204207_change_display_name_to_name.curate_engine.rb} +0 -0
- data/spec/internal/db/schema.rb +1 -1
- data/spec/internal/db/test.sqlite3 +0 -0
- data/spec/internal/log/development.log +203 -191
- data/spec/internal/log/test.log +84621 -104943
- data/spec/internal/spec/factories/spams_factory.rb +0 -1
- data/spec/internal/spec/fixtures/cassettes/remotely_identified_doi_mint_generic_work.yml +13 -14
- data/spec/internal/spec/fixtures/cassettes/remotely_identified_doi_mint_spam.yml +13 -14
- data/spec/internal/tmp/cache/assets/test/sass/2c6be7e0f6fa11a075d87959732f91fde3df1f13/search_results.css.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/953d624c1831fcea22a3be549290f4c654726e96/positioning.css.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/163665b72c8e98b0c88c19896f080bc4 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/1c1167e9384b80e15359a663448a3196 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/4132e961bdf0f2ffa2f96a4c7822e209 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/41dd5dbd03cfa3f49e2d7569ffd03f8d +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/611235bfd282813bdfbc998bcbe798e8 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/7d4fe23150294500a7bcd2630667e5c8 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/{7078324d4486aa4ba7a6c21debbf3638 → 98ad78dc8c309689440b20bfa7372b3e} +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/ada353bb8ffe3eb0f2dd479e6d869a70 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/b148a5e98ff09a12b6a2139af1e62e46 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/{f0817826ed378d461b95e0e1ac870fcf → c14352828e1be2bbf3199771a34f9c57} +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d510daa6eb0cd4805bff7fd0990dfdb5 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d610f39602b6149ca02638c1728778b5 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/e9c2a0f2fa471ace3f7ed3a1f1b9ffc5 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/ea0ece5befbce765051e27cf991cc805 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/matchers.rb +24 -0
- data/spec/{support/matchers → matchers}/metadata_field_matchers.rb +0 -0
- data/spec/{support/matchers → matchers}/raise_rescue_response_type_matcher.rb +0 -0
- data/spec/repository_models/generic_file_spec.rb +11 -0
- data/spec/spec_helper.rb +3 -2
- data/spec/support/shared/shared_examples_with_related_works.rb +0 -1
- data/spec/views/application/_add_to_collection_gui.html.erb_spec.rb +60 -0
- data/spec/views/curate/collections/_form_to_add_member.html.erb_spec.rb +11 -11
- data/spec/views/curation_concern/base/_collection.html.erb_spec.rb +0 -2
- data/spec/views/curation_concern/base/_related_files.html.erb_spec.rb +16 -0
- data/spec/views/curation_concern/base/_representative_media.html.erb_spec.rb +15 -0
- data/spec/views/curation_concern/base/_thumbnail.html.erb_spec.rb +27 -0
- data/spec/views/curation_concern/generic_files/_media_display.html.erb_spec.rb +34 -0
- data/spec/views/curation_concern/generic_files/show.html.erb_spec.rb +12 -0
- metadata +87 -74
- data/app/views/catalog/_add_to_collection_gui.html.erb +0 -15
- data/app/views/curation_concern/base/_add_to_collection_gui.html.erb +0 -18
- data/app/views/curation_concern/base/_form_to_add_collection.html.erb +0 -9
- data/app/views/curation_concern/base/_representative_image.html.erb +0 -6
- data/spec/views/catalog/_add_to_collection_gui.html.erb_spec.rb +0 -48
- data/spec/views/curation_concern/base/_add_to_collection_gui.html.erb_spec.rb +0 -34
@@ -5,12 +5,9 @@ http_interactions:
|
|
5
5
|
uri: https://apitest:apitest@n2t.net/ezid/shoulder/doi:10.5072/FK2
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string:
|
9
|
-
|
10
|
-
|
11
|
-
datacite.title: Title 183
|
12
|
-
datacite.publisher: An Interesting Chap!
|
13
|
-
datacite.publicationyear: 2013
|
8
|
+
string: "_target: http://localhost/show/h415p852938\ndatacite.creator: \ndatacite.title:
|
9
|
+
Title 4\ndatacite.publisher: An Interesting Chap!\ndatacite.publicationyear:
|
10
|
+
2013"
|
14
11
|
headers:
|
15
12
|
Accept:
|
16
13
|
- '*/*; q=0.5, application/xml'
|
@@ -19,29 +16,31 @@ http_interactions:
|
|
19
16
|
Content-Type:
|
20
17
|
- text/plain
|
21
18
|
Content-Length:
|
22
|
-
- '
|
19
|
+
- '157'
|
23
20
|
User-Agent:
|
24
21
|
- Ruby
|
25
22
|
response:
|
26
23
|
status:
|
27
|
-
code:
|
28
|
-
message:
|
24
|
+
code: 400
|
25
|
+
message: BAD REQUEST
|
29
26
|
headers:
|
30
27
|
Date:
|
31
|
-
-
|
28
|
+
- Thu, 05 Dec 2013 20:59:04 GMT
|
32
29
|
Server:
|
33
30
|
- Apache/2.2.17 (Unix) DAV/2 mod_wsgi/3.3 Python/2.7 mod_ssl/2.2.17 OpenSSL/0.9.8o
|
34
31
|
Vary:
|
35
32
|
- Cookie
|
36
33
|
Set-Cookie:
|
37
|
-
- sessionid=
|
34
|
+
- sessionid=ni4j7qfnpcx4w6c37f1jlaqshvt1tmv4; httponly; Path=/ezid/
|
38
35
|
Content-Length:
|
39
|
-
- '
|
36
|
+
- '72'
|
37
|
+
Connection:
|
38
|
+
- close
|
40
39
|
Content-Type:
|
41
40
|
- text/plain; charset=UTF-8
|
42
41
|
body:
|
43
42
|
encoding: UTF-8
|
44
|
-
string: '
|
43
|
+
string: 'error: bad request - DOI metadata requirements not satisfied: no creator'
|
45
44
|
http_version:
|
46
|
-
recorded_at:
|
45
|
+
recorded_at: Thu, 05 Dec 2013 20:59:04 GMT
|
47
46
|
recorded_with: VCR 2.8.0
|
@@ -5,12 +5,9 @@ http_interactions:
|
|
5
5
|
uri: https://apitest:apitest@n2t.net/ezid/shoulder/doi:10.5072/FK2
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string:
|
9
|
-
|
10
|
-
|
11
|
-
datacite.title: Title 19
|
12
|
-
datacite.publisher: An Interesting Chap!
|
13
|
-
datacite.publicationyear: 2013
|
8
|
+
string: "_target: http://localhost/show/h415p85421z\ndatacite.creator: \ndatacite.title:
|
9
|
+
Title 19\ndatacite.publisher: An Interesting Chap!\ndatacite.publicationyear:
|
10
|
+
2013"
|
14
11
|
headers:
|
15
12
|
Accept:
|
16
13
|
- '*/*; q=0.5, application/xml'
|
@@ -19,29 +16,31 @@ http_interactions:
|
|
19
16
|
Content-Type:
|
20
17
|
- text/plain
|
21
18
|
Content-Length:
|
22
|
-
- '
|
19
|
+
- '158'
|
23
20
|
User-Agent:
|
24
21
|
- Ruby
|
25
22
|
response:
|
26
23
|
status:
|
27
|
-
code:
|
28
|
-
message:
|
24
|
+
code: 400
|
25
|
+
message: BAD REQUEST
|
29
26
|
headers:
|
30
27
|
Date:
|
31
|
-
-
|
28
|
+
- Thu, 05 Dec 2013 21:08:47 GMT
|
32
29
|
Server:
|
33
30
|
- Apache/2.2.17 (Unix) DAV/2 mod_wsgi/3.3 Python/2.7 mod_ssl/2.2.17 OpenSSL/0.9.8o
|
34
31
|
Vary:
|
35
32
|
- Cookie
|
36
33
|
Set-Cookie:
|
37
|
-
- sessionid=
|
34
|
+
- sessionid=myy1v7e276rt0dgxrfk61hu16ua2ti8x; httponly; Path=/ezid/
|
38
35
|
Content-Length:
|
39
|
-
- '
|
36
|
+
- '72'
|
37
|
+
Connection:
|
38
|
+
- close
|
40
39
|
Content-Type:
|
41
40
|
- text/plain; charset=UTF-8
|
42
41
|
body:
|
43
42
|
encoding: UTF-8
|
44
|
-
string: '
|
43
|
+
string: 'error: bad request - DOI metadata requirements not satisfied: no creator'
|
45
44
|
http_version:
|
46
|
-
recorded_at:
|
45
|
+
recorded_at: Thu, 12 Dec 2013 21:21:34 GMT
|
47
46
|
recorded_with: VCR 2.8.0
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/matchers.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rspec/matchers'
|
2
|
+
|
3
|
+
if defined?($SHOW_MATCHERS)
|
4
|
+
module RSpec::Shim
|
5
|
+
def define(matcher_name, *args, &block)
|
6
|
+
$SHOW_MATCHERS[matcher_name] = caller.first.split(":")[0..1]
|
7
|
+
super
|
8
|
+
end
|
9
|
+
def matcher(matcher_name, *args, &block)
|
10
|
+
$SHOW_MATCHERS[matcher_name] = caller.first.split(":")[0..1]
|
11
|
+
super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec::Matchers.extend(RSpec::Shim)
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'rspec/matchers/dsl'
|
19
|
+
require 'rspec-html-matchers'
|
20
|
+
require 'rspec-rails'
|
21
|
+
require 'rspec/rails'
|
22
|
+
require 'rspec/rails/matchers'
|
23
|
+
|
24
|
+
Dir[File.expand_path('../matchers/**/*.rb', __FILE__)].each { |f| require f }
|
File without changes
|
File without changes
|
@@ -52,4 +52,15 @@ describe GenericFile do
|
|
52
52
|
it { should respond_to :version_id }
|
53
53
|
end
|
54
54
|
|
55
|
+
context '#copy_permissions_from' do
|
56
|
+
let(:work){ FactoryGirl.create(:public_generic_work) }
|
57
|
+
let(:file) { FactoryGirl.create(:generic_file) }
|
58
|
+
|
59
|
+
it 'should copy permissions from the given work' do
|
60
|
+
file.visibility.should_not == "open"
|
61
|
+
file.copy_permissions_from(work)
|
62
|
+
file.visibility.should == "open"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
55
66
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,14 +2,12 @@
|
|
2
2
|
ENV["RAILS_ENV"] ||= 'test'
|
3
3
|
|
4
4
|
if ENV['COVERAGE']
|
5
|
-
require 'coveralls'
|
6
5
|
require 'simplecov'
|
7
6
|
|
8
7
|
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
9
8
|
|
10
9
|
# Out of the box, SimpleCov was looking at file in ENGINE_ROOT/spec/internal;
|
11
10
|
# After all that was where Rails was pointed at.
|
12
|
-
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
13
11
|
SimpleCov.root(ENGINE_ROOT)
|
14
12
|
SimpleCov.start 'rails' do
|
15
13
|
filters.clear
|
@@ -23,6 +21,8 @@ end
|
|
23
21
|
|
24
22
|
require File.expand_path("../internal/config/environment.rb", __FILE__)
|
25
23
|
|
24
|
+
require File.expand_path('../matchers', __FILE__)
|
25
|
+
|
26
26
|
# Prevent double spec runs under Zeus
|
27
27
|
require 'rspec/autorun' unless ENV['RUNNING_VIA_ZEUS']
|
28
28
|
|
@@ -53,6 +53,7 @@ RSpec.configure do |config|
|
|
53
53
|
config.order = 'random'
|
54
54
|
|
55
55
|
config.include Devise::TestHelpers, type: :controller
|
56
|
+
config.include Devise::TestHelpers, type: :view
|
56
57
|
config.include InputSupport, type: :input, example_group: {
|
57
58
|
file_path: config.escaped_path(%w[spec inputs])
|
58
59
|
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'application/add_to_collection_gui' do
|
4
|
+
let(:document) { double(title: 'A Document', pid: 'sufia:vwxyz', noid: 'vwxyz') }
|
5
|
+
let(:profile) { double(title: 'Your Profile', pid: 'sufia:abcde', noid: 'abcde') }
|
6
|
+
let(:collection) { double(title: 'A Collection', pid: 'sufia:12345', noid: '12345') }
|
7
|
+
let(:profile_section) { double(title: 'A Profile Section', pid: 'sufia:56789', noid: '56789') }
|
8
|
+
|
9
|
+
context 'with collections and no profile sections' do
|
10
|
+
before do
|
11
|
+
view.stub(:current_users_profile_sections).and_return([])
|
12
|
+
view.stub(:available_collections).and_return([collection])
|
13
|
+
view.stub(:available_profiles).and_return([])
|
14
|
+
|
15
|
+
render partial: 'add_to_collection_gui', locals: { collectible: document }
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'displays add link; lists collection as an option' do
|
19
|
+
expect(rendered).to include('Your Collections')
|
20
|
+
expect(rendered).to include(collection.pid)
|
21
|
+
expect(rendered).to_not include('Profile Sections')
|
22
|
+
expect(rendered).to have_link('Add to Collection', add_member_form_collections_path(collectible_id: document.pid))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'with a profile and profile section' do
|
27
|
+
before do
|
28
|
+
view.stub(:current_users_profile_sections).and_return([profile_section])
|
29
|
+
view.stub(:available_collections).and_return([])
|
30
|
+
view.stub(:available_profiles).and_return([profile])
|
31
|
+
|
32
|
+
render partial: 'add_to_collection_gui', locals: { collectible: document }
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'displays add link; lists profile section as an option' do
|
36
|
+
expect(rendered).to_not include('Your Collections')
|
37
|
+
expect(rendered).to include(profile.pid)
|
38
|
+
expect(rendered).to include('Profile Sections')
|
39
|
+
expect(rendered).to include(profile_section.pid)
|
40
|
+
expect(rendered).to have_link('Add to Collection', add_member_form_collections_path(collectible_id: document.pid))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'with no collections and no profile' do
|
45
|
+
before do
|
46
|
+
view.stub(:current_users_profile_sections).and_return([])
|
47
|
+
view.stub(:available_collections).and_return([])
|
48
|
+
view.stub(:available_profiles).and_return([])
|
49
|
+
|
50
|
+
render partial: 'add_to_collection_gui', locals: { collectible: document }
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'displays add link; includes no profile or collections' do
|
54
|
+
expect(rendered).to_not include('Your Collections')
|
55
|
+
expect(rendered).to_not include('Profile Sections')
|
56
|
+
expect(rendered).to have_link('Add to Collection', add_member_form_collections_path(collectible_id: document.pid))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
@@ -1,21 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'curate/collections/_form_to_add_member.html.erb' do
|
4
|
-
let(:
|
5
|
-
let(:
|
6
|
-
let(:
|
7
|
-
let(:profile) { person.profile }
|
8
|
-
let(:profile_section) {double(title: 'Section 1', pid: '123')}
|
4
|
+
let(:profile) { double(title: 'Your Profile', pid: 'sufia:abcde', noid: 'abcde') }
|
5
|
+
let(:collectible) { double(title: 'A Document', pid: 'sufia:vwxyz', noid: 'vwxyz') }
|
6
|
+
let(:profile_section) { double(title: 'A Profile Section', pid: 'sufia:56789', noid: '56789') }
|
9
7
|
|
10
8
|
before do
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
view.stub(:current_users_profile_sections).and_return([profile_section])
|
10
|
+
view.stub(:available_collections).and_return([])
|
11
|
+
view.stub(:available_profiles).and_return([profile])
|
12
|
+
|
13
|
+
render partial: 'form_to_add_member', locals: { collectible: collectible }
|
15
14
|
end
|
16
15
|
|
17
16
|
it 'should list profile and profile sections in the dropdown menu' do
|
18
|
-
expect(rendered).to
|
19
|
-
expect(rendered).to
|
17
|
+
expect(rendered).to include(profile.title)
|
18
|
+
expect(rendered).to include(profile_section.title)
|
20
19
|
end
|
20
|
+
|
21
21
|
end
|
@@ -19,7 +19,6 @@ describe 'curation_concern/base/_collection.html.erb' do
|
|
19
19
|
|
20
20
|
it 'lists all the collections the work is added to' do
|
21
21
|
expect(rendered).to include("Collection 1")
|
22
|
-
expect(rendered).to include("Add to Collection")
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
@@ -34,7 +33,6 @@ describe 'curation_concern/base/_collection.html.erb' do
|
|
34
33
|
|
35
34
|
it 'lists all the collections the work is added to' do
|
36
35
|
expect(rendered).to include("Collection 1")
|
37
|
-
expect(rendered).not_to include("Add to Collection")
|
38
36
|
end
|
39
37
|
end
|
40
38
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'curation_concern/base/_related_files.html.erb' do
|
4
|
+
it 'displays a donload button' do
|
5
|
+
file = stub_model(GenericFile, audit_stat: true, pid: '1234')
|
6
|
+
work = stub_model(GenericWork, pid: '5678')
|
7
|
+
work.generic_files += [file]
|
8
|
+
allow(view).to receive(:can?) { true }
|
9
|
+
|
10
|
+
render partial: 'curation_concern/base/related_files',
|
11
|
+
locals: {curation_concern: work, with_actions: true}
|
12
|
+
|
13
|
+
expect(rendered).to include(download_path(file.noid))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'curation_concern/base/_representative_media.html.erb' do
|
4
|
+
it 'displays a donload button' do
|
5
|
+
file = stub_model(GenericFile, audit_stat: true, pid: 'curate:foo1')
|
6
|
+
work = stub_model(GenericWork, representative: file.pid)
|
7
|
+
allow(GenericFile).to receive(:load_instance_from_solr).with(file.pid) { file }
|
8
|
+
|
9
|
+
render partial: 'curation_concern/base/representative_media', locals: {work: work}
|
10
|
+
|
11
|
+
expect(response).to render_template(partial: '_media_display')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'curation_concern/base/_thumbnail.html.erb' do
|
4
|
+
describe 'with an image file' do
|
5
|
+
it 'displays a thumbnail' do
|
6
|
+
img = stub_model(GenericFile, image?: true, pid: 'curate:foo1')
|
7
|
+
|
8
|
+
render(partial: 'thumbnail', locals: {thumbnail: img})
|
9
|
+
|
10
|
+
expect(rendered).to include(download_path(img, {datastream_id: 'thumbnail'}))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'with an audio file' do
|
15
|
+
it 'displays a generic image' do
|
16
|
+
audio_file = stub_model(GenericFile, audit_stat: true, pid: 'curate:foo1', audio?: true)
|
17
|
+
|
18
|
+
render(partial: 'thumbnail', locals: {thumbnail: audio_file})
|
19
|
+
|
20
|
+
expect(rendered).to include(curation_concern_generic_file_path(audio_file.noid))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'with a video file'
|
25
|
+
end
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe 'curation_concern/generic_files/_media_display.html.erb' do
|
4
|
+
describe 'with an image file' do
|
5
|
+
it 'displays the image' do
|
6
|
+
img = stub_model(GenericFile, image?: true, pid: 'curate:testfoo')
|
7
|
+
|
8
|
+
render(partial: 'media_display', locals: {generic_file: img})
|
9
|
+
|
10
|
+
expect(rendered).to include(download_path(img))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'with an audio file' do
|
15
|
+
it 'displays an audio player' do
|
16
|
+
audio_file = stub_model(GenericFile, audio?: true, pid: 'curate:testfoo')
|
17
|
+
|
18
|
+
render(partial: 'media_display', locals: {generic_file: audio_file})
|
19
|
+
|
20
|
+
expect(rendered).to include('audio')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'with an unknown file' do
|
25
|
+
it 'displays a placeholder image' do
|
26
|
+
unknown_file = stub_model(GenericFile, pid: 'curate:testfoo')
|
27
|
+
|
28
|
+
render(partial: 'media_display', locals: {generic_file: unknown_file})
|
29
|
+
|
30
|
+
expect(rendered).to include('nope.png')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|