From 46d5a6b34bebd161f098fe3e2b425b0f13f56752 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Mon, 16 Oct 2023 13:53:18 -0500 Subject: [PATCH] Add new rubocops --- .rubocop.yml | 46 +++++ .rubocop_todo.yml | 174 +++++++----------- app/models/marc_fields/issn.rb | 2 +- .../access_panels/library_component_spec.rb | 6 +- .../access_panels/online_component_spec.rb | 4 +- spec/features/access_panels/exhibit_spec.rb | 2 +- .../access_panels/library_location_spec.rb | 2 +- .../access_panels/online_books_spec.rb | 2 +- spec/features/access_panels/online_spec.rb | 2 +- spec/features/alternate_catalog_spec.rb | 2 +- spec/features/article_display_spec.rb | 4 +- spec/features/article_eds_facets_spec.rb | 2 +- spec/features/article_home_page_spec.rb | 2 +- spec/features/article_record_toolbar_spec.rb | 4 +- spec/features/article_searching_spec.rb | 6 +- spec/features/backend_lookup_spec.rb | 2 +- .../accessibility_spec.rb | 2 +- .../bookmarks_path_spec.rb | 2 +- .../bookmarks_text_spec.rb | 2 +- .../emailing_records_spec.rb | 2 +- .../blacklight_customizations/facets_spec.rb | 8 +- .../librarian_view_spec.rb | 2 +- .../record_metadata_spec.rb | 2 +- .../record_toolbar_spec.rb | 8 +- .../results_document_spec.rb | 2 +- .../results_toolbar_spec.rb | 2 +- .../search_toolbar_spec.rb | 2 +- spec/features/bookmarking_items_spec.rb | 2 +- spec/features/brief_view_spec.rb | 6 +- spec/features/callnum_search_spec.rb | 2 +- spec/features/callnumber_browse_spec.rb | 2 +- spec/features/clear_search_box_spec.rb | 2 +- spec/features/connection_form_spec.rb | 2 +- spec/features/course_reserves_browse_spec.rb | 2 +- spec/features/date_range_spec.rb | 2 +- spec/features/feedback_form_spec.rb | 2 +- spec/features/gallery_view_spec.rb | 2 +- spec/features/home_page_spec.rb | 2 +- spec/features/image_collection_spec.rb | 2 +- spec/features/merged_file_collection_spec.rb | 2 +- .../features/merged_image_collections_spec.rb | 2 +- spec/features/mhld_spec.rb | 4 +- spec/features/options_facet_spec.rb | 2 +- spec/features/purl_embed_spec.rb | 2 +- spec/features/quick_report_spec.rb | 2 +- .../responsive/home_page_responsive_spec.rb | 4 +- .../record_toolbar_responsive_spec.rb | 4 +- .../responsive/results_toolbar_spec.rb | 6 +- spec/features/responsive/results_view_spec.rb | 2 +- .../search_subnavbar_responsive_spec.rb | 2 +- .../search_toolbar_responsive_spec.rb | 6 +- spec/features/skip_to_nav_spec.rb | 4 +- .../sort_and_per_page_dropdown_spec.rb | 2 +- spec/features/stackmap_spec.rb | 2 +- spec/features/tabbed_selections_spec.rb | 4 +- spec/features/top_nav_spec.rb | 2 +- spec/features/zero_results_spec.rb | 6 +- spec/integration/record_view_spec.rb | 2 +- spec/models/marc_extractor_spec.rb | 2 +- spec/models/nearby_on_shelf_spec.rb | 2 +- spec/rails_helper.rb | 4 +- spec/spec_helper.rb | 2 +- 62 files changed, 196 insertions(+), 198 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 4be7c2a1c..b768bb823 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -465,4 +465,50 @@ Style/YAMLFileRead: # new in 1.53 RSpec/ReceiveMessages: # new in 2.23 Enabled: true RSpec/Rails/NegationBeValid: # new in 2.23 + Enabled: true +Style/SingleLineDoEndBlock: # new in 1.57 + Enabled: true +Rails/DangerousColumnNames: # new in 2.21 + Enabled: true +Rails/RedundantActiveRecordAllMethod: # new in 2.21 + Enabled: false # https://github.com/rspec/rspec-rails/issues/2701 +Rails/SelectMap: # new in 2.21 + Enabled: true +Rails/UnusedRenderContent: # new in 2.21 + Enabled: true +Capybara/ClickLinkOrButtonStyle: # new in 2.19 + Enabled: false +Capybara/RSpec/HaveSelector: # new in 2.19 + Enabled: true +Capybara/RSpec/PredicateMatcher: # new in 2.19 + Enabled: true +FactoryBot/IdSequence: # new in <> + Enabled: true +RSpec/EmptyMetadata: # new in 2.24 + Enabled: true +RSpec/Eq: # new in 2.24 + Enabled: true +RSpec/MetadataStyle: # new in 2.24 + Enabled: true +RSpec/SpecFilePathFormat: # new in 2.24 + Enabled: true +RSpec/SpecFilePathSuffix: # new in 2.24 + Enabled: true +Performance/MapMethodChain: # new in 1.19 + Enabled: true +Lint/ItWithoutArgumentsInBlock: # new in 1.59 + Enabled: true +Lint/LiteralAssignmentInCondition: # new in 1.58 + Enabled: true +Style/SuperWithArgsParentheses: # new in 1.58 + Enabled: true +Rails/EnvLocal: # new in 2.22 + Enabled: true +Capybara/RedundantWithinFind: # new in 2.20 + Enabled: true +FactoryBot/ExcessiveCreateList: # new in 2.25 + Enabled: true +RSpec/RedundantPredicateMatcher: # new in 2.26 + Enabled: true +RSpec/RemoveConst: # new in 2.26 Enabled: true \ No newline at end of file diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8aa749169..d9ed0ab78 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,17 +1,16 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-09-11 09:49:23 UTC using RuboCop version 1.56.3. +# on 2024-01-16 17:52:42 UTC using RuboCop version 1.59.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 25 +# Offense count: 21 Capybara/SpecificActions: Exclude: - 'spec/features/blacklight_customizations/emailing_records_spec.rb' - 'spec/features/brief_view_spec.rb' - - 'spec/features/gallery_view_spec.rb' - 'spec/features/image_collection_spec.rb' - 'spec/features/merged_file_collection_spec.rb' - 'spec/features/merged_image_collections_spec.rb' @@ -19,14 +18,13 @@ Capybara/SpecificActions: - 'spec/features/responsive/record_toolbar_responsive_spec.rb' - 'spec/features/skip_to_nav_spec.rb' - 'spec/features/sort_and_per_page_dropdown_spec.rb' - - 'spec/features/stackmap_spec.rb' - 'spec/features/tabbed_selections_spec.rb' -# Offense count: 177 +# Offense count: 180 Capybara/VisibilityMatcher: Enabled: false -# Offense count: 8 +# Offense count: 7 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: with_first_argument, with_fixed_indentation @@ -34,7 +32,6 @@ Layout/ArgumentAlignment: Exclude: - 'app/controllers/catalog_controller.rb' - 'app/helpers/feedback_form_helper.rb' - - 'spec/controllers/article_controller_spec.rb' - 'spec/models/eds/repository_spec.rb' - 'spec/views/catalog/_accordion_section_course_reserves.html.erb_spec.rb' - 'spec/views/catalog/_accordion_section_library.html.erb_spec.rb' @@ -47,7 +44,7 @@ Layout/BeginEndAlignment: Exclude: - 'app/models/performance_alerts.rb' -# Offense count: 13 +# Offense count: 15 # This cop supports safe autocorrection (--autocorrect). Layout/BlockEndNewline: Exclude: @@ -154,7 +151,7 @@ Layout/EndOfLine: Exclude: - 'app/views/catalog/opensearch.xml.builder' -# Offense count: 9 +# Offense count: 8 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. Layout/ExtraSpacing: @@ -163,7 +160,6 @@ Layout/ExtraSpacing: - 'spec/controllers/concerns/replace_special_quotes_spec.rb' - 'spec/features/article_record_toolbar_spec.rb' - 'spec/lib/holdings/location_spec.rb' - - 'spec/models/concerns/cjk_query_spec.rb' - 'spec/models/concerns/marc_links_spec.rb' - 'spec/models/marc_fields/marc_field_wrapper_spec.rb' @@ -177,14 +173,14 @@ Layout/FirstArgumentIndentation: - 'spec/views/catalog/record/_marc_contents_summary.html.erb_spec.rb' - 'spec/views/catalog/record/_marc_subjects.html.erb_spec.rb' -# Offense count: 20 +# Offense count: 40 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_brackets Layout/FirstArrayElementIndentation: EnforcedStyle: consistent -# Offense count: 5 +# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: special_inside_parentheses, consistent, align_braces @@ -192,9 +188,8 @@ Layout/FirstHashElementIndentation: Exclude: - 'app/controllers/articles_controller.rb' - 'app/controllers/catalog_controller.rb' - - 'spec/views/shared/_zero_results.html.erb_spec.rb' -# Offense count: 130 +# Offense count: 129 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. # SupportedHashRocketStyles: key, separator, table @@ -208,7 +203,6 @@ Layout/HashAlignment: - 'app/models/eds/session.rb' - 'app/models/marc_fields/linked_related_works.rb' - 'app/views/catalog/index.atom.builder' - - 'spec/controllers/article_controller_spec.rb' - 'spec/features/article_searching_spec.rb' - 'spec/models/concerns/cjk_query_spec.rb' @@ -256,15 +250,7 @@ Layout/LineEndStringConcatenationIndentation: - 'spec/features/alternate_catalog_spec.rb' - 'spec/views/catalog/_alternate_catalog.html.erb_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: symmetrical, new_line, same_line -Layout/MultilineArrayBraceLayout: - Exclude: - - 'spec/lib/holdings/status/noncirc_spec.rb' - -# Offense count: 13 +# Offense count: 15 # This cop supports safe autocorrection (--autocorrect). Layout/MultilineBlockLayout: Exclude: @@ -299,14 +285,13 @@ Layout/MultilineMethodCallBraceLayout: - 'spec/views/catalog/_accordion_section_course_reserves.html.erb_spec.rb' - 'spec/views/catalog/_accordion_section_library.html.erb_spec.rb' -# Offense count: 10 +# Offense count: 7 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: aligned, indented Layout/MultilineOperationIndentation: Exclude: - 'app/helpers/feedback_form_helper.rb' - - 'lib/holdings/status/unavailable.rb' - 'lib/search_query_modifier.rb' - 'spec/helpers/application_helper_spec.rb' @@ -325,8 +310,9 @@ Layout/SpaceAfterComma: # Offense count: 22 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals. # SupportedStylesForExponentOperator: space, no_space +# SupportedStylesForRationalLiterals: space, no_space Layout/SpaceAroundOperators: Exclude: - 'app/views/catalog/index.atom.builder' @@ -396,26 +382,23 @@ Lint/AmbiguousOperatorPrecedence: Exclude: - 'app/models/marc_fields/linked_related_works.rb' -# Offense count: 17 +# Offense count: 14 # This cop supports safe autocorrection (--autocorrect). Lint/AmbiguousRegexpLiteral: Exclude: - 'spec/controllers/concerns/callnumber_search_spec.rb' - 'spec/features/blacklight_customizations/results_document_spec.rb' - - 'spec/features/home_page_spec.rb' - 'spec/helpers/collection_helper_spec.rb' - 'spec/helpers/masthead_helper_spec.rb' - 'spec/helpers/record_helper_spec.rb' - - 'spec/lib/holdings/location_spec.rb' - 'spec/models/concerns/mods_data_spec.rb' - 'spec/tasks/fixtures_indexer_spec.rb' -# Offense count: 2 +# Offense count: 1 # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. Lint/DuplicateBranch: Exclude: - 'app/models/concerns/eds_subjects.rb' - - 'app/services/live_lookup/sirsi.rb' # Offense count: 1 # Configuration parameters: AllowComments, AllowEmptyLambdas. @@ -428,7 +411,7 @@ Lint/LiteralAsCondition: Exclude: - 'app/models/concerns/course_reserves.rb' -# Offense count: 8 +# Offense count: 7 # Configuration parameters: AllowedParentClasses. Lint/MissingSuper: Exclude: @@ -437,8 +420,6 @@ Lint/MissingSuper: - 'app/components/access_panels/library_component.rb' - 'app/components/access_panels/library_location_component.rb' - 'app/components/advanced_search_range_limit_component.rb' - - 'app/components/blacklight/constraint_layout_component.rb' - - 'app/components/blacklight/facet_field_component.rb' - 'app/components/searchworks/response/facet_group_component.rb' - 'app/models/marc_fields/linked_author.rb' @@ -459,14 +440,6 @@ Lint/RedundantCopDisableDirective: Exclude: - 'spec/models/marc_fields/linked_author_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowedMethods. -# AllowedMethods: present?, blank?, presence, presence_in, try, try!, in? -Lint/SafeNavigationChain: - Exclude: - - 'app/models/solr_document.rb' - # Offense count: 13 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. @@ -477,13 +450,11 @@ Lint/SymbolConversion: - 'spec/models/citation_spec.rb' - 'spec/models/json_results_document_presenter_spec.rb' -# Offense count: 14 +# Offense count: 12 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. Lint/UnusedBlockArgument: Exclude: - - 'app/controllers/concerns/all_caps_params.rb' - - 'app/controllers/concerns/replace_special_quotes.rb' - 'app/models/article_search_builder.rb' - 'app/models/marc_fields/issn.rb' - 'config/initializers/devise.rb' @@ -517,7 +488,7 @@ Lint/UselessAssignment: - 'lib/hours_request.rb' - 'spec/features/blacklight_customizations/emailing_records_spec.rb' -# Offense count: 67 +# Offense count: 63 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 59 @@ -538,22 +509,22 @@ Metrics/CollectionLiteralLength: Exclude: - 'lib/constants.rb' -# Offense count: 32 +# Offense count: 27 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 22 -# Offense count: 76 +# Offense count: 74 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 34 -# Offense count: 4 +# Offense count: 3 # Configuration parameters: CountComments, CountAsOne. Metrics/ModuleLength: - Max: 1020 + Max: 157 -# Offense count: 23 +# Offense count: 19 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 24 @@ -682,14 +653,13 @@ Performance/TimesMap: Exclude: - 'spec/features/access_panels/exhibit_spec.rb' -# Offense count: 22 +# Offense count: 17 RSpec/AnyInstance: Exclude: - 'spec/controllers/catalog_controller_spec.rb' - 'spec/controllers/feedback_forms_controller_spec.rb' - 'spec/features/access_panels/online_spec.rb' - 'spec/features/article_display_spec.rb' - - 'spec/lib/holdings/status_spec.rb' - 'spec/lib/purl_embed_spec.rb' - 'spec/presenters/sms_presenter_spec.rb' - 'spec/support/stub_article_service.rb' @@ -702,17 +672,16 @@ RSpec/BeforeAfterAll: - 'spec/helpers/results_document_helper_spec.rb' - 'spec/lib/sms_spec.rb' -# Offense count: 195 +# Offense count: 193 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnabledMethods. RSpec/Capybara/FeatureMethods: Enabled: false -# Offense count: 21 +# Offense count: 18 # This cop supports safe autocorrection (--autocorrect). RSpec/ContextMethod: Exclude: - - 'spec/controllers/article_controller_spec.rb' - 'spec/helpers/article_helper_spec.rb' - 'spec/models/concerns/eds_links_spec.rb' - 'spec/models/concerns/eds_subjects_spec.rb' @@ -720,20 +689,20 @@ RSpec/ContextMethod: - 'spec/routing/article_routes_spec.rb' - 'spec/services/eds/search_service_spec.rb' -# Offense count: 222 +# Offense count: 209 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: Enabled: false -# Offense count: 136 +# Offense count: 88 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: SkipBlocks, EnforcedStyle. # SupportedStyles: described_class, explicit RSpec/DescribedClass: Enabled: false -# Offense count: 300 +# Offense count: 269 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowConsecutiveOneLiners. RSpec/EmptyLineAfterExample: @@ -753,19 +722,19 @@ RSpec/EmptyLineAfterSubject: Exclude: - 'spec/components/access_panels/library_component_spec.rb' -# Offense count: 225 +# Offense count: 222 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 30 -# Offense count: 566 +# Offense count: 506 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. # DisallowedExamples: works RSpec/ExampleWording: Enabled: false -# Offense count: 9 +# Offense count: 8 # This cop supports safe autocorrection (--autocorrect). RSpec/ExcessiveDocstringSpacing: Exclude: @@ -774,7 +743,7 @@ RSpec/ExcessiveDocstringSpacing: - 'spec/features/responsive/search_toolbar_responsive_spec.rb' - 'spec/mailers/search_works_record_mailer_spec.rb' -# Offense count: 9 +# Offense count: 8 # This cop supports safe autocorrection (--autocorrect). RSpec/ExpectActual: Exclude: @@ -783,7 +752,7 @@ RSpec/ExpectActual: - 'spec/controllers/hours_controller_spec.rb' - 'spec/controllers/selected_databases_controller_spec.rb' -# Offense count: 44 +# Offense count: 38 RSpec/ExpectInHook: Enabled: false @@ -822,7 +791,7 @@ RSpec/IteratedExpectation: - 'spec/models/concerns/solr_bookplates_spec.rb' - 'spec/tasks/fixtures_indexer_spec.rb' -# Offense count: 57 +# Offense count: 59 # This cop supports safe autocorrection (--autocorrect). RSpec/LeadingSubject: Enabled: false @@ -841,11 +810,11 @@ RSpec/MultipleDescribes: - 'spec/features/preview_spec.rb' - 'spec/features/quick_report_spec.rb' -# Offense count: 657 +# Offense count: 632 RSpec/MultipleExpectations: Max: 24 -# Offense count: 88 +# Offense count: 96 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: Max: 12 @@ -856,13 +825,13 @@ RSpec/MultipleSubjects: Exclude: - 'spec/services/eds/search_service_spec.rb' -# Offense count: 297 +# Offense count: 300 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # SupportedStyles: always, named_only RSpec/NamedSubject: Enabled: false -# Offense count: 116 +# Offense count: 101 # Configuration parameters: AllowedGroups. RSpec/NestedGroups: Max: 6 @@ -885,7 +854,7 @@ RSpec/PendingWithoutReason: - 'spec/views/catalog/record/_mods_bibliographic.html.erb_spec.rb' - 'spec/views/catalog/record/_mods_upper_metadata_items.html.erb_spec.rb' -# Offense count: 48 +# Offense count: 45 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers. # SupportedStyles: inflected, explicit @@ -901,8 +870,6 @@ RSpec/PredicateMatcher: - 'spec/models/concerns/collection_member_spec.rb' - 'spec/models/concerns/course_reserves_spec.rb' - 'spec/models/concerns/database_document_spec.rb' - - 'spec/models/concerns/digital_collection_spec.rb' - - 'spec/models/concerns/eds_document.rb' - 'spec/models/concerns/eds_links_spec.rb' - 'spec/models/eds/repository_spec.rb' @@ -922,12 +889,11 @@ RSpec/ReceiveCounts: - 'spec/tasks/fixtures_indexer_spec.rb' - 'spec/views/collection_members/_file_collection_members.html.erb_spec.rb' -# Offense count: 14 +# Offense count: 11 RSpec/RepeatedDescription: Exclude: - 'spec/controllers/catalog_controller_spec.rb' - 'spec/features/blacklight_customizations/devise_spec.rb' - - 'spec/lib/holdings/item_spec.rb' - 'spec/lib/page_location_spec.rb' # Offense count: 4 @@ -942,7 +908,7 @@ RSpec/ScatteredLet: Exclude: - 'spec/presenters/sms_presenter_spec.rb' -# Offense count: 69 +# Offense count: 61 RSpec/StubbedMock: Enabled: false @@ -971,7 +937,7 @@ RSpec/SubjectStub: - 'spec/presenters/facet_options_presenter_spec.rb' - 'spec/presenters/presenter_format_spec.rb' -# Offense count: 73 +# Offense count: 70 # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. RSpec/VerifiedDoubles: Enabled: false @@ -1002,7 +968,7 @@ Rails/ApplicationRecord: Exclude: - 'app/models/user.rb' -# Offense count: 15 +# Offense count: 14 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent. Rails/Blank: @@ -1018,7 +984,6 @@ Rails/Blank: - 'app/models/concerns/marc_bound_with_note.rb' - 'app/models/hathi_trust_links.rb' - 'app/models/marc_field.rb' - - 'lib/holdings/status/in_process.rb' # Offense count: 5 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -1055,13 +1020,12 @@ Rails/DynamicFindBy: Exclude: - 'spec/lib/holdings_spec.rb' -# Offense count: 11 +# Offense count: 10 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: slashes, arguments Rails/FilePath: Exclude: - - 'app/controllers/catalog_controller.rb' - 'app/controllers/concerns/backend_lookup.rb' - 'app/controllers/hours_controller.rb' - 'app/controllers/sfx_data_controller.rb' @@ -1164,11 +1128,10 @@ Rails/RakeEnvironment: Exclude: - 'lib/tasks/searchworks.rake' -# Offense count: 4 +# Offense count: 3 # This cop supports safe autocorrection (--autocorrect). Rails/RootPublicPath: Exclude: - - 'app/controllers/catalog_controller.rb' - 'app/controllers/concerns/backend_lookup.rb' - 'app/controllers/hours_controller.rb' - 'app/controllers/sfx_data_controller.rb' @@ -1201,7 +1164,7 @@ Style/AndOr: - 'app/views/catalog/index.mobile.builder' - 'app/views/catalog/show.mobile.builder' -# Offense count: 81 +# Offense count: 73 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces @@ -1269,12 +1232,12 @@ Style/ConditionalAssignment: - 'app/models/eds/repository.rb' - 'app/views/catalog/_show_default.mobile.builder' -# Offense count: 159 +# Offense count: 148 # Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false -# Offense count: 6 +# Offense count: 5 # This cop supports safe autocorrection (--autocorrect). Style/EmptyCaseCondition: Exclude: @@ -1297,12 +1260,11 @@ Style/EmptyMethod: Style/Encoding: Enabled: false -# Offense count: 2 +# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/ExpandPathArguments: Exclude: - 'Rakefile' - - 'spec/spec_helper.rb' # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). @@ -1311,7 +1273,7 @@ Style/FetchEnvVar: Exclude: - 'app/models/user.rb' -# Offense count: 536 +# Offense count: 519 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never @@ -1330,7 +1292,7 @@ Style/GlobalStdStream: Style/GuardClause: Enabled: false -# Offense count: 5 +# Offense count: 6 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowedReceivers. # AllowedReceivers: Thread.current @@ -1340,7 +1302,7 @@ Style/HashEachMethods: - 'spec/lib/search_works_marc/instrumentation_spec.rb' - 'spec/models/marc_field_spec.rb' -# Offense count: 50 +# Offense count: 49 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys @@ -1352,7 +1314,7 @@ Style/HashSyntax: - 'app/views/catalog/index.rss.builder' - 'app/views/catalog/opensearch.xml.builder' -# Offense count: 29 +# Offense count: 30 # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Enabled: false @@ -1379,7 +1341,7 @@ Style/Lambda: Exclude: - 'app/controllers/catalog_controller.rb' -# Offense count: 7 +# Offense count: 6 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowedMethods, AllowedPatterns. Style/MethodCallWithoutArgsParentheses: @@ -1388,7 +1350,6 @@ Style/MethodCallWithoutArgsParentheses: - 'spec/models/concerns/extent_spec.rb' - 'spec/models/concerns/index_authors_spec.rb' - 'spec/models/concerns/mods_data_spec.rb' - - 'spec/views/collection_members/_file_collection_members.html.erb_spec.rb' # Offense count: 8 # This cop supports safe autocorrection (--autocorrect). @@ -1416,7 +1377,7 @@ Style/MultilineIfModifier: - 'app/models/citation.rb' - 'app/views/catalog/index.atom.builder' -# Offense count: 23 +# Offense count: 16 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: literals, strict @@ -1457,7 +1418,7 @@ Style/Next: Exclude: - 'app/helpers/xml_api_helper.rb' -# Offense count: 4 +# Offense count: 5 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Strict, AllowedNumbers, AllowedPatterns. Style/NumericLiterals: @@ -1478,12 +1439,11 @@ Style/OptionalArguments: Exclude: - 'app/helpers/preview_helper.rb' -# Offense count: 2 +# Offense count: 1 # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? Style/OptionalBooleanParameter: Exclude: - - 'app/controllers/catalog_controller.rb' - 'app/helpers/preview_helper.rb' # Offense count: 1 @@ -1498,15 +1458,7 @@ Style/ParallelAssignment: Exclude: - 'spec/services/eds/search_service_spec.rb' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions. -Style/ParenthesesAroundCondition: - Exclude: - - 'app/helpers/application_helper.rb' - - 'app/views/catalog/_index_default.mobile.builder' - -# Offense count: 37 +# Offense count: 33 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: PreferredDelimiters. Style/PercentLiteralDelimiters: @@ -1582,7 +1534,7 @@ Style/RedundantInterpolation: - 'app/helpers/xml_api_helper.rb' - 'app/views/catalog/opensearch.xml.builder' -# Offense count: 6 +# Offense count: 7 # This cop supports safe autocorrection (--autocorrect). Style/RedundantParentheses: Exclude: @@ -1700,7 +1652,7 @@ Style/StringConcatenation: - 'config/application.rb' - 'config/initializers/okcomputer.rb' -# Offense count: 2842 +# Offense count: 2645 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # SupportedStyles: single_quotes, double_quotes @@ -1769,14 +1721,14 @@ Style/WhileUntilModifier: Exclude: - 'app/services/eds/search_service.rb' -# Offense count: 56 +# Offense count: 48 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, MinSize, WordRegex. # SupportedStyles: percent, brackets Style/WordArray: Enabled: false -# Offense count: 390 +# Offense count: 396 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https diff --git a/app/models/marc_fields/issn.rb b/app/models/marc_fields/issn.rb index b9b070991..dcadf8851 100644 --- a/app/models/marc_fields/issn.rb +++ b/app/models/marc_fields/issn.rb @@ -6,7 +6,7 @@ def values return [] if marc.blank? @values ||= extracted_fields.flat_map do |field, subfields| - subfields.map(&:value).map(&:strip).select { |v| v =~ issn_pattern } + subfields.map { |x| x.value.strip }.select { |v| v =~ issn_pattern } end.compact end diff --git a/spec/components/access_panels/library_component_spec.rb b/spec/components/access_panels/library_component_spec.rb index 739ebdd5a..17ce02a3b 100644 --- a/spec/components/access_panels/library_component_spec.rb +++ b/spec/components/access_panels/library_component_spec.rb @@ -7,7 +7,7 @@ it "returns the image tag for the thumbnail for the specified library" do render_inline(component) - expect(page).to have_selector('img[src^="/assets/GREEN"][srcset^="/assets/GREEN@2x"]') + expect(page).to have_css('img[src^="/assets/GREEN"][srcset^="/assets/GREEN@2x"]') end context 'with a ZOMBIE library' do @@ -16,7 +16,7 @@ it "returns the image tag (w/ png extension) for the ZOMBIE library" do render_inline(component) - expect(page).to have_selector('img[src^="/assets/ZOMBIE"][srcset^="/assets/ZOMBIE@2x"]') + expect(page).to have_css('img[src^="/assets/ZOMBIE"][srcset^="/assets/ZOMBIE@2x"]') end end @@ -26,7 +26,7 @@ it "returns a placeholder panel" do render_inline(component) - expect(page).to have_selector('h3', text: 'Stanford Libraries') + expect(page).to have_css('h3', text: 'Stanford Libraries') end end end diff --git a/spec/components/access_panels/online_component_spec.rb b/spec/components/access_panels/online_component_spec.rb index 05f54c6b7..124b93d13 100644 --- a/spec/components/access_panels/online_component_spec.rb +++ b/spec/components/access_panels/online_component_spec.rb @@ -65,13 +65,13 @@ it 'is true when there are fulltext links present' do render_inline(fulltext) - expect(page).to have_selector '.panel-online' + expect(page).to have_css '.panel-online' end it 'is true when there are eds links present' do render_inline(eds_links) - expect(page).to have_selector '.panel-online' + expect(page).to have_css '.panel-online' end it 'is false when there are only supplemental links present' do diff --git a/spec/features/access_panels/exhibit_spec.rb b/spec/features/access_panels/exhibit_spec.rb index 665dff9f8..bb5489bce 100644 --- a/spec/features/access_panels/exhibit_spec.rb +++ b/spec/features/access_panels/exhibit_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe 'Exhibit Access Panel', js: true do +RSpec.describe 'Exhibit Access Panel', :js do let(:content) { [] } before do expect(Settings.EXHIBITS_ACCESS_PANEL).to receive(:exhibits_host).and_return( diff --git a/spec/features/access_panels/library_location_spec.rb b/spec/features/access_panels/library_location_spec.rb index 84e9628f4..fbd51a21b 100644 --- a/spec/features/access_panels/library_location_spec.rb +++ b/spec/features/access_panels/library_location_spec.rb @@ -17,7 +17,7 @@ expect(page).to have_css('div.panel-library-location', count: 4) end - feature 'long lists should be truncated', js: true do + feature 'long lists should be truncated', :js do scenario 'items with more than 5 callnumbers should be truncated with a more link' do visit solr_document_path '10' expect(page).to have_no_css('td', text: 'IHG', visible: true) diff --git a/spec/features/access_panels/online_books_spec.rb b/spec/features/access_panels/online_books_spec.rb index f684cd4be..28fc8af61 100644 --- a/spec/features/access_panels/online_books_spec.rb +++ b/spec/features/access_panels/online_books_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature 'Record view', js: true do +RSpec.feature 'Record view', :js do it 'should have online books panel with Google links' do skip('Google Books API not working under test') visit solr_document_path('44') diff --git a/spec/features/access_panels/online_spec.rb b/spec/features/access_panels/online_spec.rb index 6c0edfa9f..3dd4c4392 100644 --- a/spec/features/access_panels/online_spec.rb +++ b/spec/features/access_panels/online_spec.rb @@ -38,7 +38,7 @@ ) end - it 'renders the panel', js: true do + it 'renders the panel', :js do visit solr_document_path('57') within('.panel-online') do diff --git a/spec/features/alternate_catalog_spec.rb b/spec/features/alternate_catalog_spec.rb index f7ecb9e83..69fc39da0 100644 --- a/spec/features/alternate_catalog_spec.rb +++ b/spec/features/alternate_catalog_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.feature 'Alterate catalog results', js: true do +RSpec.feature 'Alterate catalog results', :js do before do stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) end diff --git a/spec/features/article_display_spec.rb b/spec/features/article_display_spec.rb index abdca7c28..fefdb54ce 100644 --- a/spec/features/article_display_spec.rb +++ b/spec/features/article_display_spec.rb @@ -18,7 +18,7 @@ end end - describe 'Fulltext', js: true do + describe 'Fulltext', :js do let(:document) do SolrDocument.new(id: '123', eds_title: 'TITLE', eds_html_fulltext_available: true, eds_html_fulltext: '09dfa;

