iiif_print 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.env +5 -0
- data/.fcrepo_wrapper +4 -0
- data/.github/release.yml +20 -0
- data/.github/workflows/branches.yml +24 -0
- data/.github/workflows/build-lint-test-action.yaml +33 -0
- data/.github/workflows/release_labels.yml +25 -0
- data/.gitignore +52 -0
- data/.rubocop.yml +177 -0
- data/.solr_wrapper +8 -0
- data/.travis.yml +49 -0
- data/CONTRIBUTING.md +181 -0
- data/Dockerfile +15 -0
- data/Gemfile +52 -0
- data/LICENSE +203 -0
- data/README.md +203 -0
- data/Rakefile +38 -0
- data/app/actors/iiif_print/actors/file_set_actor_decorator.rb +56 -0
- data/app/assets/config/iiif_print_manifest.js +2 -0
- data/app/assets/images/iiif_print/.keep +0 -0
- data/app/assets/javascripts/iiif_print/autocomplete_fix.js +33 -0
- data/app/assets/javascripts/iiif_print/ocr_search.js.erb +6 -0
- data/app/assets/javascripts/iiif_print.js +3 -0
- data/app/assets/stylesheets/iiif_print/_iiif_print.scss +4 -0
- data/app/assets/stylesheets/iiif_print/_issue_search.scss +13 -0
- data/app/assets/stylesheets/iiif_print/_issues_calendar.scss +18 -0
- data/app/assets/stylesheets/iiif_print/_newspapers_search.scss +38 -0
- data/app/assets/stylesheets/iiif_print/_search_results.scss +6 -0
- data/app/helpers/hyrax/iiif_helper.rb +22 -0
- data/app/helpers/iiif_print/application_helper.rb +5 -0
- data/app/helpers/iiif_print_helper.rb +64 -0
- data/app/indexers/concerns/iiif_print/child_indexer.rb +34 -0
- data/app/indexers/concerns/iiif_print/file_set_indexer.rb +29 -0
- data/app/mailers/iiif_print/application_mailer.rb +8 -0
- data/app/models/concerns/iiif_print/set_child_flag.rb +29 -0
- data/app/models/concerns/iiif_print/solr/document.rb +47 -0
- data/app/models/iiif_print/application_record.rb +6 -0
- data/app/models/iiif_print/derivative_attachment.rb +8 -0
- data/app/models/iiif_print/iiif_search_response_decorator.rb +17 -0
- data/app/models/iiif_print/ingest_file_relation.rb +14 -0
- data/app/models/iiif_print/pending_relationship.rb +7 -0
- data/app/presenters/iiif_print/iiif_manifest_presenter_behavior.rb +10 -0
- data/app/presenters/iiif_print/iiif_manifest_presenter_factory_behavior.rb +33 -0
- data/app/presenters/iiif_print/work_show_presenter_decorator.rb +29 -0
- data/app/renderers/hyrax/renderers/faceted_attribute_renderer_decorator.rb +18 -0
- data/app/search_builders/concerns/iiif_print/exclude_models.rb +17 -0
- data/app/search_builders/concerns/iiif_print/highlight_search_params.rb +14 -0
- data/app/services/iiif_print/manifest_builder_service_behavior.rb +97 -0
- data/app/services/iiif_print/pluggable_derivative_service.rb +120 -0
- data/app/views/catalog/_snippets_more.html.erb +16 -0
- data/app/views/hyrax/base/_representative_media.html.erb +9 -0
- data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +8 -0
- data/app/views/hyrax/file_sets/_actions.html.erb +45 -0
- data/bin/rails +13 -0
- data/config/fcrepo_wrapper_test.yml +5 -0
- data/config/initializers/assets.rb +2 -0
- data/config/locales/iiif_print.de.yml +148 -0
- data/config/locales/iiif_print.en.yml +119 -0
- data/config/locales/iiif_print.es.yml +148 -0
- data/config/locales/iiif_print.fr.yml +149 -0
- data/config/locales/iiif_print.it.yml +142 -0
- data/config/locales/iiif_print.pt-BR.yml +148 -0
- data/config/locales/iiif_print.zh.yml +142 -0
- data/config/solr_wrapper_test.yml +9 -0
- data/config/test-fixture/solr-config/_rest_managed.json +3 -0
- data/config/test-fixture/solr-config/admin-extra.html +31 -0
- data/config/test-fixture/solr-config/elevate.xml +36 -0
- data/config/test-fixture/solr-config/mapping-ISOLatin1Accent.txt +246 -0
- data/config/test-fixture/solr-config/protwords.txt +21 -0
- data/config/test-fixture/solr-config/schema.xml +366 -0
- data/config/test-fixture/solr-config/scripts.conf +24 -0
- data/config/test-fixture/solr-config/solrconfig.xml +322 -0
- data/config/test-fixture/solr-config/spellings.txt +2 -0
- data/config/test-fixture/solr-config/stopwords.txt +58 -0
- data/config/test-fixture/solr-config/stopwords_en.txt +58 -0
- data/config/test-fixture/solr-config/synonyms.txt +31 -0
- data/config/test-fixture/solr-config/xslt/example.xsl +132 -0
- data/config/test-fixture/solr-config/xslt/example_atom.xsl +67 -0
- data/config/test-fixture/solr-config/xslt/example_rss.xsl +66 -0
- data/config/test-fixture/solr-config/xslt/luke.xsl +337 -0
- data/config/vendor/fits.xml +55 -0
- data/config/vendor/imagemagick-6-policy.xml +76 -0
- data/db/migrate/20181214181358_create_iiif_print_derivative_attachments.rb +12 -0
- data/db/migrate/20190107165909_create_iiif_print_ingest_file_relations.rb +11 -0
- data/db/migrate/20230109000000_create_iiif_print_pending_relationships.rb +11 -0
- data/docker-compose.yml +129 -0
- data/iiif_print.gemspec +43 -0
- data/lib/generators/iiif_print/assets_generator.rb +29 -0
- data/lib/generators/iiif_print/catalog_controller_generator.rb +32 -0
- data/lib/generators/iiif_print/install_generator.rb +52 -0
- data/lib/generators/iiif_print/templates/config/initializers/iiif_print.rb +22 -0
- data/lib/generators/iiif_print/templates/iiif_print.scss +1 -0
- data/lib/iiif_print/base_derivative_service.rb +113 -0
- data/lib/iiif_print/blacklight_iiif_search/annotation_decorator.rb +84 -0
- data/lib/iiif_print/catalog_search_builder.rb +31 -0
- data/lib/iiif_print/configuration.rb +99 -0
- data/lib/iiif_print/data/fileset_helper.rb +25 -0
- data/lib/iiif_print/data/path_helper.rb +40 -0
- data/lib/iiif_print/data/work_derivatives.rb +323 -0
- data/lib/iiif_print/data/work_file.rb +92 -0
- data/lib/iiif_print/data/work_files.rb +199 -0
- data/lib/iiif_print/data.rb +35 -0
- data/lib/iiif_print/engine.rb +77 -0
- data/lib/iiif_print/errors.rb +9 -0
- data/lib/iiif_print/image_tool.rb +119 -0
- data/lib/iiif_print/jobs/application_job.rb +8 -0
- data/lib/iiif_print/jobs/child_works_from_pdf_job.rb +107 -0
- data/lib/iiif_print/jobs/create_relationships_job.rb +78 -0
- data/lib/iiif_print/jp2_derivative_service.rb +118 -0
- data/lib/iiif_print/jp2_image_metadata.rb +81 -0
- data/lib/iiif_print/lineage_service.rb +41 -0
- data/lib/iiif_print/metadata.rb +125 -0
- data/lib/iiif_print/pdf_derivative_service.rb +42 -0
- data/lib/iiif_print/split_pdfs/child_work_creation_from_pdf_service.rb +75 -0
- data/lib/iiif_print/split_pdfs/pages_into_images_service.rb +130 -0
- data/lib/iiif_print/split_pdfs/pdf_image_extraction_service.rb +85 -0
- data/lib/iiif_print/text_extraction/alto_reader.rb +123 -0
- data/lib/iiif_print/text_extraction/hocr_reader.rb +172 -0
- data/lib/iiif_print/text_extraction/page_ocr.rb +87 -0
- data/lib/iiif_print/text_extraction/render_alto.rb +84 -0
- data/lib/iiif_print/text_extraction/word_coords_builder.rb +38 -0
- data/lib/iiif_print/text_extraction.rb +11 -0
- data/lib/iiif_print/text_extraction_derivative_service.rb +47 -0
- data/lib/iiif_print/text_formats_from_alto_service.rb +77 -0
- data/lib/iiif_print/tiff_derivative_service.rb +50 -0
- data/lib/iiif_print/version.rb +3 -0
- data/lib/iiif_print/works_controller_behavior.rb +9 -0
- data/lib/iiif_print.rb +136 -0
- data/lib/tasks/set_child_works.rake +22 -0
- data/spec/.keep.txt +1 -0
- data/spec/factories/ability.rb +6 -0
- data/spec/factories/newspaper_issue.rb +7 -0
- data/spec/factories/newspaper_page.rb +7 -0
- data/spec/factories/newspaper_page_solr_document.rb +12 -0
- data/spec/factories/newspaper_title.rb +8 -0
- data/spec/factories/uploaded_pdf_file.rb +9 -0
- data/spec/factories/uploaded_txt_file.rb +9 -0
- data/spec/factories/user.rb +13 -0
- data/spec/fixtures/files/4.1.07.jp2 +0 -0
- data/spec/fixtures/files/4.1.07.tiff +0 -0
- data/spec/fixtures/files/README.md +7 -0
- data/spec/fixtures/files/alto-2-0.xsd +714 -0
- data/spec/fixtures/files/broken-truncated.pdf +0 -0
- data/spec/fixtures/files/credits.md +16 -0
- data/spec/fixtures/files/lowres-gray-via-ndnp-sample.tiff +0 -0
- data/spec/fixtures/files/minimal-1-page.pdf +0 -0
- data/spec/fixtures/files/minimal-2-page.pdf +0 -0
- data/spec/fixtures/files/minimal-alto.xml +31 -0
- data/spec/fixtures/files/ndnp-alto-sample.xml +24 -0
- data/spec/fixtures/files/ndnp-sample1-json.json +1 -0
- data/spec/fixtures/files/ndnp-sample1-txt.txt +1 -0
- data/spec/fixtures/files/ndnp-sample1.pdf +0 -0
- data/spec/fixtures/files/ocr_alto.xml +202 -0
- data/spec/fixtures/files/ocr_alto_scaled_4pts_per_px.xml +202 -0
- data/spec/fixtures/files/ocr_color.tiff +0 -0
- data/spec/fixtures/files/ocr_gray.jp2 +0 -0
- data/spec/fixtures/files/ocr_gray.tiff +0 -0
- data/spec/fixtures/files/ocr_mono.tiff +0 -0
- data/spec/fixtures/files/ocr_mono_text_hocr.html +78 -0
- data/spec/fixtures/files/page1.tiff +0 -0
- data/spec/fixtures/files/sample-4page-issue.pdf +0 -0
- data/spec/fixtures/files/sample-color-newsletter.pdf +0 -0
- data/spec/fixtures/files/thumbnail.jpg +0 -0
- data/spec/helpers/hyrax/iiif_helper_spec.rb +65 -0
- data/spec/helpers/iiif_print_helper_spec.rb +43 -0
- data/spec/iiif_print/base_derivative_service_spec.rb +11 -0
- data/spec/iiif_print/blacklight_iiif_search/annotation_decorator_spec.rb +51 -0
- data/spec/iiif_print/catalog_search_builder_spec.rb +60 -0
- data/spec/iiif_print/configuration_spec.rb +67 -0
- data/spec/iiif_print/data/work_derivatives_spec.rb +245 -0
- data/spec/iiif_print/data/work_file_spec.rb +99 -0
- data/spec/iiif_print/data/work_files_spec.rb +237 -0
- data/spec/iiif_print/image_tool_spec.rb +109 -0
- data/spec/iiif_print/jobs/child_works_from_pdf_job_spec.rb +30 -0
- data/spec/iiif_print/jobs/create_relationships_job_spec.rb +17 -0
- data/spec/iiif_print/jp2_image_metadata_spec.rb +37 -0
- data/spec/iiif_print/lineage_service_spec.rb +13 -0
- data/spec/iiif_print/metadata_spec.rb +115 -0
- data/spec/iiif_print/split_pdfs/pages_into_images_service_spec.rb +6 -0
- data/spec/iiif_print/text_extraction/alto_reader_spec.rb +49 -0
- data/spec/iiif_print/text_extraction/hocr_reader_spec.rb +45 -0
- data/spec/iiif_print/text_extraction/page_ocr_spec.rb +84 -0
- data/spec/iiif_print/text_extraction/render_alto_spec.rb +54 -0
- data/spec/iiif_print/text_extraction/word_coords_builder_spec.rb +44 -0
- data/spec/iiif_print_spec.rb +51 -0
- data/spec/misc_shared.rb +111 -0
- data/spec/models/iiif_print/derivative_attachment_spec.rb +37 -0
- data/spec/models/iiif_print/ingest_file_relation_spec.rb +56 -0
- data/spec/models/solr_document_spec.rb +14 -0
- data/spec/presenters/iiif_print/iiif_manifest_presenter_behavior_spec.rb +19 -0
- data/spec/presenters/iiif_print/iiif_manifest_presenter_factory_behavior_spec.rb +49 -0
- data/spec/services/iiif_print/jp2_derivative_service_spec.rb +59 -0
- data/spec/services/iiif_print/pdf_derivative_service_spec.rb +66 -0
- data/spec/services/iiif_print/pluggable_derivative_service_spec.rb +178 -0
- data/spec/services/iiif_print/text_extraction_derivative_service_spec.rb +82 -0
- data/spec/services/iiif_print/text_formats_from_alto_service_spec.rb +127 -0
- data/spec/services/iiif_print/tiff_derivative_service_spec.rb +65 -0
- data/spec/spec_helper.rb +181 -0
- data/spec/support/controller_level_helpers.rb +28 -0
- data/spec/support/iiif_print_models.rb +127 -0
- data/spec/test_app_templates/blacklight.yml +9 -0
- data/spec/test_app_templates/fedora.yml +15 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +40 -0
- data/spec/test_app_templates/redis.yml +9 -0
- data/spec/test_app_templates/solr/conf/schema.xml +362 -0
- data/spec/test_app_templates/solr/conf/solrconfig.xml +322 -0
- data/spec/test_app_templates/solr.yml +7 -0
- data/tasks/iiif_print_dev.rake +34 -0
- data/tmp/.keep +0 -0
- metadata +605 -0
data/lib/iiif_print.rb
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
require "iiif_print/engine"
|
2
|
+
require "iiif_print/errors"
|
3
|
+
require "iiif_print/jp2_image_metadata"
|
4
|
+
require "iiif_print/image_tool"
|
5
|
+
require "iiif_print/text_extraction"
|
6
|
+
require "iiif_print/data"
|
7
|
+
require "iiif_print/configuration"
|
8
|
+
require "iiif_print/base_derivative_service"
|
9
|
+
require "iiif_print/jp2_derivative_service"
|
10
|
+
require "iiif_print/pdf_derivative_service"
|
11
|
+
require "iiif_print/text_extraction_derivative_service"
|
12
|
+
require "iiif_print/text_formats_from_alto_service"
|
13
|
+
require "iiif_print/tiff_derivative_service"
|
14
|
+
require "iiif_print/lineage_service"
|
15
|
+
require "iiif_print/metadata"
|
16
|
+
require "iiif_print/works_controller_behavior"
|
17
|
+
require "iiif_print/jobs/application_job"
|
18
|
+
require "iiif_print/blacklight_iiif_search/annotation_decorator"
|
19
|
+
require "iiif_print/jobs/child_works_from_pdf_job"
|
20
|
+
require "iiif_print/jobs/create_relationships_job"
|
21
|
+
require "iiif_print/split_pdfs/pages_into_images_service"
|
22
|
+
require "iiif_print/split_pdfs/child_work_creation_from_pdf_service"
|
23
|
+
|
24
|
+
module IiifPrint
|
25
|
+
extend ActiveSupport::Autoload
|
26
|
+
autoload :Configuration
|
27
|
+
autoload :CatalogSearchBuilder
|
28
|
+
|
29
|
+
##
|
30
|
+
# @api public
|
31
|
+
# Exposes the IiifPrint configuration.
|
32
|
+
#
|
33
|
+
# @yield [IiifPrint::Configuration] if a block is passed
|
34
|
+
# @return [IiifPrint::Configuration]
|
35
|
+
# @see IiifPrint::Configuration for configuration options
|
36
|
+
def self.config(&block)
|
37
|
+
@config ||= IiifPrint::Configuration.new
|
38
|
+
yield @config if block
|
39
|
+
@config
|
40
|
+
end
|
41
|
+
|
42
|
+
DEFAULT_MODEL_CONFIGURATION = {
|
43
|
+
# Split a PDF into individual page images and create a new child work for each image.
|
44
|
+
pdf_splitter_job: IiifPrint::Jobs::ChildWorksFromPdfJob,
|
45
|
+
pdf_splitter_service: IiifPrint::SplitPdfs::PagesIntoImagesService,
|
46
|
+
derivative_service_plugins: [
|
47
|
+
IiifPrint::JP2DerivativeService,
|
48
|
+
IiifPrint::PDFDerivativeService,
|
49
|
+
IiifPrint::TextExtractionDerivativeService,
|
50
|
+
IiifPrint::TIFFDerivativeService
|
51
|
+
]
|
52
|
+
}.freeze
|
53
|
+
|
54
|
+
# This is the record level configuration for PDF split handling.
|
55
|
+
ModelConfig = Struct.new(:pdf_split_child_model, *DEFAULT_MODEL_CONFIGURATION.keys, keyword_init: true)
|
56
|
+
|
57
|
+
# This method is responsible for assisting in the configuration of a "model".
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# class Book < ActiveFedora::Base
|
61
|
+
# include IiifPrint.model_configuration(
|
62
|
+
# pdf_split_child_model: Page,
|
63
|
+
# derivative_service_plugins: [
|
64
|
+
# IiifPrint::TIFFDerivativeService
|
65
|
+
# ]
|
66
|
+
# )
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# @param kwargs [Hash<Symbol,Object>] the configuration values that overrides the
|
70
|
+
# DEFAULT_MODEL_CONFIGURATION.
|
71
|
+
#
|
72
|
+
# @return [Module]
|
73
|
+
#
|
74
|
+
# @see IiifPrint::DEFAULT_MODEL_CONFIGURATION
|
75
|
+
# @todo Because not every job will split PDFs and write to a child model. May want to introduce
|
76
|
+
# an alternative splitting method to create new filesets on the existing work instead of new child works.
|
77
|
+
def self.model_configuration(**kwargs)
|
78
|
+
Module.new do
|
79
|
+
def iiif_print_config?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
# We don't know what you may want in your configuration, but from this gems implementation,
|
84
|
+
# we're going to provide the defaults to ensure that it works.
|
85
|
+
DEFAULT_MODEL_CONFIGURATION.each_pair do |key, default_value|
|
86
|
+
kwargs[key] ||= default_value
|
87
|
+
end
|
88
|
+
|
89
|
+
define_method(:iiif_print_config) do
|
90
|
+
@iiif_print_config ||= ModelConfig.new(**kwargs)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# @api public
|
96
|
+
#
|
97
|
+
# Map the given work's metadata to the given IIIF version spec's metadata structure. This
|
98
|
+
# is intended to be a drop-in replacement for `Hyrax::IiifManifestPresenter#manifest_metadata`.
|
99
|
+
#
|
100
|
+
# @param work [Object]
|
101
|
+
# @param version [Integer]
|
102
|
+
# @param fields [Array<IiifPrint::Metadata::Field>, Array<#name, #label>]
|
103
|
+
# @return [Array<Hash>]
|
104
|
+
#
|
105
|
+
# @see specs for expected output
|
106
|
+
#
|
107
|
+
# @see Hyrax::IiifManifestPresenter#manifest_metadata
|
108
|
+
def self.manifest_metadata_for(work:,
|
109
|
+
version: config.default_iiif_manifest_version,
|
110
|
+
fields: default_fields_for(work),
|
111
|
+
current_ability:,
|
112
|
+
base_url:)
|
113
|
+
Metadata.build_metadata_for(work: work,
|
114
|
+
version: version,
|
115
|
+
fields: fields,
|
116
|
+
current_ability: current_ability,
|
117
|
+
base_url: base_url)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Hash is an arbitrary attribute key/value pairs
|
121
|
+
# Struct is a defined set of attribute "keys". When we favor defined values,
|
122
|
+
# then we are naming the concept and defining the range of potential values.
|
123
|
+
Field = Struct.new(:name, :label, :options, keyword_init: true)
|
124
|
+
|
125
|
+
# @api private
|
126
|
+
# @todo Figure out a way to use a custom label, right now it takes it get rendered from the title.
|
127
|
+
def self.default_fields_for(_work, fields: config.metadata_fields)
|
128
|
+
fields.map do |field|
|
129
|
+
Field.new(
|
130
|
+
name: field.first,
|
131
|
+
label: Hyrax::Renderers::AttributeRenderer.new(field, nil).label,
|
132
|
+
options: field.last
|
133
|
+
)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :iiif_print do
|
4
|
+
namespace :update do
|
5
|
+
desc 'Make sure all child work models have the correct attribute'
|
6
|
+
task is_child_attribute: [:environment] do
|
7
|
+
Account.find_each do |account|
|
8
|
+
switch!(account.cname) if defined? Account
|
9
|
+
puts "********************** switched to #{account.cname} **********************"
|
10
|
+
Hyrax.config.curation_concerns.each do |cc|
|
11
|
+
puts "********************** checking #{cc}s **********************"
|
12
|
+
next if cc.count.zero?
|
13
|
+
|
14
|
+
cc.find_each(&:save)
|
15
|
+
end
|
16
|
+
rescue StandardError
|
17
|
+
puts "********************** failed to update account #{account.cname} **********************"
|
18
|
+
next
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/.keep.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
spec dir for RSpec
|
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :newspaper_page_solr_document, class: SolrDocument do
|
3
|
+
initialize_with do
|
4
|
+
new(id: '123456',
|
5
|
+
title_tesim: ['Page 1'],
|
6
|
+
has_model_ssim: ['NewspaperPage'],
|
7
|
+
issue_id_ssi: 'abc123',
|
8
|
+
file_set_ids_ssim: ['7891011'],
|
9
|
+
thumbnail_path_ss: '/downloads/123456?file=thumbnail')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :uploaded_pdf_file, class: Hyrax::UploadedFile do
|
3
|
+
initialize_with do
|
4
|
+
base = File.join(IiifPrint::GEM_PATH, 'spec', 'fixtures', 'files')
|
5
|
+
pdf_path = File.join(base, 'minimal-2-page.pdf')
|
6
|
+
new(file: File.open(pdf_path), user: create(:user))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :uploaded_txt_file, class: Hyrax::UploadedFile do
|
3
|
+
initialize_with do
|
4
|
+
base = File.join(IiifPrint::GEM_PATH, 'spec', 'fixtures', 'files')
|
5
|
+
file_path = File.join(base, 'ndnp-sample1-txt.txt')
|
6
|
+
new(file: File.open(file_path), user: create(:user))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :user do
|
3
|
+
id { "skroob" }
|
4
|
+
email { "spaceballs@example.com" }
|
5
|
+
password { "password_is_12345" }
|
6
|
+
initialize_with do
|
7
|
+
User.find_or_create_by(id: id) do |user|
|
8
|
+
user.email = email
|
9
|
+
user.password = password
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
Binary file
|
Binary file
|