sufia 2.0.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +111 -0
  3. data/Gemfile +4 -4
  4. data/History.md +126 -0
  5. data/README.md +23 -5
  6. data/SUFIA_VERSION +1 -1
  7. data/app/assets/javascripts/sufia/multiForm.js +10 -2
  8. data/app/assets/stylesheets/{application-bootstrap.css → application-bootstrap.css.erb} +7 -7
  9. data/app/assets/stylesheets/{bootstrap.min.css → bootstrap.min.css.erb} +1 -1
  10. data/app/controllers/concerns/sufia/users_controller_behavior.rb +9 -3
  11. data/app/controllers/single_use_link_controller.rb +1 -1
  12. data/app/helpers/sufia_helper.rb +7 -1
  13. data/app/models/contact_form.rb +0 -14
  14. data/app/views/_user_util_links.html.erb +0 -15
  15. data/app/views/batch_edits/_check_all.html.erb +2 -2
  16. data/app/views/batch_edits/_delete_selected.html.erb +1 -1
  17. data/app/views/layouts/{_head-tag-content.html.erb → _head_tag_content.html.erb} +0 -0
  18. data/app/views/layouts/homepage.html.erb +2 -2
  19. data/app/views/layouts/sufia-one-column.html.erb +1 -1
  20. data/app/views/layouts/sufia-two-column.html.erb +1 -1
  21. data/app/views/users/edit.html.erb +1 -1
  22. data/app/views/users/show.html.erb +1 -17
  23. data/config/routes.rb +31 -33
  24. data/lib/generators/sufia/sufia_generator.rb +5 -3
  25. data/lib/generators/sufia/templates/catalog_controller.rb +5 -1
  26. data/lib/generators/sufia/templates/config/redis_config.rb +1 -14
  27. data/lib/sufia/batch_edits_controller_behavior.rb +1 -1
  28. data/lib/sufia/controller.rb +1 -1
  29. data/lib/sufia/dashboard_controller_behavior.rb +8 -2
  30. data/lib/sufia/files_controller_behavior.rb +1 -2
  31. data/lib/sufia/version.rb +1 -1
  32. data/spec/active_fedora/unsaved_digital_object_spec.rb +1 -15
  33. data/spec/controllers/authorities_controller_spec.rb +1 -15
  34. data/spec/controllers/batch_controller_spec.rb +10 -16
  35. data/spec/controllers/batch_edits_controller_spec.rb +1 -1
  36. data/spec/controllers/catalog_controller_spec.rb +1 -15
  37. data/spec/controllers/dashboard_controller_spec.rb +23 -17
  38. data/spec/controllers/downloads_controller_spec.rb +1 -15
  39. data/spec/controllers/generic_files_controller_spec.rb +18 -32
  40. data/spec/controllers/mailbox_controller_spec.rb +1 -15
  41. data/spec/controllers/single_use_link_controller_spec.rb +6 -13
  42. data/spec/controllers/users_controller_spec.rb +27 -41
  43. data/spec/factories/users.rb +5 -14
  44. data/spec/features/browse_dashboard_files.rb +21 -0
  45. data/spec/features/browse_files.rb +31 -0
  46. data/spec/features/contact_form.rb +99 -0
  47. data/spec/features/display_dashboard.rb +46 -0
  48. data/spec/features/ingest_upload_files.rb +24 -0
  49. data/spec/features/users_spec.rb +25 -0
  50. data/spec/helpers/generic_file_helper_spec.rb +10 -3
  51. data/spec/helpers/sufia_helper_spec.rb +1 -1
  52. data/spec/lib/sufia/id_service_spec.rb +1 -15
  53. data/spec/models/audit_job_spec.rb +1 -15
  54. data/spec/models/batch_spec.rb +1 -15
  55. data/spec/models/batch_update_job_spec.rb +3 -16
  56. data/spec/models/characterize_job_spec.rb +4 -4
  57. data/spec/models/checksum_audit_log_spec.rb +1 -15
  58. data/spec/models/event_jobs_spec.rb +1 -15
  59. data/spec/models/file_content_datastream_spec.rb +5 -19
  60. data/spec/models/fits_datastream_spec.rb +1 -15
  61. data/spec/models/generic_file/web_form_spec.rb +34 -0
  62. data/spec/models/generic_file_spec.rb +11 -39
  63. data/spec/models/local_authority_spec.rb +3 -15
  64. data/spec/models/properties_datastream_spec.rb +1 -1
  65. data/spec/models/single_use_link_spec.rb +1 -1
  66. data/spec/models/solr_document_spec.rb +1 -1
  67. data/spec/models/transcode_audio_job_spec.rb +1 -1
  68. data/spec/models/transcode_video_job_spec.rb +1 -1
  69. data/spec/models/trophy_spec.rb +1 -1
  70. data/spec/models/unzip_job_spec.rb +1 -15
  71. data/spec/models/user_spec.rb +1 -15
  72. data/spec/rake/sufia_fixtures_spec.rb +3 -17
  73. data/spec/routing/route_spec.rb +7 -21
  74. data/spec/spec_helper.rb +8 -20
  75. data/spec/support/features.rb +6 -0
  76. data/spec/support/features/session_helpers.rb +21 -0
  77. data/spec/support/lib/generators/test_app_generator.rb +4 -0
  78. data/spec/views/batch_edits/check_all_spec.rb +6 -4
  79. data/sufia-models/app/models/checksum_audit_log.rb +1 -15
  80. data/sufia-models/app/models/domain_term.rb +3 -15
  81. data/sufia-models/app/models/geo_names_resource.rb +1 -13
  82. data/sufia-models/app/models/local_authority.rb +12 -17
  83. data/sufia-models/app/models/local_authority_entry.rb +1 -15
  84. data/sufia-models/app/models/single_use_link.rb +2 -3
  85. data/sufia-models/app/models/trophy.rb +1 -1
  86. data/sufia-models/app/models/version_committer.rb +1 -15
  87. data/sufia-models/lib/sufia/models.rb +6 -2
  88. data/sufia-models/lib/sufia/models/engine.rb +1 -1
  89. data/sufia-models/lib/sufia/models/generic_file.rb +3 -0
  90. data/sufia-models/lib/sufia/models/generic_file/accessible_attributes.rb +87 -0
  91. data/sufia-models/lib/sufia/models/generic_file/permissions.rb +2 -1
  92. data/sufia-models/lib/sufia/models/generic_file/web_form.rb +4 -1
  93. data/sufia-models/lib/sufia/models/user.rb +9 -2
  94. data/sufia-models/lib/sufia/models/version.rb +1 -1
  95. data/{lib → sufia-models/lib}/tasks/resque.rake +0 -0
  96. data/sufia-models/sufia-models.gemspec +13 -11
  97. data/sufia.gemspec +1 -3
  98. data/tasks/sufia-dev.rake +21 -10
  99. metadata +30 -84
  100. data/config/cucumber.yml +0 -8
  101. data/features/browse_dashboard_files.feature +0 -16
  102. data/features/browse_files.feature +0 -16
  103. data/features/contact_form.feature +0 -86
  104. data/features/display_dashboard.feature +0 -42
  105. data/features/ingest_upload_files.feature +0 -21
  106. data/features/step_definitions/edit_metadata_steps.rb +0 -89
  107. data/features/step_definitions/fixture_steps.rb +0 -35
  108. data/features/step_definitions/show_document_steps.rb +0 -103
  109. data/features/step_definitions/sufia.rb +0 -69
  110. data/features/step_definitions/user_steps.rb +0 -58
  111. data/features/step_definitions/web_steps.rb +0 -235
  112. data/features/support/cleanup.rb +0 -19
  113. data/features/support/env.rb +0 -90
  114. data/features/support/headless.rb +0 -26
  115. data/features/support/paths.rb +0 -101
  116. data/features/users.feature +0 -18
  117. data/spec/lib/sufia/role_mapper_spec.rb +0 -28
  118. data/spec/support/Gemfile +0 -24
  119. data/spec/views/single_user_link/download.html.erb_spec.rb +0 -5
  120. data/spec/views/single_user_link/generate_download.html.erb_spec.rb +0 -5
  121. data/spec/views/single_user_link/generate_show.html.erb_spec.rb +0 -5
  122. data/spec/views/single_user_link/show.html.erb_spec.rb +0 -5
  123. data/tasks/cucumber.rake +0 -72
data/config/cucumber.yml DELETED
@@ -1,8 +0,0 @@
1
- <%
2
- rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
- rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
- std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
5
- %>
6
- default: <%= std_opts %> features
7
- wip: --tags @wip:3 --wip features
8
- rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -1,16 +0,0 @@
1
- Feature: Browse Dashboard files
2
-
3
-
4
- Scenario: Browse via Fixtures
5
- Given I am logged in as "archivist2@example.com"
6
- And I follow "dashboard"
7
- And I follow "more Keywords"
8
- And I follow "keyf"
9
- Then I should see "Test mp3"
10
-
11
- Scenario: Edit Dashboard File
12
- Given I am logged in as "archivist2@example.com"
13
- And I follow "dashboard"
14
- When I follow the link within "a[href='/files/test5/edit']"
15
- Then I should see "Edit Test mp3"
16
-
@@ -1,16 +0,0 @@
1
- Feature: Browse files
2
-
3
- Scenario: Browse via Fixtures
4
- # Given I load sufia fixtures
5
- When I go to the home page
6
- And I follow "more Keyword"
7
- And I follow "test"
8
- Then I should see "1 - 4 of 4"
9
- When I follow "Test Document PDF"
10
- Then I should see "Download"
11
- But I should not see "Edit"
12
- Given I am logged in as "archivist1@example.com"
13
- And I follow "more Keyword"
14
- And I follow "test"
15
- When I follow "Test Document PDF"
16
- And I should see "Edit"
@@ -1,86 +0,0 @@
1
- Feature: Sending an email via the contact form
2
-
3
- Scenario: Input info to contact form and send
4
- # this step allows delivery even if the mail server is down
5
- Given I have a mail server
6
- Given I am on the home page
7
- When I follow "Contact"
8
- Then I should see "Contact Form"
9
- And I fill in "contact_form_name" with "Test McPherson"
10
- And I fill in "contact_form_email" with "archivist1@example.com"
11
- And I fill in "contact_form_message" with "I am contacting you regarding ScholarSphere."
12
- And I fill in "contact_form_subject" with "My Subject is Cool"
13
- And I select "Depositing content" from "contact_form_category"
14
- And I press "Send"
15
- Then I should see "Thank you"
16
- # this step allows the delivery to go back to normal
17
- Then I reset the mail server
18
-
19
- Scenario: Input no selection for contact type
20
- Given I am on the home page
21
- When I follow "Contact"
22
- Then I should see "Contact Form"
23
- And I fill in "contact_form_name" with "Test McPherson"
24
- And I fill in "contact_form_email" with "archivist1"
25
- And I fill in "contact_form_message" with "I am contacting you regarding ScholarSphere."
26
- And I fill in "contact_form_subject" with "My Subject is Cool"
27
- And I press "Send"
28
- Then I should see "Sorry, this message was not sent successfully"
29
-
30
- Scenario: Input poorly formed email address for contact
31
- Given I am on the home page
32
- When I follow "Contact"
33
- Then I should see "Contact Form"
34
- And I fill in "contact_form_name" with "Test McPherson"
35
- And I fill in "contact_form_email" with "archivist1"
36
- And I fill in "contact_form_message" with "I am contacting you regarding ScholarSphere."
37
- And I select "Depositing content" from "contact_form_category"
38
- And I fill in "contact_form_subject" with "My Subject is Cool"
39
- And I press "Send"
40
- Then I should see "Sorry, this message was not sent successfully"
41
-
42
- Scenario: Input empty name field
43
- Given I am on the home page
44
- When I follow "Contact"
45
- Then I should see "Contact Form"
46
- And I fill in "contact_form_email" with "archivist1@example.com"
47
- And I fill in "contact_form_message" with "I am contacting you regarding ScholarSphere."
48
- And I fill in "contact_form_subject" with "My Subject is Cool"
49
- And I select "Depositing content" from "contact_form_category"
50
- And I press "Send"
51
- Then I should see "Sorry, this message was not sent successfully"
52
-
53
- Scenario: Input empty subject field
54
- Given I am on the home page
55
- When I follow "Contact"
56
- Then I should see "Contact Form"
57
- And I fill in "contact_form_name" with "Test McPherson"
58
- And I fill in "contact_form_email" with "archivist1@example.com"
59
- And I fill in "contact_form_message" with "I am contacting you regarding ScholarSphere."
60
- And I select "Depositing content" from "contact_form_category"
61
- And I press "Send"
62
- Then I should see "Sorry, this message was not sent successfully"
63
-
64
- Scenario: Input empty message field
65
- Given I am on the home page
66
- When I follow "Contact"
67
- Then I should see "Contact Form"
68
- And I fill in "contact_form_name" with "Test McPherson"
69
- And I fill in "contact_form_email" with "archivist1@example.com"
70
- And I fill in "contact_form_subject" with "My Subject is Cool"
71
- And I select "Depositing content" from "contact_form_category"
72
- And I press "Send"
73
- Then I should see "Sorry, this message was not sent successfully"
74
-
75
- Scenario: Input spam field
76
- Given I am on the home page
77
- When I follow "Contact"
78
- Then I should see "Contact Form"
79
- And I fill in "contact_form_contact_method" with "My name is"
80
- And I fill in "contact_form_name" with "Test McPherson"
81
- And I fill in "contact_form_email" with "archivist1@example.com"
82
- And I fill in "contact_form_subject" with "My Subject is Cool"
83
- And I fill in "contact_form_message" with "I am contacting you regarding ScholarSphere."
84
- And I select "Depositing content" from "contact_form_category"
85
- And I press "Send"
86
- Then I should see "Sorry, "
@@ -1,42 +0,0 @@
1
- Feature: As an authenticate and authorized
2
- user when viewing my dashboard I see all
3
- the objects I have access to
4
-
5
- Scenario: I am on the homepage and want to view dashboard
6
- Given I am logged in as "contentauthor@psu.edu"
7
- And I follow "dashboard"
8
- Then I should see "Dashboard"
9
-
10
- Scenario: I am on the homepage and I want to search dashboard
11
- Given I am logged in as "contentauthor@psu.edu"
12
- And I follow "dashboard"
13
- When I fill in "dashboard_search" with "dash search"
14
- When I press "dashboard_submit"
15
- Then I should see "Dashboard"
16
- And I should see "You searched for: dash search"
17
- Then the "search-field-header" field should not contain "dash search"
18
-
19
- Scenario: I am on the dashboard and want to upload files
20
- Given I am logged in as "contentauthor@psu.edu"
21
- And I follow "dashboard"
22
- And I follow "Upload File(s)"
23
- Then I should see "Upload"
24
-
25
- Scenario: I am on the dashboard and want to search SS
26
- Given I am logged in as "contentauthor@psu.edu"
27
- And I follow "dashboard"
28
- When I fill in "search-field-header" with "ss search"
29
- When I press "search-submit-header"
30
- Then I should see "You searched for: ss search"
31
- Then I should not see "Dashboard"
32
- Then the "search-field-header" field should contain "ss search"
33
-
34
- @culerity
35
- Scenario: I have files on my dashboard I should see icons
36
- #Given I load sufia fixtures
37
- And I am logged in as "archivist1@example.com"
38
- And I follow "dashboard"
39
- Then I should see "Test Document Text"
40
- When I follow the link within "a[href='/files/test3'].itemtrash"
41
- Then I should see "The file has been deleted"
42
-
@@ -1,21 +0,0 @@
1
- Feature: Uploading files via web form
2
- In order to add file to my collections
3
- As an authorized user
4
- I want to upload files with a web form
5
-
6
- Scenario: Getting to the ingest screen
7
- Given I am logged in as "contentauthor@psu.edu"
8
- When I follow "upload"
9
- Then I should see "Select files"
10
- And I should see "Start upload"
11
- And I should see "Cancel upload"
12
- And I should see a file chooser button
13
-
14
- @celerity
15
- Scenario: Upload a file without checking terms of service
16
- Given I am logged in as "contentauthor@psu.edu"
17
- When I am on the "ingest" page
18
- And I attach the file "spec/fixtures/image.jp2" to "files[]"
19
- And I attach the file "spec/fixtures/jp2_fits.xml" to "files[]"
20
- And I press "Start upload"
21
- Then I should see "You must accept the terms of service!"
@@ -1,89 +0,0 @@
1
- # Copyright © 2012 The Pennsylvania State University
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- # This is the post-submission complement to "I fill in the following" from web_steps.rb
16
- Then /^the following (should contain|contain|should not contain|do not contain):$/ do |bool,table|
17
- # table is a Cucumber::Ast::Table
18
- if bool == "should contain" || bool == "contain"
19
- table.rows_hash.each do |name, value|
20
- step %{the "#{name}" field should contain "#{value}"}
21
- end
22
- elsif bool == "should not contain" || bool == "do not contain"
23
- table.rows_hash.each do |name, value|
24
- step %{the "#{name}" field should not contain "#{value}"}
25
- end
26
- else
27
- pending
28
- end
29
- end
30
-
31
- When /^I select the following(?: within "([^"]*)")?$/ do |scope_selector, table|
32
- # table is a Cucumber::Ast::Table
33
- table.rows_hash.each do |field_selector, value|
34
- step %{I select "#{value}" from "#{field_selector}" within "#{scope_selector}"}
35
- end
36
- end
37
-
38
- Then /^the following should be selected(?: within "([^"]*)")?$/ do |scope_selector, table|
39
- # table is a Cucumber::Ast::Table
40
- table.rows_hash.each do |field_selector, value|
41
- step %{"#{value}" should be selected from "#{field_selector}" within "#{scope_selector}"}
42
- # Then %{the "#{field_selector}" field within "#{scope_selector}" should contain "#{value}"}
43
- end
44
- end
45
-
46
- Then /^"([^"]*)" should be selected from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field_selector, scope_selector|
47
- # table is a Cucumber::Ast::Table
48
- with_scope(scope_selector) do
49
- find_and_check_selected_value(field_selector, value)
50
- end
51
- end
52
-
53
- Then /^I should see a "([^"]*)" button(?: within "([^"]*)")?$/ do |button_locator, scope_selector|
54
- with_scope(scope_selector) do
55
- begin
56
- find_button(button_locator)
57
- rescue
58
- raise "no button with value or id or text '#{button_locator}' found"
59
- end
60
- end
61
- end
62
-
63
- Then /^I should see a file chooser button$/ do
64
- find(:xpath, '//input[@type="file"]')
65
- end
66
-
67
- Given /^that "([^"]*)" has been loaded into fedora$/ do |pid|
68
- ActiveFedora::FixtureLoader.new('spec/fixtures').reload(pid)
69
- end
70
-
71
-
72
- # Find a select tag on the page
73
- # @param [String] locator Capybara locator
74
- # @return [Capybara::Node]
75
- def find_select(locator)
76
- no_select_msg = "no select box with id, name, or label '#{locator}' found"
77
- select = find(:xpath, XPath::HTML.select(locator), :message => no_select_msg)
78
- return select
79
- end
80
-
81
- # Find a select tag on the page and test whether the given value is selected within it
82
- # @param [String] locator Capybara locator for the select tag
83
- # @param [String] value the value that should be selected
84
- def find_and_check_selected_value(locator, value)
85
- select = find_select(locator)
86
- no_option_msg = "no option with text '#{value}' in select box '#{locator}'"
87
- option = select.find(:xpath, XPath::HTML.option(value), :message => no_option_msg)
88
- option.should be_selected
89
- end
@@ -1,35 +0,0 @@
1
- # Copyright © 2012 The Pennsylvania State University
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require "rake"
16
-
17
- def loaded_files_excluding_current_rake_file
18
- $".reject { |file| file.include? "lib/tasks/fixtures" }
19
- end
20
-
21
- def activefedora_path
22
- Gem.loaded_specs['active-fedora'].full_gem_path
23
- end
24
-
25
- Given /^I load sufia fixtures$/ do
26
- @rake = Rake::Application.new
27
- Rake.application = @rake
28
- Rake.application.rake_require("tasks/sufia-fixtures", ["."], loaded_files_excluding_current_rake_file)
29
- Rake.application.rake_require("lib/tasks/fixtures", ["."], loaded_files_excluding_current_rake_file)
30
- Rake.application.rake_require("lib/tasks/active_fedora", [activefedora_path], loaded_files_excluding_current_rake_file)
31
- Rake::Task.define_task(:environment)
32
- @rake['sufia:fixtures:refresh'].invoke
33
- @rake['sufia:fixtures:fix'].invoke
34
- end
35
-
@@ -1,103 +0,0 @@
1
- # Copyright © 2012 The Pennsylvania State University
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
16
-
17
- # Terms (dt / dd pairs)
18
-
19
- Then /^I should see the "([^\"]*)" term$/ do |arg1|
20
- page.should have_selector("dt", :text=>arg1)
21
- end
22
-
23
- Then /^I should not see the "([^\"]*)" term$/ do |arg1|
24
- page.should_not have_selector("dt", :text=>arg1)
25
- end
26
-
27
- Then /^the "([^\"]*)" term should contain "([^\"]*)"$/ do |arg1, arg2|
28
- page.should have_selector("dt", :content=>arg1) do |dt|
29
- dt.each do |term|
30
- term.next.should have_selector("dd", :text=>arg2)
31
- end
32
- end
33
- end
34
-
35
- Then /^I should see the "([^\"]*)" value$/ do |arg1|
36
- pending
37
- end
38
-
39
- Then /^I should see a link called "([^\"]*)"$/ do |locator|
40
- find(:xpath, XPath::HTML.link(locator)).should_not be_nil
41
- end
42
-
43
- Then /^I should see a link to "([^\"]*)"$/ do |link_path|
44
- page.should have_xpath(".//a[@href=\"#{path_to(link_path)}\"]")
45
- end
46
-
47
- Then /^I should see a link to the "([^\"]*)" page$/ do |link_path|
48
- page.should have_xpath(".//a[@href=\"#{path_to(link_path)}\"]")
49
- end
50
-
51
- Then /^I should see a link to "([^\"]*)" with label "([^\"]*)"$/ do |link_path,link_label|
52
- page.should have_xpath(".//a[@href=\"#{path_to(link_path)}\"]", :text=>link_label)
53
- end
54
-
55
- Then /^I should not see a link to "([^\"]*)"$/ do |link_path|
56
- page.should_not have_xpath(".//a[@href=\"#{path_to(link_path)}\"]")
57
- end
58
-
59
- Then /^I should not see a link to the "([^\"]*)" page$/ do |link_name|
60
- page.should_not have_xpath(".//a[@href=\"#{path_to(link_name)}\"]")
61
- end
62
-
63
- Then /^I should see a dropdown for "([^\"]*)"/ do |id|
64
- page.should have_selector("select##{id}")
65
- end
66
-
67
- Then /^related links are displayed as urls$/ do
68
- pending
69
- end
70
-
71
- # Delete button for field or contributor
72
- Then /^I (should|should not) see a delete (field|contributor) button for "([^\"]*)"$/ do |bool,type,target|
73
- if bool == "should"
74
- # page.should have_selector("a, :class=>"destructive #{type}", :href=>path_to(target))
75
- page.should have_xpath(".//a[@href=\"#{path_to(target)}\" and contains(@class, \"destructive\") and contains(@class, \"destroy_#{type}\")]")
76
- else
77
- # page.should_not have_selector("a", :class=>"destructive #{type}", :href=>path_to(target))
78
- page.should_not have_xpath(".//a[@href=\"#{path_to(target)}\" and contains(@class, \"destructive\") and contains(@class, \"#{type}\")]")
79
- end
80
- end
81
-
82
- Then /^I (should|should not) see a button to delete "([^\"]*)" from "([^\"]*)"$/ do |bool,target,container|
83
- path_name = "#{target} with #{container} as its container"
84
- if bool == "should"
85
- # page.should have_selector("a.destroy_file_asset", :href=>path_to(path_name))
86
- page.should have_xpath(".//a[@href=\"#{path_to(path_name)}\" and @class=\"destroy_file_asset\"]")
87
- else
88
- # page.should_not have_selector("a.destroy_file_asset", :href=>path_to(path_name))
89
- page.should_not have_xpath(".//a[@href=\"#{path_to(path_name)}\" and @class=\"destroy_file_asset\"]")
90
- end
91
- end
92
-
93
- # Delete button for assets
94
- Then /^I (should|should not) see a delete button for "([^\"]*)"$/ do |bool,target|
95
- path_name = "the delete confirmation page for #{target}"
96
- if bool == "should"
97
- # page.should have_selector("a.destructive", :href=>path_to(target))
98
- page.should have_xpath(".//a[@href=\"#{path_to(path_name)}\" and @class=\"delete_asset\"]")
99
- else
100
- # page.should_not have_selector("a.destructive", :href=>path_to(target))
101
- page.should_not have_xpath(".//a[@href=\"#{path_to(path_name)}\" and @class=\"delete_asset\"]")
102
- end
103
- end
@@ -1,69 +0,0 @@
1
- # Copyright © 2012 The Pennsylvania State University
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- require "cucumber/rspec/doubles"
15
-
16
- When /^I attach a file "([^"]*)" to the dynamically created "([^"]*)"$/ do |path, field|
17
- find(field).native.send_keys(File.expand_path(path, Rails.root))
18
- end
19
-
20
- Given /^And I click the anchor "([^"]*)"$/ do |link|
21
- click_link(link)
22
- end
23
-
24
- Given /^And I click within the anchor "(.*?)"$/ do |selector|
25
- #Given /^(?:|I )click within the anchor "([^"]*)"$/ do |selector|
26
- find(selector).click
27
- end
28
-
29
- Given /^I have a mail server$/ do
30
- ContactForm.any_instance.stub(:deliver).and_return(true)
31
- end
32
-
33
- Then /^I reset the mail server$/ do
34
- ContactForm.any_instance.unstub(:deliver)
35
- end
36
-
37
- When /^I follow the link within "(.*?)"$/ do |selector|
38
- find(selector).click
39
- end
40
-
41
- # tests wether a select option is choosen
42
- Then /^"([^"]*)" should be selected for "([^"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
43
- with_scope(selector) do
44
- field_labeled(field).find(:xpath, ".//option[@selected = 'selected'][text() = '#{value}']").should be_present
45
- end
46
- end
47
-
48
- Then /^"([^"]*)" should not be selected for "([^"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
49
- with_scope(selector) do
50
- field_labeled(field).find(:xpath, ".//option[@selected = 'selected'][text() = '#{value}']").should_not be_present
51
- end
52
- end
53
-
54
- # checks if a form field is disabled
55
- Then /^"([^\"]*)" should( not)? be disabled$/ do |label, negate|
56
- element = begin
57
- find_button(label)
58
- rescue Capybara::ElementNotFound
59
- find_field(label)
60
- end
61
- ["false", "", nil].send(negate ? :should : :should_not, include(field[:disabled]))
62
- end
63
-
64
- Given /^I load users$/ do
65
- FactoryGirl.create(:user)
66
- FactoryGirl.create(:archivist)
67
- FactoryGirl.create(:curator)
68
- end
69
-