This Journal

, 10(1)') end @@ -85,7 +85,7 @@ end end - describe 'Embedded SFX Menu', js: true do + describe 'Embedded SFX Menu', :js do let(:document) do SolrDocument.new( id: 'abc123', diff --git a/spec/features/article_eds_facets_spec.rb b/spec/features/article_eds_facets_spec.rb index e0512d9b8..b1f1b180a 100644 --- a/spec/features/article_eds_facets_spec.rb +++ b/spec/features/article_eds_facets_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.feature 'EDS Facets', js: true do +RSpec.feature 'EDS Facets', :js do describe 'OR facets' do context 'Source Type' do scenario 'shows warning message when 1 field is selected' do diff --git a/spec/features/article_home_page_spec.rb b/spec/features/article_home_page_spec.rb index a760e6b5e..82567cf59 100644 --- a/spec/features/article_home_page_spec.rb +++ b/spec/features/article_home_page_spec.rb @@ -31,7 +31,7 @@ end end - describe 'Search Settings', js: true do + describe 'Search Settings', :js do before { visit articles_path } it 'adds a hidden input for any initial selections' do diff --git a/spec/features/article_record_toolbar_spec.rb b/spec/features/article_record_toolbar_spec.rb index e36189cae..20f52fc0d 100644 --- a/spec/features/article_record_toolbar_spec.rb +++ b/spec/features/article_record_toolbar_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'Article Record Toolbar', js: true do +RSpec.describe 'Article Record Toolbar', :js do let(:previous_document) { SolrDocument.new(id: 1, eds_title: 'My Prev Title') } let(:document) do SolrDocument.new( @@ -17,7 +17,7 @@ Capybara.current_session.reset! # ensure a clean session visit articles_path q: 'my query' # sets up search session - click_on document[:eds_title] # show the article record + click_link document[:eds_title] # show the article record end it 'shows the Send button' do diff --git a/spec/features/article_searching_spec.rb b/spec/features/article_searching_spec.rb index edf01e606..8738867d8 100644 --- a/spec/features/article_searching_spec.rb +++ b/spec/features/article_searching_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.feature 'Article Searching' do - describe 'Search bar dropdown', js: true do + describe 'Search bar dropdown', :js do scenario 'allows the user to switch to the article search context' do stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) visit root_path @@ -85,7 +85,7 @@ expect(current_url).to match(%r{/articles/abc123}) end - scenario 'authors, subjects, and abstracts are truncated', js: true do + scenario 'authors, subjects, and abstracts are truncated', :js do long_data = Array.new(100) { |_| 'Lorem ipsum dolor sit amet' }.join(', ') document = SolrDocument.new( id: '1234', @@ -117,7 +117,7 @@ end end - describe 'breadcrumbs', js: true do + describe 'breadcrumbs', :js do scenario 'start over button returns users to articles home page' do article_search_for('kittens') diff --git a/spec/features/backend_lookup_spec.rb b/spec/features/backend_lookup_spec.rb index f190ac343..ae3df8dca 100644 --- a/spec/features/backend_lookup_spec.rb +++ b/spec/features/backend_lookup_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature 'Backend lookup', js: true do +RSpec.feature 'Backend lookup', :js do before do stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) visit root_path diff --git a/spec/features/blacklight_customizations/accessibility_spec.rb b/spec/features/blacklight_customizations/accessibility_spec.rb index 7834b9058..e00c7e4b6 100644 --- a/spec/features/blacklight_customizations/accessibility_spec.rb +++ b/spec/features/blacklight_customizations/accessibility_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature "Aria Landmarks", js: true do +RSpec.feature "Aria Landmarks", :js do before do visit root_path fill_in "q", with: '' diff --git a/spec/features/blacklight_customizations/bookmarks_path_spec.rb b/spec/features/blacklight_customizations/bookmarks_path_spec.rb index d722f11ad..8a3185fdd 100644 --- a/spec/features/blacklight_customizations/bookmarks_path_spec.rb +++ b/spec/features/blacklight_customizations/bookmarks_path_spec.rb @@ -8,7 +8,7 @@ expect(page).to have_css("h3", text: "You have no selections") end - scenario "renders some bookmarks and toolbar", js: true do + scenario "renders some bookmarks and toolbar", :js do skip('Passes locally, not on Travis.') if ENV['CI'] visit search_catalog_path f: { format: ["Book"] }, view: "default" page.all('label.toggle-bookmark')[0].click diff --git a/spec/features/blacklight_customizations/bookmarks_text_spec.rb b/spec/features/blacklight_customizations/bookmarks_text_spec.rb index 26e4cb203..d23b9112a 100644 --- a/spec/features/blacklight_customizations/bookmarks_text_spec.rb +++ b/spec/features/blacklight_customizations/bookmarks_text_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature "Bookmarks Select/UnSelect Text", js: true do +RSpec.feature "Bookmarks Select/UnSelect Text", :js do before do visit root_path fill_in "q", with: '' diff --git a/spec/features/blacklight_customizations/emailing_records_spec.rb b/spec/features/blacklight_customizations/emailing_records_spec.rb index 9bacf494a..b87728ed8 100644 --- a/spec/features/blacklight_customizations/emailing_records_spec.rb +++ b/spec/features/blacklight_customizations/emailing_records_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "Emailing Records", js: true do +RSpec.describe "Emailing Records", :js do context 'when a user is not logged in' do it 'the are provided a reCAPTCHA challenge' do visit solr_document_path('14') diff --git a/spec/features/blacklight_customizations/facets_spec.rb b/spec/features/blacklight_customizations/facets_spec.rb index 29b51c8ba..79c5136b1 100644 --- a/spec/features/blacklight_customizations/facets_spec.rb +++ b/spec/features/blacklight_customizations/facets_spec.rb @@ -12,14 +12,14 @@ end end - scenario "material type icons display after an advanced search", js: true do + scenario "material type icons display after an advanced search", :js do skip('Fails intermitently on Travis.') if ENV['CI'] visit blacklight_advanced_search_engine.advanced_search_path - click_on "Resource type" + click_link "Resource type" check "Book" - click_on "advanced-search-submit" + click_button "advanced-search-submit" expect(page).to have_css(".blacklight-format_main_ssim") @@ -51,7 +51,7 @@ expect(music_index).to be < sdr_index end - scenario "while not in an access point facet title does not change", js: true do + scenario "while not in an access point facet title does not change", :js do visit root_path fill_in "q", with: '' click_button 'search' diff --git a/spec/features/blacklight_customizations/librarian_view_spec.rb b/spec/features/blacklight_customizations/librarian_view_spec.rb index a345d7fab..e05fa2f11 100644 --- a/spec/features/blacklight_customizations/librarian_view_spec.rb +++ b/spec/features/blacklight_customizations/librarian_view_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "Librarian View Customization", js: true do +RSpec.describe "Librarian View Customization", :js do let(:embed) { double('embed-response') } it "MARC records should display" do diff --git a/spec/features/blacklight_customizations/record_metadata_spec.rb b/spec/features/blacklight_customizations/record_metadata_spec.rb index 6a8678c5c..3ca7aed24 100644 --- a/spec/features/blacklight_customizations/record_metadata_spec.rb +++ b/spec/features/blacklight_customizations/record_metadata_spec.rb @@ -5,7 +5,7 @@ visit('/view/10') end - scenario 'should have correct cover image attributes', js: true do + scenario 'should have correct cover image attributes', :js do within 'div.document' do expect(page).to have_css('img.cover-image', visible: true) expect(page).to have_css( diff --git a/spec/features/blacklight_customizations/record_toolbar_spec.rb b/spec/features/blacklight_customizations/record_toolbar_spec.rb index d98062be1..3d492be9d 100644 --- a/spec/features/blacklight_customizations/record_toolbar_spec.rb +++ b/spec/features/blacklight_customizations/record_toolbar_spec.rb @@ -6,7 +6,7 @@ visit root_path end - scenario "should have record toolbar visible but no back to search or pagination", js: true do + scenario "should have record toolbar visible but no back to search or pagination", :js do visit '/view/1' within "#content" do within "div.record-toolbar" do @@ -26,7 +26,7 @@ end end - scenario 'does not have a previous pagination button for the first item in a result', js: true do + scenario 'does not have a previous pagination button for the first item in a result', :js do visit search_catalog_path f: { format: ['Book'] } within(first('.document')) do find('h3.index_title a').click @@ -35,7 +35,7 @@ expect(page).to have_no_css('a.previous', visible: true) end - scenario 'a citable item has export links', js: true do + scenario 'a citable item has export links', :js do visit search_catalog_path f: { format: ['Book'] } page.find('a', text: 'An object').click @@ -48,7 +48,7 @@ end end - scenario "should have back to search and pagination", js: true do + scenario "should have back to search and pagination", :js do visit search_catalog_path f: { format: ["Book"] } # Specifically trying to not get the first item in the results diff --git a/spec/features/blacklight_customizations/results_document_spec.rb b/spec/features/blacklight_customizations/results_document_spec.rb index 712286e59..5a46c1ff2 100644 --- a/spec/features/blacklight_customizations/results_document_spec.rb +++ b/spec/features/blacklight_customizations/results_document_spec.rb @@ -22,7 +22,7 @@ end end - scenario 'should have correct cover image attributes', js: true do + scenario 'should have correct cover image attributes', :js do skip('Google Books API not working under test') visit root_path first('#q').set '10' diff --git a/spec/features/blacklight_customizations/results_toolbar_spec.rb b/spec/features/blacklight_customizations/results_toolbar_spec.rb index baaa8e0db..fd0999606 100644 --- a/spec/features/blacklight_customizations/results_toolbar_spec.rb +++ b/spec/features/blacklight_customizations/results_toolbar_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.feature "Results Toolbar", js: true do +RSpec.feature "Results Toolbar", :js do before do stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) end diff --git a/spec/features/blacklight_customizations/search_toolbar_spec.rb b/spec/features/blacklight_customizations/search_toolbar_spec.rb index 7da5acccc..cc13e9f9e 100644 --- a/spec/features/blacklight_customizations/search_toolbar_spec.rb +++ b/spec/features/blacklight_customizations/search_toolbar_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "Search toolbar", feature: true, js: true do +RSpec.describe "Search toolbar", :feature, :js do before { visit root_path } describe "has SearchWorks customizations" do diff --git a/spec/features/bookmarking_items_spec.rb b/spec/features/bookmarking_items_spec.rb index 51b36c6ec..39739696b 100644 --- a/spec/features/bookmarking_items_spec.rb +++ b/spec/features/bookmarking_items_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.feature 'Bookmarking Items' do - context 'Citations', js: true do + context 'Citations', :js do let(:citations) { '

