mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-30 03:36:23 -04:00
Compare commits
43 Commits
Style/Sole
...
fix-3278
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d57ca1b4bb | ||
|
|
d03f1e171d | ||
|
|
ef9fd8c82b | ||
|
|
cb9afd00c6 | ||
|
|
946b780b4e | ||
|
|
82be16b8f8 | ||
|
|
becd846022 | ||
|
|
dc4133abd2 | ||
|
|
e7a0d0276f | ||
|
|
7b5d8c0236 | ||
|
|
d45b51f85c | ||
|
|
d041382195 | ||
|
|
8f0dff1e96 | ||
|
|
5b42174baf | ||
|
|
8ba7eef6be | ||
|
|
0b4bdc6946 | ||
|
|
3d308db0d9 | ||
|
|
bfa1ae3ae2 | ||
|
|
71ef2c058b | ||
|
|
b42385be14 | ||
|
|
aba09679e0 | ||
|
|
9eff9150f6 | ||
|
|
10a32686c6 | ||
|
|
8fe65768d0 | ||
|
|
470e2d554e | ||
|
|
e952ca6c4c | ||
|
|
ee1c4fc79c | ||
|
|
c80c1c4758 | ||
|
|
3d3f97f0bf | ||
|
|
961d36c57d | ||
|
|
6a2d21d80b | ||
|
|
93b63284b7 | ||
|
|
7cd1f503f2 | ||
|
|
25f63a7708 | ||
|
|
e46b3f8d19 | ||
|
|
f04f8a9201 | ||
|
|
10e456a18d | ||
|
|
7e2be8efd9 | ||
|
|
5ba25b8e76 | ||
|
|
826f92691a | ||
|
|
81060cccf7 | ||
|
|
8b4f0771c5 | ||
|
|
4f5c47ba58 |
@@ -1,2 +1,2 @@
|
|||||||
# Ruby version
|
# Ruby version
|
||||||
VARIANT=3.2.4
|
VARIANT=3.3.4
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM mcr.microsoft.com/devcontainers/ruby:0-3.2-bullseye
|
FROM mcr.microsoft.com/devcontainers/ruby:1-3.3-bullseye
|
||||||
|
|
||||||
# Install Rails
|
# Install Rails
|
||||||
RUN gem install rails:7.0.8
|
RUN gem install rails:7.0.8
|
||||||
@@ -29,4 +29,5 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|||||||
# Make sure this is writable as https://github.com/rubygems/rubygems/issues/6272 was removed
|
# Make sure this is writable as https://github.com/rubygems/rubygems/issues/6272 was removed
|
||||||
RUN su root -c "mkdir -p /usr/local/rvm/gems/default/cache/bundler/"
|
RUN su root -c "mkdir -p /usr/local/rvm/gems/default/cache/bundler/"
|
||||||
RUN su root -c "mkdir -p /usr/local/rvm/gems/default/bundler/gems/"
|
RUN su root -c "mkdir -p /usr/local/rvm/gems/default/bundler/gems/"
|
||||||
RUN su root -c "chmod -R 777 /usr/local/rvm/gems/"
|
RUN su root -c "chown -R vscode:rvm /usr/local/rvm/gems/"
|
||||||
|
RUN su root -c "chmod -R 0755 /usr/local/rvm/gems/"
|
||||||
|
|||||||
44
.github/dependabot.yml
vendored
44
.github/dependabot.yml
vendored
@@ -7,50 +7,6 @@ updates:
|
|||||||
time: "07:00"
|
time: "07:00"
|
||||||
open-pull-requests-limit: 20
|
open-pull-requests-limit: 20
|
||||||
versioning-strategy: lockfile-only
|
versioning-strategy: lockfile-only
|
||||||
ignore:
|
|
||||||
- dependency-name: active_median
|
|
||||||
versions:
|
|
||||||
- "< 0.2.2, >= 0.2.1.a"
|
|
||||||
- dependency-name: rubocop
|
|
||||||
versions:
|
|
||||||
- "< 0.63, >= 0.62.a"
|
|
||||||
- dependency-name: rubocop
|
|
||||||
versions:
|
|
||||||
- "< 0.64, >= 0.63.a"
|
|
||||||
- dependency-name: sidekiq
|
|
||||||
versions:
|
|
||||||
- 5.2.4
|
|
||||||
- dependency-name: oj
|
|
||||||
versions:
|
|
||||||
- 3.11.4
|
|
||||||
- dependency-name: listen
|
|
||||||
versions:
|
|
||||||
- 3.5.0
|
|
||||||
- dependency-name: rspec-rails
|
|
||||||
versions:
|
|
||||||
- 4.1.0
|
|
||||||
- 5.0.0
|
|
||||||
- dependency-name: searchkick
|
|
||||||
versions:
|
|
||||||
- 4.4.3
|
|
||||||
- dependency-name: rswag-api
|
|
||||||
versions:
|
|
||||||
- 2.3.3
|
|
||||||
- dependency-name: rswag-specs
|
|
||||||
versions:
|
|
||||||
- 2.3.3
|
|
||||||
- dependency-name: rswag-ui
|
|
||||||
versions:
|
|
||||||
- 2.3.3
|
|
||||||
- dependency-name: timecop
|
|
||||||
versions:
|
|
||||||
- 0.9.3
|
|
||||||
- dependency-name: puma
|
|
||||||
versions:
|
|
||||||
- 5.2.0
|
|
||||||
- dependency-name: capybara
|
|
||||||
versions:
|
|
||||||
- 3.35.1
|
|
||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ AllCops:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'db/schema.rb'
|
- 'db/schema.rb'
|
||||||
- 'vendor/**/*'
|
- 'vendor/**/*'
|
||||||
TargetRailsVersion: 7.0
|
TargetRailsVersion: 7.1
|
||||||
|
|
||||||
Rails:
|
Rails:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2024-07-13 05:22:30 UTC using RuboCop version 1.65.0.
|
# on 2024-07-13 05:47:38 UTC using RuboCop version 1.65.0.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
@@ -12,13 +12,6 @@
|
|||||||
Capybara/ClickLinkOrButtonStyle:
|
Capybara/ClickLinkOrButtonStyle:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 84
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: have_no, not_to
|
|
||||||
Capybara/NegationMatcher:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 39
|
# Offense count: 39
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: DefaultSelector.
|
# Configuration parameters: DefaultSelector.
|
||||||
@@ -88,125 +81,14 @@ FactoryBot/ExcessiveCreateList:
|
|||||||
FactoryBot/SyntaxMethods:
|
FactoryBot/SyntaxMethods:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyleAlignWith.
|
|
||||||
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
||||||
Layout/BlockAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/factories/activity.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowForAlignment.
|
|
||||||
Layout/CommentIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'config/environments/production.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Layout/EmptyLineAfterMagicComment:
|
|
||||||
Exclude:
|
|
||||||
- 'config/initializers/application_controller_renderer.rb'
|
|
||||||
- 'config/initializers/backtrace_silencers.rb'
|
|
||||||
- 'config/initializers/content_security_policy.rb'
|
|
||||||
- 'config/initializers/mime_types.rb'
|
|
||||||
- 'config/initializers/new_framework_defaults_5_2.rb'
|
|
||||||
- 'db/migrate/20240218053122_add_slug_to_activity.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
|
||||||
Layout/EmptyLineBetweenDefs:
|
|
||||||
Exclude:
|
|
||||||
- 'db/migrate/20171129041341_create_photographings.rb'
|
|
||||||
- 'db/migrate/20190130090437_add_crop_to_photographings.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Layout/EmptyLines:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/models/ability_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: empty_lines, no_empty_lines
|
|
||||||
Layout/EmptyLinesAroundBlockBody:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/gardens.rake'
|
|
||||||
- 'spec/rails_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
||||||
# SupportedHashRocketStyles: key, separator, table
|
|
||||||
# SupportedColonStyles: key, separator, table
|
|
||||||
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
||||||
Layout/HashAlignment:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/concerns/search_activities.rb'
|
|
||||||
- 'app/models/concerns/search_plantings.rb'
|
|
||||||
|
|
||||||
# Offense count: 10
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: space, no_space
|
|
||||||
Layout/LineContinuationSpacing:
|
|
||||||
Exclude:
|
|
||||||
- 'app/mailers/notifier_mailer.rb'
|
|
||||||
- 'app/models/seed.rb'
|
|
||||||
- 'lib/tasks/growstuff.rake'
|
|
||||||
- 'spec/features/rss/plantings_spec.rb'
|
|
||||||
- 'spec/features/rss/posts_spec.rb'
|
|
||||||
- 'spec/features/rss/seeds_spec.rb'
|
|
||||||
- 'spec/models/seed_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
||||||
# SupportedStyles: aligned, indented
|
|
||||||
Layout/LineEndStringConcatenationIndentation:
|
|
||||||
Exclude:
|
|
||||||
- 'app/mailers/notifier_mailer.rb'
|
|
||||||
- 'app/models/seed.rb'
|
|
||||||
- 'lib/tasks/growstuff.rake'
|
|
||||||
- 'spec/features/rss/plantings_spec.rb'
|
|
||||||
- 'spec/features/rss/posts_spec.rb'
|
|
||||||
- 'spec/features/rss/seeds_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
||||||
# URISchemes: http, https
|
# URISchemes: http, https
|
||||||
Layout/LineLength:
|
Layout/LineLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/helpers/crops_helper.rb'
|
- 'app/helpers/crops_helper.rb'
|
||||||
- 'db/seeds.rb'
|
- 'db/seeds.rb'
|
||||||
- 'spec/requests/plantings_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: final_newline, final_blank_line
|
|
||||||
Layout/TrailingEmptyLines:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/admin/newsletter_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowInHeredoc.
|
|
||||||
Layout/TrailingWhitespace:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/factories/activity.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Lint/AmbiguousOperatorPrecedence:
|
|
||||||
Exclude:
|
|
||||||
- 'db/seeds.rb'
|
|
||||||
- 'spec/helpers/gardens_helper_spec.rb'
|
|
||||||
- 'spec/helpers/seeds_helper_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
@@ -723,14 +605,6 @@ Style/ClassAndModuleChildren:
|
|||||||
- 'lib/haml/filters/escaped_markdown.rb'
|
- 'lib/haml/filters/escaped_markdown.rb'
|
||||||
- 'lib/haml/filters/growstuff_markdown.rb'
|
- 'lib/haml/filters/growstuff_markdown.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: Keywords, RequireColon.
|
|
||||||
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE
|
|
||||||
Style/CommentAnnotation:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/features/seeds/adding_seeds_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
Style/CommentedKeyword:
|
Style/CommentedKeyword:
|
||||||
@@ -740,12 +614,6 @@ Style/CommentedKeyword:
|
|||||||
- 'spec/models/photo_spec.rb'
|
- 'spec/models/photo_spec.rb'
|
||||||
- 'spec/models/planting_spec.rb'
|
- 'spec/models/planting_spec.rb'
|
||||||
|
|
||||||
# Offense count: 37
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowedVars.
|
|
||||||
Style/FetchEnvVar:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
@@ -764,33 +632,6 @@ Style/GlobalStdStream:
|
|||||||
- 'lib/tasks/gbif.rake'
|
- 'lib/tasks/gbif.rake'
|
||||||
- 'lib/tasks/openfarm.rake'
|
- 'lib/tasks/openfarm.rake'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
|
||||||
Style/GuardClause:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/activities_controller.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# 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:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/csv_importer.rb'
|
|
||||||
- 'spec/requests/api/v1/gardens_request_spec.rb'
|
|
||||||
- 'spec/requests/api/v1/plantings_request_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Style/IfUnlessModifier:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/activities_controller.rb'
|
|
||||||
- 'app/controllers/application_controller.rb'
|
|
||||||
- 'bin/setup'
|
|
||||||
- 'spec/features/shared_examples/crop_suggest.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: AllowedMethods.
|
# Configuration parameters: AllowedMethods.
|
||||||
@@ -819,18 +660,13 @@ Style/MutableConstant:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/activity.rb'
|
- 'app/models/activity.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 5
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Style/NegatedIfElseCondition:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/crops_helper.rb'
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
||||||
# SupportedStyles: predicate, comparison
|
# SupportedStyles: predicate, comparison
|
||||||
Style/NumericPredicate:
|
Style/NumericPredicate:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'app/helpers/crops_helper.rb'
|
||||||
- 'app/helpers/harvests_helper.rb'
|
- 'app/helpers/harvests_helper.rb'
|
||||||
- 'app/helpers/plantings_helper.rb'
|
- 'app/helpers/plantings_helper.rb'
|
||||||
- 'app/models/concerns/predict_planting.rb'
|
- 'app/models/concerns/predict_planting.rb'
|
||||||
@@ -847,15 +683,6 @@ Style/OptionalBooleanParameter:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/concerns/member_newsletter.rb'
|
- 'app/models/concerns/member_newsletter.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: same_as_string_literals, single_quotes, double_quotes
|
|
||||||
Style/QuotedSymbols:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/seed.rb'
|
|
||||||
- 'spec/controllers/crops_controller_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: Methods.
|
# Configuration parameters: Methods.
|
||||||
@@ -863,12 +690,6 @@ Style/RedundantArgument:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/helpers/application_helper.rb'
|
- 'app/helpers/application_helper.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Style/RedundantConstantBase:
|
|
||||||
Exclude:
|
|
||||||
- 'config.ru'
|
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 4
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: SafeForConstants.
|
# Configuration parameters: SafeForConstants.
|
||||||
@@ -876,19 +697,6 @@ Style/RedundantFetchBlock:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'config/puma.rb'
|
- 'config/puma.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Style/RedundantRegexpArgument:
|
|
||||||
Exclude:
|
|
||||||
- 'db/migrate/20191119030244_cms_tags.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowMultipleReturnValues.
|
|
||||||
Style/RedundantReturn:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/messages_controller.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowModifier.
|
# Configuration parameters: AllowModifier.
|
||||||
@@ -908,13 +716,6 @@ Style/StringConcatenation:
|
|||||||
- 'spec/helpers/gardens_helper_spec.rb'
|
- 'spec/helpers/gardens_helper_spec.rb'
|
||||||
- 'spec/helpers/seeds_helper_spec.rb'
|
- 'spec/helpers/seeds_helper_spec.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
Style/SuperArguments:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/omniauth_callbacks_controller.rb'
|
|
||||||
- 'lib/haml/filters/escaped_markdown.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
|
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.2.2
|
3.3.4
|
||||||
|
|||||||
42
Gemfile.lock
42
Gemfile.lock
@@ -117,8 +117,8 @@ GEM
|
|||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
mutex_m
|
mutex_m
|
||||||
tzinfo (~> 2.0)
|
tzinfo (~> 2.0)
|
||||||
addressable (2.8.6)
|
addressable (2.8.7)
|
||||||
public_suffix (>= 2.0.2, < 6.0)
|
public_suffix (>= 2.0.2, < 7.0)
|
||||||
ast (2.4.2)
|
ast (2.4.2)
|
||||||
autoprefixer-rails (10.4.16.0)
|
autoprefixer-rails (10.4.16.0)
|
||||||
execjs (~> 2)
|
execjs (~> 2)
|
||||||
@@ -156,7 +156,7 @@ GEM
|
|||||||
actionpack (>= 6.1)
|
actionpack (>= 6.1)
|
||||||
activemodel (>= 6.1)
|
activemodel (>= 6.1)
|
||||||
builder (3.3.0)
|
builder (3.3.0)
|
||||||
bullet (7.1.6)
|
bullet (7.2.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.11)
|
uniform_notifier (~> 1.11)
|
||||||
byebug (11.1.3)
|
byebug (11.1.3)
|
||||||
@@ -248,12 +248,12 @@ GEM
|
|||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
excon (0.110.0)
|
excon (0.110.0)
|
||||||
execjs (2.9.1)
|
execjs (2.9.1)
|
||||||
factory_bot (6.4.5)
|
factory_bot (6.4.6)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
factory_bot_rails (6.4.3)
|
factory_bot_rails (6.4.3)
|
||||||
factory_bot (~> 6.4)
|
factory_bot (~> 6.4)
|
||||||
railties (>= 5.0.0)
|
railties (>= 5.0.0)
|
||||||
faker (3.4.1)
|
faker (3.4.2)
|
||||||
i18n (>= 1.8.11, < 2)
|
i18n (>= 1.8.11, < 2)
|
||||||
faraday (2.10.0)
|
faraday (2.10.0)
|
||||||
faraday-net_http (>= 2.0, < 3.2)
|
faraday-net_http (>= 2.0, < 3.2)
|
||||||
@@ -307,7 +307,8 @@ GEM
|
|||||||
multi_json (>= 1.9.2)
|
multi_json (>= 1.9.2)
|
||||||
webrick
|
webrick
|
||||||
highline (3.0.1)
|
highline (3.0.1)
|
||||||
httparty (0.21.0)
|
httparty (0.22.0)
|
||||||
|
csv
|
||||||
mini_mime (>= 1.0.0)
|
mini_mime (>= 1.0.0)
|
||||||
multi_xml (>= 0.5.2)
|
multi_xml (>= 0.5.2)
|
||||||
i18n (1.14.5)
|
i18n (1.14.5)
|
||||||
@@ -322,15 +323,15 @@ GEM
|
|||||||
rails-i18n
|
rails-i18n
|
||||||
rainbow (>= 2.2.2, < 4.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
terminal-table (>= 1.5.1)
|
terminal-table (>= 1.5.1)
|
||||||
icalendar (2.10.1)
|
icalendar (2.10.2)
|
||||||
ice_cube (~> 0.16)
|
ice_cube (~> 0.16)
|
||||||
ice_cube (0.16.4)
|
ice_cube (0.17.0)
|
||||||
ice_nine (0.11.2)
|
ice_nine (0.11.2)
|
||||||
image_processing (1.12.2)
|
image_processing (1.12.2)
|
||||||
mini_magick (>= 4.9.5, < 5)
|
mini_magick (>= 4.9.5, < 5)
|
||||||
ruby-vips (>= 2.0.17, < 3)
|
ruby-vips (>= 2.0.17, < 3)
|
||||||
io-console (0.7.2)
|
io-console (0.7.2)
|
||||||
irb (1.13.2)
|
irb (1.14.0)
|
||||||
rdoc (>= 4.0.0)
|
rdoc (>= 4.0.0)
|
||||||
reline (>= 0.4.2)
|
reline (>= 0.4.2)
|
||||||
jquery-rails (4.6.0)
|
jquery-rails (4.6.0)
|
||||||
@@ -349,10 +350,10 @@ GEM
|
|||||||
kramdown (2.4.0)
|
kramdown (2.4.0)
|
||||||
rexml
|
rexml
|
||||||
language_server-protocol (3.17.0.3)
|
language_server-protocol (3.17.0.3)
|
||||||
launchy (3.0.0)
|
launchy (3.0.1)
|
||||||
addressable (~> 2.8)
|
addressable (~> 2.8)
|
||||||
childprocess (~> 5.0)
|
childprocess (~> 5.0)
|
||||||
leaflet-rails (1.9.4)
|
leaflet-rails (1.9.5)
|
||||||
actionpack (>= 4.2.0)
|
actionpack (>= 4.2.0)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
letter_opener (1.10.0)
|
letter_opener (1.10.0)
|
||||||
@@ -391,7 +392,8 @@ GEM
|
|||||||
moneta (1.0.0)
|
moneta (1.0.0)
|
||||||
msgpack (1.7.2)
|
msgpack (1.7.2)
|
||||||
multi_json (1.15.0)
|
multi_json (1.15.0)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.7.1)
|
||||||
|
bigdecimal (~> 3.1)
|
||||||
mutex_m (0.2.0)
|
mutex_m (0.2.0)
|
||||||
net-http (0.4.1)
|
net-http (0.4.1)
|
||||||
uri
|
uri
|
||||||
@@ -443,7 +445,7 @@ GEM
|
|||||||
method_source (~> 1.0)
|
method_source (~> 1.0)
|
||||||
psych (5.1.2)
|
psych (5.1.2)
|
||||||
stringio
|
stringio
|
||||||
public_suffix (5.0.5)
|
public_suffix (6.0.0)
|
||||||
puma (6.4.2)
|
puma (6.4.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
query_diet (0.7.1)
|
query_diet (0.7.1)
|
||||||
@@ -503,7 +505,7 @@ GEM
|
|||||||
thor (~> 1.0, >= 1.2.2)
|
thor (~> 1.0, >= 1.2.2)
|
||||||
zeitwerk (~> 2.6)
|
zeitwerk (~> 2.6)
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
raindrops (0.20.0)
|
raindrops (0.20.1)
|
||||||
rake (13.2.1)
|
rake (13.2.1)
|
||||||
rate_throttle_client (0.1.2)
|
rate_throttle_client (0.1.2)
|
||||||
rb-fsevent (0.11.2)
|
rb-fsevent (0.11.2)
|
||||||
@@ -520,7 +522,7 @@ GEM
|
|||||||
responders (3.1.1)
|
responders (3.1.1)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
railties (>= 5.2)
|
railties (>= 5.2)
|
||||||
rexml (3.3.1)
|
rexml (3.3.2)
|
||||||
strscan
|
strscan
|
||||||
rouge (4.1.2)
|
rouge (4.1.2)
|
||||||
rspec (3.13.0)
|
rspec (3.13.0)
|
||||||
@@ -586,7 +588,7 @@ GEM
|
|||||||
rubocop-ast (>= 1.31.1, < 2.0)
|
rubocop-ast (>= 1.31.1, < 2.0)
|
||||||
rubocop-rake (0.6.0)
|
rubocop-rake (0.6.0)
|
||||||
rubocop (~> 1.0)
|
rubocop (~> 1.0)
|
||||||
rubocop-rspec (3.0.2)
|
rubocop-rspec (3.0.3)
|
||||||
rubocop (~> 1.61)
|
rubocop (~> 1.61)
|
||||||
rubocop-rspec_rails (2.30.0)
|
rubocop-rspec_rails (2.30.0)
|
||||||
rubocop (~> 1.61)
|
rubocop (~> 1.61)
|
||||||
@@ -614,7 +616,7 @@ GEM
|
|||||||
searchkick (5.3.1)
|
searchkick (5.3.1)
|
||||||
activemodel (>= 6.1)
|
activemodel (>= 6.1)
|
||||||
hashie
|
hashie
|
||||||
selenium-webdriver (4.22.0)
|
selenium-webdriver (4.23.0)
|
||||||
base64 (~> 0.2)
|
base64 (~> 0.2)
|
||||||
logger (~> 1.4)
|
logger (~> 1.4)
|
||||||
rexml (~> 3.2, >= 3.2.5)
|
rexml (~> 3.2, >= 3.2.5)
|
||||||
@@ -650,7 +652,7 @@ GEM
|
|||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
thor (1.3.1)
|
thor (1.3.1)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (2.3.0)
|
tilt (2.4.0)
|
||||||
timecop (0.9.10)
|
timecop (0.9.10)
|
||||||
timeout (0.4.1)
|
timeout (0.4.1)
|
||||||
trollop (1.16.2)
|
trollop (1.16.2)
|
||||||
@@ -677,7 +679,7 @@ GEM
|
|||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rack-test (>= 0.5.3)
|
rack-test (>= 0.5.3)
|
||||||
webrick (1.8.1)
|
webrick (1.8.1)
|
||||||
websocket (1.2.10)
|
websocket (1.2.11)
|
||||||
websocket-driver (0.7.6)
|
websocket-driver (0.7.6)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
@@ -804,7 +806,7 @@ DEPENDENCIES
|
|||||||
xmlrpc
|
xmlrpc
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 3.2.2p53
|
ruby 3.3.4p94
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.22
|
2.4.22
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ class ActivitiesController < DataController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def specifics
|
def specifics
|
||||||
if @owner.present?
|
return if @owner.blank?
|
||||||
"#{@owner.to_param}-"
|
|
||||||
end
|
"#{@owner.to_param}-"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
# Working from codespaces, we want to turn off validation
|
# Working from codespaces, we want to turn off validation
|
||||||
if Rails.env.development? && ENV['CODESPACE_NAME']
|
skip_before_action :verify_authenticity_token if Rails.env.development? && ENV['CODESPACE_NAME']
|
||||||
skip_before_action :verify_authenticity_token
|
|
||||||
end
|
|
||||||
|
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,12 @@ class CropsController < ApplicationController
|
|||||||
@crop.approval_status = "pending"
|
@crop.approval_status = "pending"
|
||||||
end
|
end
|
||||||
|
|
||||||
notify_wranglers if Crop.transaction { @crop.save && save_crop_names }
|
if Crop.transaction { @crop.save && save_crop_names }
|
||||||
|
notify_wranglers
|
||||||
|
else
|
||||||
|
@crop.alternate_names.build
|
||||||
|
@crop.scientific_names.build
|
||||||
|
end
|
||||||
|
|
||||||
respond_with @crop
|
respond_with @crop
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class MembersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def unsubscribe
|
def unsubscribe
|
||||||
verifier = ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
|
verifier = ActiveSupport::MessageVerifier.new(ENV.fetch('RAILS_SECRET_TOKEN', nil))
|
||||||
decrypted_message = verifier.verify(params[:message])
|
decrypted_message = verifier.verify(params[:message])
|
||||||
|
|
||||||
@member = Member.find(decrypted_message[:member_id])
|
@member = Member.find(decrypted_message[:member_id])
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class MessagesController < ApplicationController
|
|||||||
return if params[:recipient_id].blank?
|
return if params[:recipient_id].blank?
|
||||||
|
|
||||||
@recipient = Member.find_by(id: params[:recipient_id])
|
@recipient = Member.find_by(id: params[:recipient_id])
|
||||||
return if @recipient.nil?
|
nil if @recipient.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||||||
|
|
||||||
def after_sign_in_path_for(resource)
|
def after_sign_in_path_for(resource)
|
||||||
if resource.tos_agreement
|
if resource.tos_agreement
|
||||||
super(resource)
|
super
|
||||||
else
|
else
|
||||||
finish_signup_path(resource)
|
finish_signup_path(resource)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ module CropsHelper
|
|||||||
|
|
||||||
return "You don't have any seeds of this crop." if seeds.none?
|
return "You don't have any seeds of this crop." if seeds.none?
|
||||||
|
|
||||||
if total_quantity != 0
|
if total_quantity == 0
|
||||||
"You have #{total_quantity} #{Seed.model_name.human(count: total_quantity)} of this crop."
|
|
||||||
else
|
|
||||||
"You have an unknown quantity of seeds of this crop."
|
"You have an unknown quantity of seeds of this crop."
|
||||||
|
else
|
||||||
|
"You have #{total_quantity} #{Seed.model_name.human(count: total_quantity)} of this crop."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def crop_ebay_seeds_url(crop)
|
def crop_ebay_seeds_url(crop)
|
||||||
"https://rover.ebay.com/rover/1/705-53470-19255-0/1?icep_ff3=9&pub=5575213277&toolid=10001&campid=5337940151&customid=&icep_uq=#{CGI.escape crop.name}&icep_sellerId=&icep_ex_kw=&icep_sortBy=12&icep_catId=181003&icep_minPrice=&icep_maxPrice=&ipn=psmain&icep_vectorid=229515&kwid=902099&mtid=824&kw=lg"
|
"https://www.ebay.com/sch/i.html?_nkw=#{CGI.escape crop.name}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
class NotifierMailer < ApplicationMailer
|
class NotifierMailer < ApplicationMailer
|
||||||
# include NotificationsHelper
|
# include NotificationsHelper
|
||||||
default from: "Growstuff <#{ENV['GROWSTUFF_EMAIL']}>"
|
default from: "Growstuff <#{ENV.fetch('GROWSTUFF_EMAIL', nil)}>"
|
||||||
|
|
||||||
def verifier
|
def verifier
|
||||||
unless ENV['RAILS_SECRET_TOKEN']
|
unless ENV['RAILS_SECRET_TOKEN']
|
||||||
raise "RAILS_SECRET_TOKEN environment variable"\
|
raise "RAILS_SECRET_TOKEN environment variable" \
|
||||||
"not set - have you created config/application.yml?"
|
"not set - have you created config/application.yml?"
|
||||||
end
|
end
|
||||||
|
|
||||||
ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
|
ActiveSupport::MessageVerifier.new(ENV.fetch('RAILS_SECRET_TOKEN', nil))
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify(notification)
|
def notify(notification)
|
||||||
@@ -27,7 +27,7 @@ class NotifierMailer < ApplicationMailer
|
|||||||
|
|
||||||
def planting_reminder(member)
|
def planting_reminder(member)
|
||||||
@member = member
|
@member = member
|
||||||
@sitename = ENV['GROWSTUFF_SITE_NAME']
|
@sitename = ENV.fetch('GROWSTUFF_SITE_NAME', nil)
|
||||||
|
|
||||||
@late = []
|
@late = []
|
||||||
@super_late = []
|
@super_late = []
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ module MemberFlickr
|
|||||||
if @flickr.nil?
|
if @flickr.nil?
|
||||||
flickr_auth = auth('flickr')
|
flickr_auth = auth('flickr')
|
||||||
if flickr_auth
|
if flickr_auth
|
||||||
FlickRaw.api_key = ENV['GROWSTUFF_FLICKR_KEY']
|
FlickRaw.api_key = ENV.fetch('GROWSTUFF_FLICKR_KEY', nil)
|
||||||
FlickRaw.shared_secret = ENV['GROWSTUFF_FLICKR_SECRET']
|
FlickRaw.shared_secret = ENV.fetch('GROWSTUFF_FLICKR_SECRET', nil)
|
||||||
@flickr = FlickRaw::Flickr.new
|
@flickr = FlickRaw::Flickr.new
|
||||||
@flickr.access_token = flickr_auth.token
|
@flickr.access_token = flickr_auth.token
|
||||||
@flickr.access_secret = flickr_auth.secret
|
@flickr.access_secret = flickr_auth.secret
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ module SearchActivities
|
|||||||
1..limit.times do
|
1..limit.times do
|
||||||
where = {
|
where = {
|
||||||
# photos_count: { gt: 0 },
|
# photos_count: { gt: 0 },
|
||||||
owner_id: { not: owners }
|
owner_id: { not: owners }
|
||||||
}
|
}
|
||||||
one_record = search('*',
|
one_record = search('*',
|
||||||
limit: 1,
|
limit: 1,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ module SearchPlantings
|
|||||||
quantity:,
|
quantity:,
|
||||||
sunniness:,
|
sunniness:,
|
||||||
garden_id:,
|
garden_id:,
|
||||||
garden_name: garden&.name,
|
garden_name: garden&.name,
|
||||||
description:,
|
description:,
|
||||||
|
|
||||||
first_harvest_predicted_at:,
|
first_harvest_predicted_at:,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class CsvImporter
|
|||||||
|
|
||||||
alternate_names.split(/,\s*/).each do |name|
|
alternate_names.split(/,\s*/).each do |name|
|
||||||
altname = AlternateName.find_by(name:, crop: @crop)
|
altname = AlternateName.find_by(name:, crop: @crop)
|
||||||
altname ||= AlternateName.create! name: name, crop: @crop, creator: cropbot
|
altname ||= AlternateName.create! name:, crop: @crop, creator: cropbot
|
||||||
@crop.alternate_names << altname
|
@crop.alternate_names << altname
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Follow < ApplicationRecord
|
|||||||
recipient_id: followed_id,
|
recipient_id: followed_id,
|
||||||
sender_id: follower_id,
|
sender_id: follower_id,
|
||||||
subject: "#{follower.login_name} is now following you",
|
subject: "#{follower.login_name} is now following you",
|
||||||
body: "#{follower.login_name} just followed you on #{ENV['GROWSTUFF_SITE_NAME']}. "
|
body: "#{follower.login_name} just followed you on #{ENV.fetch('GROWSTUFF_SITE_NAME', nil)}. "
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,17 +33,17 @@ class Seed < ApplicationRecord
|
|||||||
validates :days_until_maturity_max, allow_nil: true,
|
validates :days_until_maturity_max, allow_nil: true,
|
||||||
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
||||||
validates :tradable_to, allow_blank: false,
|
validates :tradable_to, allow_blank: false,
|
||||||
inclusion: { in: TRADABLE_TO_VALUES, message: "You may only trade seed nowhere, "\
|
inclusion: { in: TRADABLE_TO_VALUES, message: "You may only trade seed nowhere, " \
|
||||||
"locally, nationally, or internationally" }
|
"locally, nationally, or internationally" }
|
||||||
validates :organic, allow_blank: false,
|
validates :organic, allow_blank: false,
|
||||||
inclusion: { in: ORGANIC_VALUES, message: "You must say whether the seeds "\
|
inclusion: { in: ORGANIC_VALUES, message: "You must say whether the seeds " \
|
||||||
"are organic or not, or that you don't know" }
|
"are organic or not, or that you don't know" }
|
||||||
validates :gmo, allow_blank: false,
|
validates :gmo, allow_blank: false,
|
||||||
inclusion: { in: GMO_VALUES, message: "You must say whether the seeds are "\
|
inclusion: { in: GMO_VALUES, message: "You must say whether the seeds are " \
|
||||||
"genetically modified or not, or that you don't know" }
|
"genetically modified or not, or that you don't know" }
|
||||||
validates :heirloom, allow_blank: false,
|
validates :heirloom, allow_blank: false,
|
||||||
inclusion: { in: HEIRLOOM_VALUES, message: "You must say whether the seeds"\
|
inclusion: { in: HEIRLOOM_VALUES, message: "You must say whether the seeds" \
|
||||||
"are heirloom, hybrid, or unknown" }
|
"are heirloom, hybrid, or unknown" }
|
||||||
|
|
||||||
#
|
#
|
||||||
# Delegations
|
# Delegations
|
||||||
@@ -56,7 +56,7 @@ class Seed < ApplicationRecord
|
|||||||
default_scope { joins(:owner).merge(Member.kept) } # Ensure owner exists
|
default_scope { joins(:owner).merge(Member.kept) } # Ensure owner exists
|
||||||
scope :tradable, -> { where.not(tradable_to: 'nowhere') }
|
scope :tradable, -> { where.not(tradable_to: 'nowhere') }
|
||||||
scope :interesting, -> { tradable.has_location }
|
scope :interesting, -> { tradable.has_location }
|
||||||
scope :has_location, -> { joins(:owner).where.not("members.location": nil) }
|
scope :has_location, -> { joins(:owner).where.not('members.location': nil) }
|
||||||
scope :recent, -> { order(created_at: :desc) }
|
scope :recent, -> { order(created_at: :desc) }
|
||||||
scope :active, -> { where('finished <> true').where('finished_at IS NULL OR finished_at < ?', Time.zone.now) }
|
scope :active, -> { where('finished <> true').where('finished_at IS NULL OR finished_at < ?', Time.zone.now) }
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
%h2 Basic information
|
%h2 Basic information
|
||||||
|
|
||||||
.form-group#new_crop
|
.form-group#new_crop
|
||||||
= f.text_field :name
|
= f.text_field :name, required: true
|
||||||
%span.help-block
|
%span.help-block
|
||||||
The common name for the crop, in English (required).
|
The common name for the crop, in English (required).
|
||||||
- if can? :wrangle, @crop
|
- if can? :wrangle, @crop
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
- unless @crop.approved?
|
- unless @crop.approved?
|
||||||
= link_to 'Search wikipedia', "https://en.wikipedia.org/w/index.php?search=#{@crop.name}", target: '_blank'
|
= link_to 'Search wikipedia', "https://en.wikipedia.org/w/index.php?search=#{@crop.name}", target: '_blank'
|
||||||
= f.text_field :en_wikipedia_url, id: "en_wikipedia_url", label: 'Wikipedia URL'
|
= f.url_field :en_wikipedia_url, id: "en_wikipedia_url", label: 'Wikipedia URL'
|
||||||
%span.help-block
|
%span.help-block
|
||||||
Link to the crop's page on the English language Wikipedia (required).
|
Link to the crop's page on the English language Wikipedia (required).
|
||||||
|
|
||||||
|
|||||||
@@ -30,3 +30,9 @@
|
|||||||
= seed_icon
|
= seed_icon
|
||||||
= link_to t('photos.show.seed', seed: seed.to_s, owner: seed.owner.to_s), seed_path(seed)
|
= link_to t('photos.show.seed', seed: seed.to_s, owner: seed.owner.to_s), seed_path(seed)
|
||||||
= render "association_delete_button", photo: @photo, type: 'seed', thing: seed
|
= render "association_delete_button", photo: @photo, type: 'seed', thing: seed
|
||||||
|
|
||||||
|
- @photo.crops.each do |crop|
|
||||||
|
%li
|
||||||
|
= crop_icon(crop)
|
||||||
|
= link_to t('photos.show.crop', crop: crop.to_s), crop_path(crop)
|
||||||
|
= render "association_delete_button", photo: @photo, type: 'crop', thing: crop
|
||||||
@@ -24,4 +24,9 @@
|
|||||||
- photo.seeds.each do |seed|
|
- photo.seeds.each do |seed|
|
||||||
%li
|
%li
|
||||||
= seed_icon
|
= seed_icon
|
||||||
= link_to t('photos.show.seed', seed: seed.to_s, owner: seed.owner.to_s), seed_path(seed)
|
= link_to t('photos.show.seed', seed: seed.to_s, owner: seed.owner.to_s), seed_path(seed)
|
||||||
|
|
||||||
|
- photo.crops.each do |crop|
|
||||||
|
%li
|
||||||
|
= crop_icon(crop)
|
||||||
|
= link_to t('photos.show.crop', crop: crop.to_s), crop_path(crop)
|
||||||
@@ -23,12 +23,8 @@ FileUtils.chdir APP_ROOT do
|
|||||||
system('bin/yarn')
|
system('bin/yarn')
|
||||||
|
|
||||||
puts "\n== Copying sample files =="
|
puts "\n== Copying sample files =="
|
||||||
unless File.exist?('config/database.yml')
|
FileUtils.cp 'config/database.yml.example', 'config/database.yml' unless File.exist?('config/database.yml')
|
||||||
FileUtils.cp 'config/database.yml.example', 'config/database.yml'
|
FileUtils.cp 'env-example', '.env' unless File.exist?('.env')
|
||||||
end
|
|
||||||
unless File.exist?('.env')
|
|
||||||
FileUtils.cp 'env-example', '.env'
|
|
||||||
end
|
|
||||||
|
|
||||||
puts "\n== Checking for elastic search =="
|
puts "\n== Checking for elastic search =="
|
||||||
system! 'script/check_elasticsearch.sh'
|
system! 'script/check_elasticsearch.sh'
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
# This file is used by Rack-based servers to start the application.
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
require ::File.expand_path('config/environment', __dir__)
|
require File.expand_path('config/environment', __dir__)
|
||||||
run Rails.application
|
run Rails.application
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ module Growstuff
|
|||||||
|
|
||||||
# Growstuff-specific configuration variables
|
# Growstuff-specific configuration variables
|
||||||
config.currency = 'AUD'
|
config.currency = 'AUD'
|
||||||
config.bot_email = ENV['GROWSTUFF_EMAIL']
|
config.bot_email = ENV.fetch('GROWSTUFF_EMAIL', nil)
|
||||||
config.user_agent = 'Growstuff'
|
config.user_agent = 'Growstuff'
|
||||||
config.user_agent_email = "info@growstuff.org"
|
config.user_agent_email = "info@growstuff.org"
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ module Growstuff
|
|||||||
# API key can't be blank or tests fail
|
# API key can't be blank or tests fail
|
||||||
Gibbon::API.timeout = 10
|
Gibbon::API.timeout = 10
|
||||||
Gibbon::API.throws_exceptions = false
|
Gibbon::API.throws_exceptions = false
|
||||||
config.newsletter_list_id = ENV['GROWSTUFF_MAILCHIMP_NEWSLETTER_ID']
|
config.newsletter_list_id = ENV.fetch('GROWSTUFF_MAILCHIMP_NEWSLETTER_ID', nil)
|
||||||
|
|
||||||
# config.active_record.raise_in_transactional_callbacks = true
|
# config.active_record.raise_in_transactional_callbacks = true
|
||||||
config.middleware.insert_before 0, Rack::Cors do
|
config.middleware.insert_before 0, Rack::Cors do
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Rails.application.configure do
|
|||||||
|
|
||||||
# Compress JavaScripts and CSS.
|
# Compress JavaScripts and CSS.
|
||||||
config.assets.js_compressor = :terser
|
config.assets.js_compressor = :terser
|
||||||
# config.assets.css_compressor = :sass
|
# config.assets.css_compressor = :sass
|
||||||
|
|
||||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||||
config.assets.compile = false
|
config.assets.compile = false
|
||||||
@@ -59,8 +59,8 @@ Rails.application.configure do
|
|||||||
# Use a different cache store in production.
|
# Use a different cache store in production.
|
||||||
config.cache_store = :mem_cache_store,
|
config.cache_store = :mem_cache_store,
|
||||||
(ENV["MEMCACHIER_SERVERS"] || "").split(","),
|
(ENV["MEMCACHIER_SERVERS"] || "").split(","),
|
||||||
{ username: ENV["MEMCACHIER_USERNAME"],
|
{ username: ENV.fetch("MEMCACHIER_USERNAME", nil),
|
||||||
password: ENV["MEMCACHIER_PASSWORD"],
|
password: ENV.fetch("MEMCACHIER_PASSWORD", nil),
|
||||||
failover: true,
|
failover: true,
|
||||||
socket_timeout: 1.5,
|
socket_timeout: 1.5,
|
||||||
socket_failure_delay: 0.2,
|
socket_failure_delay: 0.2,
|
||||||
@@ -89,20 +89,20 @@ Rails.application.configure do
|
|||||||
config.active_record.dump_schema_after_migration = false
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
|
||||||
# Growstuff configuration
|
# Growstuff configuration
|
||||||
config.action_mailer.default_url_options = { host: ENV['HOST'] }
|
config.action_mailer.default_url_options = { host: ENV.fetch('HOST', nil) }
|
||||||
|
|
||||||
config.action_mailer.smtp_settings = {
|
config.action_mailer.smtp_settings = {
|
||||||
user_name: ENV['MAILGUN_SMTP_LOGIN'],
|
user_name: ENV.fetch('MAILGUN_SMTP_LOGIN', nil),
|
||||||
password: ENV['MAILGUN_SMTP_PASSWORD'],
|
password: ENV.fetch('MAILGUN_SMTP_PASSWORD', nil),
|
||||||
domain: ENV['GROWSTUFF_EMAIL_DOMAIN'],
|
domain: ENV.fetch('GROWSTUFF_EMAIL_DOMAIN', nil),
|
||||||
address: ENV['MAILGUN_SMTP_SERVER'],
|
address: ENV.fetch('MAILGUN_SMTP_SERVER', nil),
|
||||||
port: 587,
|
port: 587,
|
||||||
authentication: :plain,
|
authentication: :plain,
|
||||||
enable_starttls_auto: true
|
enable_starttls_auto: true
|
||||||
}
|
}
|
||||||
ActionMailer::Base.delivery_method = :smtp
|
ActionMailer::Base.delivery_method = :smtp
|
||||||
|
|
||||||
config.host = ENV['HOST']
|
config.host = ENV.fetch('HOST', nil)
|
||||||
config.analytics_code = <<-GET_CLICKY_SCRIPT
|
config.analytics_code = <<-GET_CLICKY_SCRIPT
|
||||||
<script src="//static.getclicky.com/js" type="text/javascript"></script>
|
<script src="//static.getclicky.com/js" type="text/javascript"></script>
|
||||||
<script type="text/javascript">try{ clicky.init(100594260); }catch(e){}</script>
|
<script type="text/javascript">try{ clicky.init(100594260); }catch(e){}</script>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
ActionDispatch::Callbacks.after do
|
ActionDispatch::Callbacks.after do
|
||||||
# Reload the factories
|
# Reload the factories
|
||||||
return unless Rails.env.development? || Rails.env.test?
|
return unless Rails.env.local?
|
||||||
|
|
||||||
if FactoryBot.factories.present? # first init will load factories, this should only run on subsequent reloads
|
if FactoryBot.factories.present? # first init will load factories, this should only run on subsequent reloads
|
||||||
FactoryBot.factories.clear
|
FactoryBot.factories.clear
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# ActiveSupport::Reloader.to_prepare do
|
# ActiveSupport::Reloader.to_prepare do
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Define an application-wide content security policy
|
# Define an application-wide content security policy
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ Devise.setup do |config|
|
|||||||
# ==> Mailer Configuration
|
# ==> Mailer Configuration
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
||||||
config.mailer_sender = "Growstuff <#{ENV['GROWSTUFF_EMAIL']}>"
|
config.mailer_sender = "Growstuff <#{ENV.fetch('GROWSTUFF_EMAIL', nil)}>"
|
||||||
|
|
||||||
config.secret_key = ENV['RAILS_SECRET_TOKEN']
|
config.secret_key = ENV.fetch('RAILS_SECRET_TOKEN', nil)
|
||||||
|
|
||||||
# Configure the class responsible to send e-mails.
|
# Configure the class responsible to send e-mails.
|
||||||
# config.mailer = "Devise::Mailer"
|
# config.mailer = "Devise::Mailer"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Add new mime types for use in respond_to blocks:
|
# Add new mime types for use in respond_to blocks:
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
#
|
#
|
||||||
# This file contains migration options to ease your Rails 5.2 upgrade.
|
# This file contains migration options to ease your Rails 5.2 upgrade.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Rails.application.config.middleware.use OmniAuth::Builder do
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||||
provider :twitter, ENV['GROWSTUFF_TWITTER_KEY'], ENV['GROWSTUFF_TWITTER_SECRET']
|
provider :twitter, ENV.fetch('GROWSTUFF_TWITTER_KEY', nil), ENV.fetch('GROWSTUFF_TWITTER_SECRET', nil)
|
||||||
provider :flickr, ENV['GROWSTUFF_FLICKR_KEY'], ENV['GROWSTUFF_FLICKR_SECRET'], scope: 'read'
|
provider :flickr, ENV.fetch('GROWSTUFF_FLICKR_KEY', nil), ENV.fetch('GROWSTUFF_FLICKR_SECRET', nil), scope: 'read'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -267,6 +267,7 @@ en:
|
|||||||
planting: "%{planting}"
|
planting: "%{planting}"
|
||||||
seed: "%{seed}"
|
seed: "%{seed}"
|
||||||
thing_by: A %{thing} by %{owner}
|
thing_by: A %{thing} by %{owner}
|
||||||
|
crop: "%{crop}"
|
||||||
places:
|
places:
|
||||||
index:
|
index:
|
||||||
title: "%{site_name} Community Map"
|
title: "%{site_name} Community Map"
|
||||||
|
|||||||
@@ -37,18 +37,22 @@ class CreatePhotographings < ActiveRecord::Migration[4.2]
|
|||||||
Photographing.create! photo_id: s.photo_id, photographable_id: s.seed_id, photographable_type: 'Seed'
|
Photographing.create! photo_id: s.photo_id, photographable_id: s.seed_id, photographable_type: 'Seed'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class GardensPhoto < ApplicationRecord
|
class GardensPhoto < ApplicationRecord
|
||||||
belongs_to :photo
|
belongs_to :photo
|
||||||
belongs_to :garden
|
belongs_to :garden
|
||||||
end
|
end
|
||||||
|
|
||||||
class PhotosPlanting < ApplicationRecord
|
class PhotosPlanting < ApplicationRecord
|
||||||
belongs_to :photo
|
belongs_to :photo
|
||||||
belongs_to :planting
|
belongs_to :planting
|
||||||
end
|
end
|
||||||
|
|
||||||
class HarvestsPhoto < ApplicationRecord
|
class HarvestsPhoto < ApplicationRecord
|
||||||
belongs_to :photo
|
belongs_to :photo
|
||||||
belongs_to :harvest
|
belongs_to :harvest
|
||||||
end
|
end
|
||||||
|
|
||||||
class PhotosSeed < ApplicationRecord
|
class PhotosSeed < ApplicationRecord
|
||||||
belongs_to :photo
|
belongs_to :photo
|
||||||
belongs_to :seed
|
belongs_to :seed
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class AddCropToPhotographings < ActiveRecord::Migration[5.2]
|
|||||||
p.set_crop && p.save!
|
p.set_crop && p.save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Photographing < ApplicationRecord
|
class Photographing < ApplicationRecord
|
||||||
belongs_to :photo, inverse_of: :photo_associations
|
belongs_to :photo, inverse_of: :photo_associations
|
||||||
belongs_to :photographable, polymorphic: true
|
belongs_to :photographable, polymorphic: true
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ class CmsTags < ActiveRecord::Migration[5.2]
|
|||||||
layout.content = layout.content.gsub(%r{\{\{ ?cms:(\w+):([\w/-]+):([\w/-]+):([\w/-]+) ?\}\}}, '{{ cms:\1 \2 \3 \4}}')
|
layout.content = layout.content.gsub(%r{\{\{ ?cms:(\w+):([\w/-]+):([\w/-]+):([\w/-]+) ?\}\}}, '{{ cms:\1 \2 \3 \4}}')
|
||||||
end
|
end
|
||||||
layout.content = layout.content.gsub(/\{\{ ?cms:(\w+):(\w+):([^:]*) ?}}/, '{{ cms:\1 \2, "\3" }}') if layout.content.is_a? String
|
layout.content = layout.content.gsub(/\{\{ ?cms:(\w+):(\w+):([^:]*) ?}}/, '{{ cms:\1 \2, "\3" }}') if layout.content.is_a? String
|
||||||
layout.content = layout.content.gsub(/cms:rich_text/, 'cms:wysiwyg') if layout.content.is_a? String
|
layout.content = layout.content.gsub("cms:rich_text", 'cms:wysiwyg') if layout.content.is_a? String
|
||||||
layout.content = layout.content.gsub(/cms:integer/, 'cms:number') if layout.content.is_a? String
|
layout.content = layout.content.gsub("cms:integer", 'cms:number') if layout.content.is_a? String
|
||||||
if layout.content.is_a? String
|
if layout.content.is_a? String
|
||||||
layout.content = layout.content.gsub(/cms: string/, 'cms:text')
|
layout.content = layout.content.gsub("cms: string", 'cms:text')
|
||||||
end # probably a result of goofing one of the more general regexps
|
end # probably a result of goofing one of the more general regexps
|
||||||
if layout.content.is_a? String
|
if layout.content.is_a? String
|
||||||
layout.content = layout.content.gsub(%r{\{\{ ?cms:page_file ([\w/]+) ?\}\}}, '{{ cms:file \1, render: false }}')
|
layout.content = layout.content.gsub(%r{\{\{ ?cms:page_file ([\w/]+) ?\}\}}, '{{ cms:file \1, render: false }}')
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AddSlugToActivity < ActiveRecord::Migration[7.1]
|
class AddSlugToActivity < ActiveRecord::Migration[7.1]
|
||||||
def change
|
def change
|
||||||
add_column :activities, :slug, :string
|
add_column :activities, :slug, :string
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ def load_test_users
|
|||||||
owner_id: @user.id,
|
owner_id: @user.id,
|
||||||
garden_id: @user.gardens.first.id,
|
garden_id: @user.gardens.first.id,
|
||||||
planted_at: (n * 7).days.ago,
|
planted_at: (n * 7).days.ago,
|
||||||
crop_id: Crop.find((i + n) % Crop.all.size + 1).id,
|
crop_id: Crop.find(((i + n) % Crop.all.size) + 1).id,
|
||||||
sunniness: select_random_item(Planting::SUNNINESS_VALUES),
|
sunniness: select_random_item(Planting::SUNNINESS_VALUES),
|
||||||
planted_from: select_random_item(Planting::PLANTED_FROM_VALUES)
|
planted_from: select_random_item(Planting::PLANTED_FROM_VALUES)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ require 'haml/filters/growstuff_markdown'
|
|||||||
class Haml::Filters
|
class Haml::Filters
|
||||||
class EscapedMarkdown < Haml::Filters::Markdown
|
class EscapedMarkdown < Haml::Filters::Markdown
|
||||||
def compile(node)
|
def compile(node)
|
||||||
[:escape, true, super(node)]
|
[:escape, true, super]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
namespace :gardens do
|
namespace :gardens do
|
||||||
|
|
||||||
desc "Mark old gardens inactive"
|
desc "Mark old gardens inactive"
|
||||||
task archive: :environment do
|
task archive: :environment do
|
||||||
Planting.archive!
|
Planting.archive!
|
||||||
|
|||||||
@@ -5,20 +5,20 @@ namespace :growstuff do
|
|||||||
# usage: rake growstuff:admin_user name=skud
|
# usage: rake growstuff:admin_user name=skud
|
||||||
|
|
||||||
task admin_user: :environment do
|
task admin_user: :environment do
|
||||||
add_role_to_member! ENV['name'], 'Admin'
|
add_role_to_member! ENV.fetch('name', nil), 'Admin'
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Add a crop wrangler user, by name"
|
desc "Add a crop wrangler user, by name"
|
||||||
# usage: rake growstuff:cropwrangler_user name=skud
|
# usage: rake growstuff:cropwrangler_user name=skud
|
||||||
|
|
||||||
task cropwrangler_user: :environment do
|
task cropwrangler_user: :environment do
|
||||||
add_role_to_member! ENV['name'], 'Crop Wrangler'
|
add_role_to_member! ENV.fetch('name', nil), 'Crop Wrangler'
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_role_to_member!(login_name, role_name)
|
def add_role_to_member!(login_name, role_name)
|
||||||
unless login_name && role_name
|
unless login_name && role_name
|
||||||
raise "Usage: rake growstuff:[rolename] name=[username] "\
|
raise "Usage: rake growstuff:[rolename] name=[username] " \
|
||||||
"\n (login name is case-sensitive)\n"
|
"\n (login name is case-sensitive)\n"
|
||||||
end
|
end
|
||||||
member = Member.find_by!(login_name:)
|
member = Member.find_by!(login_name:)
|
||||||
role = Role.find_by!(name: role_name)
|
role = Role.find_by!(name: role_name)
|
||||||
@@ -31,7 +31,7 @@ namespace :growstuff do
|
|||||||
task import_crops: :environment do
|
task import_crops: :environment do
|
||||||
require 'csv'
|
require 'csv'
|
||||||
|
|
||||||
(@file = ENV['file']) || raise("Usage: rake growstuff:import_crops file=file.csv")
|
(@file = ENV.fetch('file', nil)) || raise("Usage: rake growstuff:import_crops file=file.csv")
|
||||||
|
|
||||||
puts "Loading crops from #{@file}..."
|
puts "Loading crops from #{@file}..."
|
||||||
CSV.foreach(@file) do |row|
|
CSV.foreach(@file) do |row|
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ require "English"
|
|||||||
|
|
||||||
if ENV['CI']
|
if ENV['CI']
|
||||||
if ENV['GITHUB_EVENT_NAME'] == 'pull_request'
|
if ENV['GITHUB_EVENT_NAME'] == 'pull_request'
|
||||||
author = ENV['GITHUB_ACTOR']
|
author = ENV.fetch('GITHUB_ACTOR', nil)
|
||||||
exit 1 unless author
|
exit 1 unless author
|
||||||
|
|
||||||
elsif ENV['TRAVIS_PULL_REQUEST']
|
elsif ENV['TRAVIS_PULL_REQUEST']
|
||||||
require 'httparty'
|
require 'httparty'
|
||||||
repo = ENV['TRAVIS_REPO_SLUG']
|
repo = ENV.fetch('TRAVIS_REPO_SLUG', nil)
|
||||||
pr = ENV['TRAVIS_PULL_REQUEST']
|
pr = ENV['TRAVIS_PULL_REQUEST']
|
||||||
url = "https://api.github.com/repos/#{repo}/pulls/#{pr}"
|
url = "https://api.github.com/repos/#{repo}/pulls/#{pr}"
|
||||||
response = HTTParty.get(url).parsed_response
|
response = HTTParty.get(url).parsed_response
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
require 'platform-api'
|
require 'platform-api'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
|
||||||
heroku = PlatformAPI.connect(ENV['HEROKU_API_KEY'])
|
heroku = PlatformAPI.connect(ENV.fetch('HEROKU_API_KEY', nil))
|
||||||
branch = ENV['TRAVIS_BRANCH']
|
branch = ENV.fetch('TRAVIS_BRANCH', nil)
|
||||||
travis_config = YAML.load_file('.travis.yml')
|
travis_config = YAML.load_file('.travis.yml')
|
||||||
if travis_config['deploy']['app'].key? branch
|
if travis_config['deploy']['app'].key? branch
|
||||||
app = travis_config['deploy']['app'][branch]
|
app = travis_config['deploy']['app'][branch]
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ describe CropsController do
|
|||||||
name: 'aubergine',
|
name: 'aubergine',
|
||||||
en_wikipedia_url: "https://en.wikipedia.org/wiki/Eggplant"
|
en_wikipedia_url: "https://en.wikipedia.org/wiki/Eggplant"
|
||||||
},
|
},
|
||||||
alt_name: { "1": "egg plant", "2": "purple apple" },
|
alt_name: { '1': "egg plant", '2': "purple apple" },
|
||||||
sci_name: { "1": "fancy sci name", "2": "" }
|
sci_name: { '1': "fancy sci name", '2': "" }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,24 +3,23 @@
|
|||||||
# Read about factories at https://github.com/thoughtbot/factory_bot
|
# Read about factories at https://github.com/thoughtbot/factory_bot
|
||||||
|
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :activity do
|
factory :activity do
|
||||||
name { "Admire" }
|
name { "Admire" }
|
||||||
description { "Spend 10 minutes admiring your hard work" }
|
description { "Spend 10 minutes admiring your hard work" }
|
||||||
category { "General" }
|
category { "General" }
|
||||||
owner
|
owner
|
||||||
|
|
||||||
trait :garden do
|
|
||||||
category { "Soil Cultivation" }
|
|
||||||
description { "Apply compost from winter" }
|
|
||||||
due_date { 3.months.from_now }
|
|
||||||
garden
|
|
||||||
end
|
|
||||||
|
|
||||||
trait :planting do
|
trait :garden do
|
||||||
category { "Pruning" }
|
category { "Soil Cultivation" }
|
||||||
description { "Stake tomato" }
|
description { "Apply compost from winter" }
|
||||||
planting
|
due_date { 3.months.from_now }
|
||||||
end
|
garden
|
||||||
|
end
|
||||||
|
|
||||||
|
trait :planting do
|
||||||
|
category { "Pruning" }
|
||||||
|
description { "Stake tomato" }
|
||||||
|
planting
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ describe "newsletter subscribers", :js do
|
|||||||
it { expect(page).to have_current_path admin_newsletter_path, ignore_query: true }
|
it { expect(page).to have_current_path admin_newsletter_path, ignore_query: true }
|
||||||
it { expect(page).to have_content @subscriber.email }
|
it { expect(page).to have_content @subscriber.email }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ describe "Conversations", :js do
|
|||||||
describe 'restore conversation' do
|
describe 'restore conversation' do
|
||||||
before { click_link class: 'restore' }
|
before { click_link class: 'restore' }
|
||||||
|
|
||||||
it { expect(page).not_to have_content 'something i want to say' }
|
it { expect(page).to have_no_content 'something i want to say' }
|
||||||
|
|
||||||
describe 'conversation was restored' do
|
describe 'conversation was restored' do
|
||||||
before { click_link 'inbox' }
|
before { click_link 'inbox' }
|
||||||
@@ -61,8 +61,8 @@ describe "Conversations", :js do
|
|||||||
all('input[type=checkbox]').each(&:click)
|
all('input[type=checkbox]').each(&:click)
|
||||||
click_button 'Delete'
|
click_button 'Delete'
|
||||||
|
|
||||||
expect(page).not_to have_content 'this is a message'
|
expect(page).to have_no_content 'this is a message'
|
||||||
expect(page).not_to have_content 'this is another message'
|
expect(page).to have_no_content 'this is another message'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'deletes multiple conversations from the sentbox' do
|
it 'deletes multiple conversations from the sentbox' do
|
||||||
@@ -81,8 +81,8 @@ describe "Conversations", :js do
|
|||||||
|
|
||||||
expect(page).to have_selector('.sent')
|
expect(page).to have_selector('.sent')
|
||||||
find('.sent').click
|
find('.sent').click
|
||||||
expect(page).not_to have_content 'this is a message'
|
expect(page).to have_no_content 'this is a message'
|
||||||
expect(page).not_to have_content 'this is another message'
|
expect(page).to have_no_content 'this is another message'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ describe "Alternate names", :js do
|
|||||||
accept_confirm do
|
accept_confirm do
|
||||||
click_link 'Delete'
|
click_link 'Delete'
|
||||||
end
|
end
|
||||||
expect(page).not_to have_content alternate_eggplant.name
|
expect(page).to have_no_content alternate_eggplant.name
|
||||||
expect(page).to have_content 'Alternate name was successfully deleted'
|
expect(page).to have_content 'Alternate name was successfully deleted'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ describe "browse crops", :search do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "pending crops are not listed" do
|
it "pending crops are not listed" do
|
||||||
expect(page).not_to have_content pending_crop.name
|
expect(page).to have_no_content pending_crop.name
|
||||||
end
|
end
|
||||||
|
|
||||||
it "rejected crops are not listed" do
|
it "rejected crops are not listed" do
|
||||||
expect(page).not_to have_content rejected_crop.name
|
expect(page).to have_no_content rejected_crop.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ describe "browse crops", :search do
|
|||||||
|
|
||||||
context 'anon' do
|
context 'anon' do
|
||||||
include_examples 'shows crops'
|
include_examples 'shows crops'
|
||||||
it { expect(page).not_to have_link "Add New Crop" }
|
it { expect(page).to have_no_link "Add New Crop" }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'member' do
|
context 'member' do
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe "crop detail page", :js do
|
|||||||
context "varieties" do
|
context "varieties" do
|
||||||
it "The crop DOES NOT have varieties" do
|
it "The crop DOES NOT have varieties" do
|
||||||
visit crop_path(crop)
|
visit crop_path(crop)
|
||||||
expect(page).not_to have_text 'Varieties'
|
expect(page).to have_no_text 'Varieties'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ describe "crop detail page", :js do
|
|||||||
|
|
||||||
it "User not signed in" do
|
it "User not signed in" do
|
||||||
visit crop_path(seed.crop)
|
visit crop_path(seed.crop)
|
||||||
expect(page).not_to have_content "You have 20 seeds"
|
expect(page).to have_no_content "You have 20 seeds"
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'signed in' do
|
context 'signed in' do
|
||||||
@@ -194,7 +194,7 @@ describe "crop detail page", :js do
|
|||||||
|
|
||||||
it { expect(page).to have_text 'Annual' }
|
it { expect(page).to have_text 'Annual' }
|
||||||
it { expect(page).to have_text 'living and reproducing in a single year or less' }
|
it { expect(page).to have_text 'living and reproducing in a single year or less' }
|
||||||
it { expect(page).not_to have_text 'Perennial' }
|
it { expect(page).to have_no_text 'Perennial' }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'crop is Perennial' do
|
context 'crop is Perennial' do
|
||||||
@@ -202,14 +202,14 @@ describe "crop detail page", :js do
|
|||||||
|
|
||||||
it { expect(page).to have_text 'Perennial' }
|
it { expect(page).to have_text 'Perennial' }
|
||||||
it { expect(page).to have_text 'living more than two years' }
|
it { expect(page).to have_text 'living more than two years' }
|
||||||
it { expect(page).not_to have_text 'Annual' }
|
it { expect(page).to have_no_text 'Annual' }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'crop Perennial value is null' do
|
context 'crop Perennial value is null' do
|
||||||
let(:crop) { FactoryBot.create(:crop, perennial: nil) }
|
let(:crop) { FactoryBot.create(:crop, perennial: nil) }
|
||||||
|
|
||||||
it { expect(page).not_to have_text 'Perennial' }
|
it { expect(page).to have_no_text 'Perennial' }
|
||||||
it { expect(page).not_to have_text 'Annual' }
|
it { expect(page).to have_no_text 'Annual' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -75,11 +75,11 @@ context "signed in non-wrangler" do
|
|||||||
|
|
||||||
it "can't see wrangling page without js", js: false do
|
it "can't see wrangling page without js", js: false do
|
||||||
visit root_path
|
visit root_path
|
||||||
expect(page).not_to have_link "Crop Wrangling"
|
expect(page).to have_no_link "Crop Wrangling"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "can't see wrangling page with js" do
|
it "can't see wrangling page with js" do
|
||||||
visit member_path(member)
|
visit member_path(member)
|
||||||
expect(page).not_to have_link "Crop Wrangling"
|
expect(page).to have_no_link "Crop Wrangling"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ describe "crop wrangling button" do
|
|||||||
context 'not signed in' do
|
context 'not signed in' do
|
||||||
before { visit crops_path }
|
before { visit crops_path }
|
||||||
|
|
||||||
it { expect(page).not_to have_link "Wrangle Crops", href: wrangle_crops_path }
|
it { expect(page).to have_no_link "Wrangle Crops", href: wrangle_crops_path }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "signed in, but not a crop wrangler" do
|
context "signed in, but not a crop wrangler" do
|
||||||
include_context 'signed in member'
|
include_context 'signed in member'
|
||||||
before { visit crops_path }
|
before { visit crops_path }
|
||||||
|
|
||||||
it { expect(page).not_to have_link "Wrangle Crops", href: wrangle_crops_path }
|
it { expect(page).to have_no_link "Wrangle Crops", href: wrangle_crops_path }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "signed in crop wrangler" do
|
context "signed in crop wrangler" do
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ describe "Scientific names", :js do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
# expect(page.status_code).to equal 200
|
# expect(page.status_code).to equal 200
|
||||||
expect(page).not_to have_content zea_mays.name
|
expect(page).to have_no_content zea_mays.name
|
||||||
expect(page).to have_content 'Scientific name was successfully deleted.'
|
expect(page).to have_content 'Scientific name was successfully deleted.'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ describe "Gardens" do
|
|||||||
|
|
||||||
include_examples "has buttons bar at top"
|
include_examples "has buttons bar at top"
|
||||||
describe 'does not show actions on other member garden' do
|
describe 'does not show actions on other member garden' do
|
||||||
it { is_expected.not_to have_link 'Actions' }
|
it { is_expected.to have_no_link 'Actions' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -73,7 +73,7 @@ describe "Gardens" do
|
|||||||
describe "someone else's garden" do
|
describe "someone else's garden" do
|
||||||
before { visit garden_path(other_member_garden) }
|
before { visit garden_path(other_member_garden) }
|
||||||
|
|
||||||
it { is_expected.not_to have_link 'Actions' }
|
it { is_expected.to have_no_link 'Actions' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ describe "Gardens", :js do
|
|||||||
fill_in "Name", with: "Negative Garden"
|
fill_in "Name", with: "Negative Garden"
|
||||||
fill_in "Area", with: -5
|
fill_in "Area", with: -5
|
||||||
click_button "Save"
|
click_button "Save"
|
||||||
expect(page).not_to have_content "Garden was successfully created"
|
expect(page).to have_no_content "Garden was successfully created"
|
||||||
expect(page).to have_content "Area must be greater than or equal to 0"
|
expect(page).to have_content "Area must be greater than or equal to 0"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ describe "Planting a crop", :js do
|
|||||||
|
|
||||||
click_link 'Actions'
|
click_link 'Actions'
|
||||||
expect(page).to have_content "Mark as active"
|
expect(page).to have_content "Mark as active"
|
||||||
expect(page).not_to have_content "Mark as inactive"
|
expect(page).to have_no_content "Mark as inactive"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "List only active gardens" do
|
it "List only active gardens" do
|
||||||
@@ -41,7 +41,7 @@ describe "Planting a crop", :js do
|
|||||||
click_link "Mark as inactive"
|
click_link "Mark as inactive"
|
||||||
end
|
end
|
||||||
visit gardens_path
|
visit gardens_path
|
||||||
expect(page).not_to have_link garden_path(garden)
|
expect(page).to have_no_link garden_path(garden)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "Create new garden" do
|
it "Create new garden" do
|
||||||
@@ -57,7 +57,7 @@ describe "Planting a crop", :js do
|
|||||||
fill_in "Name", with: "Negative Garden"
|
fill_in "Name", with: "Negative Garden"
|
||||||
fill_in "Area", with: -5
|
fill_in "Area", with: -5
|
||||||
click_button "Save"
|
click_button "Save"
|
||||||
expect(page).not_to have_content "Garden was successfully created"
|
expect(page).to have_no_content "Garden was successfully created"
|
||||||
expect(page).to have_content "Area must be greater than or equal to 0"
|
expect(page).to have_content "Area must be greater than or equal to 0"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ describe "Planting a crop", :js do
|
|||||||
|
|
||||||
it "List only active plantings on a garden" do
|
it "List only active plantings on a garden" do
|
||||||
visit gardens_path
|
visit gardens_path
|
||||||
expect(page).not_to have_content finished_planting.crop_name
|
expect(page).to have_no_content finished_planting.crop_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ describe "Gardens#index", :js do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "does not show inactive garden" do
|
it "does not show inactive garden" do
|
||||||
expect(page).not_to have_text inactive_garden.name
|
expect(page).to have_no_text inactive_garden.name
|
||||||
end
|
end
|
||||||
|
|
||||||
it "links to active garden" do
|
it "links to active garden" do
|
||||||
@@ -48,7 +48,7 @@ describe "Gardens#index", :js do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "does not link to inactive gardens" do
|
it "does not link to inactive gardens" do
|
||||||
expect(page).not_to have_link(inactive_garden.name, href: garden_path(inactive_garden))
|
expect(page).to have_no_link(inactive_garden.name, href: garden_path(inactive_garden))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ describe "Gardens#index", :js do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "does not show finished planting" do
|
it "does not show finished planting" do
|
||||||
expect(page).not_to have_text(finished_planting.crop.name)
|
expect(page).to have_no_text(finished_planting.crop.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -113,7 +113,7 @@ describe "Gardens#index", :js do
|
|||||||
it { expect(page).to have_link href: planting_path(planting) }
|
it { expect(page).to have_link href: planting_path(planting) }
|
||||||
it { expect(page).to have_link href: garden_path(planting.garden) }
|
it { expect(page).to have_link href: garden_path(planting.garden) }
|
||||||
it { expect(page).to have_text '7 weeks' }
|
it { expect(page).to have_text '7 weeks' }
|
||||||
it { expect(page).not_to have_text 'harvesting now' }
|
it { expect(page).to have_no_text 'harvesting now' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'harvesting now' do
|
describe 'harvesting now' do
|
||||||
@@ -128,7 +128,7 @@ describe "Gardens#index", :js do
|
|||||||
it { expect(crop.median_lifespan).to eq 90 }
|
it { expect(crop.median_lifespan).to eq 90 }
|
||||||
|
|
||||||
it { expect(page).to have_text 'harvesting now' }
|
it { expect(page).to have_text 'harvesting now' }
|
||||||
it { expect(page).not_to have_text 'Predicted weeks until harvest' }
|
it { expect(page).to have_no_text 'Predicted weeks until harvest' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'super late' do
|
describe 'super late' do
|
||||||
@@ -139,9 +139,9 @@ describe "Gardens#index", :js do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it { expect(page).to have_text 'super late' }
|
it { expect(page).to have_text 'super late' }
|
||||||
it { expect(page).not_to have_text 'harvesting now' }
|
it { expect(page).to have_no_text 'harvesting now' }
|
||||||
it { expect(page).not_to have_text 'Predicted weeks until harvest' }
|
it { expect(page).to have_no_text 'Predicted weeks until harvest' }
|
||||||
it { expect(page).not_to have_text 'Predicted weeks until planting is finished' }
|
it { expect(page).to have_no_text 'Predicted weeks until planting is finished' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ describe "browse harvests", :search do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'read more' do
|
it 'read more' do
|
||||||
expect(subject).not_to have_link "Read more"
|
expect(subject).to have_no_link "Read more"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ describe "home page", :search do
|
|||||||
describe 'should say welcome' do
|
describe 'should say welcome' do
|
||||||
before { visit root_path }
|
before { visit root_path }
|
||||||
|
|
||||||
it { expect(page).to have_content "Welcome to #{ENV['GROWSTUFF_SITE_NAME']}, #{member.login_name}" }
|
it { expect(page).to have_content "Welcome to #{ENV.fetch('GROWSTUFF_SITE_NAME', nil)}, #{member.login_name}" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ describe "members list" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it { expect(page).to have_link admin.login_name }
|
it { expect(page).to have_link admin.login_name }
|
||||||
it { expect(page).not_to have_link spammer.login_name }
|
it { expect(page).to have_no_link spammer.login_name }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -117,9 +117,9 @@ describe "member deletion" do
|
|||||||
|
|
||||||
it "removes members from following" do
|
it "removes members from following" do
|
||||||
visit member_follows_path(other_member)
|
visit member_follows_path(other_member)
|
||||||
expect(page).not_to have_content member.login_name.to_s
|
expect(page).to have_no_content member.login_name.to_s
|
||||||
visit member_followers_path(other_member)
|
visit member_followers_path(other_member)
|
||||||
expect(page).not_to have_content member.login_name.to_s
|
expect(page).to have_no_content member.login_name.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
it "replaces posts with deletion note" do
|
it "replaces posts with deletion note" do
|
||||||
@@ -131,7 +131,7 @@ describe "member deletion" do
|
|||||||
FactoryBot.create(:comment, post: othermemberpost, author: member, body: 'i am deleting my account')
|
FactoryBot.create(:comment, post: othermemberpost, author: member, body: 'i am deleting my account')
|
||||||
|
|
||||||
visit post_path(othermemberpost)
|
visit post_path(othermemberpost)
|
||||||
expect(page).not_to have_content member.login_name
|
expect(page).to have_no_content member.login_name
|
||||||
expect(page).to have_content other_member.login_name
|
expect(page).to have_content other_member.login_name
|
||||||
expect(page).to have_content "Member Deleted"
|
expect(page).to have_content "Member Deleted"
|
||||||
end
|
end
|
||||||
@@ -166,7 +166,7 @@ describe "member deletion" do
|
|||||||
login_as(otherwrangler)
|
login_as(otherwrangler)
|
||||||
visit edit_crop_path(crop)
|
visit edit_crop_path(crop)
|
||||||
expect(page).to have_content member.login_name
|
expect(page).to have_content member.login_name
|
||||||
expect(page).not_to have_content "cropbot"
|
expect(page).to have_no_content "cropbot"
|
||||||
logout
|
logout
|
||||||
login_as(member)
|
login_as(member)
|
||||||
visit member_path(member)
|
visit member_path(member)
|
||||||
@@ -176,7 +176,7 @@ describe "member deletion" do
|
|||||||
click_button "Delete"
|
click_button "Delete"
|
||||||
login_as(otherwrangler)
|
login_as(otherwrangler)
|
||||||
visit edit_crop_path(crop)
|
visit edit_crop_path(crop)
|
||||||
expect(page).not_to have_content member.login_name
|
expect(page).to have_no_content member.login_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ describe "follows", :js do
|
|||||||
|
|
||||||
it "follow buttons on member profile page" do
|
it "follow buttons on member profile page" do
|
||||||
visit member_path(member)
|
visit member_path(member)
|
||||||
expect(page).not_to have_link "Follow"
|
expect(page).to have_no_link "Follow"
|
||||||
expect(page).not_to have_link "Unfollow"
|
expect(page).to have_no_link "Unfollow"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@ describe "follows", :js do
|
|||||||
|
|
||||||
it "your profile doesn't have a follow button" do
|
it "your profile doesn't have a follow button" do
|
||||||
visit member_path(member)
|
visit member_path(member)
|
||||||
expect(page).not_to have_link "Follow"
|
expect(page).to have_no_link "Follow"
|
||||||
expect(page).not_to have_link "Unfollow"
|
expect(page).to have_no_link "Unfollow"
|
||||||
end
|
end
|
||||||
|
|
||||||
context "following another member" do
|
context "following another member" do
|
||||||
@@ -66,7 +66,7 @@ describe "follows", :js do
|
|||||||
click_link 'Follow'
|
click_link 'Follow'
|
||||||
click_link 'Unfollow'
|
click_link 'Unfollow'
|
||||||
visit member_follows_path(member)
|
visit member_follows_path(member)
|
||||||
expect(page).not_to have_content other_member.login_name
|
expect(page).to have_no_content other_member.login_name
|
||||||
visit member_followers_path(other_member)
|
visit member_followers_path(other_member)
|
||||||
expect(page).to have_content member.login_name
|
expect(page).to have_content member.login_name
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ describe "member profile", :js do
|
|||||||
|
|
||||||
it "member has not set location" do
|
it "member has not set location" do
|
||||||
visit member_path(member)
|
visit member_path(member)
|
||||||
expect(page).not_to have_css("h1>small")
|
expect(page).to have_no_css("h1>small")
|
||||||
expect(page).not_to have_css("#membermap")
|
expect(page).to have_no_css("#membermap")
|
||||||
expect(page).not_to have_content "See other members"
|
expect(page).to have_no_content "See other members"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ describe "member profile", :js do
|
|||||||
|
|
||||||
it "private email address" do
|
it "private email address" do
|
||||||
visit member_path(member)
|
visit member_path(member)
|
||||||
expect(page).not_to have_content member.email
|
expect(page).to have_no_content member.email
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,10 +55,10 @@ describe "member profile", :js do
|
|||||||
it "with no activity" do
|
it "with no activity" do
|
||||||
visit member_path(member)
|
visit member_path(member)
|
||||||
expect(page).to have_content "Stats"
|
expect(page).to have_content "Stats"
|
||||||
expect(page).not_to have_content "0 plantings"
|
expect(page).to have_no_content "0 plantings"
|
||||||
expect(page).not_to have_content "0 harvests"
|
expect(page).to have_no_content "0 harvests"
|
||||||
expect(page).not_to have_content "0 seeds"
|
expect(page).to have_no_content "0 seeds"
|
||||||
expect(page).not_to have_content "0 posts"
|
expect(page).to have_no_content "0 posts"
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with some activity" do
|
context "with some activity" do
|
||||||
@@ -102,8 +102,8 @@ describe "member profile", :js do
|
|||||||
|
|
||||||
it "ordinary user's page" do
|
it "ordinary user's page" do
|
||||||
visit member_path(other_member)
|
visit member_path(other_member)
|
||||||
expect(page).not_to have_text "Crop Wrangler"
|
expect(page).to have_no_text "Crop Wrangler"
|
||||||
expect(page).not_to have_text "Admin"
|
expect(page).to have_no_text "Admin"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -120,7 +120,7 @@ describe "member profile", :js do
|
|||||||
it { expect(page).to have_link href: planting_path(new_planting) }
|
it { expect(page).to have_link href: planting_path(new_planting) }
|
||||||
it { expect(page).to have_link href: planting_path(old_planting) }
|
it { expect(page).to have_link href: planting_path(old_planting) }
|
||||||
it { expect(page).to have_link href: planting_path(finished_planting) }
|
it { expect(page).to have_link href: planting_path(finished_planting) }
|
||||||
it { expect(page).not_to have_link href: planting_path(no_planted_at_planting) }
|
it { expect(page).to have_no_link href: planting_path(no_planted_at_planting) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'member has activities' do
|
context 'member has activities' do
|
||||||
@@ -257,7 +257,7 @@ describe "member profile", :js do
|
|||||||
expect(page).to have_link "Send message", href: new_message_path(recipient_id: other_member.id)
|
expect(page).to have_link "Send message", href: new_message_path(recipient_id: other_member.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(page).not_to have_link "Edit profile", href: edit_member_registration_path }
|
it { expect(page).to have_no_link "Edit profile", href: edit_member_registration_path }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ describe "User searches" do
|
|||||||
it { expect(page).to have_content "community near Philippines" }
|
it { expect(page).to have_content "community near Philippines" }
|
||||||
it { expect(page).to have_button "search_button" }
|
it { expect(page).to have_button "search_button" }
|
||||||
it { expect(page).to have_content "Nearby members" }
|
it { expect(page).to have_content "Nearby members" }
|
||||||
it { expect(page).not_to have_content "No results found" }
|
it { expect(page).to have_no_content "No results found" }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "with a blank search string" do
|
it "with a blank search string" do
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ describe "Planting reminder email", :js do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't list plantings" do
|
it "doesn't list plantings" do
|
||||||
expect(mail).not_to have_content "Progress report"
|
expect(mail).to have_no_content "Progress report"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ describe "Planting reminder email", :js do
|
|||||||
|
|
||||||
context "when member has no harvests" do
|
context "when member has no harvests" do
|
||||||
it "doesn't list plantings" do
|
it "doesn't list plantings" do
|
||||||
expect(mail).not_to have_content "Ready to harvest"
|
expect(mail).to have_no_content "Ready to harvest"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ describe "Planting a crop", :js, :search do
|
|||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content "planting was successfully created"
|
expect(page).to have_content "planting was successfully created"
|
||||||
expect(page).not_to have_content "Finished"
|
expect(page).to have_no_content "Finished"
|
||||||
expect(page).not_to have_content "Finishes"
|
expect(page).to have_no_content "Finishes"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows that planting is in progress" do
|
it "shows that planting is in progress" do
|
||||||
@@ -122,9 +122,9 @@ describe "Planting a crop", :js, :search do
|
|||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content "planting was successfully created"
|
expect(page).to have_content "planting was successfully created"
|
||||||
expect(page).not_to have_content "0%"
|
expect(page).to have_no_content "0%"
|
||||||
expect(page).not_to have_content "Finish expected"
|
expect(page).to have_no_content "Finish expected"
|
||||||
expect(page).not_to have_content "Finishes"
|
expect(page).to have_no_content "Finishes"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows that planting is 100% complete (no date specified)" do
|
it "shows that planting is 100% complete (no date specified)" do
|
||||||
@@ -184,7 +184,7 @@ describe "Planting a crop", :js, :search do
|
|||||||
|
|
||||||
it "Editing a planting to fill in the finished date" do
|
it "Editing a planting to fill in the finished date" do
|
||||||
visit planting_path(planting)
|
visit planting_path(planting)
|
||||||
expect(page).not_to have_content "Finishes"
|
expect(page).to have_no_content "Finishes"
|
||||||
# click_link(id: 'planting-actions-button')
|
# click_link(id: 'planting-actions-button')
|
||||||
click_link 'Actions'
|
click_link 'Actions'
|
||||||
click_link "Edit"
|
click_link "Edit"
|
||||||
@@ -230,7 +230,7 @@ describe "Planting a crop", :js, :search do
|
|||||||
|
|
||||||
# shouldn't be on the page
|
# shouldn't be on the page
|
||||||
visit plantings_path
|
visit plantings_path
|
||||||
expect(page).not_to have_content "maize"
|
expect(page).to have_no_content "maize"
|
||||||
|
|
||||||
# show all plantings to see this finished planting
|
# show all plantings to see this finished planting
|
||||||
visit plantings_path(all: 1)
|
visit plantings_path(all: 1)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe "Display a planting", :js do
|
|||||||
context 'Annual no predictions' do
|
context 'Annual no predictions' do
|
||||||
let(:planting) { FactoryBot.create(:annual_planting) }
|
let(:planting) { FactoryBot.create(:annual_planting) }
|
||||||
|
|
||||||
it { expect(page).not_to have_text 'Finish expected' }
|
it { expect(page).to have_no_text 'Finish expected' }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'Annual with predicted finish' do
|
context 'Annual with predicted finish' do
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ describe 'Comments RSS feed' do
|
|||||||
|
|
||||||
it 'The index title is what we expect' do
|
it 'The index title is what we expect' do
|
||||||
visit comments_path(format: 'rss')
|
visit comments_path(format: 'rss')
|
||||||
expect(page).to have_content "Recent comments on all posts (#{ENV['GROWSTUFF_SITE_NAME']})"
|
expect(page).to have_content "Recent comments on all posts (#{ENV.fetch('GROWSTUFF_SITE_NAME', nil)})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,6 +12,6 @@ describe 'Crops RSS feed' do
|
|||||||
it 'The index title is what we expect' do
|
it 'The index title is what we expect' do
|
||||||
Crop.reindex
|
Crop.reindex
|
||||||
visit crops_path(format: 'rss')
|
visit crops_path(format: 'rss')
|
||||||
expect(page).to have_content "Recently added crops (#{ENV['GROWSTUFF_SITE_NAME']})"
|
expect(page).to have_content "Recently added crops (#{ENV.fetch('GROWSTUFF_SITE_NAME', nil)})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ describe 'Members RSS feed' do
|
|||||||
before { visit member_path(member, format: 'rss') }
|
before { visit member_path(member, format: 'rss') }
|
||||||
|
|
||||||
it 'The show action title is what we expect' do
|
it 'The show action title is what we expect' do
|
||||||
expect(page).to have_content "#{member.login_name}'s recent posts (#{ENV['GROWSTUFF_SITE_NAME']})"
|
expect(page).to have_content "#{member.login_name}'s recent posts (#{ENV.fetch('GROWSTUFF_SITE_NAME', nil)})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ describe 'Plantings RSS feed' do
|
|||||||
it 'The index title is what we expect' do
|
it 'The index title is what we expect' do
|
||||||
Planting.reindex
|
Planting.reindex
|
||||||
visit plantings_path(format: 'rss')
|
visit plantings_path(format: 'rss')
|
||||||
expect(page).to have_content "Recent plantings from "\
|
expect(page).to have_content "Recent plantings from " \
|
||||||
"#{@owner || 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})"
|
"#{@owner || 'all members'} (#{ENV.fetch('GROWSTUFF_SITE_NAME', nil)})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ describe 'Posts RSS feed' do
|
|||||||
|
|
||||||
it 'The index title is what we expect' do
|
it 'The index title is what we expect' do
|
||||||
visit posts_path(format: 'rss')
|
visit posts_path(format: 'rss')
|
||||||
expect(page).to have_content "Recent posts from "\
|
expect(page).to have_content "Recent posts from " \
|
||||||
"#{@author || 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})"
|
"#{@author || 'all members'} (#{ENV.fetch('GROWSTUFF_SITE_NAME', nil)})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ describe 'Seeds RSS feed' do
|
|||||||
|
|
||||||
it 'The index title is what we expect' do
|
it 'The index title is what we expect' do
|
||||||
visit seeds_path(format: 'rss')
|
visit seeds_path(format: 'rss')
|
||||||
expect(page).to have_content "Recent seeds from "\
|
expect(page).to have_content "Recent seeds from " \
|
||||||
"#{@owner || 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})"
|
"#{@owner || 'all members'} (#{ENV.fetch('GROWSTUFF_SITE_NAME', nil)})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ describe "Seeds", :js, :search do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "displays required and optional fields properly" do
|
describe "displays required and optional fields properly" do
|
||||||
# Note: The required behaviour is pushed down to the control itself, not the form-group as of rails 7.1.
|
# NOTE: The required behaviour is pushed down to the control itself, not the form-group as of rails 7.1.
|
||||||
# Modern browsers enforce the required behaviour better than us doing it ourselves.
|
# Modern browsers enforce the required behaviour better than us doing it ourselves.
|
||||||
it { expect(page).to have_selector "label", text: "Crop" }
|
it { expect(page).to have_selector "label", text: "Crop" }
|
||||||
it { expect(page).to have_selector 'input#seed_quantity' }
|
it { expect(page).to have_selector 'input#seed_quantity' }
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ shared_examples "crop suggest" do |resource|
|
|||||||
fill_autocomplete "crop", with: "pe"
|
fill_autocomplete "crop", with: "pe"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).not_to have_content("pear")
|
expect(page).to have_no_content("pear")
|
||||||
expect(page).not_to have_content("pea")
|
expect(page).to have_no_content("pea")
|
||||||
|
|
||||||
within "form#new_#{resource}" do
|
within "form#new_#{resource}" do
|
||||||
fill_autocomplete "crop", with: "pea"
|
fill_autocomplete "crop", with: "pea"
|
||||||
@@ -66,9 +66,7 @@ shared_examples "crop suggest" do |resource|
|
|||||||
within "form#new_#{resource}" do
|
within "form#new_#{resource}" do
|
||||||
fill_autocomplete "crop", with: "Ryan Gosling"
|
fill_autocomplete "crop", with: "Ryan Gosling"
|
||||||
# Some forms require additional selections before submission.
|
# Some forms require additional selections before submission.
|
||||||
if resource == "harvest"
|
choose plant_part.name if resource == "harvest"
|
||||||
choose plant_part.name
|
|
||||||
end
|
|
||||||
click_button "Save"
|
click_button "Save"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ describe "timeline", :js do
|
|||||||
it { expect(page).to have_link href: planting_path(friend_planting) }
|
it { expect(page).to have_link href: planting_path(friend_planting) }
|
||||||
it { expect(page).to have_link href: planting_path(friend_harvest) }
|
it { expect(page).to have_link href: planting_path(friend_harvest) }
|
||||||
it { expect(page).to have_link href: planting_path(finished_planting) }
|
it { expect(page).to have_link href: planting_path(finished_planting) }
|
||||||
it { expect(page).not_to have_link href: planting_path(no_planted_at_planting) }
|
it { expect(page).to have_no_link href: planting_path(no_planted_at_planting) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'shows the friends you follow' do
|
describe 'shows the friends you follow' do
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe GardensHelper do
|
|||||||
garden = FactoryBot.create(:garden,
|
garden = FactoryBot.create(:garden,
|
||||||
description: 'a' * 140)
|
description: 'a' * 140)
|
||||||
result = helper.display_garden_description(garden)
|
result = helper.display_garden_description(garden)
|
||||||
expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", garden_path(garden))
|
expect(result).to eq ('a' * 126) + '...' + ' ' + link_to("Read more", garden_path(garden))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe SeedsHelper do
|
|||||||
seed = FactoryBot.create(:seed,
|
seed = FactoryBot.create(:seed,
|
||||||
description: 'a' * 140)
|
description: 'a' * 140)
|
||||||
result = helper.display_seed_description(seed)
|
result = helper.display_seed_description(seed)
|
||||||
expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", seed_path(seed))
|
expect(result).to eq ('a' * 126) + '...' + ' ' + link_to("Read more", seed_path(seed))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ describe Ability do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
context 'members' do
|
context 'members' do
|
||||||
context 'ordinary member' do
|
context 'ordinary member' do
|
||||||
it "can't manage members" do
|
it "can't manage members" do
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ describe Seed do
|
|||||||
@seed = FactoryBot.build(:seed, tradable_to: 'not valid')
|
@seed = FactoryBot.build(:seed, tradable_to: 'not valid')
|
||||||
@seed.should_not be_valid
|
@seed.should_not be_valid
|
||||||
@seed.errors[:tradable_to].should include(
|
@seed.errors[:tradable_to].should include(
|
||||||
"You may only trade seed nowhere, locally, "\
|
"You may only trade seed nowhere, locally, " \
|
||||||
"nationally, or internationally"
|
"nationally, or internationally"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ RSpec.configure do |config|
|
|||||||
|
|
||||||
# Prevent Poltergeist from fetching external URLs during feature tests
|
# Prevent Poltergeist from fetching external URLs during feature tests
|
||||||
config.before(:each, :js) do
|
config.before(:each, :js) do
|
||||||
|
|
||||||
# TODO: Why are we setting this page size then straight afterwards, maximising?
|
# TODO: Why are we setting this page size then straight afterwards, maximising?
|
||||||
width = 1280
|
width = 1280
|
||||||
height = 1280
|
height = 1280
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ RSpec.describe 'Gardens', type: :request do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it '#index' do
|
it '#index' do
|
||||||
get '/api/v1/gardens', params: {}, headers: headers
|
get('/api/v1/gardens', params: {}, headers:)
|
||||||
expect(subject['data']).to include(garden_encoded_as_json_api)
|
expect(subject['data']).to include(garden_encoded_as_json_api)
|
||||||
end
|
end
|
||||||
|
|
||||||
it '#show' do
|
it '#show' do
|
||||||
get "/api/v1/gardens/#{garden.id}", params: {}, headers: headers
|
get("/api/v1/gardens/#{garden.id}", params: {}, headers:)
|
||||||
expect(subject['data']).to include(garden_encoded_as_json_api)
|
expect(subject['data']).to include(garden_encoded_as_json_api)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -78,14 +78,14 @@ RSpec.describe 'Plantings', type: :request do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it '#index' do
|
it '#index' do
|
||||||
get '/api/v1/plantings', params: {}, headers: headers
|
get('/api/v1/plantings', params: {}, headers:)
|
||||||
expect(subject['data'][0].keys).to eq(planting_encoded_as_json_api.keys)
|
expect(subject['data'][0].keys).to eq(planting_encoded_as_json_api.keys)
|
||||||
expect(subject['data'][0]['attributes'].keys.sort!).to eq(planting_encoded_as_json_api['attributes'].keys.sort!)
|
expect(subject['data'][0]['attributes'].keys.sort!).to eq(planting_encoded_as_json_api['attributes'].keys.sort!)
|
||||||
expect(subject['data']).to include(planting_encoded_as_json_api)
|
expect(subject['data']).to include(planting_encoded_as_json_api)
|
||||||
end
|
end
|
||||||
|
|
||||||
it '#show' do
|
it '#show' do
|
||||||
get "/api/v1/plantings/#{planting.id}", params: {}, headers: headers
|
get("/api/v1/plantings/#{planting.id}", params: {}, headers:)
|
||||||
expect(subject['data']['relationships']).to include("garden" => garden_as_json_api)
|
expect(subject['data']['relationships']).to include("garden" => garden_as_json_api)
|
||||||
expect(subject['data']['relationships']).to include("crop" => crop_as_json_api)
|
expect(subject['data']['relationships']).to include("crop" => crop_as_json_api)
|
||||||
expect(subject['data']['relationships']).to include("owner" => owner_as_json_api)
|
expect(subject['data']['relationships']).to include("owner" => owner_as_json_api)
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ describe "Plantings" do
|
|||||||
before do
|
before do
|
||||||
@member = create(:interesting_member)
|
@member = create(:interesting_member)
|
||||||
|
|
||||||
@predictable_planting = create(:predictable_planting, owner: @member, planted_at: 1.days.ago, days_to_first_harvest: 10, days_to_last_harvest: 20)
|
@predictable_planting = create(:predictable_planting, owner: @member, planted_at: 1.days.ago, days_to_first_harvest: 10,
|
||||||
|
days_to_last_harvest: 20)
|
||||||
@predictable_planting.crop.update(median_days_to_first_harvest: 10)
|
@predictable_planting.crop.update(median_days_to_first_harvest: 10)
|
||||||
|
|
||||||
@seedling_planting = create(:seedling_planting, owner: @member)
|
@seedling_planting = create(:seedling_planting, owner: @member)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ describe "crops/show" do
|
|||||||
|
|
||||||
it "hides sunniness block if no sunniness" do
|
it "hides sunniness block if no sunniness" do
|
||||||
render
|
render
|
||||||
expect(rendered).not_to have_content "Sunniness"
|
expect(rendered).to have_no_content "Sunniness"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has sunniness block if sunny planting" do
|
it "has sunniness block if sunny planting" do
|
||||||
@@ -27,7 +27,7 @@ describe "crops/show" do
|
|||||||
|
|
||||||
it "hides planted from block if no planted_from" do
|
it "hides planted from block if no planted_from" do
|
||||||
render
|
render
|
||||||
expect(rendered).not_to have_content "Planted from"
|
expect(rendered).to have_no_content "Planted from"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has planted from block if seed planting" do
|
it "has planted from block if seed planting" do
|
||||||
@@ -38,7 +38,7 @@ describe "crops/show" do
|
|||||||
|
|
||||||
it "hides harvested block if no harvests" do
|
it "hides harvested block if no harvests" do
|
||||||
render
|
render
|
||||||
expect(rendered).not_to have_content "Harvested for"
|
expect(rendered).to have_no_content "Harvested for"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has harvested block if harvest" do
|
it "has harvested block if harvest" do
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ describe "plantings/show" do
|
|||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(rendered).not_to have_content 'Planted from' }
|
it { expect(rendered).to have_no_content 'Planted from' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ describe "plantings/show" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't contain a () if no location is set" do
|
it "doesn't contain a () if no location is set" do
|
||||||
expect(rendered).not_to have_content "()"
|
expect(rendered).to have_no_content "()"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe "posts/new" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'no forum mentioned' do
|
it 'no forum mentioned' do
|
||||||
expect(rendered).not_to have_content "This post will be posted in the forum"
|
expect(rendered).to have_no_content "This post will be posted in the forum"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "asks what's going on in your garden" do
|
it "asks what's going on in your garden" do
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ describe "posts/show" do
|
|||||||
it { is_expected.to have_text('hello there') }
|
it { is_expected.to have_text('hello there') }
|
||||||
# shouldn't show the subject on a single post page
|
# shouldn't show the subject on a single post page
|
||||||
# (it appears in the title/h1 via the layout, not via this view)
|
# (it appears in the title/h1 via the layout, not via this view)
|
||||||
it { is_expected.not_to have_text('An Update') }
|
it { is_expected.to have_no_text('An Update') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "should parse markdown into html" do
|
describe "should parse markdown into html" do
|
||||||
@@ -37,19 +37,19 @@ describe "posts/show" do
|
|||||||
let(:post) { FactoryBot.create(:post, author:, body: '<a href="http://evil.com">EVIL</a>') }
|
let(:post) { FactoryBot.create(:post, author:, body: '<a href="http://evil.com">EVIL</a>') }
|
||||||
|
|
||||||
it { is_expected.to have_content('EVIL') }
|
it { is_expected.to have_content('EVIL') }
|
||||||
it { is_expected.not_to have_link("http://evil.com") }
|
it { is_expected.to have_no_link("http://evil.com") }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'script tag in post body' do
|
describe 'script tag in post body' do
|
||||||
let(:post) { FactoryBot.create(:post, author:, body: "<script>alert('hakker!')</script>") }
|
let(:post) { FactoryBot.create(:post, author:, body: "<script>alert('hakker!')</script>") }
|
||||||
|
|
||||||
it { is_expected.not_to have_selector('script') }
|
it { is_expected.to have_no_selector('script') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'script tag in post title' do
|
describe 'script tag in post title' do
|
||||||
let(:post) { FactoryBot.create(:post, author:, subject: "<script>alert('hakker!')</script>") }
|
let(:post) { FactoryBot.create(:post, author:, subject: "<script>alert('hakker!')</script>") }
|
||||||
|
|
||||||
it { is_expected.not_to have_selector('script') }
|
it { is_expected.to have_no_selector('script') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'has an anchor to the comments' do
|
describe 'has an anchor to the comments' do
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ describe 'seeds/index.rss.haml', :search do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "does not offer untradable seed as tradeable" do
|
it "does not offer untradable seed as tradeable" do
|
||||||
expect(rendered).not_to have_content "Will trade #{seed.tradable_to} from #{seed.owner.location}"
|
expect(rendered).to have_no_content "Will trade #{seed.tradable_to} from #{seed.owner.location}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user