Skip to content

Commit

Permalink
Switches object types based on Wings activity in spec/features/workfl…
Browse files Browse the repository at this point in the history
…ow_state_changes_spec.rb.
  • Loading branch information
bwatson78 authored and jeremyf committed Jan 26, 2024
1 parent 7b9dd81 commit 3b0813e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions spec/features/workflow_state_changes_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# frozen_string_literal: true
RSpec.describe "Workflow state changes", type: :feature do
let(:wings_disabled) { Hyrax.config.disable_wings }
let(:workflow_name) { 'with_comment' }
let(:approving_user) { create(:admin) }
let(:depositing_user) { create(:admin) }
let(:admin_set) { create(:admin_set, edit_users: [depositing_user.user_key]) }
let(:admin_set) do
if wings_disabled
valkyrie_create(:hyrax_admin_set, edit_users: [depositing_user])
else
create(:admin_set, edit_users: [depositing_user.user_key])
end
end
let(:one_step_workflow) do
{
workflows: [
Expand All @@ -28,7 +35,13 @@
end

let(:workflow) { Sipity::Workflow.find_by!(name: workflow_name, permission_template: permission_template) }
let(:work) { create(:work, user: depositing_user, admin_set: admin_set) }
let(:work) do
if wings_disabled
valkyrie_create(:monograph, depositor: depositing_user.user_key, admin_set_id: admin_set.id)
else
create(:work, user: depositing_user, admin_set: admin_set)
end
end
let(:permission_template) { create(:permission_template, source_id: admin_set.id) }

before do
Expand All @@ -42,7 +55,7 @@
describe 'leaving a comment for non-state changing' do
it 'will not advance the state' do
login_as(approving_user, scope: :user)
visit hyrax_generic_work_path(work)
wings_disabled ? visit(hyrax_monograph_path(work)) : visit(hyrax_generic_work_path(work))

expect do
the_comment = 'I am leaving a great comment. A bigly comment. The best comment.'
Expand Down

0 comments on commit 3b0813e

Please sign in to comment.