mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 01:13:03 -04:00
Compare commits
12 Commits
release76
...
rubocop-mr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a6f826c1d | ||
|
|
ef1ff9d519 | ||
|
|
84c71c75eb | ||
|
|
a91b357408 | ||
|
|
514d271638 | ||
|
|
8ab94bae67 | ||
|
|
c6e57ca3ed | ||
|
|
c3cdf8cb77 | ||
|
|
82bcb00fa1 | ||
|
|
aec2bb67e9 | ||
|
|
60765d5ebf | ||
|
|
baca600f45 |
@@ -1,5 +1,5 @@
|
||||
inherit_from: .rubocop_todo.yml
|
||||
require:
|
||||
plugins:
|
||||
- rubocop-factory_bot
|
||||
- rubocop-capybara
|
||||
- rubocop-rails
|
||||
|
||||
@@ -1,18 +1,30 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2024-07-13 05:47:38 UTC using RuboCop version 1.65.0.
|
||||
# on 2025-09-07 08:46:49 UTC using RuboCop version 1.80.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
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 231
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: link_or_button, strict
|
||||
Capybara/ClickLinkOrButtonStyle:
|
||||
Enabled: false
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
|
||||
Bundler/OrderedGems:
|
||||
Exclude:
|
||||
- 'Gemfile'
|
||||
|
||||
# Offense count: 39
|
||||
# Offense count: 18
|
||||
Capybara/NegationMatcherAfterVisit:
|
||||
Exclude:
|
||||
- 'spec/features/crops/crop_detail_page_spec.rb'
|
||||
- 'spec/features/crops/crop_wranglers_spec.rb'
|
||||
- 'spec/features/gardens/gardens_spec.rb'
|
||||
- 'spec/features/members/deletion_spec.rb'
|
||||
- 'spec/features/members/following_spec.rb'
|
||||
- 'spec/features/members/profile_spec.rb'
|
||||
- 'spec/features/plantings/planting_a_crop_spec.rb'
|
||||
|
||||
# Offense count: 34
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: DefaultSelector.
|
||||
Capybara/RSpec/HaveSelector:
|
||||
@@ -25,7 +37,6 @@ Capybara/RSpec/HaveSelector:
|
||||
- 'spec/features/plantings/planting_a_crop_spec.rb'
|
||||
- 'spec/features/seeds/adding_seeds_spec.rb'
|
||||
- 'spec/features/shared_examples/crop_suggest.rb'
|
||||
- 'spec/helpers/application_helper_spec.rb'
|
||||
- 'spec/support/feature_helpers.rb'
|
||||
- 'spec/views/posts/show.html.haml_spec.rb'
|
||||
|
||||
@@ -56,8 +67,7 @@ FactoryBot/AssociationStyle:
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AutoCorrect, Include, EnforcedStyle, ExplicitOnly.
|
||||
# Include: **/*_spec.rb, **/spec/**/*, **/test/**/*, **/features/support/factories/**/*.rb
|
||||
# Configuration parameters: EnforcedStyle, ExplicitOnly.
|
||||
# SupportedStyles: create_list, n_times
|
||||
FactoryBot/CreateList:
|
||||
Exclude:
|
||||
@@ -66,31 +76,29 @@ FactoryBot/CreateList:
|
||||
- 'spec/views/posts/index.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: Include, MaxAmount.
|
||||
# Include: **/*_spec.rb, **/spec/**/*, **/test/**/*, **/features/support/factories/**/*.rb
|
||||
# Configuration parameters: MaxAmount.
|
||||
FactoryBot/ExcessiveCreateList:
|
||||
Exclude:
|
||||
- 'spec/controllers/posts_controller_spec.rb'
|
||||
- 'spec/features/crops/show_spec.rb'
|
||||
- 'spec/features/percy/percy_spec.rb'
|
||||
|
||||
# Offense count: 1127
|
||||
# Offense count: 1144
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Include.
|
||||
# Include: **/*_spec.rb, **/spec/**/*, **/test/**/*, **/features/support/factories/**/*.rb
|
||||
FactoryBot/SyntaxMethods:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 3
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
||||
# URISchemes: http, https
|
||||
Layout/LineLength:
|
||||
Exclude:
|
||||
- 'app/helpers/crops_helper.rb'
|
||||
- 'app/models/concerns/predict_planting.rb'
|
||||
- 'app/models/member.rb'
|
||||
- 'db/seeds.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: RequireParenthesesForMethodChains.
|
||||
Lint/AmbiguousRange:
|
||||
@@ -98,14 +106,20 @@ Lint/AmbiguousRange:
|
||||
- 'app/models/concerns/search_activities.rb'
|
||||
- 'app/models/concerns/search_harvests.rb'
|
||||
- 'app/models/concerns/search_plantings.rb'
|
||||
- 'db/seeds.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
|
||||
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
||||
Lint/DuplicateBranch:
|
||||
Exclude:
|
||||
- 'app/models/harvest.rb'
|
||||
- 'lib/actions/oauth_signup_action.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Lint/DuplicateMethods:
|
||||
Exclude:
|
||||
- 'app/models/planting.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
||||
Lint/EmptyBlock:
|
||||
@@ -124,12 +138,6 @@ Lint/RedundantCopDisableDirective:
|
||||
Exclude:
|
||||
- 'db/migrate/20230313015323_create_active_storage_tables.active_storage.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Lint/RedundantDirGlobSort:
|
||||
Exclude:
|
||||
- 'spec/rails_helper.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: AllowComments, AllowNil.
|
||||
Lint/SuppressedException:
|
||||
@@ -137,14 +145,18 @@ Lint/SuppressedException:
|
||||
- 'lib/tasks/testing.rake'
|
||||
|
||||
# Offense count: 7
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AutoCorrect.
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Lint/UselessAssignment:
|
||||
Exclude:
|
||||
- 'config.rb'
|
||||
- 'config/compass.rb'
|
||||
|
||||
# Offense count: 52
|
||||
# Offense count: 1
|
||||
Lint/UselessConstantScoping:
|
||||
Exclude:
|
||||
- 'app/controllers/members_controller.rb'
|
||||
|
||||
# Offense count: 55
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
Max: 151
|
||||
@@ -153,33 +165,42 @@ Metrics/AbcSize:
|
||||
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
|
||||
# AllowedMethods: refine
|
||||
Metrics/BlockLength:
|
||||
Max: 115
|
||||
Max: 116
|
||||
|
||||
# Offense count: 7
|
||||
# Offense count: 9
|
||||
# Configuration parameters: CountComments, CountAsOne.
|
||||
Metrics/ClassLength:
|
||||
Max: 188
|
||||
Max: 181
|
||||
|
||||
# Offense count: 6
|
||||
# Offense count: 8
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 32
|
||||
|
||||
# Offense count: 71
|
||||
# Offense count: 73
|
||||
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
||||
Metrics/MethodLength:
|
||||
Max: 127
|
||||
Max: 128
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: CountComments, CountAsOne.
|
||||
Metrics/ModuleLength:
|
||||
Max: 125
|
||||
Max: 132
|
||||
|
||||
# Offense count: 5
|
||||
# Offense count: 7
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 32
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
||||
# AllowedMethods: call
|
||||
# WaywardPredicates: nonzero?
|
||||
Naming/PredicateMethod:
|
||||
Exclude:
|
||||
- 'app/models/concerns/finishable.rb'
|
||||
- 'app/models/seed.rb'
|
||||
|
||||
# Offense count: 3
|
||||
RSpec/AnyInstance:
|
||||
Exclude:
|
||||
@@ -204,7 +225,6 @@ RSpec/DescribedClass:
|
||||
|
||||
# Offense count: 13
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AutoCorrect.
|
||||
RSpec/EmptyExampleGroup:
|
||||
Exclude:
|
||||
- 'spec/controllers/authentications_controller_spec.rb'
|
||||
@@ -220,17 +240,10 @@ RSpec/EmptyExampleGroup:
|
||||
- 'spec/views/photos/edit.html.haml_spec.rb'
|
||||
- 'spec/views/posts/_single.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowConsecutiveOneLiners.
|
||||
RSpec/EmptyLineAfterExample:
|
||||
Exclude:
|
||||
- 'spec/models/ability_spec.rb'
|
||||
|
||||
# Offense count: 140
|
||||
# Offense count: 137
|
||||
# Configuration parameters: CountAsOne.
|
||||
RSpec/ExampleLength:
|
||||
Max: 25
|
||||
Max: 27
|
||||
|
||||
# Offense count: 32
|
||||
RSpec/ExpectInHook:
|
||||
@@ -245,17 +258,8 @@ RSpec/ExpectInHook:
|
||||
- 'spec/features/plantings/planting_a_crop_spec.rb'
|
||||
- 'spec/features/shared_examples/append_date.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: implicit, each, example
|
||||
RSpec/HookArgument:
|
||||
Exclude:
|
||||
- 'spec/requests/api/v1/plantings_request_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AutoCorrect.
|
||||
RSpec/HooksBeforeExamples:
|
||||
Exclude:
|
||||
- 'spec/features/crops/creating_a_crop_spec.rb'
|
||||
@@ -276,21 +280,15 @@ RSpec/IndexedLet:
|
||||
- 'spec/models/member_spec.rb'
|
||||
- 'spec/views/forums/index.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 720
|
||||
# Offense count: 719
|
||||
# Configuration parameters: AssignmentOnly.
|
||||
RSpec/InstanceVariable:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 40
|
||||
# Offense count: 42
|
||||
RSpec/LetSetup:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
RSpec/MatchArray:
|
||||
Exclude:
|
||||
- 'spec/models/post_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
RSpec/MessageChain:
|
||||
Exclude:
|
||||
@@ -307,11 +305,11 @@ RSpec/MultipleDescribes:
|
||||
Exclude:
|
||||
- 'spec/features/crops/crop_wranglers_spec.rb'
|
||||
|
||||
# Offense count: 152
|
||||
# Offense count: 149
|
||||
RSpec/MultipleExpectations:
|
||||
Max: 19
|
||||
|
||||
# Offense count: 138
|
||||
# Offense count: 147
|
||||
# Configuration parameters: AllowSubject.
|
||||
RSpec/MultipleMemoizedHelpers:
|
||||
Max: 14
|
||||
@@ -322,12 +320,12 @@ RSpec/MultipleMemoizedHelpers:
|
||||
RSpec/NamedSubject:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 111
|
||||
# Offense count: 110
|
||||
# Configuration parameters: AllowedGroups.
|
||||
RSpec/NestedGroups:
|
||||
Max: 6
|
||||
|
||||
# Offense count: 403
|
||||
# Offense count: 407
|
||||
# Configuration parameters: AllowedPatterns.
|
||||
# AllowedPatterns: ^expect_, ^assert_
|
||||
RSpec/NoExpectationExample:
|
||||
@@ -358,15 +356,13 @@ RSpec/RepeatedExampleGroupBody:
|
||||
|
||||
# Offense count: 6
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AutoCorrect.
|
||||
RSpec/ScatteredSetup:
|
||||
Exclude:
|
||||
- 'spec/features/percy/percy_spec.rb'
|
||||
- 'spec/features/plantings/prediction_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
|
||||
# Include: **/*_spec.rb
|
||||
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata.
|
||||
RSpec/SpecFilePathFormat:
|
||||
Exclude:
|
||||
- 'spec/controllers/member_controller_spec.rb'
|
||||
@@ -380,8 +376,6 @@ RSpec/StubbedMock:
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: constant, string
|
||||
RSpec/VerifiedDoubleReference:
|
||||
Exclude:
|
||||
- 'spec/models/member_spec.rb'
|
||||
@@ -411,30 +405,36 @@ RSpecRails/HaveHttpStatus:
|
||||
RSpecRails/InferredSpecType:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 28
|
||||
# Configuration parameters: Database, Include.
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent.
|
||||
Rails/Blank:
|
||||
Exclude:
|
||||
- 'lib/tasks/wikidata.rake'
|
||||
|
||||
# Offense count: 29
|
||||
# Configuration parameters: Database.
|
||||
# SupportedDatabases: mysql, postgresql
|
||||
# Include: db/**/*.rb
|
||||
Rails/BulkChangeTable:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: Include.
|
||||
# Include: db/**/*.rb
|
||||
Rails/CreateTableWithTimestamps:
|
||||
Exclude:
|
||||
- 'db/migrate/20150201052245_create_cms.rb'
|
||||
- 'db/migrate/20171022032108_all_the_predictions.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle, AllowToTime.
|
||||
# SupportedStyles: strict, flexible
|
||||
Rails/Date:
|
||||
Exclude:
|
||||
- 'app/controllers/activities_controller.rb'
|
||||
- 'app/mailers/notifier_mailer.rb'
|
||||
- 'app/models/concerns/search_seeds.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# Offense count: 12
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
# AllowedMethods: order, limit, select, lock
|
||||
@@ -445,64 +445,55 @@ Rails/FindEach:
|
||||
- 'db/migrate/20171129041341_create_photographings.rb'
|
||||
- 'db/migrate/20190130090437_add_crop_to_photographings.rb'
|
||||
- 'db/migrate/20191119030244_cms_tags.rb'
|
||||
- 'lib/tasks/wikidata.rake'
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasAndBelongsToMany:
|
||||
Exclude:
|
||||
- 'app/models/member.rb'
|
||||
- 'app/models/role.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasManyOrHasOneDependent:
|
||||
Exclude:
|
||||
- 'app/models/member.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: Include.
|
||||
# Include: spec/**/*.rb, test/**/*.rb
|
||||
Rails/I18nLocaleAssignment:
|
||||
Exclude:
|
||||
- 'spec/features/locale_spec.rb'
|
||||
|
||||
# Offense count: 33
|
||||
# Offense count: 37
|
||||
Rails/I18nLocaleTexts:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 3
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/controllers/**/*.rb, app/mailers/**/*.rb
|
||||
Rails/LexicallyScopedActionFilter:
|
||||
Exclude:
|
||||
- 'app/controllers/data_controller.rb'
|
||||
- 'app/controllers/registrations_controller.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/OrderArguments:
|
||||
Exclude:
|
||||
- 'app/models/crop.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Rails/OutputSafety:
|
||||
Exclude:
|
||||
- 'app/helpers/auto_suggest_helper.rb'
|
||||
- 'app/helpers/gardens_helper.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Rails/PluralizationGrammar:
|
||||
Exclude:
|
||||
- 'spec/requests/plantings_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Include.
|
||||
# Include: **/Rakefile, **/*.rake
|
||||
Rails/RakeEnvironment:
|
||||
Exclude:
|
||||
- 'lib/tasks/hooks.rake'
|
||||
- 'lib/tasks/i18n.rake'
|
||||
- 'lib/tasks/testing.rake'
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 8
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowedReceivers.
|
||||
# AllowedReceivers: ActionMailer::Preview, ActiveSupport::TimeZone
|
||||
@@ -513,7 +504,6 @@ Rails/RedundantActiveRecordAllMethod:
|
||||
- 'app/controllers/forums_controller.rb'
|
||||
- 'app/controllers/plant_parts_controller.rb'
|
||||
- 'app/controllers/scientific_names_controller.rb'
|
||||
- 'app/services/openfarm_service.rb'
|
||||
- 'spec/features/percy/percy_spec.rb'
|
||||
- 'spec/models/harvest_spec.rb'
|
||||
|
||||
@@ -528,8 +518,6 @@ Rails/RedundantPresenceValidationOnBelongsTo:
|
||||
|
||||
# Offense count: 15
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Include.
|
||||
# Include: spec/controllers/**/*.rb, spec/requests/**/*.rb, test/controllers/**/*.rb, test/integration/**/*.rb
|
||||
Rails/ResponseParsedBody:
|
||||
Exclude:
|
||||
- 'spec/controllers/api/v1/plantings_controller_spec.rb'
|
||||
@@ -543,29 +531,31 @@ Rails/ResponseParsedBody:
|
||||
- 'spec/requests/api/v1/seeds_request_spec.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Configuration parameters: Include.
|
||||
# Include: db/**/*.rb
|
||||
Rails/ReversibleMigration:
|
||||
Exclude:
|
||||
- 'db/migrate/20130326092227_change_planted_at_to_date.rb'
|
||||
- 'db/migrate/20191119020643_upgrade_cms.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/RootPathnameMethods:
|
||||
Exclude:
|
||||
- 'app/controllers/crops_controller.rb'
|
||||
- 'app/helpers/icons_helper.rb'
|
||||
- 'config/application.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# 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:
|
||||
Exclude:
|
||||
- 'db/migrate/20240810160538_set_default_language_for_existing_alternate_names.rb'
|
||||
|
||||
# Offense count: 21
|
||||
# Configuration parameters: Include.
|
||||
# Include: db/**/*.rb
|
||||
Rails/ThreeStateBooleanColumn:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 6
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/UniqueValidationWithoutIndex:
|
||||
Exclude:
|
||||
- 'app/models/follow.rb'
|
||||
@@ -583,12 +573,13 @@ Rails/WhereEquals:
|
||||
- 'app/models/harvest.rb'
|
||||
- 'app/models/planting.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/WhereRange:
|
||||
Exclude:
|
||||
- 'app/models/concerns/predict_planting.rb'
|
||||
- 'app/models/garden.rb'
|
||||
- 'app/models/seed.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Rake/MethodDefinitionInTask:
|
||||
@@ -597,8 +588,10 @@ Rake/MethodDefinitionInTask:
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules.
|
||||
# SupportedStyles: nested, compact
|
||||
# SupportedStylesForClasses: ~, nested, compact
|
||||
# SupportedStylesForModules: ~, nested, compact
|
||||
Style/ClassAndModuleChildren:
|
||||
Exclude:
|
||||
- 'lib/actions/oauth_signup_action.rb'
|
||||
@@ -614,7 +607,15 @@ Style/CommentedKeyword:
|
||||
- 'spec/models/photo_spec.rb'
|
||||
- 'spec/models/planting_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: left_coerce, right_coerce, single_coerce, fdiv
|
||||
Style/FloatDivision:
|
||||
Exclude:
|
||||
- 'app/models/concerns/predict_planting.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, always_true, never
|
||||
@@ -622,23 +623,34 @@ Style/FrozenStringLiteralComment:
|
||||
Exclude:
|
||||
- 'config/initializers/new_framework_defaults_6_0.rb'
|
||||
- 'db/migrate/20200801084007_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb'
|
||||
- 'db/migrate/20240716120000_add_social_media_to_members.rb'
|
||||
- 'db/migrate/20240716120001_rename_other_handle_to_other_url_in_members.rb'
|
||||
- 'db/migrate/20240929041435_create_garden_collaborators.rb'
|
||||
- 'db/migrate/20250810120000_make_notifications_polymorphic.rb'
|
||||
- 'db/migrate/20250824081313_change_comments_polymorphic.rb'
|
||||
- 'db/migrate/20250901105232_add_source_to_seeds.rb'
|
||||
- 'db/migrate/20250901110545_add_indexes_crops.rb'
|
||||
- 'db/migrate/20250901130830_add_overall_rating_plantings.rb'
|
||||
- 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/GlobalStdStream:
|
||||
Exclude:
|
||||
- 'config/environments/production.rb'
|
||||
- 'lib/tasks/gbif.rake'
|
||||
- 'lib/tasks/openfarm.rake'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: nonzero?
|
||||
Style/IfWithBooleanLiteralBranches:
|
||||
Style/HashFetchChain:
|
||||
Exclude:
|
||||
- 'app/controllers/gardens_controller.rb'
|
||||
- 'app/models/concerns/open_farm_data.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/IdenticalConditionalBranches:
|
||||
Exclude:
|
||||
- 'lib/actions/oauth_signup_action.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
@@ -676,11 +688,12 @@ Style/OpenStructUse:
|
||||
Exclude:
|
||||
- 'spec/helpers/event_helper_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 3
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: respond_to_missing?
|
||||
Style/OptionalBooleanParameter:
|
||||
Exclude:
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/models/concerns/member_newsletter.rb'
|
||||
|
||||
# Offense count: 1
|
||||
@@ -697,6 +710,26 @@ Style/RedundantFetchBlock:
|
||||
Exclude:
|
||||
- 'config/puma.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/RedundantInterpolation:
|
||||
Exclude:
|
||||
- 'app/helpers/buttons_helper.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: implicit, explicit
|
||||
Style/RescueStandardError:
|
||||
Exclude:
|
||||
- 'lib/tasks/wikidata.rake'
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: Max.
|
||||
Style/SafeNavigationChainLength:
|
||||
Exclude:
|
||||
- 'app/models/ability.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowModifier.
|
||||
@@ -705,17 +738,35 @@ Style/SoleNestedConditional:
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/controllers/messages_controller.rb'
|
||||
|
||||
# Offense count: 24
|
||||
# Offense count: 28
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Mode.
|
||||
Style/StringConcatenation:
|
||||
Exclude:
|
||||
- 'app/controllers/messages_controller.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/helpers/buttons_helper.rb'
|
||||
- 'app/models/photo.rb'
|
||||
- 'config/initializers/rswag_api.rb'
|
||||
- 'spec/helpers/gardens_helper_spec.rb'
|
||||
- 'spec/helpers/seeds_helper_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: single_quotes, double_quotes
|
||||
Style/StringLiteralsInInterpolation:
|
||||
Exclude:
|
||||
- 'config/initializers/mailboxer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: .
|
||||
# SupportedStyles: percent, brackets
|
||||
Style/SymbolArray:
|
||||
EnforcedStyle: percent
|
||||
MinSize: 3
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -199,6 +199,4 @@ group :travis do
|
||||
gem 'platform-api'
|
||||
end
|
||||
|
||||
|
||||
|
||||
gem "i18n_data", "~> 1.1"
|
||||
|
||||
@@ -29,7 +29,7 @@ class ActivitiesController < DataController
|
||||
|
||||
def new
|
||||
@activity = Activity.new(
|
||||
owner: current_member,
|
||||
owner: current_member,
|
||||
due_date: Date.today
|
||||
)
|
||||
if params[:garden_id]
|
||||
|
||||
@@ -6,7 +6,7 @@ class RegistrationsController < Devise::RegistrationsController
|
||||
prepend_before_action :check_captcha, only: [:create] # Change this to be any actions you want to protect with recaptcha.
|
||||
|
||||
def edit
|
||||
@flickr_auth = current_member.auth('flickr')
|
||||
@flickr_auth = current_member.auth('flickr')
|
||||
render "edit"
|
||||
end
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ module AutoSuggestHelper
|
||||
resource = resource.class.name.downcase
|
||||
source_path = Rails.application.routes.url_helpers.send("search_#{source}s_path", format: :json)
|
||||
%(
|
||||
<input id="#{source}" class="auto-suggest #{options[:class]}" #{options[:required] ? 'required="required"' : ''}
|
||||
<input id="#{source}" class="auto-suggest #{options[:class]}" #{'required="required"' if options[:required]}
|
||||
type="text" value="#{default}" data-source-url="#{source_path}",
|
||||
placeholder="e.g. lettuce">
|
||||
<noscript class="text-warning">
|
||||
|
||||
@@ -7,8 +7,8 @@ module EventHelper
|
||||
|
||||
def event_description(event)
|
||||
render "#{event.event_type.pluralize}/description", event_model: resolve_model(event)
|
||||
rescue ActionView::MissingTemplate
|
||||
"#{event.event_type.humanize.downcase}d"
|
||||
rescue ActionView::MissingTemplate
|
||||
"#{event.event_type.humanize.downcase}d"
|
||||
end
|
||||
|
||||
def resolve_model(event)
|
||||
|
||||
@@ -90,7 +90,7 @@ class Crop < ApplicationRecord
|
||||
def popular_plant_parts
|
||||
PlantPart.joins(:harvests)
|
||||
.where("crop_id = ?", id)
|
||||
.order("count_harvests_id DESC")
|
||||
.order(count_harvests_id: :desc)
|
||||
.group("plant_parts.id", "plant_parts.name")
|
||||
.count("harvests.id")
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
class Forum < ApplicationRecord
|
||||
extend FriendlyId
|
||||
include Ownable
|
||||
|
||||
validates :name, presence: true
|
||||
validates :description, presence: true
|
||||
friendly_id :name, use: %i(slugged finders)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class GardenType < ApplicationRecord
|
||||
extend FriendlyId
|
||||
|
||||
friendly_id :name, use: %i(slugged finders)
|
||||
|
||||
has_many :gardens, dependent: :nullify
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
class Member < ApplicationRecord
|
||||
include Discard::Model
|
||||
|
||||
acts_as_messageable # messages can be sent to this model
|
||||
include Geocodable
|
||||
include MemberFlickr
|
||||
include MemberNewsletter
|
||||
|
||||
extend FriendlyId
|
||||
|
||||
friendly_id :login_name, use: %i(slugged finders)
|
||||
|
||||
#
|
||||
@@ -91,9 +93,9 @@ class Member < ApplicationRecord
|
||||
uniqueness: {
|
||||
case_sensitive: false
|
||||
}
|
||||
validates :website_url, format: { with: /\Ahttps?:\/\//, message: "must start with http:// or https://" }, allow_blank: true
|
||||
validates :other_url, format: { with: /\Ahttps?:\/\//, message: "must start with http:// or https://" }, allow_blank: true
|
||||
validates :instagram_handle, :facebook_handle, :bluesky_handle, format: { without: %r{\Ahttps?:\/\/|\/}, message: "should be a handle, not a URL" }, allow_blank: true
|
||||
validates :website_url, format: { with: %r{\Ahttps?://}, message: "must start with http:// or https://" }, allow_blank: true
|
||||
validates :other_url, format: { with: %r{\Ahttps?://}, message: "must start with http:// or https://" }, allow_blank: true
|
||||
validates :instagram_handle, :facebook_handle, :bluesky_handle, format: { without: %r{\Ahttps?://|/}, message: "should be a handle, not a URL" }, allow_blank: true
|
||||
|
||||
#
|
||||
# Triggers
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class PlantPart < ApplicationRecord
|
||||
extend FriendlyId
|
||||
|
||||
friendly_id :name, use: %i(slugged finders)
|
||||
|
||||
has_many :harvests, dependent: :destroy
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class Role < ApplicationRecord
|
||||
extend FriendlyId
|
||||
|
||||
friendly_id :name, use: %i(slugged finders)
|
||||
validates :name, uniqueness: true, presence: true
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ class Seed < ApplicationRecord
|
||||
include Finishable
|
||||
include Ownable
|
||||
include SearchSeeds
|
||||
|
||||
friendly_id :seed_slug, use: %i(slugged finders)
|
||||
|
||||
TRADABLE_TO_VALUES = %w(nowhere locally nationally internationally).freeze
|
||||
@@ -48,7 +49,7 @@ class Seed < ApplicationRecord
|
||||
"are heirloom, hybrid, or unknown" }
|
||||
validates :source, allow_blank: true,
|
||||
inclusion: { in: SOURCE_VALUES, message: "You must say where the seeds are from," \
|
||||
"or that you don't know" }
|
||||
"or that you don't know" }
|
||||
|
||||
#
|
||||
# Delegations
|
||||
|
||||
@@ -5,7 +5,7 @@ Mailboxer.setup do |config|
|
||||
config.uses_emails = true
|
||||
|
||||
# Configures the default from for emails sent for Messages and Notifications
|
||||
config.default_from = "Growstuff <#{ENV.fetch('GROWSTUFF_EMAIL', "no-reply@growstuff.org")}>"
|
||||
config.default_from = "Growstuff <#{ENV.fetch('GROWSTUFF_EMAIL', "no-reply@growstuff.org")}>"
|
||||
|
||||
# Configures the methods needed by mailboxer
|
||||
# config.email_method = :email
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
class SetDefaultLanguageForExistingAlternateNames < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
AlternateName.update_all(language: 'en')
|
||||
AlternateName.update_all(language: 'en') # rubocop:disable Rails/SkipsModelValidations
|
||||
end
|
||||
|
||||
def down
|
||||
AlternateName.update_all(language: nil)
|
||||
AlternateName.update_all(language: nil) # rubocop:disable Rails/SkipsModelValidations
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,15 +36,15 @@ namespace :wikidata do
|
||||
aliases = wikidata_data['entities'][wikidata_id]['aliases']
|
||||
aliases.each do |lang, values|
|
||||
values.each do |value|
|
||||
unless AlternateName.exists?(name: value['value'], language: lang, crop: crop)
|
||||
AlternateName.create!(
|
||||
name: value['value'],
|
||||
language: lang,
|
||||
crop: crop,
|
||||
creator: creator
|
||||
)
|
||||
puts " Added alternate name: #{value['value']} (#{lang})"
|
||||
end
|
||||
next if AlternateName.exists?(name: value['value'], language: lang, crop: crop)
|
||||
|
||||
AlternateName.create!(
|
||||
name: value['value'],
|
||||
language: lang,
|
||||
crop: crop,
|
||||
creator: creator
|
||||
)
|
||||
puts " Added alternate name: #{value['value']} (#{lang})"
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
@@ -4,6 +4,7 @@ require 'rails_helper'
|
||||
|
||||
RSpec.describe GardenTypesController, type: :controller do
|
||||
include Devise::Test::ControllerHelpers
|
||||
|
||||
let(:valid_params) { { name: 'My second GardenType' } }
|
||||
let(:garden_type) { FactoryBot.create(:garden_type) }
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ require 'rails_helper'
|
||||
|
||||
RSpec.describe GardensController, type: :controller do
|
||||
include Devise::Test::ControllerHelpers
|
||||
|
||||
let(:valid_params) { { name: 'My second Garden' } }
|
||||
|
||||
let(:garden) { FactoryBot.create(:garden) }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
FactoryBot.define do
|
||||
factory :comment do
|
||||
association :commentable, factory: :post
|
||||
commentable factory: %i(post)
|
||||
author
|
||||
sequence(:body) { |n| "OMG LOL #{n}" }
|
||||
# because our commenters are more polite than YouTube's
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :garden_collaborator do
|
||||
garden
|
||||
|
||||
@@ -10,7 +10,7 @@ FactoryBot.define do
|
||||
|
||||
body { "MyText" }
|
||||
read { false }
|
||||
association :notifiable, factory: :post
|
||||
notifiable factory: %i(post)
|
||||
|
||||
factory :no_email_notification do
|
||||
recipient { FactoryBot.create(:no_email_notifications_member) }
|
||||
|
||||
@@ -18,7 +18,7 @@ describe "Conversations", :js do
|
||||
click_link 'Inbox'
|
||||
end
|
||||
|
||||
include_examples 'is accessible'
|
||||
it_behaves_like 'is accessible'
|
||||
|
||||
it { expect(page).to have_content 'something i want to say' }
|
||||
it { page.percy_snapshot(page, name: 'conversations#index') }
|
||||
|
||||
@@ -83,23 +83,23 @@ describe "Alternate names", :js do
|
||||
end
|
||||
|
||||
context 'Anonymous' do
|
||||
include_examples 'show alt names'
|
||||
it_behaves_like 'show alt names'
|
||||
end
|
||||
|
||||
context 'Signed in member' do
|
||||
include_context 'signed in member'
|
||||
include_examples 'show alt names'
|
||||
it_behaves_like 'show alt names'
|
||||
end
|
||||
|
||||
context 'Crop wrangler' do
|
||||
include_context 'signed in crop wrangler'
|
||||
include_examples 'show alt names'
|
||||
include_examples 'edit alt names'
|
||||
it_behaves_like 'show alt names'
|
||||
it_behaves_like 'edit alt names'
|
||||
end
|
||||
|
||||
context 'Admin' do
|
||||
include_context 'signed in admin'
|
||||
include_examples 'show alt names'
|
||||
include_examples 'edit alt names'
|
||||
it_behaves_like 'show alt names'
|
||||
it_behaves_like 'edit alt names'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,25 +34,25 @@ describe "browse crops", :search do
|
||||
end
|
||||
|
||||
context 'anon' do
|
||||
include_examples 'shows crops'
|
||||
it_behaves_like 'shows crops'
|
||||
it { expect(page).to have_no_link "Add New Crop" }
|
||||
end
|
||||
|
||||
context 'member' do
|
||||
include_context 'signed in member'
|
||||
include_examples 'shows crops'
|
||||
include_examples 'add new crop'
|
||||
it_behaves_like 'shows crops'
|
||||
it_behaves_like 'add new crop'
|
||||
end
|
||||
|
||||
context 'wrangler' do
|
||||
include_context 'signed in crop wrangler'
|
||||
include_examples 'shows crops'
|
||||
include_examples 'add new crop'
|
||||
it_behaves_like 'shows crops'
|
||||
it_behaves_like 'add new crop'
|
||||
end
|
||||
|
||||
context 'admin' do
|
||||
include_context 'signed in admin'
|
||||
include_examples 'shows crops'
|
||||
include_examples 'add new crop'
|
||||
it_behaves_like 'shows crops'
|
||||
it_behaves_like 'add new crop'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ describe "Crop", :js do
|
||||
|
||||
shared_examples 'request crop' do
|
||||
describe "requesting a crop with multiple scientific and alternate name" do
|
||||
include_examples 'fill in form'
|
||||
it_behaves_like 'fill in form'
|
||||
before do
|
||||
within "form#new_crop" do
|
||||
fill_in "request_notes", with: "This is the Philippine national flower."
|
||||
@@ -42,7 +42,7 @@ describe "Crop", :js do
|
||||
|
||||
shared_examples 'create crop' do
|
||||
describe "creating a crop with multiple scientific and alternate name" do
|
||||
include_examples 'fill in form'
|
||||
it_behaves_like 'fill in form'
|
||||
before do
|
||||
click_button "Save"
|
||||
end
|
||||
@@ -61,16 +61,16 @@ describe "Crop", :js do
|
||||
|
||||
context 'member' do
|
||||
include_context 'signed in member'
|
||||
include_examples 'request crop'
|
||||
it_behaves_like 'request crop'
|
||||
end
|
||||
|
||||
context 'crop wrangler' do
|
||||
include_context 'signed in crop wrangler'
|
||||
include_examples 'create crop'
|
||||
it_behaves_like 'create crop'
|
||||
end
|
||||
|
||||
context 'admin' do
|
||||
include_context 'signed in admin'
|
||||
include_examples 'create crop'
|
||||
it_behaves_like 'create crop'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,17 +59,17 @@ describe "crop detail page", :js, :search do
|
||||
|
||||
context "when signed in" do
|
||||
include_context 'signed in member'
|
||||
include_examples "shows photos"
|
||||
it_behaves_like "shows photos"
|
||||
end
|
||||
|
||||
context "when signed in as photos owner" do
|
||||
include_context 'signed in member'
|
||||
let(:member) { owner_member }
|
||||
|
||||
include_examples "shows photos"
|
||||
it_behaves_like "shows photos"
|
||||
end
|
||||
|
||||
context "when not signed in" do
|
||||
include_examples "shows photos"
|
||||
it_behaves_like "shows photos"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,11 +27,11 @@ describe "Delete crop spec" do
|
||||
|
||||
context "As a crop wrangler" do
|
||||
include_context 'signed in crop wrangler'
|
||||
include_examples 'delete crop'
|
||||
it_behaves_like 'delete crop'
|
||||
end
|
||||
|
||||
context 'admin' do
|
||||
include_context 'signed in admin'
|
||||
include_examples 'delete crop'
|
||||
it_behaves_like 'delete crop'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ describe "Gardens" do
|
||||
context 'my gardens' do
|
||||
before { visit gardens_path(member_slug: member.slug) }
|
||||
|
||||
include_examples "has buttons bar at top"
|
||||
it_behaves_like "has buttons bar at top"
|
||||
|
||||
context 'with actions menu expanded' do
|
||||
before { click_link 'Actions' }
|
||||
@@ -43,13 +43,13 @@ describe "Gardens" do
|
||||
context 'all gardens' do
|
||||
before { visit gardens_path }
|
||||
|
||||
include_examples "has buttons bar at top"
|
||||
it_behaves_like "has buttons bar at top"
|
||||
end
|
||||
|
||||
context "other member's garden" do
|
||||
before { visit gardens_path(member_slug: FactoryBot.create(:member).slug) }
|
||||
|
||||
include_examples "has buttons bar at top"
|
||||
it_behaves_like "has buttons bar at top"
|
||||
describe 'does not show actions on other member garden' do
|
||||
it { is_expected.to have_no_link 'Actions' }
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ describe "Gardens", :js do
|
||||
include_context 'signed in member'
|
||||
before { visit new_garden_path }
|
||||
|
||||
include_examples 'is accessible'
|
||||
it_behaves_like 'is accessible'
|
||||
|
||||
it "displays required and optional fields properly" do
|
||||
expect(page).to have_selector ".required", text: "Name"
|
||||
|
||||
@@ -14,7 +14,7 @@ describe "Gardens#index", :js do
|
||||
visit member_gardens_path(member_slug: member.slug)
|
||||
end
|
||||
|
||||
include_examples 'is accessible'
|
||||
it_behaves_like 'is accessible'
|
||||
|
||||
it "displays each of the gardens" do
|
||||
member.gardens.each do |garden|
|
||||
|
||||
@@ -26,7 +26,7 @@ describe "Harvesting a crop", :js, :search do
|
||||
|
||||
within "form#new_harvest" do
|
||||
choose plant_part.name
|
||||
fill_in "When?", with: Time.new(2014, 06, 15)
|
||||
fill_in "When?", with: Time.zone.local(2014, 0o6, 15)
|
||||
fill_in "How many?", with: 42
|
||||
fill_in "Weighing (in total)", with: 42
|
||||
fill_in "Notes", with: "It's killer."
|
||||
|
||||
@@ -58,13 +58,13 @@ describe 'Likeable', :js, :search do
|
||||
describe 'photos#index' do
|
||||
let(:path) { photos_path }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
it_behaves_like 'object can be liked'
|
||||
end
|
||||
|
||||
describe 'photos#show' do
|
||||
let(:path) { photo_path(photo) }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
it_behaves_like 'object can be liked'
|
||||
end
|
||||
|
||||
describe 'crops#show' do
|
||||
@@ -74,7 +74,7 @@ describe 'Likeable', :js, :search do
|
||||
|
||||
before { planting.photos << photo }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
it_behaves_like 'object can be liked'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -82,27 +82,27 @@ describe 'Likeable', :js, :search do
|
||||
let(:like_count_class) { ".post-#{post.id} .like-count" }
|
||||
let(:path) { post_path(post) }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
it_behaves_like 'object can be liked'
|
||||
end
|
||||
|
||||
describe 'activities' do
|
||||
let(:like_count_class) { ".activity-#{activity.id} .like-count" }
|
||||
let(:path) { activity_path(activity) }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
it_behaves_like 'object can be liked'
|
||||
end
|
||||
|
||||
describe 'plantings' do
|
||||
let(:like_count_class) { ".planting-#{planting.id} .like-count" }
|
||||
let(:path) { planting_path(planting) }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
it_behaves_like 'object can be liked'
|
||||
end
|
||||
|
||||
describe 'harvests' do
|
||||
let(:like_count_class) { ".harvest-#{harvest.id} .like-count" }
|
||||
let(:path) { harvest_path(harvest) }
|
||||
|
||||
include_examples 'object can be liked'
|
||||
it_behaves_like 'object can be liked'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe "member deletion", flaky: true do
|
||||
describe "member deletion", :flaky do
|
||||
context "with activity and followers" do
|
||||
let(:member) { FactoryBot.create(:member) }
|
||||
let(:other_member) { FactoryBot.create(:member) }
|
||||
@@ -63,7 +63,7 @@ describe "member deletion", flaky: true do
|
||||
member.reload
|
||||
expect(member.discarded?).to be true
|
||||
|
||||
# Frustratingly, this cannot be discarded? and also meet
|
||||
# Frustratingly, this cannot be discarded? and also meet
|
||||
# `@member = Member.confirmed.kept.find_by!(slug: params[:slug])`
|
||||
#
|
||||
# Yet, we see the below assert fail in CI.
|
||||
@@ -96,7 +96,7 @@ describe "member deletion", flaky: true do
|
||||
end
|
||||
|
||||
describe 'member exists but is marked deleted' do
|
||||
subject { Member.all.find(member.id) }
|
||||
subject { Member.find(member.id) }
|
||||
|
||||
it { expect(subject).to eq member }
|
||||
it { expect(subject.discarded?).to be true }
|
||||
|
||||
@@ -34,11 +34,11 @@ describe "signout" do
|
||||
end
|
||||
|
||||
describe 'after signout, redirect to signin page if page needs authentication' do
|
||||
include_examples "sign-in redirects", "/plantings/new"
|
||||
include_examples "sign-in redirects", "/harvests/new"
|
||||
include_examples "sign-in redirects", "/posts/new"
|
||||
include_examples "sign-in redirects", "/gardens/new"
|
||||
include_examples "sign-in redirects", "/seeds/new"
|
||||
it_behaves_like "sign-in redirects", "/plantings/new"
|
||||
it_behaves_like "sign-in redirects", "/harvests/new"
|
||||
it_behaves_like "sign-in redirects", "/posts/new"
|
||||
it_behaves_like "sign-in redirects", "/gardens/new"
|
||||
it_behaves_like "sign-in redirects", "/seeds/new"
|
||||
end
|
||||
|
||||
it 'photos' do
|
||||
|
||||
@@ -136,6 +136,7 @@ describe Ability do
|
||||
it "can manage members" do
|
||||
ability.should be_able_to(:destroy, FactoryBot.create(:member))
|
||||
end
|
||||
|
||||
it "cannot delete themselves" do
|
||||
ability.should_not be_able_to(:destroy, member)
|
||||
end
|
||||
|
||||
@@ -154,7 +154,7 @@ describe Crop do
|
||||
|
||||
it { expect(crop.default_photo).to eq photo }
|
||||
|
||||
include_examples 'has default photo'
|
||||
it_behaves_like 'has default photo'
|
||||
end
|
||||
|
||||
context 'with a harvest photo' do
|
||||
@@ -165,7 +165,7 @@ describe Crop do
|
||||
|
||||
it { expect(crop.default_photo).to eq photo }
|
||||
|
||||
include_examples 'has default photo'
|
||||
it_behaves_like 'has default photo'
|
||||
|
||||
context 'and planting photo' do
|
||||
let(:planting) { FactoryBot.create(:planting, crop:) }
|
||||
|
||||
@@ -523,6 +523,7 @@ describe Planting do
|
||||
|
||||
context "failed" do
|
||||
let(:failed_planting) { FactoryBot.create(:planting, failed: true) }
|
||||
|
||||
it 'has a failed field' do
|
||||
expect(failed_planting.failed).to be true
|
||||
end
|
||||
@@ -535,20 +536,20 @@ describe Planting do
|
||||
end
|
||||
|
||||
it 'is not included in the active scope' do
|
||||
@p = FactoryBot.create(:planting)
|
||||
@f = FactoryBot.create(:planting, failed: true)
|
||||
described_class.active.should include @p
|
||||
described_class.active.should_not include @f
|
||||
@p = FactoryBot.create(:planting)
|
||||
@f = FactoryBot.create(:planting, failed: true)
|
||||
described_class.active.should include @p
|
||||
described_class.active.should_not include @f
|
||||
end
|
||||
|
||||
it 'cannot be finished and failed' do
|
||||
@f = FactoryBot.build(:planting, finished: true, failed: true)
|
||||
@f.should_not be_valid
|
||||
@f = FactoryBot.build(:planting, finished: true, failed: true)
|
||||
@f.should_not be_valid
|
||||
end
|
||||
|
||||
it 'is not finished' do
|
||||
@f = FactoryBot.build(:planting, finished: true, failed: true)
|
||||
expect(@f.finished?).to be false
|
||||
@f = FactoryBot.build(:planting, finished: true, failed: true)
|
||||
expect(@f.finished?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -587,7 +588,7 @@ describe Planting do
|
||||
FactoryBot.create(:finished_planting, owner: member, garden: member.gardens.first)
|
||||
end
|
||||
let!(:failed_planting) do
|
||||
FactoryBot.create(:planting, failed: true, owner: member, garden: member.gardens.first)
|
||||
FactoryBot.create(:planting, failed: true, owner: member, garden: member.gardens.first)
|
||||
end
|
||||
|
||||
it { expect(member.plantings.active).to include(planting) }
|
||||
|
||||
@@ -144,7 +144,7 @@ describe Post do
|
||||
end
|
||||
|
||||
it "does not duplicate" do
|
||||
expect(post.crops).to match_array([tomato, maize])
|
||||
expect(post.crops).to contain_exactly(tomato, maize)
|
||||
end
|
||||
|
||||
it "is updated when post was modified" do
|
||||
|
||||
@@ -70,8 +70,8 @@ include Warden::Test::Helpers
|
||||
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
||||
# require only the support files necessary.
|
||||
#
|
||||
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }
|
||||
Dir[Rails.root.join("spec/features/shared_examples/**/*.rb")].sort.each { |f| require f }
|
||||
Rails.root.glob("spec/support/**/*.rb").sort.each { |f| require f }
|
||||
Rails.root.glob("spec/features/shared_examples/**/*.rb").sort.each { |f| require f }
|
||||
|
||||
# Checks for pending migrations before tests are run.
|
||||
# If you are not using ActiveRecord, you can remove this line.
|
||||
|
||||
@@ -116,7 +116,7 @@ RSpec.describe 'Plantings', type: :request do
|
||||
end
|
||||
|
||||
describe "by member/owner" do
|
||||
before :each do
|
||||
before do
|
||||
@member1 = planting.owner
|
||||
@planting2 = create(:planting, owner: create(:owner))
|
||||
@member2 = @planting2.owner
|
||||
|
||||
@@ -15,7 +15,7 @@ describe "Plantings" do
|
||||
before do
|
||||
@member = create(:interesting_member)
|
||||
|
||||
@predictable_planting = create(:predictable_planting, owner: @member, planted_at: 1.days.ago, days_to_first_harvest: 10,
|
||||
@predictable_planting = create(:predictable_planting, owner: @member, planted_at: 1.day.ago, days_to_first_harvest: 10,
|
||||
days_to_last_harvest: 20)
|
||||
@predictable_planting.crop.update(median_days_to_first_harvest: 10)
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@ module FeatureHelpers
|
||||
|
||||
shared_context 'signed in member' do
|
||||
let(:member) { FactoryBot.create(:member) }
|
||||
include_examples 'sign in'
|
||||
it_behaves_like 'sign in'
|
||||
end
|
||||
|
||||
shared_context 'signed in crop wrangler' do
|
||||
let(:member) { FactoryBot.create(:crop_wrangling_member) }
|
||||
include_examples 'sign in'
|
||||
it_behaves_like 'sign in'
|
||||
end
|
||||
|
||||
shared_context 'signed in admin' do
|
||||
let(:member) { FactoryBot.create(:admin_member) }
|
||||
include_examples 'sign in'
|
||||
it_behaves_like 'sign in'
|
||||
end
|
||||
|
||||
shared_context 'sign in' do
|
||||
|
||||
@@ -58,7 +58,7 @@ describe "photos/show" do
|
||||
render
|
||||
end
|
||||
|
||||
include_examples "photo data renders"
|
||||
it_behaves_like "photo data renders"
|
||||
|
||||
it "has a delete button" do
|
||||
assert_select "a[href='#{photo_path(@photo)}']"
|
||||
@@ -71,8 +71,8 @@ describe "photos/show" do
|
||||
render
|
||||
end
|
||||
|
||||
include_examples "photo data renders"
|
||||
include_examples "No links to change data"
|
||||
it_behaves_like "photo data renders"
|
||||
it_behaves_like "No links to change data"
|
||||
end
|
||||
|
||||
context "not signed in" do
|
||||
@@ -81,8 +81,8 @@ describe "photos/show" do
|
||||
render
|
||||
end
|
||||
|
||||
include_examples "photo data renders"
|
||||
include_examples "No links to change data"
|
||||
it_behaves_like "photo data renders"
|
||||
it_behaves_like "No links to change data"
|
||||
end
|
||||
|
||||
context "CC-licensed photo" do
|
||||
|
||||
@@ -31,7 +31,7 @@ describe 'seeds/index.rss.haml', :search do
|
||||
render
|
||||
end
|
||||
|
||||
include_examples 'displays seed in rss feed'
|
||||
it_behaves_like 'displays seed in rss feed'
|
||||
|
||||
it 'shows RSS feed title' do
|
||||
expect(rendered).to have_content "Recent seeds from all members"
|
||||
@@ -60,6 +60,6 @@ describe 'seeds/index.rss.haml', :search do
|
||||
expect(rendered).to have_content "Recent seeds from #{seed.owner}"
|
||||
end
|
||||
|
||||
include_examples 'displays seed in rss feed'
|
||||
it_behaves_like 'displays seed in rss feed'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user