-
Notifications
You must be signed in to change notification settings - Fork 121
/
_subject.html.erb_spec.rb
35 lines (29 loc) · 1 KB
/
_subject.html.erb_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true
RSpec.describe 'records/edit_fields/_subject.html.erb', type: :view do
RSpec.shared_examples 'check for subject 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
let(:form_template) do
%(
<%= simple_form_for [main_app, @form] do |f| %>
<%= render "records/edit_fields/subject", f: f, key: 'subject' %>
<% end %>
)
end
before do
assign(:form, form)
render inline: form_template
end
context 'ActiveFedora', :active_fedora do
let(:work) { GenericWork.new }
let(:form) { Hyrax::GenericWorkForm.new(work, nil, controller) }
include_examples 'check for subject autocomplete url'
end
context 'Valkyrie' do
let(:work) { Monograph.new }
let(:form) { Hyrax::Forms::ResourceForm.for(work) }
include_examples 'check for subject autocomplete url'
end
end