sufia 0.0.1.pre1 → 0.0.1.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -2
- data/Gemfile +2 -1
- data/README.md +19 -15
- data/Rakefile +2 -0
- data/app/controllers/batch_controller.rb +2 -3
- data/app/controllers/contact_form_controller.rb +1 -0
- data/app/controllers/dashboard_controller.rb +2 -2
- data/app/controllers/generic_files_controller.rb +24 -12
- data/app/controllers/mailbox_controller.rb +2 -2
- data/app/controllers/single_use_link_controller.rb +5 -5
- data/app/controllers/users_controller.rb +10 -10
- data/app/helpers/{application_helper.rb → sufia_helper.rb} +5 -13
- data/app/models/audit_job.rb +3 -4
- data/app/models/batch.rb +2 -0
- data/app/models/batch_update_job.rb +4 -6
- data/app/models/checksum_audit_log.rb +2 -0
- data/app/models/contact_form.rb +2 -0
- data/app/models/content_delete_event_job.rb +1 -1
- data/app/models/content_deposit_event_job.rb +2 -2
- data/app/models/content_new_version_event_job.rb +2 -2
- data/app/models/content_restored_version_event_job.rb +2 -2
- data/app/models/content_update_event_job.rb +2 -2
- data/app/models/datastreams/properties_datastream.rb +1 -1
- data/app/models/domain_term.rb +1 -0
- data/app/models/event_job.rb +1 -1
- data/app/models/generic_file.rb +5 -4
- data/app/models/local_authority.rb +1 -0
- data/app/models/local_authority_entry.rb +1 -0
- data/app/models/single_use_link.rb +2 -2
- data/app/models/user_edit_profile_event_job.rb +1 -1
- data/app/models/user_follow_event_job.rb +2 -2
- data/app/models/user_unfollow_event_job.rb +2 -2
- data/app/models/version_committer.rb +1 -0
- data/app/views/_footer.html.erb +21 -0
- data/app/views/_logo.html.erb +3 -0
- data/app/views/_masthead.html.erb +38 -0
- data/app/views/_user_util_links.html.erb +14 -43
- data/app/views/catalog/_document_list.html.erb +0 -7
- data/app/views/catalog/_home_text.html.erb +4 -4
- data/app/views/catalog/_recent_document.html.erb +5 -5
- data/app/views/contact_form/_directions.html.erb +4 -0
- data/app/views/contact_form/new.html.erb +2 -4
- data/app/views/dashboard/_document_list.html.erb +1 -8
- data/app/views/dashboard/_facets.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_list_files.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +6 -6
- data/app/views/dashboard/_search_form.html.erb +1 -1
- data/app/views/dashboard/index.html.erb +26 -25
- data/app/views/generic_files/_media_display.html.erb +5 -5
- data/app/views/generic_files/_permission.html.erb +11 -11
- data/app/views/generic_files/edit.html.erb +10 -8
- data/app/views/generic_files/show.html.erb +16 -12
- data/app/views/layouts/error.html.erb +2 -53
- data/app/views/layouts/hydra-head.html.erb +2 -21
- data/app/views/mailbox/index.html.erb +1 -1
- data/app/views/static/about.html.erb +2 -65
- data/app/views/static/help.html.erb +1 -721
- data/app/views/users/_search_form.html.erb +1 -1
- data/app/views/users/edit.html.erb +6 -3
- data/config/locales/sufia.en.yml +6 -0
- data/config/routes.rb +1 -3
- data/features/browse_dashboard_files.feature +1 -1
- data/features/display_dashboard.feature +1 -1
- data/features/step_definitions/fixture_steps.rb +2 -2
- data/features/step_definitions/user_steps.rb +12 -8
- data/features/support/env.rb +9 -0
- data/features/support/paths.rb +21 -21
- data/lib/generators/sufia/sufia_generator.rb +46 -4
- data/lib/generators/sufia/templates/catalog_controller.rb +2 -2
- data/lib/generators/sufia/templates/config/redis_config.rb +20 -0
- data/lib/generators/sufia/templates/config/sufia.rb +29 -0
- data/lib/generators/sufia/templates/migrations/add_groups_to_users.rb +0 -4
- data/lib/sufia.rb +22 -15
- data/lib/sufia/active_fedora/redis.rb +49 -0
- data/lib/{generators/sufia/templates/config/active_record_base_redis.rb → sufia/active_record/redis.rb} +1 -16
- data/lib/sufia/controller.rb +1 -2
- data/lib/sufia/http_header_auth.rb +9 -0
- data/lib/sufia/role_mapper.rb +1 -0
- data/lib/sufia/user.rb +24 -6
- data/lib/sufia/version.rb +1 -1
- data/lib/tasks/fixtures.rake +245 -0
- data/spec/.gitignore +1 -0
- data/spec/active_fedora/unsaved_digital_object_spec.rb +2 -2
- data/spec/config/host_to_vhost_spec.rb +8 -8
- data/spec/controllers/batch_controller_spec.rb +6 -6
- data/spec/controllers/catalog_controller_spec.rb +2 -0
- data/spec/controllers/dashboard_controller_spec.rb +13 -10
- data/spec/controllers/downloads_controller_spec.rb +8 -8
- data/spec/controllers/generic_files_controller_spec.rb +46 -44
- data/spec/controllers/mailbox_controller_spec.rb +6 -12
- data/spec/controllers/sessions_controller_spec.rb +8 -6
- data/spec/controllers/single_use_link_controller_spec.rb +9 -14
- data/spec/controllers/users_controller_spec.rb +49 -49
- data/spec/{factories.rb → factories/users.rb} +6 -3
- data/spec/fixtures/scholarsphere/scholarsphere_test2.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test3.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test4.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test6.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.descMeta.txt +12 -0
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.foxml.erb +79 -0
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.txt +1 -0
- data/spec/fixtures/scholarsphere/{scholarsphere_test1.foxml.erb → sufia_test1.foxml.erb} +6 -6
- data/spec/fixtures/scholarsphere/{scholarsphere_test5.foxml.erb → sufia_test5.foxml.erb} +5 -5
- data/spec/fixtures/scholarsphere_generic_stub.foxml.erb +5 -5
- data/spec/lib/{scholarsphere → sufia}/id_service_spec.rb +5 -5
- data/spec/lib/{scholarsphere → sufia}/role_mapper_spec.rb +5 -2
- data/spec/models/audit_job_spec.rb +1 -1
- data/spec/models/batch_spec.rb +2 -2
- data/spec/models/batch_update_job_spec.rb +5 -5
- data/spec/models/checksum_audit_log_spec.rb +1 -1
- data/spec/models/event_jobs_spec.rb +19 -19
- data/spec/models/file_content_datastream_spec.rb +6 -6
- data/spec/models/fits_datastream_spec.rb +1 -1
- data/spec/models/generic_file_spec.rb +8 -9
- data/spec/models/local_authority_spec.rb +3 -3
- data/spec/models/single_use_link_spec.rb +5 -5
- data/spec/models/unzip_job_spec.rb +1 -1
- data/spec/models/user_spec.rb +5 -26
- data/spec/rake/scholarsphere_fixtures_spec.rb +13 -12
- data/spec/routing/route_spec.rb +4 -41
- data/spec/spec_helper.rb +14 -4
- data/spec/support/Gemfile +21 -0
- data/spec/support/config/redis.yml +6 -0
- data/spec/support/lib/generators/test_app_generator.rb +40 -0
- data/sufia.gemspec +4 -2
- data/tasks/cucumber.rake +0 -6
- data/tasks/jetty.rake +40 -0
- data/tasks/scholarsphere-dev.rake +57 -17
- data/tasks/scholarsphere-fixtures.rake +16 -63
- metadata +74 -55
- data/.rvmrc +0 -59
- data/LICENSE +0 -22
- data/app/assets/images/site_images/logo_psuss_logotype.png +0 -0
- data/app/assets/images/site_images/logo_psuss_shield.png +0 -0
- data/lib/generators/sufia/templates/config/active_fedora_base_redis.rb +0 -54
- data/lib/sufia/ldap.rb +0 -123
- data/spec/fixtures/hydra_test_default_partials.foxml.xml +0 -80
- data/spec/fixtures/hydra_test_generic_content.foxml.xml +0 -138
- data/spec/fixtures/hydra_test_generic_image.foxml.xml +0 -395
- data/spec/fixtures/hydra_test_no_model.foxml.xml +0 -79
- data/spec/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +0 -1212
- data/spec/fixtures/hydrangea_fixture_file_asset1.foxml.xml +0 -4946
- data/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml +0 -234
- data/spec/fixtures/hydrangea_fixture_mods_article2.foxml.xml +0 -177
- data/spec/fixtures/hydrangea_fixture_mods_article3.foxml.xml +0 -170
- data/spec/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +0 -187
- data/spec/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +0 -676
- data/spec/fixtures/hydrus_admin_class1.foxml.xml +0 -176
- data/spec/fixtures/libra-oa_1.foxml.xml +0 -2324
- data/spec/fixtures/libra-oa_2.foxml.xml +0 -2422
- data/spec/fixtures/libra-oa_7.foxml.xml +0 -1735
@@ -16,9 +16,9 @@ require 'spec_helper'
|
|
16
16
|
|
17
17
|
describe LocalAuthority do
|
18
18
|
before(:all) do
|
19
|
-
@tsv = [
|
20
|
-
@nt = [
|
21
|
-
@rdfxml = [
|
19
|
+
@tsv = [fixture_path + '/cities15000.tsv']
|
20
|
+
@nt = [fixture_path + '/genreForms.nt']
|
21
|
+
@rdfxml = [fixture_path + '/lexvo.rdf']
|
22
22
|
LocalAuthority.count.should == 0
|
23
23
|
LocalAuthorityEntry.count.should == 0
|
24
24
|
end
|
@@ -4,7 +4,7 @@ describe SingleUseLink do
|
|
4
4
|
before (:all) do
|
5
5
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
6
6
|
@file = GenericFile.new
|
7
|
-
@file.add_file_datastream(File.new(
|
7
|
+
@file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
|
8
8
|
@file.apply_depositor_metadata('mjg36')
|
9
9
|
@file.save
|
10
10
|
end
|
@@ -25,21 +25,21 @@ describe SingleUseLink do
|
|
25
25
|
su = SingleUseLink.create_show( @file.pid)
|
26
26
|
su.downloadKey.should == @hash
|
27
27
|
su.itemId.should == @file.pid
|
28
|
-
su.path.should ==
|
28
|
+
su.path.should == Sufia::Engine.routes.url_helpers.generic_file_path(@file.pid)
|
29
29
|
su.delete
|
30
30
|
end
|
31
31
|
it "should create show download link" do
|
32
32
|
su = SingleUseLink.create_download( @file.pid)
|
33
33
|
su.downloadKey.should == @hash
|
34
34
|
su.itemId.should == @file.pid
|
35
|
-
su.path.should ==
|
35
|
+
su.path.should == Sufia::Engine.routes.url_helpers.download_path(@file.pid)
|
36
36
|
su.delete
|
37
37
|
end
|
38
38
|
end
|
39
39
|
describe "find" do
|
40
40
|
describe "not expired" do
|
41
41
|
before do
|
42
|
-
@su = SingleUseLink.create(downloadKey:'sha2hashb', itemId:@file.pid, path:
|
42
|
+
@su = SingleUseLink.create(downloadKey:'sha2hashb', itemId:@file.pid, path:Sufia::Engine.routes.url_helpers.download_path(@file.noid), expires:DateTime.now.advance(:hours => 1))
|
43
43
|
end
|
44
44
|
after do
|
45
45
|
@su.delete
|
@@ -59,7 +59,7 @@ describe SingleUseLink do
|
|
59
59
|
end
|
60
60
|
describe "expired" do
|
61
61
|
before do
|
62
|
-
@su = SingleUseLink.create(downloadKey:'sha2hashb', itemId:@file.pid, path:
|
62
|
+
@su = SingleUseLink.create(downloadKey:'sha2hashb', itemId:@file.pid, path:Sufia::Engine.routes.url_helpers.download_path(@file.noid), expires:DateTime.now.advance(:hours => -1))
|
63
63
|
end
|
64
64
|
after do
|
65
65
|
@su.delete
|
@@ -20,7 +20,7 @@ describe UnzipJob do
|
|
20
20
|
GenericFile.any_instance.expects(:characterize_if_changed).at_least_once.yields
|
21
21
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
22
22
|
@generic_file = GenericFile.new(:batch=>@batch)
|
23
|
-
@generic_file.add_file_datastream(File.new(
|
23
|
+
@generic_file.add_file_datastream(File.new(fixture_path + '/icons.zip'), :dsid=>'content')
|
24
24
|
@generic_file.apply_depositor_metadata('mjg36')
|
25
25
|
@generic_file.save
|
26
26
|
end
|
data/spec/models/user_spec.rb
CHANGED
@@ -24,8 +24,12 @@ describe User do
|
|
24
24
|
@another_user.delete
|
25
25
|
end
|
26
26
|
it "should have a login" do
|
27
|
+
pending "Move to scholarsphere"
|
27
28
|
@user.login.should == "jilluser"
|
28
29
|
end
|
30
|
+
it "should have an email" do
|
31
|
+
@user.user_key.should == "jilluser@example.com"
|
32
|
+
end
|
29
33
|
it "should have activity stream-related methods defined" do
|
30
34
|
@user.should respond_to(:stream)
|
31
35
|
@user.should respond_to(:events)
|
@@ -40,7 +44,7 @@ describe User do
|
|
40
44
|
@user.should respond_to(:googleplus_handle)
|
41
45
|
end
|
42
46
|
it "should redefine to_param to make redis keys more recognizable" do
|
43
|
-
@user.to_param.should == @user.
|
47
|
+
@user.to_param.should == @user.user_key
|
44
48
|
end
|
45
49
|
it "should have a cancan ability defined" do
|
46
50
|
@user.should respond_to(:can?)
|
@@ -71,29 +75,4 @@ describe User do
|
|
71
75
|
@another_user.followed_by?(@user).should be_false
|
72
76
|
end
|
73
77
|
end
|
74
|
-
describe "#groups" do
|
75
|
-
before do
|
76
|
-
filter = Net::LDAP::Filter.eq('uid', @user.login)
|
77
|
-
Hydra::LDAP.expects(:groups_for_user).with(filter).returns(["umg/up.dlt.gamma-ci", "umg/up.dlt.redmine"])
|
78
|
-
stub_connection = stub(:get_operation_result => OpenStruct.new({code:0, message:"Success"}))
|
79
|
-
Hydra::LDAP.stubs(:connection).returns(stub_connection)
|
80
|
-
end
|
81
|
-
it "should return a list" do
|
82
|
-
@user.groups.should == ["umg/up.dlt.gamma-ci", "umg/up.dlt.redmine"]
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe "#attributes" do
|
87
|
-
before do
|
88
|
-
entry = Net::LDAP::Entry.new()
|
89
|
-
entry['dn'] = ["uid=mjg36,dc=psu,edu"]
|
90
|
-
entry['cn'] = ["MICHAEL JOSEPH GIARLO"]
|
91
|
-
Hydra::LDAP.expects(:get_user).returns([entry])
|
92
|
-
stub_connection = stub(:get_operation_result => OpenStruct.new({code:0, message:"Success"}))
|
93
|
-
Hydra::LDAP.stubs(:connection).returns(stub_connection)
|
94
|
-
end
|
95
|
-
it "should return user attributes from LDAP" do
|
96
|
-
User.directory_attributes('mjg36', ['cn']).first['cn'].should == ['MICHAEL JOSEPH GIARLO']
|
97
|
-
end
|
98
|
-
end
|
99
78
|
end
|
@@ -20,7 +20,7 @@ require "rake"
|
|
20
20
|
describe "scholarsphere:fixtures" do
|
21
21
|
|
22
22
|
def loaded_files_excluding_current_rake_file
|
23
|
-
$".reject { |file| file.include? "
|
23
|
+
$".reject { |file| file.include? "tasks/scholarsphere-fixtures" }
|
24
24
|
end
|
25
25
|
|
26
26
|
# saves original $stdout in variable
|
@@ -42,11 +42,11 @@ describe "scholarsphere:fixtures" do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def delete_fixture_files
|
45
|
-
File.delete(
|
46
|
-
File.delete(
|
47
|
-
File.delete(
|
45
|
+
File.delete(File.join(File.expand_path("#{fixture_path}/scholarsphere"), "sufia_rspecTestFixture.txt"))
|
46
|
+
File.delete(File.join(File.expand_path("#{fixture_path}/scholarsphere"), "sufia_rspecTestFixture.descMeta.txt"))
|
47
|
+
File.delete(File.join(File.expand_path("#{fixture_path}/scholarsphere"), "sufia_rspecTestFixture.foxml.erb"))
|
48
48
|
begin
|
49
|
-
File.delete(
|
49
|
+
File.delete(File.join(File.expand_path("#{fixture_path}/scholarsphere"), "sufia_rspecTestFixture.foxml.xml"))
|
50
50
|
rescue
|
51
51
|
# do nothing; this just means the generate task was not called
|
52
52
|
end
|
@@ -56,7 +56,8 @@ describe "scholarsphere:fixtures" do
|
|
56
56
|
before(:each) do
|
57
57
|
@rake = Rake::Application.new
|
58
58
|
Rake.application = @rake
|
59
|
-
Rake.application.rake_require("
|
59
|
+
Rake.application.rake_require("tasks/scholarsphere-fixtures", ["."], loaded_files_excluding_current_rake_file)
|
60
|
+
Rake.application.rake_require("lib/tasks/fixtures", ["."], loaded_files_excluding_current_rake_file)
|
60
61
|
Rake.application.rake_require("lib/tasks/active_fedora", [activefedora_path], loaded_files_excluding_current_rake_file)
|
61
62
|
Rake::Task.define_task(:environment)
|
62
63
|
end
|
@@ -76,12 +77,12 @@ describe "scholarsphere:fixtures" do
|
|
76
77
|
@rake['scholarsphere:fixtures:load'].invoke
|
77
78
|
@rake['scholarsphere:fixtures:delete'].invoke
|
78
79
|
end
|
79
|
-
Dir.glob(
|
80
|
-
Dir.glob(
|
81
|
-
Dir.glob(
|
82
|
-
Dir.glob(
|
83
|
-
o.should include "Loaded '
|
84
|
-
o.should include "Deleted '
|
80
|
+
Dir.glob(File.join(fixture_path, File.expand_path("/scholarsphere"), "sufia_rspecTestFixture.txt")).length.should == 1
|
81
|
+
Dir.glob(File.join(fixture_path, File.expand_path("/scholarsphere"), "sufia_rspecTestFixture.foxml.erb")).length.should == 1
|
82
|
+
Dir.glob(File.join(fixture_path, File.expand_path("/scholarsphere"), "sufia_rspecTestFixture.descMeta.txt")).length.should == 1
|
83
|
+
Dir.glob(File.join(fixture_path, File.expand_path("/scholarsphere"), "sufia_rspecTestFixture.foxml.xml")).length.should == 1
|
84
|
+
o.should include "Loaded 'sufia:rspecTestFixture'"
|
85
|
+
o.should include "Deleted 'sufia:rspecTestFixture'"
|
85
86
|
end
|
86
87
|
end
|
87
88
|
end
|
data/spec/routing/route_spec.rb
CHANGED
@@ -15,52 +15,15 @@
|
|
15
15
|
require 'spec_helper'
|
16
16
|
|
17
17
|
describe 'Routes' do
|
18
|
-
|
19
|
-
it "should route Blacklight routes"
|
20
|
-
# TODO: finish adding route specs for BL
|
21
|
-
# clear_bookmarks /bookmarks/clear(.:format) bookmarks#clear
|
22
|
-
# bookmarks GET /bookmarks(.:format) bookmarks#index
|
23
|
-
# POST /bookmarks(.:format) bookmarks#create
|
24
|
-
# new_bookmark GET /bookmarks/new(.:format) bookmarks#new
|
25
|
-
# edit_bookmark GET /bookmarks/:id/edit(.:format) bookmarks#edit
|
26
|
-
# bookmark GET /bookmarks/:id(.:format) bookmarks#show
|
27
|
-
# PUT /bookmarks/:id(.:format) bookmarks#update
|
28
|
-
# DELETE /bookmarks/:id(.:format) bookmarks#destroy
|
29
|
-
# clear_folder /folder/clear(.:format) folder#clear
|
30
|
-
# folder_destroy /folder/destroy(.:format) folder#destroy
|
31
|
-
# folder_index GET /folder(.:format) folder#index
|
32
|
-
# folder PUT /folder/:id(.:format) folder#update
|
33
|
-
# DELETE /folder/:id(.:format) folder#destroy
|
34
|
-
# search_history /search_history(.:format) search_history#index
|
35
|
-
# clear_search_history /search_history/clear(.:format) search_history#clear
|
36
|
-
# clear_saved_searches /saved_searches/clear(.:format) saved_searches#clear
|
37
|
-
# saved_searches /saved_searches(.:format) saved_searches#index
|
38
|
-
# save_search /saved_searches/save/:id(.:format) saved_searches#save
|
39
|
-
# forget_search /saved_searches/forget/:id(.:format) saved_searches#forget
|
40
|
-
# opensearch_catalog /catalog/opensearch(.:format) catalog#opensearch
|
41
|
-
# citation_catalog /catalog/citation(.:format) catalog#citation
|
42
|
-
# email_catalog /catalog/email(.:format) catalog#email
|
43
|
-
# sms_catalog /catalog/sms(.:format) catalog#sms
|
44
|
-
# endnote_catalog /catalog/endnote(.:format) catalog#endnote
|
45
|
-
# send_email_record_catalog /catalog/send_email_record(.:format) catalog#send_email_record
|
46
|
-
# catalog_facet /catalog/facet/:id(.:format) catalog#facet
|
47
|
-
# catalog_index /catalog(.:format) catalog#index
|
48
|
-
# librarian_view_catalog /catalog/:id/librarian_view(.:format) catalog#librarian_view
|
49
|
-
# solr_document GET /catalog/:id(.:format) catalog#show
|
50
|
-
# PUT /catalog/:id(.:format) catalog#update
|
51
|
-
# catalog GET /catalog/:id(.:format) catalog#show
|
52
|
-
# PUT /catalog/:id(.:format) catalog#update
|
53
|
-
# feedback /feedback(.:format) feedback#show
|
54
|
-
# feedback_complete /feedback/complete(.:format) feedback#complete
|
55
|
-
end
|
56
|
-
|
18
|
+
before(:each) { @routes = Sufia::Engine.routes }
|
57
19
|
describe 'Catalog' do
|
20
|
+
|
58
21
|
it 'should route the root url to the catalog controller' do
|
59
22
|
{ get: '/' }.should route_to(controller: 'catalog', action: 'index')
|
60
23
|
end
|
61
24
|
|
62
25
|
it 'should route to recently added files' do
|
63
|
-
{ get: '/catalog/recent' }.should route_to(controller: 'catalog', action: '
|
26
|
+
{ get: '/catalog/recent' }.should route_to(controller: 'catalog', action: 'recent')
|
64
27
|
end
|
65
28
|
end
|
66
29
|
|
@@ -256,7 +219,7 @@ describe 'Routes' do
|
|
256
219
|
|
257
220
|
describe "Catch-all" do
|
258
221
|
it "should route non-existent routes to errors" do
|
259
|
-
|
222
|
+
get('/awesome').should_not be_routable
|
260
223
|
end
|
261
224
|
end
|
262
225
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -14,16 +14,22 @@
|
|
14
14
|
|
15
15
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
16
16
|
ENV["RAILS_ENV"] ||= 'test'
|
17
|
-
|
17
|
+
|
18
|
+
require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../internal", __FILE__))
|
18
19
|
require 'rspec/rails'
|
19
20
|
require 'rspec/autorun'
|
20
21
|
require 'capybara/rspec'
|
21
22
|
require 'capybara/rails'
|
22
23
|
require 'mocha'
|
23
24
|
|
25
|
+
Resque.inline = Rails.env.test?
|
26
|
+
|
27
|
+
FactoryGirl.definition_file_paths = [File.expand_path("../factories", __FILE__)]
|
28
|
+
FactoryGirl.find_definitions
|
29
|
+
|
24
30
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
25
31
|
# in spec/support/ and its subdirectories.
|
26
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
32
|
+
#Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
27
33
|
|
28
34
|
RSpec.configure do |config|
|
29
35
|
# == Mock Framework
|
@@ -33,7 +39,7 @@ RSpec.configure do |config|
|
|
33
39
|
config.mock_with :mocha
|
34
40
|
|
35
41
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
36
|
-
config.fixture_path = "
|
42
|
+
config.fixture_path = File.expand_path("../fixtures", __FILE__)
|
37
43
|
|
38
44
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
39
45
|
# examples within a transaction, remove the following line or assign false
|
@@ -46,10 +52,14 @@ RSpec.configure do |config|
|
|
46
52
|
config.infer_base_class_for_anonymous_controllers = false
|
47
53
|
|
48
54
|
config.include Devise::TestHelpers, :type => :controller
|
55
|
+
|
56
|
+
# see https://github.com/rails/journey/issues/39
|
57
|
+
config.before(:each, :type=>"controller") { @routes = Sufia::Engine.routes }
|
49
58
|
end
|
50
59
|
|
60
|
+
|
51
61
|
module FactoryGirl
|
52
|
-
def self.find_or_create(handle, by=:
|
62
|
+
def self.find_or_create(handle, by=:email)
|
53
63
|
tmpl = FactoryGirl.build(handle)
|
54
64
|
tmpl.class.send("find_by_#{by}".to_sym, tmpl.send(by)) || FactoryGirl.create(handle)
|
55
65
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '3.2.9'
|
4
|
+
|
5
|
+
gem 'sqlite3'
|
6
|
+
|
7
|
+
gem 'devise'
|
8
|
+
gem 'blacklight'
|
9
|
+
gem 'hydra-head'
|
10
|
+
gem 'sufia', :path=>'../../'
|
11
|
+
gem 'rspec-rails', :group=>:test
|
12
|
+
gem 'capybara', :group=>:test
|
13
|
+
gem 'mocha', :group=>:test
|
14
|
+
|
15
|
+
gem 'factory_girl'
|
16
|
+
|
17
|
+
group :assets do
|
18
|
+
gem 'sass-rails', '~> 3.2.0'
|
19
|
+
gem 'compass-rails', '~> 1.0.0'
|
20
|
+
gem 'compass-susy-plugin', '~> 0.9.0'
|
21
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class TestAppGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../../../../support", __FILE__)
|
5
|
+
|
6
|
+
def run_blacklight_generator
|
7
|
+
say_status("warning", "GENERATING BL", :yellow)
|
8
|
+
|
9
|
+
generate 'blacklight', '--devise'
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_hydra_head_generator
|
13
|
+
say_status("warning", "GENERATING HH", :yellow)
|
14
|
+
|
15
|
+
generate 'hydra:head', '-f'
|
16
|
+
end
|
17
|
+
|
18
|
+
def run_hydra_head_generator
|
19
|
+
say_status("warning", "GENERATING HH", :yellow)
|
20
|
+
|
21
|
+
generate 'hydra:head', '-f'
|
22
|
+
end
|
23
|
+
|
24
|
+
def install_redis_config
|
25
|
+
copy_file "config/redis.yml"
|
26
|
+
end
|
27
|
+
|
28
|
+
def run_sufia_generator
|
29
|
+
say_status("warning", "GENERATING SUFIA", :yellow)
|
30
|
+
|
31
|
+
generate 'sufia', '-f'
|
32
|
+
|
33
|
+
remove_file 'spec/factories/users.rb'
|
34
|
+
end
|
35
|
+
|
36
|
+
def remove_index_page
|
37
|
+
remove_file 'public/index.html'
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/sufia.gemspec
CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_dependency 'blacklight'#, '~> 4.0.0.pre4'
|
20
20
|
gem.add_dependency 'blacklight_advanced_search'
|
21
21
|
gem.add_dependency 'hydra-head', '5.0.0.pre11'
|
22
|
-
#
|
22
|
+
#TODO remove
|
23
23
|
gem.add_dependency 'noid', '0.5.5'
|
24
|
-
gem.add_dependency 'hydra-batch-edit'
|
24
|
+
gem.add_dependency 'hydra-batch-edit', '~> 0.0.7'
|
25
25
|
|
26
26
|
# Other components
|
27
27
|
gem.add_dependency 'resque', '1.22.0'#, :require => 'resque/server'
|
@@ -34,6 +34,7 @@ Gem::Specification.new do |gem|
|
|
34
34
|
gem.add_dependency 'execjs', '1.4.0'
|
35
35
|
gem.add_dependency 'therubyracer', '0.10.2'
|
36
36
|
gem.add_dependency 'zipruby', '0.3.6'
|
37
|
+
gem.add_dependency 'mail_form'
|
37
38
|
gem.add_dependency 'rails_autolink', '1.0.9'
|
38
39
|
gem.add_dependency 'acts_as_follower', '0.1.1'
|
39
40
|
gem.add_dependency 'nest', '1.1.1'
|
@@ -42,4 +43,5 @@ Gem::Specification.new do |gem|
|
|
42
43
|
gem.add_dependency 'mailboxer', '0.8.0'
|
43
44
|
gem.add_dependency 'rainbow', '1.1.4'
|
44
45
|
gem.add_dependency 'will_paginate', '3.0.3'
|
46
|
+
gem.add_dependency 'activerecord-import'
|
45
47
|
end
|
data/tasks/cucumber.rake
CHANGED
@@ -21,27 +21,21 @@
|
|
21
21
|
|
22
22
|
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
23
23
|
|
24
|
-
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
25
|
-
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
26
|
-
|
27
24
|
begin
|
28
25
|
require 'cucumber/rake/task'
|
29
26
|
|
30
27
|
namespace :cucumber do
|
31
28
|
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
32
|
-
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
33
29
|
t.fork = true # You may get faster startup if you set this to false
|
34
30
|
t.profile = 'default'
|
35
31
|
end
|
36
32
|
|
37
33
|
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
38
|
-
t.binary = vendored_cucumber_bin
|
39
34
|
t.fork = true # You may get faster startup if you set this to false
|
40
35
|
t.profile = 'wip'
|
41
36
|
end
|
42
37
|
|
43
38
|
Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
44
|
-
t.binary = vendored_cucumber_bin
|
45
39
|
t.fork = true # You may get faster startup if you set this to false
|
46
40
|
t.profile = 'rerun'
|
47
41
|
end
|
data/tasks/jetty.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
namespace :jetty do
|
2
|
+
desc "Copies the default Solr & Fedora configs into the bundled Hydra Testing Server"
|
3
|
+
task :config do
|
4
|
+
Rake::Task["jetty:config_fedora"].invoke
|
5
|
+
Rake::Task["jetty:config_solr"].invoke
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Copies the contents of solr_conf into the Solr development-core and test-core of Testing Server"
|
9
|
+
task :config_solr do
|
10
|
+
FileList['solr_conf/conf/*'].each do |f|
|
11
|
+
cp("#{f}", 'jetty/solr/development-core/conf/', :verbose => true)
|
12
|
+
cp("#{f}", 'jetty/solr/test-core/conf/', :verbose => true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Copies a custom fedora config for the bundled Hydra Testing Server"
|
17
|
+
task :config_fedora do
|
18
|
+
# load a custom fedora.fcfg -
|
19
|
+
if defined?(Rails.root)
|
20
|
+
app_root = Rails.root
|
21
|
+
else
|
22
|
+
app_root = File.join(File.dirname(__FILE__),"..")
|
23
|
+
end
|
24
|
+
|
25
|
+
fcfg = File.join(app_root,"fedora_conf","conf","development","fedora.fcfg")
|
26
|
+
if File.exists?(fcfg)
|
27
|
+
puts "copying over development/fedora.fcfg"
|
28
|
+
cp("#{fcfg}", 'jetty/fedora/default/server/config/', :verbose => true)
|
29
|
+
else
|
30
|
+
puts "#{fcfg} file not found -- skipping fedora config"
|
31
|
+
end
|
32
|
+
fcfg = File.join(app_root,"fedora_conf","conf","test","fedora.fcfg")
|
33
|
+
if File.exists?(fcfg)
|
34
|
+
puts "copying over test/fedora.fcfg"
|
35
|
+
cp("#{fcfg}", 'jetty/fedora/test/server/config/', :verbose => true)
|
36
|
+
else
|
37
|
+
puts "#{fcfg} file not found -- skipping fedora config"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|