sufia 2.0.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +111 -0
- data/Gemfile +4 -4
- data/History.md +126 -0
- data/README.md +23 -5
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/sufia/multiForm.js +10 -2
- data/app/assets/stylesheets/{application-bootstrap.css → application-bootstrap.css.erb} +7 -7
- data/app/assets/stylesheets/{bootstrap.min.css → bootstrap.min.css.erb} +1 -1
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +9 -3
- data/app/controllers/single_use_link_controller.rb +1 -1
- data/app/helpers/sufia_helper.rb +7 -1
- data/app/models/contact_form.rb +0 -14
- data/app/views/_user_util_links.html.erb +0 -15
- data/app/views/batch_edits/_check_all.html.erb +2 -2
- data/app/views/batch_edits/_delete_selected.html.erb +1 -1
- data/app/views/layouts/{_head-tag-content.html.erb → _head_tag_content.html.erb} +0 -0
- data/app/views/layouts/homepage.html.erb +2 -2
- data/app/views/layouts/sufia-one-column.html.erb +1 -1
- data/app/views/layouts/sufia-two-column.html.erb +1 -1
- data/app/views/users/edit.html.erb +1 -1
- data/app/views/users/show.html.erb +1 -17
- data/config/routes.rb +31 -33
- data/lib/generators/sufia/sufia_generator.rb +5 -3
- data/lib/generators/sufia/templates/catalog_controller.rb +5 -1
- data/lib/generators/sufia/templates/config/redis_config.rb +1 -14
- data/lib/sufia/batch_edits_controller_behavior.rb +1 -1
- data/lib/sufia/controller.rb +1 -1
- data/lib/sufia/dashboard_controller_behavior.rb +8 -2
- data/lib/sufia/files_controller_behavior.rb +1 -2
- data/lib/sufia/version.rb +1 -1
- data/spec/active_fedora/unsaved_digital_object_spec.rb +1 -15
- data/spec/controllers/authorities_controller_spec.rb +1 -15
- data/spec/controllers/batch_controller_spec.rb +10 -16
- data/spec/controllers/batch_edits_controller_spec.rb +1 -1
- data/spec/controllers/catalog_controller_spec.rb +1 -15
- data/spec/controllers/dashboard_controller_spec.rb +23 -17
- data/spec/controllers/downloads_controller_spec.rb +1 -15
- data/spec/controllers/generic_files_controller_spec.rb +18 -32
- data/spec/controllers/mailbox_controller_spec.rb +1 -15
- data/spec/controllers/single_use_link_controller_spec.rb +6 -13
- data/spec/controllers/users_controller_spec.rb +27 -41
- data/spec/factories/users.rb +5 -14
- data/spec/features/browse_dashboard_files.rb +21 -0
- data/spec/features/browse_files.rb +31 -0
- data/spec/features/contact_form.rb +99 -0
- data/spec/features/display_dashboard.rb +46 -0
- data/spec/features/ingest_upload_files.rb +24 -0
- data/spec/features/users_spec.rb +25 -0
- data/spec/helpers/generic_file_helper_spec.rb +10 -3
- data/spec/helpers/sufia_helper_spec.rb +1 -1
- data/spec/lib/sufia/id_service_spec.rb +1 -15
- data/spec/models/audit_job_spec.rb +1 -15
- data/spec/models/batch_spec.rb +1 -15
- data/spec/models/batch_update_job_spec.rb +3 -16
- data/spec/models/characterize_job_spec.rb +4 -4
- data/spec/models/checksum_audit_log_spec.rb +1 -15
- data/spec/models/event_jobs_spec.rb +1 -15
- data/spec/models/file_content_datastream_spec.rb +5 -19
- data/spec/models/fits_datastream_spec.rb +1 -15
- data/spec/models/generic_file/web_form_spec.rb +34 -0
- data/spec/models/generic_file_spec.rb +11 -39
- data/spec/models/local_authority_spec.rb +3 -15
- data/spec/models/properties_datastream_spec.rb +1 -1
- data/spec/models/single_use_link_spec.rb +1 -1
- data/spec/models/solr_document_spec.rb +1 -1
- data/spec/models/transcode_audio_job_spec.rb +1 -1
- data/spec/models/transcode_video_job_spec.rb +1 -1
- data/spec/models/trophy_spec.rb +1 -1
- data/spec/models/unzip_job_spec.rb +1 -15
- data/spec/models/user_spec.rb +1 -15
- data/spec/rake/sufia_fixtures_spec.rb +3 -17
- data/spec/routing/route_spec.rb +7 -21
- data/spec/spec_helper.rb +8 -20
- data/spec/support/features.rb +6 -0
- data/spec/support/features/session_helpers.rb +21 -0
- data/spec/support/lib/generators/test_app_generator.rb +4 -0
- data/spec/views/batch_edits/check_all_spec.rb +6 -4
- data/sufia-models/app/models/checksum_audit_log.rb +1 -15
- data/sufia-models/app/models/domain_term.rb +3 -15
- data/sufia-models/app/models/geo_names_resource.rb +1 -13
- data/sufia-models/app/models/local_authority.rb +12 -17
- data/sufia-models/app/models/local_authority_entry.rb +1 -15
- data/sufia-models/app/models/single_use_link.rb +2 -3
- data/sufia-models/app/models/trophy.rb +1 -1
- data/sufia-models/app/models/version_committer.rb +1 -15
- data/sufia-models/lib/sufia/models.rb +6 -2
- data/sufia-models/lib/sufia/models/engine.rb +1 -1
- data/sufia-models/lib/sufia/models/generic_file.rb +3 -0
- data/sufia-models/lib/sufia/models/generic_file/accessible_attributes.rb +87 -0
- data/sufia-models/lib/sufia/models/generic_file/permissions.rb +2 -1
- data/sufia-models/lib/sufia/models/generic_file/web_form.rb +4 -1
- data/sufia-models/lib/sufia/models/user.rb +9 -2
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/{lib → sufia-models/lib}/tasks/resque.rake +0 -0
- data/sufia-models/sufia-models.gemspec +13 -11
- data/sufia.gemspec +1 -3
- data/tasks/sufia-dev.rake +21 -10
- metadata +30 -84
- data/config/cucumber.yml +0 -8
- data/features/browse_dashboard_files.feature +0 -16
- data/features/browse_files.feature +0 -16
- data/features/contact_form.feature +0 -86
- data/features/display_dashboard.feature +0 -42
- data/features/ingest_upload_files.feature +0 -21
- data/features/step_definitions/edit_metadata_steps.rb +0 -89
- data/features/step_definitions/fixture_steps.rb +0 -35
- data/features/step_definitions/show_document_steps.rb +0 -103
- data/features/step_definitions/sufia.rb +0 -69
- data/features/step_definitions/user_steps.rb +0 -58
- data/features/step_definitions/web_steps.rb +0 -235
- data/features/support/cleanup.rb +0 -19
- data/features/support/env.rb +0 -90
- data/features/support/headless.rb +0 -26
- data/features/support/paths.rb +0 -101
- data/features/users.feature +0 -18
- data/spec/lib/sufia/role_mapper_spec.rb +0 -28
- data/spec/support/Gemfile +0 -24
- data/spec/views/single_user_link/download.html.erb_spec.rb +0 -5
- data/spec/views/single_user_link/generate_download.html.erb_spec.rb +0 -5
- data/spec/views/single_user_link/generate_show.html.erb_spec.rb +0 -5
- data/spec/views/single_user_link/show.html.erb_spec.rb +0 -5
- data/tasks/cucumber.rake +0 -72
@@ -1,58 +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
|
-
# @example
|
16
|
-
# I log in as "archivist1@example.com"
|
17
|
-
# @example
|
18
|
-
# I am logged in as "archivist1@example.com"
|
19
|
-
Given /^I (?:am )?log(?:ged)? in as "([^\"]*)"$/ do |login|
|
20
|
-
# driver_name = "rack_test_authenticated_header_#{login}".to_s
|
21
|
-
# Capybara.register_driver(driver_name) do |app|
|
22
|
-
# Capybara::RackTest::Driver.new(app, headers: { 'REMOTE_USER' => login })
|
23
|
-
# end
|
24
|
-
#Capybara.current_driver = driver_name
|
25
|
-
user = User.where(:email=>login).first || FactoryGirl.create(:user, :email=>login)
|
26
|
-
User.find_by_user_key(login).should_not be_nil
|
27
|
-
visit "/"
|
28
|
-
find("a[href=\"/users/sign_in\"]").click
|
29
|
-
fill_in 'Email', with: login
|
30
|
-
fill_in 'Password', with: 'password'
|
31
|
-
click_button 'Sign in'
|
32
|
-
|
33
|
-
step %{And I click within the anchor "i.icon-user"}
|
34
|
-
step %{I should see a link to "ingest" with label "upload"}
|
35
|
-
step %{I should see a link to "dashboard" with label "dashboard"}
|
36
|
-
# step %{I should see a link to "logout"}
|
37
|
-
end
|
38
|
-
|
39
|
-
Given /^I am logged in as "([^\"]*)" with "([^\"]*)" permissions$/ do |login,permission_group|
|
40
|
-
Given %{I am logged in as "#{login}"}
|
41
|
-
RoleMapper.roles(login).should include permission_group
|
42
|
-
end
|
43
|
-
|
44
|
-
Given /^I am a superuser$/ do
|
45
|
-
step %{I am logged in as "bigwig@example.com"}
|
46
|
-
bigwig_id = User.find_by_email("bigwig@example.com").id
|
47
|
-
superuser = Superuser.create(:id => 20, :user_id => bigwig_id)
|
48
|
-
visit superuser_path
|
49
|
-
end
|
50
|
-
|
51
|
-
Given /^I am not logged in$/ do
|
52
|
-
step %{I log out}
|
53
|
-
end
|
54
|
-
|
55
|
-
Given /^I log out$/ do
|
56
|
-
Capybara.use_default_driver
|
57
|
-
visit "/"
|
58
|
-
end
|
@@ -1,235 +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
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
16
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
17
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
18
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
19
|
-
# files.
|
20
|
-
|
21
|
-
|
22
|
-
require 'uri'
|
23
|
-
require 'cgi'
|
24
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
25
|
-
|
26
|
-
module WithinHelpers
|
27
|
-
# Hydra::LDAP.stubs(:does_user_exist?).returns(true)
|
28
|
-
|
29
|
-
def with_scope(locator)
|
30
|
-
locator ? within(locator) { yield } : yield
|
31
|
-
end
|
32
|
-
end
|
33
|
-
World(WithinHelpers)
|
34
|
-
|
35
|
-
Given /^(?:|I )am on (.+)$/ do |page_name|
|
36
|
-
visit path_to(page_name)
|
37
|
-
end
|
38
|
-
|
39
|
-
When /^(?:|I )go to (.+)$/ do |page_name|
|
40
|
-
visit path_to(page_name)
|
41
|
-
end
|
42
|
-
|
43
|
-
When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
|
44
|
-
with_scope(selector) do
|
45
|
-
click_button(button)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
|
50
|
-
with_scope(selector) do
|
51
|
-
click_link(link)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
|
56
|
-
with_scope(selector) do
|
57
|
-
fill_in(field, :with => value)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
62
|
-
with_scope(selector) do
|
63
|
-
fill_in(field, :with => value)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# Use this to fill in an entire form with data from a table. Example:
|
68
|
-
#
|
69
|
-
# When I fill in the following:
|
70
|
-
# | Account Number | 5002 |
|
71
|
-
# | Expiry date | 2009-11-01 |
|
72
|
-
# | Note | Nice guy |
|
73
|
-
# | Wants Email? | |
|
74
|
-
#
|
75
|
-
# TODO: Add support for checkbox, select og option
|
76
|
-
# based on naming conventions.
|
77
|
-
#
|
78
|
-
When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
|
79
|
-
with_scope(selector) do
|
80
|
-
fields.rows_hash.each do |name, value|
|
81
|
-
When %{I fill in "#{name}" with "#{value}"}
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
87
|
-
with_scope(selector) do
|
88
|
-
select(value, :from => field)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
93
|
-
with_scope(selector) do
|
94
|
-
check(field)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
99
|
-
with_scope(selector) do
|
100
|
-
uncheck(field)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
105
|
-
with_scope(selector) do
|
106
|
-
choose(field)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
|
111
|
-
with_scope(selector) do
|
112
|
-
attach_file(field, path)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
Then /^(?:|I )should see JSON:$/ do |expected_json|
|
117
|
-
require 'json'
|
118
|
-
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
119
|
-
actual = JSON.pretty_generate(JSON.parse(response.body))
|
120
|
-
expected.should == actual
|
121
|
-
end
|
122
|
-
|
123
|
-
Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
124
|
-
with_scope(selector) do
|
125
|
-
if page.respond_to? :should
|
126
|
-
page.should have_content(text)
|
127
|
-
else
|
128
|
-
assert page.has_content?(text)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
134
|
-
regexp = Regexp.new(regexp)
|
135
|
-
with_scope(selector) do
|
136
|
-
if page.respond_to? :should
|
137
|
-
page.should have_xpath('//*', :text => regexp)
|
138
|
-
else
|
139
|
-
assert page.has_xpath?('//*', :text => regexp)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
145
|
-
with_scope(selector) do
|
146
|
-
if page.respond_to? :should
|
147
|
-
page.should have_no_content(text)
|
148
|
-
else
|
149
|
-
assert page.has_no_content?(text)
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
155
|
-
regexp = Regexp.new(regexp)
|
156
|
-
with_scope(selector) do
|
157
|
-
if page.respond_to? :should
|
158
|
-
page.should have_no_xpath('//*', :text => regexp)
|
159
|
-
else
|
160
|
-
assert page.has_no_xpath?('//*', :text => regexp)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
|
166
|
-
with_scope(selector) do
|
167
|
-
field = find_field(field)
|
168
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
169
|
-
if field_value.respond_to? :should
|
170
|
-
field_value.should =~ /#{value}/
|
171
|
-
else
|
172
|
-
assert_match(/#{value}/, field_value)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
|
178
|
-
with_scope(selector) do
|
179
|
-
field = find_field(field)
|
180
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
181
|
-
if field_value.respond_to? :should_not
|
182
|
-
field_value.should_not =~ /#{value}/
|
183
|
-
else
|
184
|
-
assert_no_match(/#{value}/, field_value)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
|
190
|
-
with_scope(selector) do
|
191
|
-
field_checked = find_field(label)['checked']
|
192
|
-
if field_checked.respond_to? :should
|
193
|
-
field_checked.should be_true
|
194
|
-
else
|
195
|
-
assert field_checked
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
|
201
|
-
with_scope(selector) do
|
202
|
-
field_checked = find_field(label)['checked']
|
203
|
-
if field_checked.respond_to? :should
|
204
|
-
field_checked.should be_false
|
205
|
-
else
|
206
|
-
assert !field_checked
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
212
|
-
current_path = URI.parse(current_url).path
|
213
|
-
if current_path.respond_to? :should
|
214
|
-
current_path.should == path_to(page_name)
|
215
|
-
else
|
216
|
-
assert_equal path_to(page_name), current_path
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
221
|
-
query = URI.parse(current_url).query
|
222
|
-
actual_params = query ? CGI.parse(query) : {}
|
223
|
-
expected_params = {}
|
224
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
225
|
-
|
226
|
-
if actual_params.respond_to? :should
|
227
|
-
actual_params.should == expected_params
|
228
|
-
else
|
229
|
-
assert_equal expected_params, actual_params
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
Then /^show me the page$/ do
|
234
|
-
save_and_open_page
|
235
|
-
end
|
data/features/support/cleanup.rb
DELETED
@@ -1,19 +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
|
-
at_exit do
|
16
|
-
Batch.destroy_all
|
17
|
-
GenericFile.destroy_all
|
18
|
-
User.destroy_all
|
19
|
-
end
|
data/features/support/env.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
-
# files.
|
6
|
-
require "rake"
|
7
|
-
|
8
|
-
#require 'capybara'
|
9
|
-
ENV["RAILS_ENV"] ||= "test"
|
10
|
-
require File.expand_path("../../../spec/internal/config/environment.rb", __FILE__)
|
11
|
-
ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + "../../../spec/internal"
|
12
|
-
|
13
|
-
|
14
|
-
FactoryGirl.definition_file_paths = [File.expand_path("../../../spec/factories", __FILE__)]
|
15
|
-
FactoryGirl.find_definitions
|
16
|
-
|
17
|
-
require 'cucumber/rails'
|
18
|
-
|
19
|
-
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
20
|
-
# order to ease the transition to Capybara we set the default here. If you'd
|
21
|
-
# prefer to use XPath just remove this line and adjust any selectors in your
|
22
|
-
# steps to use the XPath syntax.
|
23
|
-
Capybara.default_selector = :css
|
24
|
-
|
25
|
-
# By default, any exception happening in your Rails application will bubble up
|
26
|
-
# to Cucumber so that your scenario will fail. This is a different from how
|
27
|
-
# your application behaves in the production environment, where an error page will
|
28
|
-
# be rendered instead.
|
29
|
-
#
|
30
|
-
# Sometimes we want to override this default behaviour and allow Rails to rescue
|
31
|
-
# exceptions and display an error page (just like when the app is running in production).
|
32
|
-
# Typical scenarios where you want to do this is when you test your error pages.
|
33
|
-
# There are two ways to allow Rails to rescue exceptions:
|
34
|
-
#
|
35
|
-
# 1) Tag your scenario (or feature) with @allow-rescue
|
36
|
-
#
|
37
|
-
# 2) Set the value below to true. Beware that doing this globally is not
|
38
|
-
# recommended as it will mask a lot of errors for you!
|
39
|
-
#
|
40
|
-
ActionController::Base.allow_rescue = false
|
41
|
-
|
42
|
-
# Remove/comment out the lines below if your app doesn't have a database.
|
43
|
-
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
|
44
|
-
begin
|
45
|
-
DatabaseCleaner.strategy = :transaction
|
46
|
-
rescue NameError
|
47
|
-
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
48
|
-
end
|
49
|
-
|
50
|
-
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
|
51
|
-
# See the DatabaseCleaner documentation for details. Example:
|
52
|
-
#
|
53
|
-
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
|
54
|
-
# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
|
55
|
-
# end
|
56
|
-
#
|
57
|
-
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
|
58
|
-
# DatabaseCleaner.strategy = :transaction
|
59
|
-
# end
|
60
|
-
#
|
61
|
-
|
62
|
-
# Possible values are :truncation and :transaction
|
63
|
-
# The :transaction strategy is faster, but might give you threading problems.
|
64
|
-
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
|
65
|
-
Cucumber::Rails::Database.javascript_strategy = :truncation
|
66
|
-
|
67
|
-
#load fixtures for cucumber tests
|
68
|
-
def loaded_files_excluding_current_rake_file
|
69
|
-
$".reject { |file| file.include? "lib/tasks/fixtures" }
|
70
|
-
end
|
71
|
-
def activefedora_path
|
72
|
-
Gem.loaded_specs['active-fedora'].full_gem_path
|
73
|
-
end
|
74
|
-
def load_rake
|
75
|
-
@rake = Rake::Application.new
|
76
|
-
Rake.application = @rake
|
77
|
-
Rake.application.rake_require("tasks/sufia-fixtures", ["."], loaded_files_excluding_current_rake_file)
|
78
|
-
Rake.application.rake_require("lib/tasks/fixtures", ["."], loaded_files_excluding_current_rake_file)
|
79
|
-
Rake.application.rake_require("lib/tasks/active_fedora", [activefedora_path], loaded_files_excluding_current_rake_file)
|
80
|
-
Rake::Task.define_task(:environment)
|
81
|
-
end
|
82
|
-
load_rake
|
83
|
-
@rake['sufia:fixtures:refresh'].invoke
|
84
|
-
@rake['sufia:fixtures:fix'].invoke
|
85
|
-
|
86
|
-
at_exit do
|
87
|
-
load_rake
|
88
|
-
@rake['sufia:fixtures:delete'].invoke
|
89
|
-
end
|
90
|
-
|
@@ -1,26 +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
|
-
# Headless for Jenkins CI builds
|
16
|
-
Before("@javascript") do
|
17
|
-
if ENV['HEADLESS'] == 'true'
|
18
|
-
Capybara.current_driver = :selenium
|
19
|
-
require 'headless'
|
20
|
-
headless = Headless.new
|
21
|
-
headless.start
|
22
|
-
at_exit do
|
23
|
-
headless.destroy
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/features/support/paths.rb
DELETED
@@ -1,101 +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
|
-
module NavigationHelpers
|
16
|
-
# Maps a name to a path. Used by the
|
17
|
-
#
|
18
|
-
# When /^I go to (.+)$/ do |page_name|
|
19
|
-
#
|
20
|
-
# step definition in webrat_steps.rb
|
21
|
-
#
|
22
|
-
def path_to(page_name)
|
23
|
-
|
24
|
-
case page_name
|
25
|
-
|
26
|
-
when /the home\s?page/
|
27
|
-
'/'
|
28
|
-
when /the search page/
|
29
|
-
'/catalog'
|
30
|
-
when /ingest/
|
31
|
-
sufia.new_generic_file_path
|
32
|
-
when /logout/
|
33
|
-
sufia.destroy_user_session_path
|
34
|
-
when /my account info/
|
35
|
-
sufia.edit_user_registration_path
|
36
|
-
when /the base search page/
|
37
|
-
'/catalog?q=&search_field=search&action=index&controller=catalog&commit=search'
|
38
|
-
when /the document page for id (.+)/
|
39
|
-
sufia.catalog_path($1)
|
40
|
-
when /the edit page for id (.+)/
|
41
|
-
sufia.edit_catalog_path($1)
|
42
|
-
when /the catalog index page/
|
43
|
-
sufia.catalog_index_path
|
44
|
-
# Add more mappings here.
|
45
|
-
# Here is a more fancy example:
|
46
|
-
#
|
47
|
-
# when /^(.*)'s profile page$/i
|
48
|
-
# user_profile_path(User.find_by_login($1))
|
49
|
-
when /dashboard/
|
50
|
-
sufia.dashboard_index_path
|
51
|
-
|
52
|
-
when /the edit document page for (.*)$/i
|
53
|
-
sufia.edit_catalog_path($1)
|
54
|
-
when /the show document page for (.*)$/i
|
55
|
-
sufia.catalog_path($1)
|
56
|
-
when /the delete confirmation page for (.*)$/i
|
57
|
-
sufia.delete_catalog_path($1)
|
58
|
-
|
59
|
-
when /the file (?:asset )?list page for (.*)$/i
|
60
|
-
sufia.asset_file_assets_path($1)
|
61
|
-
when /the file asset creation page for (.*)$/i
|
62
|
-
sufia.asset_file_assets_path($1)
|
63
|
-
when /the deletable file list page for (.*)/i
|
64
|
-
sufia.asset_file_assets_path($1, :deletable=>"true",:layout=>"false")
|
65
|
-
when /the file asset (.*) with (.*) as its container$/i
|
66
|
-
sufia.asset_file_asset_path($2, $1)
|
67
|
-
when /the file asset (.*)$/i
|
68
|
-
sufia.file_asset_path($1)
|
69
|
-
when /the permissions page for (.*)$/i
|
70
|
-
sufia.asset_permissions_path($1)
|
71
|
-
|
72
|
-
when /new (.*) page$/i
|
73
|
-
sufia.new_asset_path(:content_type => $1)
|
74
|
-
when /the asset (.*)$/i
|
75
|
-
sufia.asset_path($1)
|
76
|
-
when /show asset page for (.*)$/i
|
77
|
-
sufia.asset_path($1)
|
78
|
-
|
79
|
-
|
80
|
-
when /the (\d+)(?:st|nd|rd|th) (person|organization|conference) entry in (.*)$/i
|
81
|
-
# contributor_id = "#{$2}_#{$1.to_i-1}"
|
82
|
-
sufia.asset_contributor_path($3, $2, $1.to_i-1, :content_type=>"mods_asset")
|
83
|
-
|
84
|
-
when /the edit (.*) page for (.*)$/i
|
85
|
-
sufia.edit_catalog_path($2,:wf_step=>$1)
|
86
|
-
else
|
87
|
-
begin
|
88
|
-
page_name =~ /the (.*) page/
|
89
|
-
path_components = $1.split(/\s+/)
|
90
|
-
self.send(path_components.push('path').join('_').to_sym)
|
91
|
-
rescue Object => e
|
92
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
93
|
-
"Now, go and add a mapping in #{__FILE__}"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
World(NavigationHelpers)
|