Skip to content

Commit 888853b

Browse files
Archivist user cannot manage repositories step definition
1 parent 310c42a commit 888853b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

helpers/helpers.rb

+9
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ def login_archivist
5858
fill_in 'password', with: "archivist-user-#{uuid}"
5959

6060
click_on 'Sign In'
61+
62+
begin
63+
element = find('.alert.alert-danger.with-hide-alert')
64+
if element.text == 'Login attempt failed'
65+
raise "Login failed for user: archivist-user-#{uuid}"
66+
end
67+
rescue Capybara::ElementNotFound
68+
# Pass on successful login
69+
end
6170
end
6271

6372
def ensure_test_repository_exists

staff_features/repositories/repository_create.rb

+21
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,24 @@
33
Then 'the {string} option is not displayed in the dropdown menu' do |string|
44
expect(page).to_not have_text string
55
end
6+
7+
Then 'the archivist user cannot manage repositories' do
8+
visit "#{STAFF_URL}/repositories"
9+
10+
expect(find('h2').text).to eq 'Repositories'
11+
12+
rows = all('#tabledSearchResults tbody tr')
13+
14+
expect(rows.length > 0).to eq true
15+
16+
within rows[0] do
17+
click_on "View"
18+
end
19+
20+
respository_id = current_url.split('/').pop
21+
visit "#{STAFF_URL}/repositories/#{respository_id}/edit"
22+
expect(page).to have_text 'Unable to Access Page'
23+
24+
visit "#{STAFF_URL}/repositories/new"
25+
expect(page).to have_text 'Unable to Access Page'
26+
end

0 commit comments

Comments
 (0)