-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make search string used to look up objects configurable (#884)
* make search string used to look up objects configurable * fix lint require for ci, add example to initializer * fix typo * move object factory specs to all be in one place * make rubocop happy * unpin dry-monads. its not a dependency of bulkrax, but previously needed to be pinned for specs --------- Co-authored-by: Jeremy Friesen <[email protected]>
- Loading branch information
1 parent
9ada93c
commit 519b377
Showing
12 changed files
with
55 additions
and
41 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
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 |
---|---|---|
|
@@ -34,4 +34,5 @@ end | |
|
||
group :lint do | ||
gem 'bixby' | ||
gem 'rubocop-factory_bot', require: false | ||
end |
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,29 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe Bulkrax::ObjectFactory do | ||
# Why aren't there more tests? In part because so much of the ObjectFactory require that we boot | ||
# up Fedora and SOLR; something that remains non-desirous due to speed. | ||
describe "#transform_attributes" do | ||
context 'default behavior' do | ||
it "does not empty arrays that only have empty values" do | ||
attributes = { empty_array: ["", ""], empty_string: "", filled_array: ["A", "B"], filled_string: "A" } | ||
factory = described_class.new(attributes: attributes, source_identifier_value: 123, work_identifier: "filled_string") | ||
factory.base_permitted_attributes = %i[empty_array empty_string filled_array filled_string] | ||
expect(factory.send(:transform_attributes)).to eq(attributes.stringify_keys) | ||
end | ||
end | ||
|
||
context 'when :transformation_removes_blank_hash_values = true' do | ||
it "empties arrays that only have empty values" do | ||
attributes = { empty_array: ["", ""], empty_string: "", filled_array: ["A", "B"], filled_string: "A" } | ||
factory = described_class.new(attributes: attributes, source_identifier_value: 123, work_identifier: "filled_string") | ||
factory.base_permitted_attributes = %i[empty_array empty_string filled_array filled_string] | ||
factory.transformation_removes_blank_hash_values = true | ||
expect(factory.send(:transform_attributes)) | ||
.to eq({ empty_array: [], empty_string: nil, filled_array: ["A", "B"], filled_string: "A" }.stringify_keys) | ||
end | ||
end | ||
end | ||
end | ||
# NOTE: do not put any specs here. FactoryBot autoloads every ruby file in spec/factories so even through it better | ||
# mirrors the app/ path, we put the ObjectFactory specs in spec/models/bulkrax/object_factory_spec.rb |
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
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
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