Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test creation of collections when valkyrie resource & fix failures #5267

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

elrayle
Copy link
Contributor

@elrayle elrayle commented Dec 3, 2021

Add tests for creating collections when the collection is processed as a Hyrax::PcdmCollection which is a Valkyrie::Resource. Marks pending tests for other actions (e.g. update, edit, show), except for a few that pass as written.

Fixes several failing tests:

  • parent collection not assigned
  • default collection type not assigned when collection type is missing

@samvera/hyrax-code-reviewers

@elrayle elrayle force-pushed the val_col_create_tests branch from d478da9 to 6185e98 Compare December 3, 2021 23:41
@elrayle elrayle marked this pull request as ready for review December 3, 2021 23:45
@elrayle elrayle marked this pull request as draft December 6, 2021 16:13
@elrayle elrayle force-pushed the val_col_create_tests branch 4 times, most recently from 3b3659f to 3f07cf1 Compare December 9, 2021 15:51
@elrayle elrayle changed the title test creation of collections when valkyrie resource test creation of collections when valkyrie resource & fix failures Dec 9, 2021
…mCollection’

NOTE: A few tests pass without requiring changes.  Those were not marked pending.
@elrayle elrayle force-pushed the val_col_create_tests branch from 3f07cf1 to ebe5f72 Compare December 9, 2021 17:29
@elrayle elrayle marked this pull request as ready for review December 9, 2021 17:44
@@ -220,6 +220,7 @@ def valkyrie_create
@collection = transactions['change_set.create_collection']
.with_step_args(
'change_set.set_user_as_depositor' => { user: current_user },
'change_set.add_to_collections' => { collection_ids: Array(params[:parent_id]) },
Copy link
Contributor Author

@elrayle elrayle Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes failure to set parent collection in test: #create when params includes parent_id

@@ -390,7 +395,8 @@ def collection_params
form_class.model_attributes(params[:collection])
else
params.permit(collection: {})[:collection]
.merge(params.permit(:collection_type_gid))
.merge(params.permit(:collection_type_gid)
.with_defaults(collection_type_gid: default_collection_type_gid))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes failure to set collection type in test: #create when setting collection type and collection type is not passed

@dlpierce dlpierce merged commit d76407e into main Dec 10, 2021
@dlpierce dlpierce deleted the val_col_create_tests branch December 10, 2021 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants