sufia 4.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +247 -215
  3. data/README.md +7 -3
  4. data/SUFIA_VERSION +1 -1
  5. data/app/assets/javascripts/sufia.js +5 -2
  6. data/app/assets/javascripts/sufia/proxy_rights.js +68 -0
  7. data/app/assets/javascripts/sufia/transfers.js +3 -0
  8. data/app/assets/javascripts/sufia/user_search.js +31 -0
  9. data/app/assets/stylesheets/jquery-ui.css +17 -17
  10. data/app/assets/stylesheets/sufia.css.scss +3 -2
  11. data/app/assets/stylesheets/sufia/_proxy-rights.scss +10 -0
  12. data/app/controllers/concerns/sufia/contact_form_controller_behavior.rb +22 -23
  13. data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +41 -0
  14. data/app/controllers/concerns/sufia/files_controller_behavior.rb +1 -0
  15. data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +76 -0
  16. data/app/controllers/concerns/sufia/users_controller_behavior.rb +9 -11
  17. data/app/controllers/depositors_controller.rb +3 -0
  18. data/app/controllers/transfers_controller.rb +3 -0
  19. data/app/helpers/sufia/dashboard_helper_behavior.rb +15 -0
  20. data/app/helpers/sufia/sufia_helper_behavior.rb +24 -2
  21. data/app/jobs/content_depositor_change_event_job.rb +50 -0
  22. data/app/views/dashboard/_index_partials/_contents.html.erb +18 -0
  23. data/app/views/dashboard/_index_partials/_proxy_rights.html.erb +23 -0
  24. data/app/views/dashboard/_index_partials/_transfers.html.erb +14 -0
  25. data/app/views/generic_files/proxy.html.erb +5 -0
  26. data/app/views/generic_files/upload/_form.html.erb +7 -2
  27. data/app/views/my/_action_menu.html.erb +3 -1
  28. data/app/views/records/edit_fields/_default.html.erb +1 -1
  29. data/app/views/transfers/_received.html.erb +58 -0
  30. data/app/views/transfers/_sent.html.erb +38 -0
  31. data/app/views/transfers/index.html.erb +7 -0
  32. data/app/views/transfers/new.html.erb +23 -0
  33. data/app/views/users/_proxies.html.erb +8 -0
  34. data/app/views/users/_user_util_links_extra.html.erb +1 -0
  35. data/app/views/users/edit.html.erb +6 -1
  36. data/config/locales/sufia.en.yml +9 -4
  37. data/config/routes.rb +14 -3
  38. data/lib/sufia.rb +7 -5
  39. data/lib/sufia/version.rb +1 -1
  40. data/spec/controllers/authorities_controller_spec.rb +6 -6
  41. data/spec/controllers/batch_controller_spec.rb +29 -29
  42. data/spec/controllers/batch_edits_controller_spec.rb +7 -7
  43. data/spec/controllers/catalog_controller_spec.rb +9 -9
  44. data/spec/controllers/collections_controller_spec.rb +28 -28
  45. data/spec/controllers/content_blocks_controller_spec.rb +3 -3
  46. data/spec/controllers/dashboard_controller_spec.rb +1 -1
  47. data/spec/controllers/depositors_controller_spec.rb +50 -0
  48. data/spec/controllers/downloads_controller_spec.rb +22 -22
  49. data/spec/controllers/featured_work_lists_controller_spec.rb +1 -1
  50. data/spec/controllers/featured_works_controller_spec.rb +1 -1
  51. data/spec/controllers/generic_files_controller_spec.rb +98 -90
  52. data/spec/controllers/homepage_controller_spec.rb +1 -1
  53. data/spec/controllers/mailbox_controller_spec.rb +10 -10
  54. data/spec/controllers/my/collections_controller_spec.rb +1 -1
  55. data/spec/controllers/my/files_controller_spec.rb +1 -1
  56. data/spec/controllers/my/highlights_controller_spec.rb +1 -1
  57. data/spec/controllers/my/shares_controller_spec.rb +1 -1
  58. data/spec/controllers/my_controller_spec.rb +1 -1
  59. data/spec/controllers/pages_controller_spec.rb +1 -1
  60. data/spec/controllers/single_use_links_controller_spec.rb +46 -50
  61. data/spec/controllers/single_use_links_viewer_controller_spec.rb +16 -16
  62. data/spec/controllers/static_controller_spec.rb +9 -9
  63. data/spec/controllers/tinymce_assets_controller_spec.rb +1 -1
  64. data/spec/controllers/transfers_controller_spec.rb +212 -0
  65. data/spec/controllers/users_controller_spec.rb +1 -1
  66. data/spec/factories/generic_files.rb +4 -4
  67. data/spec/factories/proxy_deposit_requests.rb +6 -0
  68. data/spec/features/browse_dashboard_files_spec.rb +25 -36
  69. data/spec/features/browse_files_spec.rb +18 -13
  70. data/spec/features/catalog_search_spec.rb +3 -6
  71. data/spec/features/cloud_upload_spec.rb +5 -7
  72. data/spec/features/collection_spec.rb +28 -35
  73. data/spec/features/contact_form_spec.rb +24 -24
  74. data/spec/features/display_dashboard_spec.rb +11 -11
  75. data/spec/features/ingest_upload_files_spec.rb +10 -10
  76. data/spec/features/notifications_spec.rb +11 -11
  77. data/spec/features/ownership_transfer_spec.rb +111 -0
  78. data/spec/features/proxy_spec.rb +52 -0
  79. data/spec/features/search_spec.rb +1 -1
  80. data/spec/features/single_use_links_spec.rb +28 -18
  81. data/spec/features/users_spec.rb +3 -3
  82. data/spec/helpers/batch_edits_helper_spec.rb +1 -1
  83. data/spec/helpers/content_block_helper_spec.rb +1 -1
  84. data/spec/helpers/dashboard_helper_spec.rb +1 -1
  85. data/spec/helpers/generic_file_helper_spec.rb +1 -1
  86. data/spec/helpers/records_helper_spec.rb +1 -1
  87. data/spec/helpers/sufia_helper_spec.rb +8 -8
  88. data/spec/helpers/trophy_helper_spec.rb +1 -1
  89. data/spec/jobs/audit_job_spec.rb +5 -5
  90. data/spec/jobs/batch_update_job_spec.rb +14 -14
  91. data/spec/jobs/content_depositor_change_event_job_spec.rb +22 -0
  92. data/spec/jobs/event_jobs_spec.rb +104 -104
  93. data/spec/jobs/import_url_job_spec.rb +2 -2
  94. data/spec/jobs/ingest_local_file_job_spec.rb +1 -1
  95. data/spec/lib/sufia/breadcrumbs_spec.rb +3 -3
  96. data/spec/lib/sufia/id_service_spec.rb +1 -1
  97. data/spec/lib/sufia/upload_complete_behavior_spec.rb +4 -4
  98. data/spec/models/ability_spec.rb +59 -15
  99. data/spec/models/batch_spec.rb +16 -16
  100. data/spec/models/characterization_spec.rb +1 -1
  101. data/spec/models/checksum_audit_log_spec.rb +34 -26
  102. data/spec/models/collection_spec.rb +1 -1
  103. data/spec/models/download_spec.rb +1 -1
  104. data/spec/models/featured_work_list_spec.rb +1 -1
  105. data/spec/models/featured_work_spec.rb +15 -4
  106. data/spec/models/file_content_datastream_spec.rb +14 -14
  107. data/spec/models/file_usage_spec.rb +1 -1
  108. data/spec/models/fits_datastream_spec.rb +1 -1
  109. data/spec/models/generic_file/reload_on_save_spec.rb +4 -4
  110. data/spec/models/generic_file/visibility_spec.rb +1 -1
  111. data/spec/models/generic_file/web_form_spec.rb +6 -5
  112. data/spec/models/generic_file_rdf_datastream_spec.rb +1 -1
  113. data/spec/models/generic_file_spec.rb +254 -220
  114. data/spec/models/geo_names_resource_spec.rb +2 -2
  115. data/spec/models/local_authority_spec.rb +60 -59
  116. data/spec/models/pageview_spec.rb +1 -1
  117. data/spec/models/properties_datastream_spec.rb +29 -10
  118. data/spec/models/proxy_deposit_request_spec.rb +107 -0
  119. data/spec/models/single_use_link_spec.rb +13 -13
  120. data/spec/models/solr_document_spec.rb +1 -1
  121. data/spec/models/trophy_spec.rb +6 -6
  122. data/spec/models/user_spec.rb +38 -22
  123. data/spec/routing/featured_works_route_spec.rb +1 -1
  124. data/spec/routing/ownership_transfers_route_spec.rb +45 -0
  125. data/spec/routing/route_spec.rb +42 -42
  126. data/spec/services/noid_spec.rb +2 -2
  127. data/spec/spec_helper.rb +10 -5
  128. data/spec/support/cleaner.rb +12 -0
  129. data/spec/support/features.rb +5 -0
  130. data/spec/support/features/session_helpers.rb +3 -17
  131. data/spec/support/locations.rb +36 -0
  132. data/spec/support/poltergeist.rb +11 -0
  133. data/spec/support/proxies.rb +14 -0
  134. data/spec/support/selectors.rb +122 -0
  135. data/spec/views/batch/edit.html.erb_spec.rb +1 -1
  136. data/spec/views/batch_edits/check_all_spec.rb +4 -4
  137. data/spec/views/catalog/index.html.erb_spec.rb +1 -1
  138. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +1 -1
  139. data/spec/views/collections/_form.html.erb_spec.rb +3 -1
  140. data/spec/views/collections/_show_descriptions.html.erb_spec.rb +1 -1
  141. data/spec/views/dashboard/index_spec.rb +3 -6
  142. data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
  143. data/spec/views/generic_file/show.html.erb_spec.rb +1 -1
  144. data/spec/views/generic_file/stats.html.erb_spec.rb +1 -1
  145. data/spec/views/my/facet.html.erb_spec.rb +2 -2
  146. data/spec/views/users/_follower_modal.html.erb_spec.rb +1 -1
  147. data/spec/views/users/_following_modal.html.erb_spec.rb +1 -1
  148. data/spec/views/users/_notify_number.html.erb_spec.rb +1 -1
  149. data/spec/views/users/_user_util_links.html.erb_spec.rb +1 -1
  150. data/spec/views/users/index.html.erb_spec.rb +2 -2
  151. data/spec/views/users/show.html.erb_spec.rb +2 -2
  152. data/sufia-models/app/models/concerns/sufia/ability.rb +22 -0
  153. data/sufia-models/app/models/concerns/sufia/generic_file.rb +1 -0
  154. data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +22 -0
  155. data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +3 -0
  156. data/sufia-models/app/models/concerns/sufia/user.rb +9 -0
  157. data/sufia-models/app/models/proxy_deposit_request.rb +85 -0
  158. data/sufia-models/app/models/proxy_deposit_rights.rb +4 -0
  159. data/sufia-models/app/models/sufia/avatar_uploader.rb +2 -3
  160. data/sufia-models/lib/generators/sufia/models/install_generator.rb +9 -1
  161. data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +53 -0
  162. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +16 -0
  163. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +11 -0
  164. data/sufia-models/lib/sufia/models/engine.rb +1 -1
  165. data/sufia-models/lib/sufia/models/version.rb +1 -1
  166. data/sufia.gemspec +2 -1
  167. data/tasks/sufia-dev.rake +5 -0
  168. metadata +82 -6
  169. data/tasks/sufia-db.rake +0 -21
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe UsersController do
3
+ describe UsersController, :type => :controller do
4
4
  before(:each) do
5
5
  @user = FactoryGirl.find_or_create(:jill)
6
6
  @another_user = FactoryGirl.find_or_create(:archivist)
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :generic_file do
3
- ignore do
3
+ transient do
4
4
  depositor "archivist1@example.com"
5
5
  end
6
6
  before(:create) do |gf, evaluator|
@@ -13,7 +13,7 @@ FactoryGirl.define do
13
13
 
14
14
  factory :fixture do
15
15
  factory :public_pdf do
16
- ignore do
16
+ transient do
17
17
  pid "sufia:fixture-pdf"
18
18
  end
19
19
  initialize_with { new(pid: pid) }
@@ -27,7 +27,7 @@ FactoryGirl.define do
27
27
  end
28
28
  end
29
29
  factory :public_mp3 do
30
- ignore do
30
+ transient do
31
31
  pid "sufia:fixture-mp3"
32
32
  end
33
33
  initialize_with { new(pid: pid) }
@@ -40,7 +40,7 @@ FactoryGirl.define do
40
40
  read_groups ["public"]
41
41
  end
42
42
  factory :public_wav do
43
- ignore do
43
+ transient do
44
44
  pid "sufia:fixture-wav"
45
45
  end
46
46
  initialize_with { new(pid: pid) }
@@ -0,0 +1,6 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :proxy_deposit_request do
5
+ end
6
+ end
@@ -1,9 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Browse Dashboard" do
3
+ describe "Browse Dashboard", :type => :feature do
4
4
 
5
- before do
5
+ before :all do
6
+ cleanup_jetty
6
7
  @fixtures = find_or_create_file_fixtures
8
+ end
9
+ after :all do
10
+ cleanup_jetty
11
+ end
12
+
13
+ before do
7
14
  sign_in FactoryGirl.create :user_with_fixtures
8
15
  end
9
16
 
@@ -17,10 +24,13 @@ describe "Browse Dashboard" do
17
24
  context "within my files page" do
18
25
 
19
26
  before do
20
- visit "dashboard/files"
27
+ visit "/dashboard/files"
21
28
  end
22
29
 
23
30
  it "should display all the necessary information" do
31
+ within("#document_#{@fixtures.first.noid}") do
32
+ click_button("Select an action")
33
+ end
24
34
  expect(page).to have_content("Edit File")
25
35
  expect(page).to have_content("Download File")
26
36
  expect(page).to_not have_content("Is part of:")
@@ -44,6 +54,7 @@ describe "Browse Dashboard" do
44
54
  end
45
55
 
46
56
  it "should allow you to browse facets" do
57
+ click_link "Subject"
47
58
  click_link "more Subjects"
48
59
  click_link "consectetur"
49
60
  within("#document_#{@fixtures[1].noid}") do
@@ -62,50 +73,28 @@ describe "Browse Dashboard" do
62
73
 
63
74
  it "should refresh the page of files" do
64
75
  click_button "Refresh"
65
- expect(page).to have_content("Edit File")
66
- expect(page).to have_content("Download File")
76
+ within("#document_#{@fixtures.first.noid}") do
77
+ click_button("Select an action")
78
+ expect(page).to have_content("Edit File")
79
+ expect(page).to have_content("Download File")
80
+ end
67
81
  end
68
82
 
69
83
  it "should allow me to edit files in batches" do
70
- pending "Need to enable javascript testing"
71
84
  first('input#check_all').click
72
85
  click_button('Edit Selected')
73
86
  expect(page).to have_content('3 files')
74
87
  end
75
88
 
76
- end
77
-
78
- context "within my collections page" do
79
- before do
80
- visit "dashboard/collections"
81
- end
82
- it "should search within my collections" do
83
- within(".input-group-btn") do
84
- expect(page).to have_content("My Collections")
85
- end
86
- end
87
- end
88
-
89
- context "within my highlights page" do
90
- before do
91
- visit "dashboard/highlights"
92
- end
93
- it "should search within my highlights" do
94
- within(".input-group-btn") do
95
- expect(page).to have_content("My Highlights")
89
+ it "should link to my other tabs" do
90
+ ["My Collections", "My Highlights", "Files Shared with Me"].each do |tab|
91
+ within("#my_nav") do
92
+ click_link(tab)
93
+ end
94
+ expect(page).to have_content(tab)
96
95
  end
97
96
  end
98
- end
99
97
 
100
- context "within my shares page" do
101
- before do
102
- visit "dashboard/shares"
103
- end
104
- it "should search within my shares" do
105
- within(".input-group-btn") do
106
- expect(page).to have_content("My Shares")
107
- end
108
- end
109
98
  end
110
99
 
111
100
  end
@@ -1,12 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Browse files" do
3
+ describe "Browse files", :type => :feature do
4
4
 
5
- before do
6
- allow(User).to receive(:find_by_user_key).and_return(stub_model(User, twitter_handle: 'bob'))
7
- end
8
-
9
- before(:all) do
5
+ before :all do
6
+ cleanup_jetty
10
7
  @fixtures = find_or_create_file_fixtures
11
8
  @fixtures[0].tag = ["key"]
12
9
  (1..25).each do |i|
@@ -15,25 +12,33 @@ describe "Browse files" do
15
12
  @fixtures[0].save
16
13
  end
17
14
 
15
+ after :all do
16
+ cleanup_jetty
17
+ end
18
+
18
19
  before do
20
+ allow(User).to receive(:find_by_user_key).and_return(stub_model(User, twitter_handle: 'bob'))
19
21
  visit '/'
20
22
  fill_in "search-field-header", with: "key"
21
23
  click_button "search-submit-header"
22
- click_link "more Keywords"
24
+ click_link "Keyword"
25
+ click_link "more Keywords»"
23
26
  end
24
27
 
25
28
  describe "when not logged in" do
26
29
  it "should let us browse some of the fixtures" do
27
30
  click_link "18"
28
- page.should have_content "Search Results"
31
+ expect(page).to have_content "Search Results"
29
32
  click_link @fixtures[0].title[0]
30
- page.should have_content "Download"
31
- page.should_not have_content "Edit"
33
+ expect(page).to have_content "Download"
34
+ expect(page).not_to have_content "Edit"
32
35
  end
33
36
  it "should allow you to click next" do
34
- first(:link, 'Next').click
35
- page.should have_content "5"
36
- page.should_not have_content "11"
37
+ click_link 'Next »'
38
+ within(".modal-body") do
39
+ expect(page).to have_content "5"
40
+ expect(page).not_to have_content "11"
41
+ end
37
42
  end
38
43
  end
39
44
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'catalog searching' do
3
+ describe 'catalog searching', :type => :feature do
4
4
 
5
5
  before(:all) do
6
6
  @gf1 = GenericFile.new.tap do |f|
@@ -84,11 +84,8 @@ describe 'catalog searching' do
84
84
  end
85
85
 
86
86
  it "allows for browsing tags" do
87
- expect(page).to have_content('Search Results')
88
- within('#facets') do
89
- first('a.more_facets_link').click
90
- click_link "more Keywords»"
91
- end
87
+ click_link "Keyword"
88
+ click_link "more Keywords»"
92
89
  click_link "tag18"
93
90
  expect(page).to have_content "Search Results"
94
91
  click_link @gf1.title[0]
@@ -1,18 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Selecting files to import from cloud providers" do
4
-
3
+ describe "Selecting files to import from cloud providers", :type => :feature do
5
4
  before do
6
5
  sign_in :user
6
+ click_link "Upload"
7
7
  end
8
8
 
9
9
  it "should have a Cloud file picker using browse-everything" do
10
- click_link "upload"
11
10
  click_link "Cloud Providers"
12
- page.should have_content "Browse cloud files"
13
- page.should have_content "Submit selected files"
14
- page.should have_content "0 items selected"
11
+ expect(page).to have_content "Browse cloud files"
12
+ expect(page).to have_content "Submit selected files"
13
+ expect(page).to have_content "0 items selected"
15
14
  click_button 'Browse cloud files'
16
15
  end
17
-
18
16
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'collection' do
3
+ describe 'collection', :type => :feature do
4
4
  def create_collection(title, description)
5
5
  visit '/dashboard'
6
6
  first('#hydra-collection-add').click
@@ -19,12 +19,8 @@ describe 'collection' do
19
19
  let(:description2) {"Description for collection 2 we are testing."}
20
20
 
21
21
  let(:user) { FactoryGirl.find_or_create(:archivist) }
22
- let(:user_key) { user.user_key }
23
22
 
24
23
  before(:all) do
25
- @old_resque_inline_value = Resque.inline
26
- Resque.inline = true
27
-
28
24
  @gfs = []
29
25
  (0..12).each do |x|
30
26
  @gfs[x] = GenericFile.new.tap do |f|