MLA Citation

' } before { stub_oclc_response(citations, for: '12345') } diff --git a/spec/features/brief_view_spec.rb b/spec/features/brief_view_spec.rb index c22f0651c..b3b60a57f 100644 --- a/spec/features/brief_view_spec.rb +++ b/spec/features/brief_view_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.feature "Brief View" do - scenario "Catalog search results", js: true do + scenario "Catalog search results", :js do visit search_catalog_path f: { format: ["Book"] } within '#view-type-dropdown' do click_button 'View' @@ -20,7 +20,7 @@ expect(page).to have_css('.brief-document ul li', text: 'Chemistry & ChemEng Library (Swain) : Stacks : ABC') end end - skip 'Brief preview', js: true do + skip 'Brief preview', :js do visit search_catalog_path f: { format: ["Book"] }, view: 'brief' page.find("button.btn.docid-1").click expect(page).to have_css("h3.preview-title", text: "An object") @@ -38,7 +38,7 @@ end end - scenario "Articles search brief view", js: true do + scenario "Articles search brief view", :js do stub_article_service(type: :single, docs: [StubArticleService::SAMPLE_RESULTS.first]) article_search_for('kittens') within '#view-type-dropdown' do diff --git a/spec/features/callnum_search_spec.rb b/spec/features/callnum_search_spec.rb index 1a6c91b49..5ae9687fb 100644 --- a/spec/features/callnum_search_spec.rb +++ b/spec/features/callnum_search_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'Call num search', js: true do +RSpec.describe 'Call num search', :js do before do stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) end diff --git a/spec/features/callnumber_browse_spec.rb b/spec/features/callnumber_browse_spec.rb index 63d10b304..b32432a89 100644 --- a/spec/features/callnumber_browse_spec.rb +++ b/spec/features/callnumber_browse_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'Callnumber Browse', js: true do +RSpec.describe 'Callnumber Browse', :js do describe 'embedded on the record page' do it 'renders' do visit solr_document_path('1') diff --git a/spec/features/clear_search_box_spec.rb b/spec/features/clear_search_box_spec.rb index f5319aacd..8e79840c7 100644 --- a/spec/features/clear_search_box_spec.rb +++ b/spec/features/clear_search_box_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature "Search box", js: true do +RSpec.feature "Search box", :js do scenario "clear query text" do visit root_path diff --git a/spec/features/connection_form_spec.rb b/spec/features/connection_form_spec.rb index 8b39b16bc..c6e242843 100644 --- a/spec/features/connection_form_spec.rb +++ b/spec/features/connection_form_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.feature 'Connection form (js)', js: true do +RSpec.feature 'Connection form (js)', :js do before do stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) visit articles_path diff --git a/spec/features/course_reserves_browse_spec.rb b/spec/features/course_reserves_browse_spec.rb index 258822dd3..b204e26bd 100644 --- a/spec/features/course_reserves_browse_spec.rb +++ b/spec/features/course_reserves_browse_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature 'Course reserves browse', js: true do +RSpec.feature 'Course reserves browse', :js do context 'homepage and subnavbar' do before { visit root_path } diff --git a/spec/features/date_range_spec.rb b/spec/features/date_range_spec.rb index 12f942826..958971824 100644 --- a/spec/features/date_range_spec.rb +++ b/spec/features/date_range_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.feature 'Date Range', js: true do +RSpec.feature 'Date Range', :js do scenario 'Search results should have date slider facet' do visit search_catalog_path f: { access_facet: ['Online'] } click_button 'Date' diff --git a/spec/features/feedback_form_spec.rb b/spec/features/feedback_form_spec.rb index c6ecde40f..e1d26ff60 100644 --- a/spec/features/feedback_form_spec.rb +++ b/spec/features/feedback_form_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature "Feedback form (js)", js: true do +RSpec.feature "Feedback form (js)", :js do before do visit root_path end diff --git a/spec/features/gallery_view_spec.rb b/spec/features/gallery_view_spec.rb index a19821b40..3589b14a3 100644 --- a/spec/features/gallery_view_spec.rb +++ b/spec/features/gallery_view_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.feature 'Gallery View' do - scenario 'Search results are rendered properly', js: true do + scenario 'Search results are rendered properly', :js do visit search_catalog_path f: { format: ['Book'] } within '#view-type-dropdown' do click_button 'View' diff --git a/spec/features/home_page_spec.rb b/spec/features/home_page_spec.rb index 3685f4d40..66e0108a9 100644 --- a/spec/features/home_page_spec.rb +++ b/spec/features/home_page_spec.rb @@ -35,7 +35,7 @@ end end - scenario "should have the library facet hidden by default", js: true do + scenario "should have the library facet hidden by default", :js do within(".blacklight-building_facet") do expect(page).to have_button 'Library' expect(page).to have_no_css('li a', visible: true) diff --git a/spec/features/image_collection_spec.rb b/spec/features/image_collection_spec.rb index af7a33fd0..659636c13 100644 --- a/spec/features/image_collection_spec.rb +++ b/spec/features/image_collection_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature "Image Collection", js: true do +RSpec.feature "Image Collection", :js do before do stub_article_service(docs: []) end diff --git a/spec/features/merged_file_collection_spec.rb b/spec/features/merged_file_collection_spec.rb index 49ed42a51..ac83e479f 100644 --- a/spec/features/merged_file_collection_spec.rb +++ b/spec/features/merged_file_collection_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature "Merged File Collections", js: true do +RSpec.feature "Merged File Collections", :js do before do stub_article_service(docs: []) end diff --git a/spec/features/merged_image_collections_spec.rb b/spec/features/merged_image_collections_spec.rb index 0069b9a07..09e08b5a0 100644 --- a/spec/features/merged_image_collections_spec.rb +++ b/spec/features/merged_image_collections_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature "Merged Image Collections", js: true do +RSpec.feature "Merged Image Collections", :js do before do stub_article_service(docs: []) end diff --git a/spec/features/mhld_spec.rb b/spec/features/mhld_spec.rb index 8fb54dc4f..10da0e174 100644 --- a/spec/features/mhld_spec.rb +++ b/spec/features/mhld_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "MHLD", feature: true do +RSpec.describe "MHLD", :feature do describe "record view" do it "should be present in the location access panel" do visit solr_document_path('10') @@ -20,7 +20,7 @@ end end - describe "results view", js: true do + describe "results view", :js do before do stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) end diff --git a/spec/features/options_facet_spec.rb b/spec/features/options_facet_spec.rb index e50dad039..4ffd06342 100644 --- a/spec/features/options_facet_spec.rb +++ b/spec/features/options_facet_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.describe 'Options Facet' do - it 'renders the eds_search_limiters_facet as checkboxes (behaves like a link)', js: true do + it 'renders the eds_search_limiters_facet as checkboxes (behaves like a link)', :js do stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) visit articles_path(q: 'Example Query') diff --git a/spec/features/purl_embed_spec.rb b/spec/features/purl_embed_spec.rb index 19ef25837..001a402b1 100644 --- a/spec/features/purl_embed_spec.rb +++ b/spec/features/purl_embed_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'PURL Embed', js: true do +RSpec.describe 'PURL Embed', :js do it 'should be present for images' do visit solr_document_path('mf774fs2413') diff --git a/spec/features/quick_report_spec.rb b/spec/features/quick_report_spec.rb index 694317dc4..39b8dbc03 100644 --- a/spec/features/quick_report_spec.rb +++ b/spec/features/quick_report_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.feature 'Quick report form (js)', js: true do +RSpec.feature 'Quick report form (js)', :js do before do visit root_path end diff --git a/spec/features/responsive/home_page_responsive_spec.rb b/spec/features/responsive/home_page_responsive_spec.rb index 877c330be..f5fdbc6ce 100644 --- a/spec/features/responsive/home_page_responsive_spec.rb +++ b/spec/features/responsive/home_page_responsive_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "Responsive Home Page", feature: true, js: true do +RSpec.describe "Responsive Home Page", :feature, :js do describe "facets" do it "shows the facets on large screens" do visit root_path @@ -14,7 +14,7 @@ end end - it 'collapses facets on small screens', page_width: 700, responsive: true do + it 'collapses facets on small screens', :responsive, page_width: 700 do visit root_path within(".blacklight-access_facet") do diff --git a/spec/features/responsive/record_toolbar_responsive_spec.rb b/spec/features/responsive/record_toolbar_responsive_spec.rb index c3815301f..3c940e22a 100644 --- a/spec/features/responsive/record_toolbar_responsive_spec.rb +++ b/spec/features/responsive/record_toolbar_responsive_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "Record toolbar", feature: true, js: true do +RSpec.describe "Record toolbar", :feature, :js do before do stub_oclc_response('', for: '12345') end @@ -49,7 +49,7 @@ end end - describe " - mobile landscape view (480px - 767px) - ", page_width: 700, responsive: true do + describe " - mobile landscape view (480px - 767px) - ", :responsive, page_width: 700 do before { visit search_catalog_path f: { format: ['Book'] } } context 'a citable item' do diff --git a/spec/features/responsive/results_toolbar_spec.rb b/spec/features/responsive/results_toolbar_spec.rb index 6443334e6..ec43d9b83 100644 --- a/spec/features/responsive/results_toolbar_spec.rb +++ b/spec/features/responsive/results_toolbar_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "Responsive results toolbar", feature: true, js: true do +RSpec.describe "Responsive results toolbar", :feature, :js do describe "desktop view (> 992px)" do it "displays correct tools" do visit root_path @@ -19,7 +19,7 @@ end end - describe "tablet view (768px - 992px) - ", page_width: 800, responsive: true do + describe "tablet view (768px - 992px) - ", :responsive, page_width: 800 do it "displays correct tools" do visit root_path fill_in "q", with: '' @@ -36,7 +36,7 @@ end end - describe "mobile landscape view (480px - 767px) - ", page_width: 700, responsive: true do + describe "mobile landscape view (480px - 767px) - ", :responsive, page_width: 700 do it "display correct tools" do visit root_path fill_in "q", with: '' diff --git a/spec/features/responsive/results_view_spec.rb b/spec/features/responsive/results_view_spec.rb index 55caf0df3..5a423d0b4 100644 --- a/spec/features/responsive/results_view_spec.rb +++ b/spec/features/responsive/results_view_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'Responsive results view Page', feature: true, js: true do +RSpec.describe 'Responsive results view Page', :feature, :js do describe 'facets' do before do visit search_catalog_path f: { access_facet: ['Online'] } diff --git a/spec/features/responsive/search_subnavbar_responsive_spec.rb b/spec/features/responsive/search_subnavbar_responsive_spec.rb index 570c45f81..9bd6de45b 100644 --- a/spec/features/responsive/search_subnavbar_responsive_spec.rb +++ b/spec/features/responsive/search_subnavbar_responsive_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe 'Responsive subnavbar (gray banner)', feature: true, js: true, page_width: 700, responsive: true do +RSpec.describe 'Responsive subnavbar (gray banner)', :feature, :js, :responsive, page_width: 700 do scenario 'collapses menu options in mobile view' do visit root_path diff --git a/spec/features/responsive/search_toolbar_responsive_spec.rb b/spec/features/responsive/search_toolbar_responsive_spec.rb index 7ccbd616f..56c3f5fb8 100644 --- a/spec/features/responsive/search_toolbar_responsive_spec.rb +++ b/spec/features/responsive/search_toolbar_responsive_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "Responsive search bar", feature: true, js: true do +RSpec.describe "Responsive search bar", :feature, :js do describe " - desktop view (> 980px)" do it "displays the search form" do visit root_path @@ -13,7 +13,7 @@ end end - describe " - tablet view (768px - 980px) - ", page_width: 800, responsive: true do + describe " - tablet view (768px - 980px) - ", :responsive, page_width: 800 do it "displays the search form" do visit root_path first("#q").set '' @@ -25,7 +25,7 @@ end end - describe " - mobile landscape view (480px - 767px) - ", page_width: 700, responsive: true do + describe " - mobile landscape view (480px - 767px) - ", :responsive, page_width: 700 do it "displays the search form" do visit root_path first("#q").set '' diff --git a/spec/features/skip_to_nav_spec.rb b/spec/features/skip_to_nav_spec.rb index 506262b16..271709565 100644 --- a/spec/features/skip_to_nav_spec.rb +++ b/spec/features/skip_to_nav_spec.rb @@ -25,7 +25,7 @@ end end - scenario "has skip-to navigation links to search field, main container and records in selections page", js: true do + scenario "has skip-to navigation links to search field, main container and records in selections page", :js do visit root_path fill_in 'q', with: '20' find('button#search').click @@ -39,7 +39,7 @@ end end - scenario 'places focus on traditionally non-focusable elements', js: true do + scenario 'places focus on traditionally non-focusable elements', :js do visit root_path body_element = page.find("body") diff --git a/spec/features/sort_and_per_page_dropdown_spec.rb b/spec/features/sort_and_per_page_dropdown_spec.rb index 99fb51a30..c8d51c9be 100644 --- a/spec/features/sort_and_per_page_dropdown_spec.rb +++ b/spec/features/sort_and_per_page_dropdown_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'Sort and per page toolbar', feature: true, js: true do +RSpec.describe 'Sort and per page toolbar', :feature, :js do describe 'View dropdown' do before do visit root_path diff --git a/spec/features/stackmap_spec.rb b/spec/features/stackmap_spec.rb index b01e2b585..1a17f4ccb 100644 --- a/spec/features/stackmap_spec.rb +++ b/spec/features/stackmap_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.feature 'StackMap View' do - scenario 'Search results', js: true do + scenario 'Search results', :js do visit search_catalog_path f: { format: ['Book'] } within '#view-type-dropdown' do click_button 'View' diff --git a/spec/features/tabbed_selections_spec.rb b/spec/features/tabbed_selections_spec.rb index b22e5e80e..1189bc4ed 100644 --- a/spec/features/tabbed_selections_spec.rb +++ b/spec/features/tabbed_selections_spec.rb @@ -18,7 +18,7 @@ stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) end - describe 'selections drop down', js: true do + describe 'selections drop down', :js do it 'renders a drop down with counts for each type of record selection' do visit '/' @@ -33,7 +33,7 @@ end end - describe 'selections send to', js: true do + describe 'selections send to', :js do it 'renders export formats' do visit '/selections' find('#tools-dropdown button').click diff --git a/spec/features/top_nav_spec.rb b/spec/features/top_nav_spec.rb index cb9ae66b8..c1de65815 100644 --- a/spec/features/top_nav_spec.rb +++ b/spec/features/top_nav_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.feature "Top Navigation" do - scenario "should have navigational links and top menu", js: true do + scenario "should have navigational links and top menu", :js do visit root_path within "#topnav" do within ".header-links" do diff --git a/spec/features/zero_results_spec.rb b/spec/features/zero_results_spec.rb index be638c383..6b97c8e79 100644 --- a/spec/features/zero_results_spec.rb +++ b/spec/features/zero_results_spec.rb @@ -13,7 +13,7 @@ expect(page).to have_css('a', text: 'sdfsda') end end - scenario "should have no results and show correct link from advanced search", js: true do + scenario "should have no results and show correct link from advanced search", :js do visit blacklight_advanced_search_engine.advanced_search_path fill_in "Title", with: "sdfsda" click_button 'advanced-search-submit' @@ -34,7 +34,7 @@ end end - context 'it does not replace query string in a way that will execute js', js: true do + context 'it does not replace query string in a way that will execute js', :js do before { stub_article_service(docs: StubArticleService::SAMPLE_RESULTS) } scenario do @@ -49,7 +49,7 @@ context 'article search' do before { stub_article_service(docs: []) } - scenario 'displays backend lookup links', js: true do + scenario 'displays backend lookup links', :js do visit articles_path(q: 'Kittens', f: { 'eds_facet' => ['Abc'] }, search_field: 'search') # Has zero results because we pass an empty array of docs, but is sucessfully searching diff --git a/spec/integration/record_view_spec.rb b/spec/integration/record_view_spec.rb index cf820b5a3..947b43658 100644 --- a/spec/integration/record_view_spec.rb +++ b/spec/integration/record_view_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe "Record view", feature: true do +RSpec.describe "Record view", :feature do it "should display records from the index" do visit solr_document_path("1") expect(page).to have_css("h1", text: "An object") diff --git a/spec/models/marc_extractor_spec.rb b/spec/models/marc_extractor_spec.rb index 2521f2d31..a54d729d5 100644 --- a/spec/models/marc_extractor_spec.rb +++ b/spec/models/marc_extractor_spec.rb @@ -90,7 +90,7 @@ subject(:extracted_data) { described_class.new(marc, ['506', '541', '555']).extract.to_a } it 'extracts field data in the order they appear in the MARC record' do - expect(extracted_data.map(&:first).map(&:tag)).to eq ['506', '555', '541'] + expect(extracted_data.map { |x| x.first.tag }).to eq ['506', '555', '541'] end end diff --git a/spec/models/nearby_on_shelf_spec.rb b/spec/models/nearby_on_shelf_spec.rb index 7fa251551..e15267ad8 100644 --- a/spec/models/nearby_on_shelf_spec.rb +++ b/spec/models/nearby_on_shelf_spec.rb @@ -59,7 +59,7 @@ end it 'set the preferred callnumber on the document so it can be used in the view' do - expect(service.items('A', incl: true, per: 3).map(&:document).map(&:preferred_item).map(&:shelfkey)).to eq %w[A B C] + expect(service.items('A', incl: true, per: 3).map { |x| x.document.preferred_item.shelfkey }).to eq %w[A B C] end end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 6f6615fc8..1deb988ac 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -97,11 +97,11 @@ config.include Capybara::DSL - config.before(:example, responsive: true) do |example| + config.before(:example, :responsive) do |example| page.current_window.resize_to(example.metadata[:page_width].to_i, 700) end - config.after(:example, responsive: true) do + config.after(:example, :responsive) do page.current_window.resize_to(1000, 700) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 56e4f4973..658a8c347 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -88,7 +88,7 @@ end def total_results - expect(page).to have_selector 'h2', text: number_pattern + expect(page).to have_css 'h2', text: number_pattern page.find("h2", text: number_pattern).text.gsub(/\D+/, '').to_i end