You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;drHyrax::Forms::PcdmCollectionForm changes on prepoluate but does not test it, and the collection generator creates a form that inherits from Hyrax::Forms::PcdmCollectionForm and tests (and fails) that the #prepopulate! method does not change the form.
On 715f599 (HEAD of main of of writing this issue), when I adjust the Hyrax::Forms::PcdmCollectionForm spec to use the it_behaves_like 'a Valkyrie::ChangeSet I get the following failed spec:
1) Hyrax::Forms::PcdmCollectionForm behaves like a Valkyrie::ChangeSet #prepopulate! doesn't make it look changed
Failure/Error: DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
expected `#<Hyrax::Forms::PcdmCollectionForm:0x0000ffff700c79a0 @fields={"human_readable_type"=>"Collection", "...rs:0x0000ffff71b06000 @base=#<Hyrax::Forms::PcdmCollectionForm:0x0000ffff700c79a0 ...>, @errors=[]>>.changed?` to be falsey, got true
Shared Example Group: "a Valkyrie::ChangeSet" called from ./spec/forms/hyrax/forms/pcdm_collection_form_spec.rb:8
# /app/bundle/ruby/3.2.0/gems/valkyrie-3.1.1/lib/valkyrie/specs/shared_specs/change_set.rb:48:in `block (3 levels) in <top (required)>'
# /app/bundle/ruby/3.2.0/gems/webmock-3.19.1/lib/webmock/rspec.rb:39:in `block (2 levels) in <top (required)>'
The spec is as follows:
describe"#prepopulate!"doit"doesn't make it look changed"doexpect(change_set).not_tobe_changedchange_set.prepopulate!expect(change_set).not_tobe_changedendend
When we dig a bit deeper, there are three properties that have pre-populators:
:version
:banner_info
:logo_info
And in the above RSpec example, when we ask the change_set what has changed after #prepopulate!, we get the following: {"version"=>true, "banner_info"=>true, "logo_info"=>true}
This is problematic for a few reasons. First Valkyrie does not account for pre-populators. And more vexing, the generator for a collection form and resource has the following (first the form and then the spec):
This test is fragile in that it does not account for the fact that we
can specify a :prepopulate option for a property.
When you specify the `:prepopulate` option (as in
`Hyrax::Form::PcdmCollection`) and use this shared spec, then the now
deleted spec fails with no recourse.
Related to:
- samvera/hyrax#6702
- samvera/hyrax#6703
tl;dr
Hyrax::Forms::PcdmCollectionForm
changes on prepoluate but does not test it, and the collection generator creates a form that inherits fromHyrax::Forms::PcdmCollectionForm
and tests (and fails) that the#prepopulate!
method does not change the form.Error demonstration:
On 715f599 (HEAD of
main
of of writing this issue), when I adjust theHyrax::Forms::PcdmCollectionForm
spec to use theit_behaves_like 'a Valkyrie::ChangeSet
I get the following failed spec:The spec is as follows:
When we dig a bit deeper, there are three properties that have pre-populators:
:version
:banner_info
:logo_info
And in the above RSpec example, when we ask the
change_set
what has changed after#prepopulate!
, we get the following:{"version"=>true, "banner_info"=>true, "logo_info"=>true}
This is problematic for a few reasons. First Valkyrie does not account for pre-populators. And more vexing, the generator for a collection form and resource has the following (first the form and then the spec):
The text was updated successfully, but these errors were encountered: