Skip to content

Commit

Permalink
Remove redundant tests
Browse files Browse the repository at this point in the history
The example groups being removed do not exercise any code paths not covered
by the remaining tests.  Changing the school data does not trigger
any alternate code paths.  These are slow running tests with expensive
setup, so we're removing them to speed up the test suite.
  • Loading branch information
mark-dce committed Mar 19, 2023
1 parent 5d3b338 commit 083b438
Showing 1 changed file with 5 additions and 163 deletions.
168 changes: 5 additions & 163 deletions spec/system/check_school_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.feature 'Check for school', :clean, integration: true, js: true, type: :system do
RSpec.feature 'Selected school', :clean, integration: true, js: true, type: :system do
let(:user) { create :user }

let(:approver) { User.where(uid: "tezprox").first }
Expand All @@ -10,7 +10,7 @@
allow_any_instance_of(ActionController::Base).to receive(:protect_against_forgery?).and_return(true)
end

describe 'verify school is Emory College' do
describe 'does not change' do
let(:default_attrs) do
{ depositor: user.user_key,
title: ['This is a thesis'],
Expand All @@ -36,12 +36,10 @@
end

context 'when editing an etd' do
scenario 'school does not change when etd is in request_changes status' do
scenario 'in request_changes status' do
# Changes are requested for ETD
change_workflow_status(ec_etd, "request_changes", approver)

ec_etd.reload

visit("/concern/etds/#{ec_etd.id}")

expect(find('.attribute-school').text).to eq 'Emory College'
Expand All @@ -52,12 +50,10 @@
expect(find('.no-edit-school-name').text).to eq 'Emory College'
end

scenario 'school does not change when etd is in approved status' do
scenario 'in approved status' do
# ETD is approved
change_workflow_status(ec_etd, "approve", approver)

ec_etd.reload

visit("/concern/etds/#{ec_etd.id}")

expect(find('.attribute-school').text).to eq 'Emory College'
Expand All @@ -68,12 +64,10 @@
expect(find('.no-edit-school-name').text).to eq 'Emory College'
end

scenario 'school does not change when etd is in published status' do
scenario 'in published status' do
# ETD is published
change_workflow_status(ec_etd, "publish", approver)

ec_etd.reload

visit("/concern/etds/#{ec_etd.id}")

expect(find('.attribute-school').text).to eq 'Emory College'
Expand All @@ -85,156 +79,4 @@
end
end
end

describe 'verify school is Candler School of Theology' do
let(:default_attrs) do
{ depositor: user.user_key,
title: ['This is another thesis'],
school: ['Candler School of Theology'],
department: ['Divinity'] }
end
let(:candler_etd) do
FactoryBot.build(:etd, default_attrs)
end

let(:workflow_setup) { WorkflowSetup.new("#{fixture_path}/config/emory/superusers.yml", "#{fixture_path}/config/emory/candler_admin_sets.yml", "/dev/null") }

before do
workflow_setup.setup
candler_etd.assign_admin_set

# Create the ETD record
env = Hyrax::Actors::Environment.new(candler_etd, ::Ability.new(user), {})
middleware = Hyrax::DefaultMiddlewareStack.build_stack.build(Hyrax::Actors::Terminator.new)
middleware.create(env)

login_as approver
end

context 'when editing an etd' do
scenario 'school does not change when etd is in request_changes status' do
# Changes are requested for ETD
change_workflow_status(candler_etd, "request_changes", approver)

candler_etd.reload

visit("/concern/etds/#{candler_etd.id}")

expect(find('.attribute-school').text).to eq 'Candler School of Theology'

click_on("Edit")

expect(find(:css, 'input[name="etd[school]"]', visible: false, match: :first).value).to eq 'Candler School of Theology'
expect(find('.no-edit-school-name').text).to eq 'Candler School of Theology'
end

scenario 'school does not change when etd is in approved status' do
# ETD is approved
change_workflow_status(candler_etd, "approve", approver)

candler_etd.reload

visit("/concern/etds/#{candler_etd.id}")

expect(find('.attribute-school').text).to eq 'Candler School of Theology'

click_on("Edit")

expect(find(:css, 'input[name="etd[school]"]', visible: false, match: :first).value).to eq 'Candler School of Theology'
expect(find('.no-edit-school-name').text).to eq 'Candler School of Theology'
end

scenario 'school does not change when etd is in published status' do
# ETD is published
change_workflow_status(candler_etd, "publish", approver)

candler_etd.reload

visit("/concern/etds/#{candler_etd.id}")

expect(find('.attribute-school').text).to eq 'Candler School of Theology'

click_on("Edit")

expect(find(:css, 'input[name="etd[school]"]', visible: false, match: :first).value).to eq 'Candler School of Theology'
expect(find('.no-edit-school-name').text).to eq 'Candler School of Theology'
end
end
end

describe 'verify school is Laney Graduate School' do
let(:default_attrs) do
{ depositor: user.user_key,
title: ['This is one more thesis'],
school: ['Laney Graduate School'],
department: ['Anthropology'] }
end
let(:laney_etd) do
FactoryBot.build(:etd, default_attrs)
end

let(:workflow_setup) { WorkflowSetup.new("#{fixture_path}/config/emory/superusers.yml", "#{fixture_path}/config/emory/laney_admin_sets.yml", "/dev/null") }

before do
workflow_setup.setup
laney_etd.assign_admin_set

# Create the ETD record
env = Hyrax::Actors::Environment.new(laney_etd, ::Ability.new(user), {})
middleware = Hyrax::DefaultMiddlewareStack.build_stack.build(Hyrax::Actors::Terminator.new)
middleware.create(env)

login_as approver
end

context 'when editing an etd' do
scenario 'school does not change when etd is in request_changes status' do
# Changes are requested for ETD
change_workflow_status(laney_etd, "request_changes", approver)

laney_etd.reload

visit("/concern/etds/#{laney_etd.id}")

expect(find('.attribute-school').text).to eq 'Laney Graduate School'

click_on("Edit")

expect(find(:css, 'input[name="etd[school]"]', visible: false, match: :first).value).to eq 'Laney Graduate School'
expect(find('.no-edit-school-name').text).to eq 'Laney Graduate School'
end

scenario 'school does not change when etd is in approved status' do
# ETD is approved
change_workflow_status(laney_etd, "approve", approver)

laney_etd.reload

visit("/concern/etds/#{laney_etd.id}")

expect(find('.attribute-school').text).to eq 'Laney Graduate School'

click_on("Edit")

expect(find(:css, 'input[name="etd[school]"]', visible: false, match: :first).value).to eq 'Laney Graduate School'
expect(find('.no-edit-school-name').text).to eq 'Laney Graduate School'
end

scenario 'school does not change when etd is in published status' do
# ETD is published
change_workflow_status(laney_etd, "publish", approver)

laney_etd.reload

visit("/concern/etds/#{laney_etd.id}")

expect(find('.attribute-school').text).to eq 'Laney Graduate School'

click_on("Edit")

expect(find(:css, 'input[name="etd[school]"]', visible: false, match: :first).value).to eq 'Laney Graduate School'
expect(find('.no-edit-school-name').text).to eq 'Laney Graduate School'
end
end
end
end

0 comments on commit 083b438

Please sign in to comment.