diff --git a/.rubocop.yml b/.rubocop.yml index 5f06f129..e37f209d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,4 @@ -require: +plugins: - rubocop-rspec - rubocop-rspec_rails - rubocop-rails diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0d79098f..f5ce0be7 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-12-02 11:47:52 UTC using RuboCop version 1.66.1. +# on 2025-08-12 13:33:30 UTC using RuboCop version 1.79.2. # 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 @@ -14,13 +14,7 @@ Bundler/OrderedGems: Exclude: - 'Gemfile' -# Offense count: 151 -# Configuration parameters: EnforcedStyle. -# SupportedStyles: link_or_button, strict -Capybara/ClickLinkOrButtonStyle: - Enabled: false - -# Offense count: 280 +# Offense count: 279 # This cop supports safe autocorrection (--autocorrect). Capybara/CurrentPathExpectation: Exclude: @@ -36,7 +30,7 @@ Capybara/CurrentPathExpectation: - 'spec/features/track_organizer_ability_spec.rb' - 'spec/features/user_ability_spec.rb' -# Offense count: 13 +# Offense count: 12 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: DefaultSelector. Capybara/RSpec/HaveSelector: @@ -49,10 +43,14 @@ Capybara/RSpec/HaveSelector: - 'spec/features/track_organizer_ability_spec.rb' - 'spec/features/voting_spec.rb' -# Offense count: 78 +# Offense count: 17 # This cop supports safe autocorrection (--autocorrect). Capybara/SpecificFinders: - Enabled: false + Exclude: + - 'spec/features/difficulty_levels_spec.rb' + - 'spec/features/email_spec.rb' + - 'spec/features/event_types_spec.rb' + - 'spec/features/program_spec.rb' # Offense count: 1 Capybara/SpecificMatcher: @@ -209,7 +207,7 @@ Layout/IndentationWidth: # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. +# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment, AllowRBSInlineAnnotation, AllowSteepAnnotation. Layout/LeadingCommentSpace: Exclude: - 'app/models/comment.rb' @@ -270,14 +268,27 @@ Layout/MultilineHashBraceLayout: Layout/MultilineMethodCallBraceLayout: Enabled: false -# Offense count: 38 +# Offense count: 32 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: aligned, indented, indented_relative_to_receiver Layout/MultilineMethodCallIndentation: - Enabled: false + Exclude: + - 'app/controllers/admin/conferences_controller.rb' + - 'app/controllers/admin/reports_controller.rb' + - 'app/controllers/conference_registrations_controller.rb' + - 'app/datatables/user_datatable.rb' + - 'app/helpers/application_helper.rb' + - 'app/models/cfp.rb' + - 'app/models/conference.rb' + - 'app/models/event.rb' + - 'app/models/registration_period.rb' + - 'spec/controllers/admin/conferences_controller_spec.rb' + - 'spec/controllers/schedules_controller_spec.rb' + - 'spec/models/conference_spec.rb' + - 'spec/support/external_request.rb' -# Offense count: 18 +# Offense count: 15 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: aligned, indented @@ -448,7 +459,7 @@ Lint/AmbiguousBlockAssociation: - 'spec/controllers/schedules_controller_spec.rb' - 'spec/models/user_spec.rb' -# Offense count: 13 +# Offense count: 11 # This cop supports safe autocorrection (--autocorrect). Lint/AmbiguousOperatorPrecedence: Exclude: @@ -468,7 +479,7 @@ Lint/ConstantDefinitionInBlock: - 'lib/tasks/data.rake' # Offense count: 5 -# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch. Lint/DuplicateBranch: Exclude: - 'app/helpers/format_helper.rb' @@ -501,7 +512,8 @@ Lint/UnusedBlockArgument: # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods. +# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions. +# NotImplementedExceptions: NotImplementedError Lint/UnusedMethodArgument: Exclude: - 'app/helpers/application_helper.rb' @@ -514,7 +526,7 @@ Lint/UriRegexp: - 'app/models/commercial.rb' - 'app/models/contact.rb' -# Offense count: 125 +# Offense count: 124 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 70 @@ -533,14 +545,14 @@ Metrics/BlockNesting: # Offense count: 14 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 649 + Max: 646 -# Offense count: 25 +# Offense count: 24 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 16 -# Offense count: 151 +# Offense count: 150 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 56 @@ -548,7 +560,7 @@ Metrics/MethodLength: # Offense count: 5 # Configuration parameters: CountComments, CountAsOne. Metrics/ModuleLength: - Max: 174 + Max: 166 # Offense count: 21 # Configuration parameters: AllowedMethods, AllowedPatterns. @@ -576,13 +588,23 @@ Naming/MethodParameterName: Exclude: - 'app/models/conference.rb' +# Offense count: 3 +# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates. +# AllowedMethods: call +# WaywardPredicates: nonzero? +Naming/PredicateMethod: + Exclude: + - 'app/helpers/conference_helper.rb' + - 'app/helpers/format_helper.rb' + - 'config/initializers/fuckups.rb' + # Offense count: 2 -# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. -# NamePrefix: is_, has_, have_ -# ForbiddenPrefixes: is_, has_, have_ +# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs. +# NamePrefix: is_, has_, have_, does_ +# ForbiddenPrefixes: is_, has_, have_, does_ # AllowedMethods: is_a? # MethodDefinitionMacros: define_method, define_singleton_method -Naming/PredicateName: +Naming/PredicatePrefix: Exclude: - 'app/models/comment.rb' - 'app/models/contact.rb' @@ -598,7 +620,7 @@ Naming/RescuedExceptionsVariableName: # Offense count: 9 # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. # SupportedStyles: snake_case, normalcase, non_integer -# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 +# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 Naming/VariableNumber: Exclude: - 'app/models/program.rb' @@ -606,11 +628,12 @@ Naming/VariableNumber: - 'spec/models/payment_spec.rb' - 'spec/models/ticket_purchase_spec.rb' -# Offense count: 1 +# Offense count: 2 # Configuration parameters: MinSize. Performance/CollectionLiteralInLoop: Exclude: - 'app/models/conference.rb' + - 'db/migrate/20140730104658_migrate_roles_for_cancancan.rb' # Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -651,7 +674,7 @@ RSpec/BeEmpty: - 'spec/controllers/conference_registration_controller_spec.rb' - 'spec/models/conference_spec.rb' -# Offense count: 302 +# Offense count: 298 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: @@ -735,7 +758,7 @@ RSpec/EmptyLineAfterSubject: - 'spec/models/survey_spec.rb' - 'spec/models/track_spec.rb' -# Offense count: 202 +# Offense count: 179 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 181 @@ -774,7 +797,7 @@ RSpec/ExpectChange: - 'spec/models/event_spec.rb' - 'spec/models/user_spec.rb' -# Offense count: 166 +# Offense count: 167 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: implicit, each, example @@ -834,7 +857,7 @@ RSpec/IndexedLet: - 'spec/models/ticket_spec.rb' - 'spec/models/user_spec.rb' -# Offense count: 321 +# Offense count: 320 # Configuration parameters: AssignmentOnly. RSpec/InstanceVariable: Exclude: @@ -862,7 +885,7 @@ RSpec/LeadingSubject: - 'spec/models/conference_spec.rb' - 'spec/models/ticket_spec.rb' -# Offense count: 56 +# Offense count: 57 RSpec/LetSetup: Enabled: false @@ -880,7 +903,7 @@ RSpec/MatchArray: RSpec/MessageSpies: EnforcedStyle: receive -# Offense count: 225 +# Offense count: 138 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: hash, symbol @@ -892,11 +915,11 @@ RSpec/MultipleDescribes: Exclude: - 'spec/models/conference_spec.rb' -# Offense count: 251 +# Offense count: 229 RSpec/MultipleExpectations: Max: 94 -# Offense count: 218 +# Offense count: 212 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: Max: 31 @@ -911,7 +934,7 @@ RSpec/NamedSubject: - 'spec/models/room_spec.rb' - 'spec/models/track_spec.rb' -# Offense count: 202 +# Offense count: 198 # Configuration parameters: AllowedGroups. RSpec/NestedGroups: Max: 7 @@ -925,7 +948,7 @@ RSpec/NoExpectationExample: - 'spec/controllers/admin/registration_periods_controller_spec.rb' - 'spec/features/voting_spec.rb' -# Offense count: 78 +# Offense count: 24 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: not_to, to_not @@ -936,11 +959,6 @@ RSpec/NotToNot: - 'spec/controllers/admin/registration_periods_controller_spec.rb' - 'spec/controllers/admin/ticket_scannings_controller_spec.rb' - 'spec/controllers/booths_controller_spec.rb' - - 'spec/features/cfp_ability_spec.rb' - - 'spec/features/info_desk_ability_spec.rb' - - 'spec/features/organizer_ability_spec.rb' - - 'spec/features/sponsor_spec.rb' - - 'spec/features/track_organizer_ability_spec.rb' - 'spec/features/tracks_spec.rb' - 'spec/models/program_spec.rb' - 'spec/models/track_spec.rb' @@ -996,7 +1014,7 @@ RSpec/ScatteredSetup: Exclude: - 'spec/models/payment_spec.rb' -# Offense count: 30 +# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). RSpec/SortMetadata: Exclude: @@ -1082,7 +1100,7 @@ RSpecRails/InferredSpecType: # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: ExpectedOrder, Include. # ExpectedOrder: index, show, new, edit, create, update, destroy -# Include: app/controllers/**/*.rb +# Include: **/app/controllers/**/*.rb Rails/ActionOrder: Enabled: false @@ -1098,7 +1116,7 @@ Rails/ActiveRecordAliases: # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Include. -# Include: app/models/**/*.rb +# Include: **/app/models/**/*.rb Rails/ActiveRecordCallbacksOrder: Exclude: - 'app/models/event.rb' @@ -1117,10 +1135,15 @@ Rails/ApplicationMailer: Exclude: - 'app/mailers/mailbot.rb' -# Offense count: 129 +# Offense count: 5 # This cop supports unsafe autocorrection (--autocorrect-all). Rails/ApplicationRecord: - Enabled: false + Exclude: + - 'app/models/survey.rb' + - 'app/models/survey_question.rb' + - 'app/models/survey_reply.rb' + - 'app/models/survey_submission.rb' + - 'lib/tasks/data.rake' # Offense count: 10 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -1233,7 +1256,7 @@ Rails/EagerEvaluationLogMessage: # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Include. -# Include: app/models/**/*.rb +# Include: **/app/models/**/*.rb Rails/EnumHash: Exclude: - 'app/models/conference.rb' @@ -1262,7 +1285,7 @@ Rails/FindEach: # Offense count: 6 # Configuration parameters: Include. -# Include: app/models/**/*.rb +# Include: **/app/models/**/*.rb Rails/HasAndBelongsToMany: Exclude: - 'app/models/conference.rb' @@ -1273,13 +1296,13 @@ Rails/HasAndBelongsToMany: # Offense count: 24 # Configuration parameters: Include. -# Include: app/models/**/*.rb +# Include: **/app/models/**/*.rb Rails/HasManyOrHasOneDependent: Enabled: false # Offense count: 5 # Configuration parameters: Include. -# Include: app/helpers/**/*.rb +# Include: **/app/helpers/**/*.rb Rails/HelperInstanceVariable: Exclude: - 'app/helpers/application_helper.rb' @@ -1305,7 +1328,7 @@ Rails/I18nLocaleTexts: # Offense count: 7 # Configuration parameters: IgnoreScopes, Include. -# Include: app/models/**/*.rb +# Include: **/app/models/**/*.rb Rails/InverseOf: Exclude: - 'app/models/booth.rb' @@ -1315,7 +1338,7 @@ Rails/InverseOf: # Offense count: 1 # Configuration parameters: Include. -# Include: app/controllers/**/*.rb, app/mailers/**/*.rb +# Include: **/app/controllers/**/*.rb, **/app/mailers/**/*.rb Rails/LexicallyScopedActionFilter: Exclude: - 'app/controllers/registrations_controller.rb' @@ -1329,7 +1352,7 @@ Rails/LinkToBlank: # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Include. -# Include: app/mailers/**/*.rb +# Include: **/app/mailers/**/*.rb Rails/MailerName: Exclude: - 'app/mailers/mailbot.rb' @@ -1437,7 +1460,7 @@ Rails/ReversibleMigration: - 'db/migrate/20170720134353_make_track_cfp_active_not_null.rb' - 'db/migrate/20171118113113_change_visit_id_type_of_ahoy_events_to_integer.rb' -# Offense count: 48 +# Offense count: 41 # Configuration parameters: ForbiddenMethods, AllowedMethods. # ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all Rails/SkipsModelValidations: @@ -1474,7 +1497,7 @@ Rails/TopLevelHashWithIndifferentAccess: # Offense count: 12 # Configuration parameters: Include. -# Include: app/models/**/*.rb +# Include: **/app/models/**/*.rb Rails/UniqueValidationWithoutIndex: Exclude: - 'app/models/booth.rb' @@ -1583,7 +1606,7 @@ Style/ConditionalAssignment: - 'db/migrate/20140610165551_migrate_data_person_to_user.rb' - 'db/migrate/20140820124117_undo_wrong_migration20140801080705_add_users_to_events.rb' -# Offense count: 517 +# Offense count: 518 # Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false @@ -1628,7 +1651,7 @@ Style/ExpandPathArguments: Exclude: - 'spec/spec_helper.rb' -# Offense count: 38 +# Offense count: 39 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never @@ -1671,13 +1694,17 @@ Style/HashLikeCase: Exclude: - 'app/helpers/versions_helper.rb' -# Offense count: 346 +# Offense count: 7 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys # SupportedShorthandSyntax: always, never, either, consistent, either_consistent Style/HashSyntax: - Enabled: false + Exclude: + - 'Gemfile' + - 'app/views/admin/events/events.xlsx.axlsx' + - 'app/views/admin/registrations/index.xlsx.axlsx' + - 'lib/tasks/user.rake' # Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -1686,7 +1713,7 @@ Style/HashTransformValues: - 'app/controllers/admin/comments_controller.rb' - 'app/helpers/chart_helper.rb' -# Offense count: 56 +# Offense count: 54 # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Enabled: false @@ -1749,7 +1776,7 @@ Style/NestedParenthesizedCalls: # Offense count: 27 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, MinBodyLength. +# Configuration parameters: EnforcedStyle, MinBodyLength, AllowConsecutiveConditionals. # SupportedStyles: skip_modifier_ifs, always Style/Next: Enabled: false @@ -1768,19 +1795,18 @@ Style/NumericLiteralPrefix: - 'spec/serializers/conference_serializer_spec.rb' - 'spec/serializers/event_serializer_spec.rb' -# Offense count: 7 +# Offense count: 6 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Strict, AllowedNumbers, AllowedPatterns. Style/NumericLiterals: MinDigits: 15 -# Offense count: 36 +# Offense count: 27 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns. # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: - - 'app/controllers/admin/conferences_controller.rb' - 'app/helpers/application_helper.rb' - 'app/helpers/date_time_helper.rb' - 'app/helpers/format_helper.rb' @@ -1790,8 +1816,6 @@ Style/NumericPredicate: - 'app/models/program.rb' - 'app/models/registration.rb' - 'app/models/ticket_purchase.rb' - - 'app/models/user.rb' - - 'lib/tasks/events_registrations.rake' # Offense count: 3 Style/OptionalArguments: @@ -1813,14 +1837,13 @@ Style/OrAssignment: Exclude: - 'app/controllers/schedules_controller.rb' -# Offense count: 3 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions. Style/ParenthesesAroundCondition: Exclude: - 'app/controllers/admin/base_controller.rb' - 'app/controllers/application_controller.rb' - - 'app/helpers/format_helper.rb' # Offense count: 17 # This cop supports safe autocorrection (--autocorrect). @@ -1849,7 +1872,7 @@ Style/PreferredHashMethods: Exclude: - 'lib/tasks/migrate_config.rake' -# Offense count: 6 +# Offense count: 7 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowedCompactTypes. # SupportedStyles: compact, exploded @@ -1862,7 +1885,7 @@ Style/RandomWithOffset: Exclude: - 'spec/factories/sponsors.rb' -# Offense count: 3 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Style/RedundantAssignment: Exclude: @@ -1871,6 +1894,8 @@ Style/RedundantAssignment: # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedMethods. +# AllowedMethods: nonzero? Style/RedundantCondition: Exclude: - 'app/helpers/versions_helper.rb' @@ -1896,14 +1921,13 @@ Style/RedundantFilterChain: Exclude: - 'app/models/program.rb' -# Offense count: 12 +# Offense count: 11 # This cop supports safe autocorrection (--autocorrect). Style/RedundantParentheses: Exclude: - 'app/controllers/admin/base_controller.rb' - 'app/controllers/application_controller.rb' - 'app/helpers/application_helper.rb' - - 'app/helpers/format_helper.rb' - 'app/models/admin_ability.rb' - 'app/models/conference.rb' - 'app/models/program.rb' @@ -1941,14 +1965,13 @@ Style/RescueStandardError: - 'app/controllers/users/omniauth_callbacks_controller.rb' - 'lib/tasks/migrate_config.rake' -# Offense count: 3 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: only_raise, only_fail, semantic Style/SignalException: Exclude: - 'lib/tasks/user.rake' - - 'spec/support/flash.rb' # Offense count: 6 # This cop supports safe autocorrection (--autocorrect). @@ -2013,7 +2036,7 @@ Style/StringLiteralsInInterpolation: Style/SymbolArray: Enabled: false -# Offense count: 10 +# Offense count: 9 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. # AllowedMethods: define_method, mail, respond_to @@ -2025,7 +2048,6 @@ Style/SymbolProc: - 'app/models/admin_ability.rb' - 'db/migrate/20140730104658_migrate_roles_for_cancancan.rb' - 'spec/controllers/admin/conferences_controller_spec.rb' - - 'spec/support/flash.rb' # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). @@ -2038,13 +2060,13 @@ Style/TernaryParentheses: # Offense count: 21 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma +# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma Style/TrailingCommaInHashLiteral: Exclude: - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' - 'spec/models/conference_spec.rb' -# Offense count: 3 +# Offense count: 10 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: WordRegex. # SupportedStyles: percent, brackets @@ -2052,9 +2074,9 @@ Style/WordArray: EnforcedStyle: percent MinSize: 6 -# Offense count: 497 +# Offense count: 431 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https Layout/LineLength: Max: 619 diff --git a/Gemfile b/Gemfile index 4e39c405..417143dd 100644 --- a/Gemfile +++ b/Gemfile @@ -192,6 +192,10 @@ gem 'icalendar' # to tame logs gem 'lograge' +# FIXME: https://github.com/ruby-concurrency/concurrent-ruby/commit/d7ce956dacd0b772273d39b8ed31a30cff7ecf38 +# remove after updating to rails to >7.1 +gem 'concurrent-ruby', '1.3.4' + group :development do # for static code analisys gem 'rubocop', require: false diff --git a/Gemfile.lock b/Gemfile.lock index f74adc4c..b59e71e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -87,7 +87,7 @@ GEM zeitwerk archive-zip (0.12.0) io-like (~> 0.3.0) - ast (2.4.2) + ast (2.4.3) autoprefixer-rails (10.4.21.0) execjs (~> 2) awesome_nested_set (3.8.0) @@ -230,7 +230,7 @@ GEM hashery (2.1.2) hashie (5.0.0) htmlentities (4.3.4) - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) i18n_data (1.1.0) simple_po_parser (~> 1.1) @@ -255,14 +255,14 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (8.0.0) railties (>= 3.2.16) - json (2.9.1) + json (2.13.2) json-schema (5.2.1) addressable (~> 2.8) bigdecimal (~> 3.1) jsonapi-renderer (0.2.2) jwt (2.9.3) base64 - language_server-protocol (3.17.0.3) + language_server-protocol (3.17.0.5) launchy (3.0.1) addressable (~> 2.8) childprocess (~> 5.0) @@ -276,6 +276,7 @@ GEM letter_opener (~> 1.9) railties (>= 6.1) rexml + lint_roller (1.1.0) logger (1.6.3) lograge (0.14.0) actionpack (>= 4) @@ -298,7 +299,7 @@ GEM mini_magick (4.13.2) mini_mime (1.1.5) mini_portile2 (2.8.9) - minitest (5.25.4) + minitest (5.25.5) monetize (1.13.0) money (~> 6.12) money (6.19.0) @@ -365,8 +366,8 @@ GEM paper_trail (16.0.0) activerecord (>= 6.1) request_store (~> 1.4) - parallel (1.26.3) - parser (3.3.6.0) + parallel (1.27.0) + parser (3.3.9.0) ast (~> 2.4.1) racc pdf-core (0.10.0) @@ -393,11 +394,12 @@ GEM prawn-table prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) + prism (1.4.0) public_suffix (6.0.2) puma (6.5.0) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.14) + rack (2.2.17) rack-openid (1.4.2) rack (>= 1.1.0) ruby-openid (>= 2.1.8) @@ -445,7 +447,7 @@ GEM rake (13.2.1) recaptcha (5.18.0) redcarpet (3.6.0) - regexp_parser (2.9.3) + regexp_parser (2.11.1) request_store (1.7.0) rack (>= 1.4) responders (3.1.1) @@ -478,35 +480,43 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.2) - rubocop (1.69.2) + rubocop (1.79.2) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.36.2, < 2.0) + rubocop-ast (>= 1.46.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.37.0) - parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.26.1) - rubocop (~> 1.61) - rubocop-performance (1.23.0) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.27.0) + rubocop-ast (1.46.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-capybara (2.22.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-factory_bot (2.27.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-performance (1.25.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rails (2.33.1) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.52.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (3.3.0) - rubocop (~> 1.61) - rubocop-rspec_rails (2.30.0) - rubocop (~> 1.61) - rubocop-rspec (~> 3, >= 3.0.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rspec (3.6.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec_rails (2.31.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec (~> 3.5) ruby-oembed (0.18.1) ruby-openid (2.9.2) ruby-progressbar (1.13.0) @@ -580,7 +590,7 @@ GEM concurrent-ruby (~> 1.0) uglifier (4.2.1) execjs (>= 0.3.0, < 3) - unicode-display_width (3.1.2) + unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) unobtrusive_flash (3.3.1) @@ -634,6 +644,7 @@ DEPENDENCIES climate_control cloudinary cocoon + concurrent-ruby (= 1.3.4) countable-rails daemons dalli diff --git a/app/controllers/admin/conferences_controller.rb b/app/controllers/admin/conferences_controller.rb index cafc2b32..1def3c5b 100644 --- a/app/controllers/admin/conferences_controller.rb +++ b/app/controllers/admin/conferences_controller.rb @@ -8,7 +8,7 @@ module Admin def index # Redirect to new form if there is no conference - if Conference.count == 0 + if Conference.none? redirect_to new_admin_conference_path return end diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index ca455dce..d69e1ab1 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -69,7 +69,7 @@ module Admin end # The conference must have at least 1 organizer - if @role.name == 'organizer' && state == 'false' && @role.users.count == 1 + if @role.name == 'organizer' && state == 'false' && @role.users.one? redirect_to admin_conference_role_path(@conference.short_title, @role.name), error: 'The conference must have at least 1 organizer!' return diff --git a/app/controllers/admin/volunteers_controller.rb b/app/controllers/admin/volunteers_controller.rb index b0b85ffc..35629345 100644 --- a/app/controllers/admin/volunteers_controller.rb +++ b/app/controllers/admin/volunteers_controller.rb @@ -3,6 +3,7 @@ module Admin class VolunteersController < Admin::BaseController include VolunteersHelper + load_and_authorize_resource :conference, find_by: :short_title def index diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 93105587..315c4e30 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,6 +3,7 @@ class ApplicationController < ActionController::Base before_action :set_paper_trail_whodunnit include ApplicationHelper + add_flash_types :error protect_from_forgery with: :exception, prepend: true before_action :store_location diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 8a4262f1..43809551 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -50,14 +50,14 @@ class ConferencesController < ApplicationController ).order('tracks.name') end if splashpage.include_booths - @booths = @conference.confirmed_booths.order('title') + @booths = @conference.confirmed_booths.order(:title) end end if splashpage.include_registrations || splashpage.include_tickets - @tickets = @conference.tickets.order('price_cents') + @tickets = @conference.tickets.order(:price_cents) end if splashpage.include_lodgings - @lodgings = @conference.lodgings.order('name') + @lodgings = @conference.lodgings.order(:name) end if splashpage.include_sponsors @sponsorship_levels = @conference.sponsorship_levels.eager_load( diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index ddb16e4c..b2768317 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -39,7 +39,7 @@ module EventsHelper end def canceled_replacement_event_label(event, event_schedule, *label_classes) - if event.state == 'canceled' || event.state == 'withdrawn' + if ['canceled', 'withdrawn'].include?(event.state) content_tag :span, 'CANCELED', class: (['label', 'label-danger'] + label_classes) elsif event_schedule.present? && event_schedule.replacement?(@withdrawn_event_schedules) content_tag :span, 'REPLACEMENT', class: (['label', 'label-info'] + label_classes) diff --git a/app/models/admin_ability.rb b/app/models/admin_ability.rb index 67bf6cfe..34bccc51 100644 --- a/app/models/admin_ability.rb +++ b/app/models/admin_ability.rb @@ -141,7 +141,7 @@ class AdminAbility # Abilities for Role (Conference resource) can [:index, :show], Role do |role| - role.resource_type == 'Conference' || role.resource_type == 'Track' + ['Conference', 'Track'].include?(role.resource_type) end can [:edit, :update, :toggle_user], Role do |role| @@ -180,7 +180,7 @@ class AdminAbility # Abilities for Role (Conference resource) can [:index, :show], Role do |role| - role.resource_type == 'Conference' || role.resource_type == 'Track' + ['Conference', 'Track'].include?(role.resource_type) end # Can add or remove users from role, when user has that same role for the conference # Eg. If you are member of the CfP team, you can add more CfP team members (add users to the role 'CfP') @@ -218,7 +218,7 @@ class AdminAbility # Abilities for Role (Conference resource) can [:index, :show], Role do |role| - role.resource_type == 'Conference' || role.resource_type == 'Track' + ['Conference', 'Track'].include?(role.resource_type) end # Can add or remove users from role, when user has that same role for the conference # Eg. If you are member of the CfP team, you can add more CfP team members (add users to the role 'CfP') @@ -242,7 +242,7 @@ class AdminAbility # Abilities for Role (Conference resource) can [:index, :show], Role do |role| - role.resource_type == 'Conference' || role.resource_type == 'Track' + ['Conference', 'Track'].include?(role.resource_type) end # Can add or remove users from role, when user has that same role for the conference # Eg. If you are member of the CfP team, you can add more CfP team members (add users to the role 'CfP') @@ -278,7 +278,7 @@ class AdminAbility # Show Roles in the admin sidebar and allow authorization of the index action can [:index, :show], Role do |role| - role.resource_type == 'Conference' || role.resource_type == 'Track' + ['Conference', 'Track'].include?(role.resource_type) end can :toggle_user, Role do |role| diff --git a/app/models/booth.rb b/app/models/booth.rb index 85c6c7a8..06357f0e 100644 --- a/app/models/booth.rb +++ b/app/models/booth.rb @@ -2,6 +2,7 @@ class Booth < ApplicationRecord include ActiveRecord::Transitions + has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id } belongs_to :conference diff --git a/app/models/comment.rb b/app/models/comment.rb index ee1a07a8..0b4e6800 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -35,13 +35,13 @@ class Comment < ApplicationRecord # Helper class method to lookup all comments assigned # to all commentable types for a given user. scope :find_comments_by_user, lambda { |user| - where(user_id: user.id).order('created_at DESC') + where(user_id: user.id).order(created_at: :desc) } # Helper class method to look up all comments for # commentable class name and commentable id. scope :find_comments_for_commentable, lambda { |commentable_str, commentable_id| - where(commentable_type: commentable_str.to_s, commentable_id: commentable_id).order('created_at DESC') + where(commentable_type: commentable_str.to_s, commentable_id: commentable_id).order(created_at: :desc) } scope :find_since_last_login, lambda { |user| diff --git a/app/models/conference.rb b/app/models/conference.rb index 2e63e4ee..46505572 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -2,13 +2,14 @@ class Conference < ApplicationRecord include RevisionCount + require 'uri' serialize :events_per_week, Hash # Needed to call 'Conference.with_role' in /models/ability.rb # Dependent destroy will fail as roles#destroy will be cancelled,hence delete_all resourcify :roles, dependent: :delete_all - default_scope { order('start_date DESC') } + default_scope { order(start_date: :desc) } scope :upcoming, (-> { where(end_date: Date.current..) }) scope :past, (-> { where(end_date: ...Date.current) }) @@ -39,7 +40,7 @@ class Conference < ApplicationRecord has_many :participants, through: :registrations, source: :user has_many :vdays, dependent: :destroy has_many :vpositions, dependent: :destroy - has_many :sponsorship_levels, -> { order('position ASC') }, dependent: :destroy + has_many :sponsorship_levels, -> { order(:position) }, dependent: :destroy has_many :sponsors, dependent: :destroy has_many :commercials, as: :commercialable, dependent: :destroy has_many :subscriptions, dependent: :destroy @@ -107,7 +108,7 @@ class Conference < ApplicationRecord # * +false+ -> If the user is registered # * +true+ - If the user isn't registered def user_registered? user - user.present? && registrations.where(user_id: user.id).count > 0 + user.present? && registrations.where(user_id: user.id).any? end ## @@ -350,7 +351,7 @@ class Conference < ApplicationRecord # * +hash+ -> user: submissions def self.get_top_submitter(limit = 5) submitter = EventUser.select(:user_id).where('event_role = ?', 'submitter').limit(limit).group(:user_id) - counter = submitter.order('count_all desc').count(:all) + counter = submitter.order(count_all: :desc).count(:all) calculate_user_submission_hash(submitter, counter) end @@ -363,7 +364,7 @@ class Conference < ApplicationRecord submitter = EventUser.joins(:event).select(:user_id) .where('event_role = ? and program_id = ?', 'submitter', Conference.find(id).program.id) .limit(limit).group(:user_id) - counter = submitter.order('count_all desc').count(:all) + counter = submitter.order(count_all: :desc).count(:all) Conference.calculate_user_submission_hash(submitter, counter) end @@ -921,7 +922,7 @@ class Conference < ApplicationRecord # * +True+ -> One difficulty level or more # * +False+ -> No diffculty level def difficulty_levels_set? - program.difficulty_levels.count > 0 + program.difficulty_levels.any? end ## @@ -931,7 +932,7 @@ class Conference < ApplicationRecord # * +True+ -> One difficulty level or more # * +False+ -> No diffculty level def event_types_set? - program.event_types.count > 0 + program.event_types.any? end ## @@ -941,7 +942,7 @@ class Conference < ApplicationRecord # * +True+ -> One track or more # * +False+ -> No track def tracks_set? - program.tracks.count > 0 + program.tracks.any? end ## @@ -951,7 +952,7 @@ class Conference < ApplicationRecord # * +True+ -> One room or more # * +False+ -> No room def rooms_set? - venue.present? && venue.rooms.count > 0 + venue.present? && venue.rooms.any? end # Checks if the conference has a venue object. diff --git a/app/models/event.rb b/app/models/event.rb index dc7202c2..82f8204b 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -4,6 +4,7 @@ class Event < ApplicationRecord include ActionView::Helpers::NumberHelper # for number_with_precision include ActiveRecord::Transitions include RevisionCount + has_paper_trail on: [:create, :update], ignore: [:updated_at, :guid, :week], meta: { conference_id: :conference_id } acts_as_commentable diff --git a/app/models/event_schedule.rb b/app/models/event_schedule.rb index 8c5e9753..32ec8b4f 100644 --- a/app/models/event_schedule.rb +++ b/app/models/event_schedule.rb @@ -82,13 +82,13 @@ class EventSchedule < ApplicationRecord end def start_after_end_hour - return unless event && start_time && event.program&.conference && event.program.conference.end_hour + return unless event && start_time && event.program&.conference&.end_hour errors.add(:start_time, "can't be after the conference end hour (#{event.program.conference.end_hour})") if start_time.hour >= event.program.conference.end_hour end def start_before_start_hour - return unless event && start_time && event.program&.conference && event.program.conference.start_hour + return unless event && start_time && event.program&.conference&.start_hour errors.add(:start_time, "can't be before the conference start hour (#{event.program.conference.start_hour})") if start_time.hour < event.program.conference.start_hour end diff --git a/app/models/room.rb b/app/models/room.rb index 4bd88834..af180fb6 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -2,6 +2,7 @@ class Room < ApplicationRecord include RevisionCount + belongs_to :venue has_many :event_schedules, dependent: :destroy has_many :tracks diff --git a/app/models/survey.rb b/app/models/survey.rb index 933fa9f6..62ce553e 100644 --- a/app/models/survey.rb +++ b/app/models/survey.rb @@ -25,7 +25,7 @@ class Survey < ActiveRecord::Base now = Time.current.in_time_zone(timezone) if start_date && end_date - now >= start_date && now <= end_date + now.between?(start_date, end_date) elsif start_date && !end_date now >= start_date elsif !start_date && end_date diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 677ef90f..abc014cd 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -81,7 +81,7 @@ class Ticket < ApplicationRecord def tickets_of_conference_have_same_currency tickets = Ticket.where(conference_id: conference_id) - return if tickets.count.zero? || (tickets.count == 1 && self == tickets.first) + return if tickets.none? || (tickets.one? && self == tickets.first) unless tickets.all?{|t| t.price_currency == price_currency } errors.add(:price_currency, 'is different from the existing tickets of this conference.') diff --git a/app/models/ticket_purchase.rb b/app/models/ticket_purchase.rb index f8e6c210..6d373d3f 100644 --- a/app/models/ticket_purchase.rb +++ b/app/models/ticket_purchase.rb @@ -97,8 +97,6 @@ class TicketPurchase < ApplicationRecord end end -private - def set_week self.week = created_at.strftime('%W') save! diff --git a/app/models/track.rb b/app/models/track.rb index d34bfbef..b249bef3 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -233,8 +233,8 @@ class Track < ApplicationRecord (program.tracks.accepted + program.tracks.confirmed - [self]).each do |existing_track| next unless existing_track.room == room && existing_track.start_date && existing_track.end_date - if start_date >= existing_track.start_date && start_date <= existing_track.end_date || - end_date >= existing_track.start_date && end_date <= existing_track.end_date || + if start_date.between?(existing_track.start_date, existing_track.end_date) || + end_date.between?(existing_track.start_date, existing_track.end_date) || start_date <= existing_track.start_date && end_date >= existing_track.end_date errors.add(:track, 'has overlapping dates with a confirmed or accepted track in the same room') break diff --git a/app/models/user.rb b/app/models/user.rb index 564384f9..4cbac281 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -30,6 +30,7 @@ class User < ApplicationRecord :avatar_content_type, :avatar_file_size, :avatar_updated_at, :updated_at, :confirmation_sent_at, :confirmation_token, :reset_password_token] include Gravtastic + gravtastic size: 32 before_create :setup_role @@ -238,7 +239,7 @@ class User < ApplicationRecord end def registered - if registrations.count == 0 + if registrations.none? 'None' else registrations.map { |r| r.conference.title }.join ', ' @@ -247,7 +248,7 @@ class User < ApplicationRecord def attended registrations_attended = registrations.where(attended: true) - if registrations_attended.count == 0 + if registrations_attended.none? 'None' else registrations_attended.map { |r| r.conference.title }.join ', ' @@ -271,7 +272,7 @@ class User < ApplicationRecord end def self.empty? - User.count == 1 && User.first.email == 'deleted@localhost.osem' + User.one? && User.first.email == 'deleted@localhost.osem' end private diff --git a/db/migrate/20140730104658_migrate_roles_for_cancancan.rb b/db/migrate/20140730104658_migrate_roles_for_cancancan.rb index ed76b7c0..adbe9d05 100644 --- a/db/migrate/20140730104658_migrate_roles_for_cancancan.rb +++ b/db/migrate/20140730104658_migrate_roles_for_cancancan.rb @@ -8,7 +8,7 @@ class MigrateRolesForCancancan < ActiveRecord::Migration Role.all.each do |role| role.users.each do |user| Conference.all.each do |conference| - if role.name == 'Admin' || role.name == 'Organizer' + if ['Admin', 'Organizer'].include?(role.name) user.add_role :organizer, conference user.update_columns(is_admin: true) else diff --git a/db/migrate/20170531094819_move_conferences_to_organizations.rb b/db/migrate/20170531094819_move_conferences_to_organizations.rb index 7f7e776c..01cfa87f 100644 --- a/db/migrate/20170531094819_move_conferences_to_organizations.rb +++ b/db/migrate/20170531094819_move_conferences_to_organizations.rb @@ -13,7 +13,7 @@ class MoveConferencesToOrganizations < ActiveRecord::Migration add_reference :conferences, :organization, index: true TempConference.reset_column_information - if TempConference.count != 0 + if TempConference.any? organization = TempOrganization.create(name: 'organization', description: 'Default organization') TempConference.all.each do |conference| conference.organization_id = organization.id diff --git a/lib/tasks/data_demo.rake b/lib/tasks/data_demo.rake index ae57b717..0e5450b4 100644 --- a/lib/tasks/data_demo.rake +++ b/lib/tasks/data_demo.rake @@ -5,6 +5,7 @@ namespace :data do task demo: :environment do include FactoryBot::Syntax::Methods + conference = create(:full_conference, title: 'Open Source Event Manager Demo', short_title: 'osemdemo' ,description: "This is a [Open Source Event Manager](http://osem.io/) demo instance. You can log in as **admin** with the password **password123** or just you just [sign up](/accounts/sign_up) with your own user. We hope you enjoy checking out all the functionality, if you have questions don't hesitate to [contact us](http://osem.io/#contact)!\r\n\r\n## Data will be destroyed every thirty minutes or whenever someone updates the [OSEM source code on github](https://github.com/openSUSE/osem/commits/master).") conference.contact.update(email: 'osemdemo@osem.io', sponsor_email: 'osemdemo@osem.io') create(:admin, email: 'admin@osem.io', username: 'admin', password: 'password123', password_confirmation: 'password123') diff --git a/lib/tasks/events_registrations.rake b/lib/tasks/events_registrations.rake index 171f4b25..ccab6e0c 100644 --- a/lib/tasks/events_registrations.rake +++ b/lib/tasks/events_registrations.rake @@ -7,13 +7,13 @@ namespace :events_registrations do duplicates = EventsRegistration.all.map { |er| er.id if er.valid? == false}.compact puts "Duplicates found: #{duplicates.count}" - if duplicates.count > 0 + if duplicates.any? puts "With IDs: #{duplicates}" end EventsRegistration.all.each do |er| records = EventsRegistration.where(registration_id: er.registration_id, event_id: er.event_id) - if records.count > 1 + if records.many? # Iterate through duplicates (excluding 1st record) (1..(records.count - 1)).each do |i| puts "Deleting EventsRegistration record with ID #{records[i].id} ..." diff --git a/spec/mailers/mailbot_spec.rb b/spec/mailers/mailbot_spec.rb index 39aaf3cf..afcdb0b0 100644 --- a/spec/mailers/mailbot_spec.rb +++ b/spec/mailers/mailbot_spec.rb @@ -32,7 +32,7 @@ describe Mailbot do end describe '.registration_mail' do - include_examples 'mailer actions' do + it_behaves_like 'mailer actions' do let(:mail) { Mailbot.registration_mail(conference, user).deliver_now } end end @@ -44,7 +44,7 @@ describe Mailbot do accepted_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end - include_examples 'mailer actions' do + it_behaves_like 'mailer actions' do let(:mail) { Mailbot.acceptance_mail(event).deliver_now } end end @@ -56,7 +56,7 @@ describe Mailbot do rejected_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end - include_examples 'mailer actions' do + it_behaves_like 'mailer actions' do let(:mail) { Mailbot.rejection_mail(event).deliver_now } end end @@ -68,7 +68,7 @@ describe Mailbot do confirmed_without_registration_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end - include_examples 'mailer actions' do + it_behaves_like 'mailer actions' do let(:mail) { Mailbot.confirm_reminder_mail(event).deliver_now } end end diff --git a/spec/support/login_macros.rb b/spec/support/login_macros.rb index 7557c14d..96237512 100644 --- a/spec/support/login_macros.rb +++ b/spec/support/login_macros.rb @@ -2,6 +2,7 @@ module LoginMacros include Warden::Test::Helpers + Warden.test_mode! def sign_in(user)