-
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.
MERGE TO BRANCH - 214 branch in house repair checks - MERGE FIRST (#495)
* Edit controlled vocab specs * Check read-only cons records for access rights * Remove blank lines, correct disabled fields test * Rearrange feature tests by subject, add in-house creation testing * Check in-house repair deletion * Rubocop and fix broken tests
- Loading branch information
1 parent
2f81783
commit 07192ba
Showing
31 changed files
with
125 additions
and
62 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
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
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
14 changes: 14 additions & 0 deletions
14
spec/features/support/helpers/conservation_record_helpers.rb
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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
def add_in_house_repair(conservation_record) | ||
visit conservation_records_path | ||
click_link(conservation_record.title, match: :prefer_exact) | ||
expect(page).to have_button('Add In-House Repairs') | ||
click_button('Add In-House Repairs') | ||
select(user.display_name, from: 'in_house_repair_record_performed_by_user_id', match: :first) | ||
select('Mend paper', from: 'in_house_repair_record_repair_type', match: :first) | ||
fill_in 'in_house_repair_record_minutes_spent', with: '10' | ||
fill_in 'in_house_repair_record_other_note', with: 'Other Note' | ||
select('test', from: 'in_house_repair_record_staff_code_id', match: :first) | ||
click_button('Create In-House Repair Record') | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions
17
spec/features/support/shared_examples/in_house_repair_checks/in_house_repair_creation.rb
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.shared_examples 'creates new in-house repairs' do | ||
let(:conservation_record) { create(:conservation_record) } | ||
|
||
before do | ||
conservation_record | ||
end | ||
|
||
it 'creates a new in-house repair' do | ||
add_in_house_repair(conservation_record) | ||
|
||
expect(page).to have_content("Mend paper performed by #{user.display_name}") | ||
end | ||
end |
21 changes: 21 additions & 0 deletions
21
spec/features/support/shared_examples/in_house_repair_checks/in_house_repair_deletion.rb
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,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.shared_examples 'deletes in-house repairs' do | ||
let(:conservation_record) { create(:conservation_record) } | ||
|
||
before do | ||
conservation_record | ||
end | ||
|
||
it 'deletes an in-house repair' do | ||
add_in_house_repair(conservation_record) | ||
expect(page).to have_content("Mend paper performed by #{user.display_name}") | ||
|
||
accept_confirm do | ||
find("a[id='delete_in_house_repair_record_1']").click | ||
end | ||
expect(page).not_to have_content("Mend paper performed by #{user.display_name}") | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
spec/features/support/shared_examples/in_house_repair_checks/in_house_repair_editing.rb
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 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.shared_examples 'edits in-house repairs' do | ||
let(:conservation_record) { create(:conservation_record) } | ||
|
||
before do | ||
conservation_record | ||
end | ||
|
||
it 'edits an in-house repair' do | ||
# Currently there is no funtionality to edit an in-house repair. | ||
end | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
spec/features/support/shared_examples/role_specific_checks/read_only_cons_record_check.rb
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,53 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.shared_examples 'can read but not edit conservation records' do | ||
let(:cons_record) { create(:conservation_record) } | ||
|
||
before do | ||
cons_record | ||
end | ||
|
||
it 'does not have buttons that it should not have' do | ||
visit conservation_records_path | ||
expect(page).not_to have_link('New Conservation Record') | ||
|
||
within('table tbody') do | ||
first('a').click | ||
end | ||
|
||
expect(page).not_to have_link('Edit Conservation Record') | ||
expect(page).not_to have_link('Add In-House Repair') | ||
expect(page).not_to have_link('Add External Repair') | ||
expect(page).not_to have_link('Add Conservators and Technicians') | ||
end | ||
|
||
it 'has disabled conservation record buttons' do | ||
visit conservation_records_path | ||
within('table tbody') do | ||
first('a').click | ||
end | ||
|
||
expect(page).to have_content('Cost and Return Information') | ||
expect(page).to have_button('Save Cost and Return Information', disabled: true) | ||
expect(page).to have_button('Save Treatment Report', disabled: true) | ||
expect(page).to have_button('Save Cost and Return Information', disabled: true) | ||
end | ||
|
||
it 'has disabled input fields in the conservation record form' do | ||
visit conservation_record_path(cons_record) | ||
expect(page).to have_selector('h1', text: cons_record.title) | ||
expect(page).to have_selector('form.disable_input') | ||
all('form.disable_input').each do |form| # There are several forms on the page | ||
within(form) do | ||
# Check disabled state for all input, textarea, and select elements | ||
%w[input textarea select].each do |element_type| | ||
all(element_type).each do |element| | ||
expect(element).to be_disabled | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.