-
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.
specs for catalog/_field.json.jbuilder
- Loading branch information
1 parent
1478df8
commit 996bf76
Showing
3 changed files
with
29 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'catalog/_field.json.jbuilder', api: true do | ||
let(:field_name) { 'genre_basic_ssim' } | ||
let(:blacklight_config) do | ||
Blacklight::Configuration.new.configure do |config| | ||
config.add_index_field field_name | ||
end | ||
end | ||
let(:field_config) { blacklight_config.index_fields[field_name] } | ||
let(:document) { SolrDocument.find('bpl-dev:h702q6403') } | ||
|
||
let(:field_presenter) { CommonwealthVlrEngine::JsonFieldPresenter.new({}, document, field_config) } | ||
let(:hash) do | ||
render template: 'catalog/_field.json.jbuilder', format: :json | ||
JSON.parse(rendered).with_indifferent_access | ||
end | ||
|
||
before :each do | ||
allow(view).to receive(:field_name).and_return(field_name) | ||
allow(view).to receive(:field_presenter).and_return(field_presenter) | ||
end | ||
|
||
it 'returns the raw field value' do | ||
expect(hash[field_name]).to eq ['Photographs'] | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.