-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1237 from projecthydra/guard_zotero_reference
Check to make sure Zotero integration is enabled. Fixes #1235
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'spec_helper' | ||
|
||
describe 'users/_user_info.html.erb', type: :view do | ||
let(:user) { stub_model(User, user_key: 'jdoe42') } | ||
|
||
context 'with Zotero disabled' do | ||
before do | ||
allow(Sufia.config).to receive(:arkivo_api) { false } | ||
allow(user).to receive(:zotero_userid).and_raise(NoMethodError) | ||
render "users/user_info", user: user | ||
end | ||
|
||
it 'does not display a Zotero profile link' do | ||
expect(rendered).not_to match(/Zotero Profile/) | ||
end | ||
end | ||
|
||
context 'with Zotero enabled' do | ||
before do | ||
allow(Sufia.config).to receive(:arkivo_api) { true } | ||
allow(user).to receive(:zotero_userid) { 'jdoe42zotero' } | ||
render "users/user_info", user: user | ||
end | ||
|
||
it 'displays a Zotero profile link' do | ||
expect(rendered).to match(/Zotero Profile/) | ||
end | ||
end | ||
end |