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

Valkyrizes spec/abilities/ability_spec.rb. #6454

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

bwatson78
Copy link
Contributor

Fixes

Fixes spec/abilities/ability_spec.rb.

Summary

Valkyrizes spec/abilities/ability_spec.rb.

Type of change (for release notes)

  • notes-valkyrie Valkyrie Progress

Changes proposed in this pull request:

  • Since GenericWork is AF-specific, we switch on tests that focus on that class when rspec is ran on Dassie only.
  • Replace all creation calls to Valyrie-friendly factories.

@samvera/hyrax-code-reviewers

@bwatson78 bwatson78 added valkyrization notes-valkyrie Release Notes: Valkyrie specific labels Nov 17, 2023
@bwatson78 bwatson78 self-assigned this Nov 17, 2023
it { is_expected.to be_able_to(:read, GenericWork) }
it { is_expected.to be_able_to(:stats, GenericWork) }
it { is_expected.to be_able_to(:citation, GenericWork) }
unless I18n.t('hyrax.product_name') == 'Koppie'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
unless I18n.t('hyrax.product_name') == 'Koppie'
unless Hyrax.config.disable_wings

I'd rather stick to checking disable_wings for this.

Comment on lines +102 to +104
it { is_expected.to be_able_to(:read, GenericWork) }
it { is_expected.to be_able_to(:stats, GenericWork) }
it { is_expected.to be_able_to(:citation, GenericWork) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there equivalent checks that can be added for work resources?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That depends on Koppie setup. At the moment, there are no Work objects that come with an "empty" user ability inside Koppie.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#<Ability:0x00007fbcea58e388
 @aliased_actions={:read=>[:index, :show, :stats, :citation], :create=>[:new], :update=>[:edit, :versions, :file_manager]},
 @cache=#<Blacklight::AccessControls::PermissionsCache:0x00007fbceb1b8a78 @cache={}>,
 @current_user=
  #<User id: nil, email: "", created_at: nil, updated_at: nil, guest: false, facebook_handle: nil, twitter_handle: nil, googleplus_handle: nil, display_name: nil, address: nil, admin_area: nil, department: nil, title: nil, office: nil, chat_id: nil, website: nil, affiliation: nil, telephone: nil, avatar_file_name: nil, avatar_content_type: nil, avatar_file_size: nil, avatar_updated_at: nil, linkedin_handle: nil, orcid: nil, arkivo_token: "bu1ijt6+hMzK64oMYtN5/4K/+IMZFikx", arkivo_subscription: nil, zotero_token: nil, zotero_userid: nil, preferred_locale: nil>,
 @options={},
 @rules=
  [#<CanCan::Rulecan [:edit, :update, :destroy], [String], [], {}>,
   #<CanCan::Rulecan [:edit, :update, :destroy], [ActiveFedora::Base], [], {}>,
   #<CanCan::Rulecan [:edit, :update, :destroy], [SolrDocument], [], {}>,
   #<CanCan::Rulecan [:read], [String], [], {}>,
   #<CanCan::Rulecan [:read], [SolrDocument], [], {}>,
   #<CanCan::Rulecan [:read], [ActiveFedora::Base], [], {}>,
   #<CanCan::Rulecan [:discover], [String], [], {}>,
   #<CanCan::Rulecan [:discover], [SolrDocument], [], {}>,
   #<CanCan::Rulecan [:discover], [ActiveFedora::Base], [], {}>,
   #<CanCan::Rulecan [:download], [String], [], {}>,
   #<CanCan::Rulecan [:download], [SolrDocument], [], {}>,
   #<CanCan::Rulecan [:edit, :update, :destroy], [Hyrax::Resource], [], {}>,
   #<CanCan::Rulecannot [:index], [Hydra::AccessControls::Embargo], [], {}>,
   #<CanCan::Rulecannot [:index], [Hydra::AccessControls::Lease], [], {}>,
   #<CanCan::Rulecan [:read], [Hyrax::Operation(id: integer, status: string, operation_type: string, job_class: string, job_id: string, type: string, message: text, user_id: integer, parent_id: integer, lft: integer, rgt: integer, depth: integer, children_count: integer, created_at: datetime, updated_at: datetime)], [], {:user_id=>nil}>,
   #<CanCan::Rulecan [:edit, :update, :toggle_trophy], [User(id: integer, email: string, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, created_at: datetime, updated_at: datetime, guest: boolean, facebook_handle: string, twitter_handle: string, googleplus_handle: string, display_name: string, address: string, admin_area: string, department: string, title: string, office: string, chat_id: string, website: string, affiliation: string, telephone: string, avatar_file_name: string, avatar_content_type: string, avatar_file_size: integer, avatar_updated_at: datetime, linkedin_handle: string, orcid: string, arkivo_token: string, arkivo_subscription: string, zotero_token: binary, zotero_userid: string, preferred_locale: string)], [], {:id=>nil}>,
   #<CanCan::Rulecan [:show], [User(id: integer, email: string, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, created_at: datetime, updated_at: datetime, guest: boolean, facebook_handle: string, twitter_handle: string, googleplus_handle: string, display_name: string, address: string, admin_area: string, department: string, title: string, office: string, chat_id: string, website: string, affiliation: string, telephone: string, avatar_file_name: string, avatar_content_type: string, avatar_file_size: integer, avatar_updated_at: datetime, linkedin_handle: string, orcid: string, arkivo_token: string, arkivo_subscription: string, zotero_token: binary, zotero_userid: string, preferred_locale: string)], [], {}>,
   #<CanCan::Rulecan [:read], [ContentBlock(id: integer, name: string, value: text, created_at: datetime, updated_at: datetime, external_key: string)], [], {}>,
   #<CanCan::Rulecan [:transfer], [String], [], {}>,
   #<CanCan::Rulecan [:accept], [ProxyDepositRequest(id: integer, work_id: string, sending_user_id: integer, receiving_user_id: integer, fulfillment_date: datetime, status: string, sender_comment: text, receiver_comment: text, created_at: datetime, updated_at: datetime)], [], {:receiving_user_id=>nil, :status=>"pending"}>,
   #<CanCan::Rulecan [:reject], [ProxyDepositRequest(id: integer, work_id: string, sending_user_id: integer, receiving_user_id: integer, fulfillment_date: datetime, status: string, sender_comment: text, receiver_comment: text, created_at: datetime, updated_at: datetime)], [], {:receiving_user_id=>nil, :status=>"pending"}>,
   #<CanCan::Rulecan [:destroy], [ProxyDepositRequest(id: integer, work_id: string, sending_user_id: integer, receiving_user_id: integer, fulfillment_date: datetime, status: string, sender_comment: text, receiver_comment: text, created_at: datetime, updated_at: datetime)], [], {:sending_user_id=>nil, :status=>"pending"}>,
   #<CanCan::Rulecan [:edit, :update, :destroy], [Hyrax::AdministrativeSet], [], {}>,
   #<CanCan::Rulecan [:deposit], [AdminSet], [], {}>,
   #<CanCan::Rulecan [:deposit], [Hyrax::AdministrativeSet], [], {}>,
   #<CanCan::Rulecan [:view_admin_show], [AdminSet], [], {}>,
   #<CanCan::Rulecan [:view_admin_show], [Hyrax::AdministrativeSet], [], {}>,
   #<CanCan::Rulecan [:read], [Hyrax::AdministrativeSet], [], {}>,
   #<CanCan::Rulecan [:review], [:submissions], [], {}>,
   #<CanCan::Rulecan [:edit, :update, :destroy], [Hyrax::PcdmCollection], [], {}>,
   #<CanCan::Rulecan [:deposit], [Hyrax::PcdmCollection], [], {}>,
   #<CanCan::Rulecan [:view_admin_show], [Hyrax::PcdmCollection], [], {}>,
   #<CanCan::Rulecan [:read], [Hyrax::PcdmCollection], [], {}>,
   #<CanCan::Rulecan [:edit, :update, :destroy], [CollectionResource], [], {}>,
   #<CanCan::Rulecan [:deposit], [CollectionResource], [], {}>,
   #<CanCan::Rulecan [:view_admin_show], [CollectionResource], [], {}>,
   #<CanCan::Rulecan [:read], [CollectionResource], [], {}>,
   #<CanCan::Rulecan [:deposit], [SolrDocument], [], {}>,
   #<CanCan::Rulecan [:deposit], [String], [], {}>,
   #<CanCan::Rulecan [:view_admin_show], [SolrDocument], [], {}>,
   #<CanCan::Rulecan [:create_collection_of_type], [Hyrax::CollectionType(id: integer, title: string, description: text, machine_id: string, nestable: boolean, discoverable: boolean, sharable: boolean, allow_multiple_membership: boolean, require_membership: boolean, assigns_workflow: boolean, assigns_visibility: boolean, share_applies_to_new_works: boolean, brandable: boolean, badge_color: string)], [], {}>,
   #<CanCan::Rulecan [:create, :edit, :update, :destroy], [Hyrax::PermissionTemplate(id: integer, source_id: string, visibility: string, created_at: datetime, updated_at: datetime, release_date: date, release_period: string)], [], {}>,
   #<CanCan::Rulecan [:create, :edit, :update, :destroy], [Hyrax::PermissionTemplateAccess(id: integer, permission_template_id: integer, agent_type: string, agent_id: string, access: string, created_at: datetime, updated_at: datetime)], [], {}>,
   #<CanCan::Rulecan [:edit, :update, :destroy], [SolrDocument], [], {}>,
   #<CanCan::Rulecan [:read], [SolrDocument], [], {}>,
   #<CanCan::Rulecan [:create, :destroy], [Trophy(id: integer, user_id: integer, work_id: string, created_at: datetime, updated_at: datetime)], [], {}>],
 @rules_index=
  {String=>[0, 3, 6, 9, 18, 38],
   ActiveFedora::Base=>[1, 5, 8],
   SolrDocument=>[2, 4, 7, 10, 37, 39, 43, 44],
   Hyrax::Resource=>[11],
   Hydra::AccessControls::Embargo=>[12],
   Hydra::AccessControls::Lease=>[13],
   Hyrax::Operation(id: integer, status: string, operation_type: string, job_class: string, job_id: string, type: string, message: text, user_id: integer, parent_id: integer, lft: integer, rgt: integer, depth: integer, children_count: integer, created_at: datetime, updated_at: datetime)=>
    [14],
   User(id: integer, email: string, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, created_at: datetime, updated_at: datetime, guest: boolean, facebook_handle: string, twitter_handle: string, googleplus_handle: string, display_name: string, address: string, admin_area: string, department: string, title: string, office: string, chat_id: string, website: string, affiliation: string, telephone: string, avatar_file_name: string, avatar_content_type: string, avatar_file_size: integer, avatar_updated_at: datetime, linkedin_handle: string, orcid: string, arkivo_token: string, arkivo_subscription: string, zotero_token: binary, zotero_userid: string, preferred_locale: string)=>
    [15, 16],
   ContentBlock(id: integer, name: string, value: text, created_at: datetime, updated_at: datetime, external_key: string)=>[17],
   ProxyDepositRequest(id: integer, work_id: string, sending_user_id: integer, receiving_user_id: integer, fulfillment_date: datetime, status: string, sender_comment: text, receiver_comment: text, created_at: datetime, updated_at: datetime)=>
    [19, 20, 21],
   Hyrax::AdministrativeSet=>[22, 24, 26, 27],
   AdminSet=>[23, 25],
   :submissions=>[28],
   Hyrax::PcdmCollection=>[29, 30, 31, 32],
   CollectionResource=>[33, 34, 35, 36],
   Hyrax::CollectionType(id: integer, title: string, description: text, machine_id: string, nestable: boolean, discoverable: boolean, sharable: boolean, allow_multiple_membership: boolean, require_membership: boolean, assigns_workflow: boolean, assigns_visibility: boolean, share_applies_to_new_works: boolean, brandable: boolean, badge_color: string)=>
    [40],
   Hyrax::PermissionTemplate(id: integer, source_id: string, visibility: string, created_at: datetime, updated_at: datetime, release_date: date, release_period: string)=>
    [41],
   Hyrax::PermissionTemplateAccess(id: integer, permission_template_id: integer, agent_type: string, agent_id: string, access: string, created_at: datetime, updated_at: datetime)=>
    [42],
   Trophy(id: integer, user_id: integer, work_id: string, created_at: datetime, updated_at: datetime)=>[45]},
 @user=
  #<User id: nil, email: "", created_at: nil, updated_at: nil, guest: false, facebook_handle: nil, twitter_handle: nil, googleplus_handle: nil, display_name: nil, address: nil, admin_area: nil, department: nil, title: nil, office: nil, chat_id: nil, website: nil, affiliation: nil, telephone: nil, avatar_file_name: nil, avatar_content_type: nil, avatar_file_size: nil, avatar_updated_at: nil, linkedin_handle: nil, orcid: nil, arkivo_token: "bu1ijt6+hMzK64oMYtN5/4K/+IMZFikx", arkivo_subscription: nil, zotero_token: nil, zotero_userid: nil, preferred_locale: nil>,
 @user_groups=["public"]>

@bwatson78 bwatson78 force-pushed the updates_abilities_ability_spec branch from 85fcbc5 to 43f18da Compare November 17, 2023 19:22
@bwatson78 bwatson78 force-pushed the updates_abilities_ability_spec branch from 4092ee2 to 4e0ad59 Compare November 17, 2023 19:44
@dlpierce dlpierce merged commit e2bdd9a into main Nov 17, 2023
4 checks passed
@dlpierce dlpierce deleted the updates_abilities_ability_spec branch November 17, 2023 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-valkyrie Release Notes: Valkyrie specific valkyrization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants