-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
230 additions
and
107 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
6 changes: 3 additions & 3 deletions
6
app/views/shared/_circulation_statistics_report_formats.html.erb
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,6 +1,6 @@ | ||
<div class='form-group row'> | ||
<%= f.label :format_array, 'Select the formats to include:', class: 'col-sm-10 form-control-label' %> | ||
<div class='col-sm-10'> | ||
<%= f.select :format_array, CirculationStatisticsReportFormat.formats, { selected: 'All Formats' }, { multiple: true, class: 'form-control' } %> | ||
<%= f.label :format_array, 'Select the formats to include:', class: 'col-sm-4 form-control-label' %> | ||
<div class='col-sm-8'> | ||
<%= f.select :format_array, CirculationStatisticsReportFormat.formats, { selected: 'All Formats' }, { multiple: true, size: CirculationStatisticsReportFormat.formats.size/2, class: 'form-control' } %> | ||
</div> | ||
</div> |
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,8 +1,6 @@ | ||
<div class='form-group row'> | ||
<div class='col-sm-10'> | ||
<%= f.label :email, 'Email for notification when the report is ready:', class: 'form-control-label' %> | ||
</div> | ||
<div class='col-sm-10'> | ||
<%= f.label :email, 'Email for notification when the report is ready:', class: 'col-sm-4 form-control-label' %> | ||
<div class='col-sm-8'> | ||
<%= f.text_field 'email', class: 'form-control' %> | ||
</div> | ||
</div> |
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
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,15 @@ | ||
require 'rails_helper' | ||
|
||
describe 'Circulation Statistics Report Page', type: :feature, js: true do | ||
before do | ||
FactoryBot.create(:uni_libs_locs) | ||
stub_current_user(FactoryBot.create(:authorized_user)) | ||
visit new_circulation_statistics_report_path | ||
select('SAL3', from: 'circulation_statistics_report_lib_array') | ||
end | ||
|
||
it 'shows the optional criteria when you click on the Proceed to next step button' do | ||
find_link('Proceed to next step').click | ||
expect(page).to have_css '#SAL3select option', count: 2 | ||
end | ||
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,82 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe CirculationStatisticsReport, type: :model do | ||
describe 'LC callnum range' do | ||
context 'when call_lo is one or two LC letters' do | ||
let(:report) { FactoryBot.build(:circulation_statistics_report, range_type: 'lc', call_lo: 'n', call_hi: '') } | ||
|
||
it 'call_hi can be blank' do | ||
expect(report).to be_valid | ||
end | ||
|
||
it 'converts the call_lo to upper case' do | ||
report.validate | ||
expect(report.call_lo).to eq 'N' | ||
end | ||
end | ||
end | ||
|
||
context 'when call_lo is one or two LC letters' do | ||
let(:report) { FactoryBot.build(:circulation_statistics_report, range_type: 'lc', call_lo: 'nd', call_hi: 'nz') } | ||
|
||
it 'call_hi can be a latter letter' do | ||
expect(report).to be_valid | ||
end | ||
|
||
it 'converts the call_lo to upper case' do | ||
report.validate | ||
expect(report.call_lo).to eq 'ND' | ||
end | ||
|
||
it 'converts the call_hi to upper case' do | ||
report.validate | ||
expect(report.call_hi).to eq 'NZ' | ||
end | ||
end | ||
|
||
context 'when call lo is one or two letters with a wildcard' do | ||
let(:report) { FactoryBot.build(:circulation_statistics_report, range_type: 'lc', call_lo: 'n#') } | ||
|
||
it 'call_hi should be blank' do | ||
expect(report).to be_valid | ||
end | ||
|
||
it 'converts the call_lo to upper case' do | ||
report.validate | ||
expect(report.call_lo).to eq 'N#' | ||
end | ||
end | ||
|
||
describe 'classic call' do | ||
context 'when classic call number alpha range' do | ||
let(:report) { FactoryBot.build(:circulation_statistics_report, range_type: 'classic', call_alpha: 'nd') } | ||
|
||
it 'converts the call_alpha to upper case before validations' do | ||
report.validate | ||
expect(report.call_alpha).to eq 'ND' | ||
end | ||
end | ||
|
||
context 'when classic call number numeric range' do | ||
let(:report) do | ||
FactoryBot.build(:circulation_statistics_report, range_type: 'classic', call_lo: '100', call_hi: '230') | ||
end | ||
|
||
it 'is a valid report' do | ||
report.validate | ||
expect(report).to be_valid | ||
end | ||
end | ||
end | ||
|
||
describe 'tag fields' do | ||
context 'when there is a 008 in one of the tag fields' do | ||
let(:report) { FactoryBot.build(:circulation_statistics_report, tag_field4: '008') } | ||
|
||
it 'is an invalis report' do | ||
report.validate | ||
expect(report).not_to be_valid | ||
end | ||
end | ||
end | ||
end |