@@ -38,10 +34,7 @@ describe 'collection' do
38
34
  end
39
35
 
40
36
  after(:all) do
41
- Resque.inline = @old_resque_inline_value
42
- Batch.destroy_all
43
- GenericFile.destroy_all
44
- Collection.destroy_all
37
+ ActiveFedora::Base.destroy_all
45
38
  end
46
39
 
47
40
  describe 'create collection' do
@@ -67,19 +60,19 @@ describe 'collection' do
67
60
  before (:each) do
68
61
  @collection = Collection.new title:'collection title'
69
62
  @collection.description = 'collection description'
70
- @collection.apply_depositor_metadata(user_key)
63
+ @collection.apply_depositor_metadata(user.user_key)
71
64
  @collection.save
72
65
  sign_in user
73
66
  visit '/dashboard/collections'
74
67
  end
75
68
 
76
69
  it "should delete a collection" do
77
- page.should have_content(@collection.title)
70
+ expect(page).to have_content(@collection.title)
78
71
  within('#document_'+@collection.noid) do
79
72
  first('button.dropdown-toggle').click
80
73
  first(".itemtrash").click
81
74
  end
82
- page.should_not have_content(@collection.title)
75
+ expect(page).not_to have_content(@collection.title)
83
76
  end
84
77
  end
85
78
 
@@ -87,7 +80,7 @@ describe 'collection' do
87
80
  before do
88
81
  @collection = Collection.new title: 'collection title'
89
82
  @collection.description = 'collection description'
90
- @collection.apply_depositor_metadata(user_key)
83
+ @collection.apply_depositor_metadata(user.user_key)
91
84
  @collection.members = [@gf1,@gf2]
92
85
  @collection.save
93
86
  sign_in user
@@ -144,7 +137,7 @@ describe 'collection' do
144
137
  before (:each) do
145
138
  @collection = Collection.new(title: 'collection title')
146
139
  @collection.description = 'collection description'
147
- @collection.apply_depositor_metadata(user_key)
140
+ @collection.apply_depositor_metadata(user.user_key)
148
141
  @collection.members = [@gf1, @gf2]
149
142
  @collection.save
150
143
  sign_in user
@@ -180,41 +173,41 @@ describe 'collection' do
180
173
  end
181
174
 
182
175
  it "should remove a file from a collection" do
183
- page.should have_content(@collection.title)
176
+ expect(page).to have_content(@collection.title)
184
177
  within("#document_#{@collection.noid}") do
185
178
  first('button.dropdown-toggle').click
186
179
  click_link('Edit Collection')
187
180
  end
188
- page.should have_field('collection_title', with: @collection.title)
189
- page.should have_field('collection_description', with: @collection.description)
190
- page.should have_content(@gf1.title.first)
191
- page.should have_content(@gf2.title.first)
181
+ expect(page).to have_field('collection_title', with: @collection.title)
182
+ expect(page).to have_field('collection_description', with: @collection.description)
183
+ expect(page).to have_content(@gf1.title.first)
184
+ expect(page).to have_content(@gf2.title.first)
192
185
  within("#document_#{@gf1.noid}") do
193
186
  first('button.dropdown-toggle').click
194
187
  click_button('Remove from Collection')
195
188
  end
196
- page.should have_content(@collection.title)
197
- page.should have_content(@collection.description)
198
- page.should_not have_content(@gf1.title.first)
199
- page.should have_content(@gf2.title.first)
189
+ expect(page).to have_content(@collection.title)
190
+ expect(page).to have_content(@collection.description)
191
+ expect(page).not_to have_content(@gf1.title.first)
192
+ expect(page).to have_content(@gf2.title.first)
200
193
  end
201
194
 
202
195
  it "should remove all files from a collection", js: true do
203
- page.should have_content(@collection.title)
196
+ expect(page).to have_content(@collection.title)
204
197
  within('#document_'+@collection.noid) do
205
198
  first('button.dropdown-toggle').click
206
199
  click_link('Edit Collection')
207
200
  end
