-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make fixity dashboard viewable only by admins, fixes #899
- Loading branch information
1 parent
45f2afc
commit aec7cb7
Showing
4 changed files
with
51 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="panel panel-fixity panel-classify-work"> | ||
<div class="panel-heading">Fixity</div> | ||
<div class="panel-body"> | ||
<ul> | ||
<li><%= link_to 'Fixity Dashboard', fixity_dashboard_path %></li> | ||
</ul> | ||
<% if can?(:read, :fixity) %> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="panel panel-fixity panel-classify-work"> | ||
<div class="panel-heading">Fixity</div> | ||
<div class="panel-body"> | ||
<ul> | ||
<li><%= link_to 'Fixity Dashboard', fixity_dashboard_path %></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
require 'rails_helper' | ||
|
||
RSpec.describe "catalog/_home_text.html.erb" do | ||
before do | ||
sign_in user if user | ||
render | ||
end | ||
|
||
context "when the user is an admin" do | ||
let(:user) { FactoryBot.create(:admin) } | ||
|
||
it 'has a link to the fixity dashboard' do | ||
expect(rendered).to have_link 'Fixity Dashboard' | ||
end | ||
end | ||
|
||
context "when the user is not an admin" do | ||
let(:user) { FactoryBot.create(:curator) } | ||
|
||
it 'does not have a link to the fixity dashboard' do | ||
expect(rendered).not_to have_link 'Fixity Dashboard' | ||
end | ||
end | ||
end |