Skip to content

Commit

Permalink
Merge pull request #6433 from samvera/fixes_subject_html_erb_spec
Browse files Browse the repository at this point in the history
Refactors _subject.html.erb_spec.rb to cleanly split AF and Valkyrie testing.
  • Loading branch information
dlpierce authored Nov 9, 2023
2 parents 950fa4e + 4b03172 commit bafffa0
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions spec/views/records/edit_fields/_subject.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# frozen_string_literal: true

RSpec.shared_examples 'check for autocomplete url' do
it 'has url for autocomplete service' do
expect(rendered).to have_selector('input[data-autocomplete-url="/authorities/search/local/subjects"][data-autocomplete="subject"]')
end
end

RSpec.describe 'records/edit_fields/_subject.html.erb', type: :view do
let(:work) { GenericWork.new }
let(:form) { Hyrax::GenericWorkForm.new(work, nil, controller) }
let(:form_template) do
%(
<%= simple_form_for [main_app, @form] do |f| %>
Expand All @@ -15,7 +20,17 @@
render inline: form_template
end

it 'has url for autocomplete service' do
expect(rendered).to have_selector('input[data-autocomplete-url="/authorities/search/local/subjects"][data-autocomplete="subject"]')
context 'ActiveFedora', :active_fedora do
let(:work) { GenericWork.new }
let(:form) { Hyrax::GenericWorkForm.new(work, nil, controller) }

include_examples 'check for autocomplete url'
end

context 'Valkyrie' do
let(:work) { Monograph.new }
let(:form) { Hyrax::Forms::ResourceForm.for(work) }

include_examples 'check for autocomplete url'
end
end

0 comments on commit bafffa0

Please sign in to comment.