208
- page.should have_field('collection_title', with: @collection.title)
209
- page.should have_field('collection_description', with: @collection.description)
210
- page.should have_content(@gf1.title.first)
211
- page.should have_content(@gf2.title.first)
201
+ expect(page).to have_field('collection_title', with: @collection.title)
202
+ expect(page).to have_field('collection_description', with: @collection.description)
203
+ expect(page).to have_content(@gf1.title.first)
204
+ expect(page).to have_content(@gf2.title.first)
212
205
  first('input#check_all').click
213
206
  click_button('Remove From Collection')
214
- page.should have_content(@collection.title)
215
- page.should have_content(@collection.description)
216
- page.should_not have_content(@gf1.title.first)
217
- page.should_not have_content(@gf2.title.first)
207
+ expect(page).to have_content(@collection.title)
208
+ expect(page).to have_content(@collection.description)
209
+ expect(page).not_to have_content(@gf1.title.first)
210
+ expect(page).not_to have_content(@gf2.title.first)
218
211
  end
219
212
  end
220
213
 
@@ -222,7 +215,7 @@ describe 'collection' do
222
215
  before (:each) do
223
216
  @collection = Collection.new title:'collection title'
224
217
  @collection.description = 'collection description'
225
- @collection.apply_depositor_metadata(user_key)
218
+ @collection.apply_depositor_metadata(user.user_key)
226
219
  @collection.members = @gfs
227
220
  @collection.save!
228
221
  sign_in user
@@ -230,11 +223,11 @@ describe 'collection' do
230
223
  end
231
224
 
232
225
  it "should show a collection with a listing of Descriptive Metadata and catalog-style search results" do
233
- page.should have_content(@collection.title)
226
+ expect(page).to have_content(@collection.title)
234
227
  within('#document_'+@collection.noid) do
235
228
  click_link("Display all details of collection title")
236
229
  end
237
- page.should have_css(".pager")
230
+ expect(page).to have_css(".pager")
238
231
  end
239
232
  end
240
233
  end
@@ -1,99 +1,99 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Sending an email via the contact form" do
3
+ describe "Sending an email via the contact form", :type => :feature do
4
4
 
5
5
  before do
6
6
  sign_in :user_with_fixtures
7
7
  end
8
8
 
9
9
  it "should send mail" do
10
- ContactForm.any_instance.stub(:deliver).and_return(true)
10
+ allow_any_instance_of(ContactForm).to receive(:deliver).and_return(true)
11
11
  visit '/'
12
12
  click_link "Contact"
13
- page.should have_content "Contact Form"
14
- fill_in "contact_form_name", with: "Test McPherson"
13
+ expect(page).to have_content "Contact Form"
14
+ fill_in "contact_form_name", with: "Test McPherson"
15
15
  fill_in "contact_form_email", with: "archivist1@example.com"
16
16
  fill_in "contact_form_message", with: "I am contacting you regarding ScholarSphere."
17
17
  fill_in "contact_form_subject", with: "My Subject is Cool"
18
18
  select "Depositing content", from: "contact_form_category"
19
19
  click_button "Send"
20
- page.should have_content "Thank you"
20
+ expect(page).to have_content "Thank you"
21
21
  # this step allows the delivery to go back to normal
22
- ContactForm.any_instance.unstub(:deliver)
22
+ allow_any_instance_of(ContactForm).to receive(:deliver).and_call_original
23
23
  end
24
24
 
25
25
  it "should give an error when I don't provide a contact type" do
26
26
  visit '/'
27
27
  click_link "Contact"
28
- page.should have_content "Contact Form"
29
- fill_in "contact_form_name", with: "Test McPherson"
28
+ expect(page).to have_content "Contact Form"
29
+ fill_in "contact_form_name", with: "Test McPherson"
30
30
  fill_in "contact_form_email", with: "archivist1@example.com"
31
31
  fill_in "contact_form_message", with: "I am contacting you regarding ScholarSphere."
32
32
  fill_in "contact_form_subject", with: "My Subject is Cool"
33
33
  click_button "Send"
34
- page.should have_content "Sorry, this message was not sent successfully"
34
+ expect(page).to have_content "Sorry, this message was not sent successfully"
35
35
  end
36
36
 
