Skip to content

Commit

Permalink
Adds requested disclaimer and some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwatson78 committed Apr 20, 2020
1 parent 85e095a commit 897349c
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<div class="modal-body">
<p>
<i>
Provided as a suggestion only. Please verify these automated citations against the guidelines of your preferred style.
</i>
</p>
<% style_count = @citations.map{|c| c[:style]}.uniq.size %>
<% counter = 0 %>
<% @citations.each do |citation| %>
Expand Down
5 changes: 5 additions & 0 deletions app/views/blacklight/citeproc/citation/print_single.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<div class="modal-body">
<p>
<i>
Provided as a suggestion only. Please verify these automated citations against the guidelines of your preferred style.
</i>
</p>
<% @citations.each do |citation| %>
<h3><%= t("blacklight.citeproc.styles.#{citation[:label]}") %></h3>
<%= citation[:citation].html_safe %>
Expand Down
45 changes: 45 additions & 0 deletions spec/system/work_citation_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe "View a Work Citation", type: :system, js: false do
before do
solr = Blacklight.default_index.connection
solr.add(work_attributes)
solr.commit
allow(Rails.application.config).to receive(:iiif_url).and_return('https://example.com')
visit solr_document_path(id)
click_link('citationLink')
end

let(:id) { '123' }

let(:work_attributes) do
CURATE_GENERIC_WORK
end

it 'has a disclaimer' do
expect(page).to have_content('Provided as a suggestion only. Please verify these automated citations against the guidelines of your preferred style.')
end

it 'has the right headers' do
expect(page).to have_content('APA 6th edition')
expect(page).to have_content('Chicago Fullnote Bibliography')
expect(page).to have_content('Modern Language Association')
end

it 'provides the right link 3 times' do
expect(page).to have_content('https://digital.library.emory.edu/purl/123', count: 3)
end

it 'shows the APA correctly' do
expect(page).to have_content('Smith, S. The Title of my Work (3rd ed.). New York Labor News Company. https://digital.library.emory.edu/purl/123')
end

it 'shows the Chicago Fullnote correctly' do
expect(page).to have_content('Smith, Somebody. The Title of My Work. 3Rd ed. New York Labor News Company, n.d. https://digital.library.emory.edu/purl/123.')
end

it 'shows the MLA correctly' do
expect(page).to have_content('Smith, Somebody. The Title of My Work. 3Rd ed., New York Labor News Company, https://digital.library.emory.edu/purl/123.')
end
end

0 comments on commit 897349c

Please sign in to comment.