37
37
  it "should give an error when I don't provide a valid email" do
38
38
  visit '/'
39
39
  click_link "Contact"
40
- page.should have_content "Contact Form"
41
- fill_in "contact_form_name", with: "Test McPherson"
40
+ expect(page).to have_content "Contact Form"
41
+ fill_in "contact_form_name", with: "Test McPherson"
42
42
  fill_in "contact_form_email", with: "archivist1"
43
43
  fill_in "contact_form_message", with: "I am contacting you regarding ScholarSphere."
44
44
  fill_in "contact_form_subject", with: "My Subject is Cool"
45
45
  select "Depositing content", from: "contact_form_category"
46
46
  click_button "Send"
47
- page.should have_content "Sorry, this message was not sent successfully"
47
+ expect(page).to have_content "Sorry, this message was not sent successfully"
48
48
  end
49
49
 
50
50
  it "should give an error when I don't provide a name" do
51
51
  visit '/'
52
52
  click_link "Contact"
53
- page.should have_content "Contact Form"
53
+ expect(page).to have_content "Contact Form"
54
54
  fill_in "contact_form_email", with: "archivist1@example.com"
55
55
  fill_in "contact_form_message", with: "I am contacting you regarding ScholarSphere."
56
56
  fill_in "contact_form_subject", with: "My Subject is Cool"
57
57
  select "Depositing content", from: "contact_form_category"
58
58
  click_button "Send"
59
- page.should have_content "Sorry, this message was not delivered"
59
+ expect(page).to have_content "Sorry, this message was not delivered"
60
60
  end
61
61
 
62
62
  it "should give an error when I don't provide a subject" do
63
63
  visit '/'
64
64
  click_link "Contact"
65
- page.should have_content "Contact Form"
66
- fill_in "contact_form_name", with: "Test McPherson"
65
+ expect(page).to have_content "Contact Form"
66
+ fill_in "contact_form_name", with: "Test McPherson"
67
67
  fill_in "contact_form_email", with: "archivist1@example.com"
68
68
  fill_in "contact_form_message", with: "I am contacting you regarding ScholarSphere."
69
69
  select "Depositing content", from: "contact_form_category"
70
+ expect_any_instance_of(ContactForm).not_to receive(:deliver)
70
71
  click_button "Send"
71
- page.should have_content "Sorry, this message was not sent successfully"
72
72
  end
73
73
 
74
74
  it "should give an error when I don't provide a message" do
75
75
  visit '/'
76
76
  click_link "Contact"
77
- page.should have_content "Contact Form"
78
- fill_in "contact_form_name", with: "Test McPherson"
77
+ expect(page).to have_content "Contact Form"
78
+ fill_in "contact_form_name", with: "Test McPherson"
79
79
  fill_in "contact_form_email", with: "archivist1@example.com"
80
80
  fill_in "contact_form_subject", with: "My Subject is Cool"
81
81
  select "Depositing content", from: "contact_form_category"
82
+ expect_any_instance_of(ContactForm).not_to receive(:deliver)
82
83
  click_button "Send"
83
- page.should have_content "Sorry, this message was not sent successfully"
84
84
  end
85
85
 
86
86
  it "should give an error when I provide an invalid captcha" do
87
87
  visit '/'
88
88
  click_link "Contact"
89
- page.should have_content "Contact Form"
90
- fill_in "contact_form_contact_method", with: "My name is"
91
- fill_in "contact_form_name", with: "Test McPherson"
89
+ expect(page).to have_content "Contact Form"
90
+ fill_in 'contact_form_contact_method', with: 'My name is', visible: false
91
+ fill_in "contact_form_name", with: "Test McPherson"
92
92
  fill_in "contact_form_email", with: "archivist1@example.com"
93
93
  fill_in "contact_form_subject", with: "My Subject is Cool"
94
94
  fill_in "contact_form_message", with: "I am contacting you regarding ScholarSphere."
95
95
  select "Depositing content", from: "contact_form_category"
96
96
  click_button "Send"
97
- page.should have_content "Sorry, this message was not sent successfully"
97
+ expect(page).to have_content "Sorry, this message was not sent successfully"
98
98
  end
99
99
  end