diff --git a/.rubocop.yml b/.rubocop.yml
index 7d564984d..355a14ac6 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -27,13 +27,13 @@ Style/PercentLiteralDelimiters:
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
-Layout/AlignHash:
+Layout/HashAlignment:
EnforcedColonStyle: table
EnforcedHashRocketStyle: table
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
-Layout/AlignParameters:
+Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 48abddc81..906cc5479 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,26 +1,57 @@
# This configuration was generated by
-# `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp`
-# using RuboCop version 0.71.0.
+# `rubocop --auto-gen-config --no-offense-counts`
+# on 2019-12-16 21:01:58 +1300 using RuboCop version 0.77.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, IndentationWidth.
-# SupportedStyles: with_first_argument, with_fixed_indentation
-Layout/AlignArguments:
- Enabled: false
-
Lint/AmbiguousOperator:
Exclude:
- 'spec/controllers/crops_controller_spec.rb'
# Configuration parameters: AllowComments.
-Lint/HandleExceptions:
+Lint/SuppressedException:
Exclude:
- 'lib/tasks/testing.rake'
+Lint/UselessAssignment:
+ Exclude:
+ - 'config.rb'
+ - 'config/compass.rb'
+
+Metrics/AbcSize:
+ Max: 125
+
+# Configuration parameters: CountComments, ExcludedMethods.
+# ExcludedMethods: refine
+Metrics/BlockLength:
+ Max: 59
+
+# Configuration parameters: CountComments.
+Metrics/ClassLength:
+ Max: 186
+
+Metrics/CyclomaticComplexity:
+ Max: 29
+
+# Cop supports --auto-correct.
+# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
+# URISchemes: http, https
+Metrics/LineLength:
+ Max: 341
+
+# Configuration parameters: CountComments, ExcludedMethods.
+Metrics/MethodLength:
+ Max: 106
+
+# Configuration parameters: CountComments.
+Metrics/ModuleLength:
+ Max: 107
+
+Metrics/PerceivedComplexity:
+ Max: 29
+
# Configuration parameters: EnforcedStyle.
# SupportedStyles: lowercase, uppercase
Naming/HeredocDelimiterCase:
@@ -41,11 +72,27 @@ Rails/CreateTableWithTimestamps:
- 'db/migrate/20161201154922_add_photos_seeds_table.rb'
- 'db/migrate/20171022032108_all_the_predictions.rb'
+# Configuration parameters: EnforcedStyle.
+# SupportedStyles: strict, flexible
+Rails/Date:
+ Exclude:
+ - 'app/mailers/notifier.rb'
+
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
Exclude:
- - 'spec/rails_helper.rb'
+ - 'app/controllers/crops_controller.rb'
+ - 'config/application.rb'
+ - 'config/environments/development.rb'
+ - 'db/seeds.rb'
+
+# Configuration parameters: Include.
+# Include: app/models/**/*.rb
+Rails/HasAndBelongsToMany:
+ Exclude:
+ - 'app/models/member.rb'
+ - 'app/models/role.rb'
# Configuration parameters: Include.
# Include: app/models/**/*.rb
@@ -53,6 +100,44 @@ Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/member.rb'
+# Configuration parameters: Include.
+# Include: app/models/**/*.rb
+Rails/InverseOf:
+ Exclude:
+ - 'app/models/concerns/ownable.rb'
+
+Rails/OutputSafety:
+ Exclude:
+ - 'app/helpers/auto_suggest_helper.rb'
+ - 'app/helpers/gardens_helper.rb'
+
+# Configuration parameters: Include.
+# Include: **/Rakefile, **/*.rake
+Rails/RakeEnvironment:
+ Exclude:
+ - 'lib/tasks/hooks.rake'
+ - 'lib/tasks/i18n.rake'
+ - 'lib/tasks/testing.rake'
+
+# Configuration parameters: Include.
+# Include: db/migrate/*.rb
+Rails/ReversibleMigration:
+ Exclude:
+ - 'db/migrate/20191119020643_upgrade_cms.rb'
+
+# Configuration parameters: Blacklist, Whitelist.
+# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
+Rails/SkipsModelValidations:
+ Exclude:
+ - 'db/migrate/20190317023129_finished_boolean.rb'
+ - 'db/seeds.rb'
+ - 'db/migrate/20190910022329_add_photo_source.rb'
+
+# Configuration parameters: AllowedChars.
+Style/AsciiComments:
+ Exclude:
+ - 'config/initializers/comfortable_mexican_sofa.rb'
+
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: nested, compact
@@ -60,10 +145,10 @@ Style/ClassAndModuleChildren:
Exclude:
- 'lib/actions/oauth_signup_action.rb'
- 'lib/haml/filters/escaped_markdown.rb'
+ - 'lib/haml/filters/growstuff_markdown.rb'
Style/CommentedKeyword:
Exclude:
- - 'lib/tasks/growstuff.rake'
- 'spec/models/crop_spec.rb'
- 'spec/models/photo_spec.rb'
- 'spec/models/planting_spec.rb'
@@ -82,4 +167,3 @@ Style/NumericPredicate:
- 'spec/**/*'
- 'app/helpers/harvests_helper.rb'
- 'app/helpers/plantings_helper.rb'
- - 'lib/tasks/growstuff.rake'
diff --git a/Guardfile b/Guardfile
index 0d6759dbf..e4197ab07 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,6 +1,6 @@
guard :rspec,
- cmd: 'bundle exec rspec --format documentation',
- failed_mode: :keep do
+ cmd: 'bundle exec rspec --format documentation',
+ failed_mode: :keep do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/libs/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index e30fe25b1..ceafaa6cb 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -59,26 +59,26 @@ class ApplicationController < ActionController::Base
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up) do |member|
member.permit(:login_name, :email, :password, :password_confirmation,
- :remember_me, :login,
- # terms of service
- :tos_agreement,
- # profile stuff
- :bio, :location, :latitude, :longitude,
- # email settings
- :show_email, :newsletter, :send_notification_email, :send_planting_reminder)
+ :remember_me, :login,
+ # terms of service
+ :tos_agreement,
+ # profile stuff
+ :bio, :location, :latitude, :longitude,
+ # email settings
+ :show_email, :newsletter, :send_notification_email, :send_planting_reminder)
end
devise_parameter_sanitizer.permit(:account_update) do |member|
member.permit(:login_name, :email, :password, :password_confirmation,
- :remember_me, :login,
- # terms of service
- :tos_agreement,
- # profile stuff
- :bio, :location, :latitude, :longitude,
- # email settings
- :show_email, :newsletter, :send_notification_email, :send_planting_reminder,
- # update password
- :current_password)
+ :remember_me, :login,
+ # terms of service
+ :tos_agreement,
+ # profile stuff
+ :bio, :location, :latitude, :longitude,
+ # email settings
+ :show_email, :newsletter, :send_notification_email, :send_planting_reminder,
+ # update password
+ :current_password)
end
end
diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb
index f6bf1bb21..fc18ff4d7 100644
--- a/app/controllers/authentications_controller.rb
+++ b/app/controllers/authentications_controller.rb
@@ -12,14 +12,14 @@ class AuthenticationsController < ApplicationController
@authentication = current_member.authentications
.create_with(
- name: name,
- token: auth['credentials']['token'],
+ name: name,
+ token: auth['credentials']['token'],
secret: auth['credentials']['secret']
)
.find_or_create_by(
provider: auth['provider'],
- uid: auth['uid'],
- name: name
+ uid: auth['uid'],
+ name: name
)
flash[:notice] = "Authentication successful."
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index f6bbc412c..d47dae87d 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -19,7 +19,7 @@ class CommentsController < ApplicationController
respond_with(@comments)
else
redirect_to(request.referer || root_url,
- alert: "Can't post a comment on a non-existent post")
+ alert: "Can't post a comment on a non-existent post")
end
end
diff --git a/app/controllers/conversations_controller.rb b/app/controllers/conversations_controller.rb
index a8b806a9d..e5da3be93 100644
--- a/app/controllers/conversations_controller.rb
+++ b/app/controllers/conversations_controller.rb
@@ -54,7 +54,7 @@ class ConversationsController < ApplicationController
def set_box
@boxes = {
'inbox' => { 'total' => mailbox.inbox.size, 'unread' => current_member.receipts.where(is_read: false).count },
- 'sent' => { 'total' => mailbox.sentbox.size, 'unread' => 0 },
+ 'sent' => { 'total' => mailbox.sentbox.size, 'unread' => 0 },
'trash' => { 'total' => mailbox.trash.size, 'unread' => 0 }
}
@box = if params[:box].blank? || !@boxes.keys.include?(params[:box])
diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb
index d5eb60573..99c702e7f 100644
--- a/app/controllers/crops_controller.rb
+++ b/app/controllers/crops_controller.rb
@@ -50,8 +50,8 @@ class CropsController < ApplicationController
@term = params[:term]
@crops = CropSearchService.search(
- @term, page: params[:page],
- per_page: 36,
+ @term, page: params[:page],
+ per_page: 36,
current_member: current_member
)
respond_with @crops
@@ -202,13 +202,13 @@ class CropsController < ApplicationController
def crop_json_fields
{
include: {
- plantings: {
+ plantings: {
include: {
owner: { only: %i(id login_name location latitude longitude) }
}
},
scientific_names: { only: [:name] },
- alternate_names: { only: [:name] }
+ alternate_names: { only: [:name] }
}
}
end
diff --git a/app/controllers/gardens_controller.rb b/app/controllers/gardens_controller.rb
index 8a39b6dc1..333fa454d 100644
--- a/app/controllers/gardens_controller.rb
+++ b/app/controllers/gardens_controller.rb
@@ -55,6 +55,6 @@ class GardensController < ApplicationController
def garden_params
params.require(:garden).permit(:name, :slug, :description, :active,
- :location, :latitude, :longitude, :area, :area_unit, :garden_type_id)
+ :location, :latitude, :longitude, :area, :area_unit, :garden_type_id)
end
end
diff --git a/app/controllers/harvests_controller.rb b/app/controllers/harvests_controller.rb
index 353e338d6..c474e2679 100644
--- a/app/controllers/harvests_controller.rb
+++ b/app/controllers/harvests_controller.rb
@@ -65,8 +65,8 @@ class HarvestsController < ApplicationController
def harvest_params
params.require(:harvest)
.permit(:planting_id, :crop_id, :harvested_at, :description,
- :quantity, :unit, :weight_quantity, :weight_unit,
- :plant_part_id, :slug, :si_weight)
+ :quantity, :unit, :weight_quantity, :weight_unit,
+ :plant_part_id, :slug, :si_weight)
.merge(owner_id: current_member.id)
end
diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb
index 2837dfb0a..501bc6ee1 100644
--- a/app/controllers/likes_controller.rb
+++ b/app/controllers/likes_controller.rb
@@ -28,11 +28,11 @@ class LikesController < ApplicationController
def render_json(like, liked_by_member: true)
{
- id: like.likeable.id,
- like_count: like.likeable.likes.count,
+ id: like.likeable.id,
+ like_count: like.likeable.likes.count,
liked_by_member: liked_by_member,
- description: ActionController::Base.helpers.pluralize(like.likeable.likes.count, "like"),
- url: like_path(like, format: :json)
+ description: ActionController::Base.helpers.pluralize(like.likeable.likes.count, "like"),
+ url: like_path(like, format: :json)
}
end
@@ -40,8 +40,8 @@ class LikesController < ApplicationController
respond_to do |format|
format.html { redirect_to like.likeable }
format.json do
- render(json: render_json(like,
- liked_by_member: liked_by_member),
+ render(json: render_json(like,
+ liked_by_member: liked_by_member),
status: status_code)
end
end
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index 552a71bd0..0d07b303f 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -69,7 +69,7 @@ class MembersController < ApplicationController
EMAIL_TYPE_STRING = {
send_notification_email: "direct message notifications",
- send_planting_reminder: "planting reminders"
+ send_planting_reminder: "planting reminders"
}.freeze
def member_params
diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb
index c8908801e..c6243ad20 100644
--- a/app/controllers/photos_controller.rb
+++ b/app/controllers/photos_controller.rb
@@ -65,7 +65,7 @@ class PhotosController < ApplicationController
def photo_params
params.require(:photo).permit(:source_id, :source, :title, :license_name,
- :license_url, :thumbnail_url, :fullsize_url, :link_url)
+ :license_url, :thumbnail_url, :fullsize_url, :link_url)
end
# Item with photos attached
@@ -84,7 +84,7 @@ class PhotosController < ApplicationController
def find_or_create_photo_from_flickr_photo
photo = Photo.find_or_initialize_by(
source_id: photo_params[:source_id],
- source: 'flickr'
+ source: 'flickr'
)
photo.update(photo_params)
photo.owner_id = current_member.id
diff --git a/app/controllers/plantings_controller.rb b/app/controllers/plantings_controller.rb
index f36a94e39..ae01b499c 100644
--- a/app/controllers/plantings_controller.rb
+++ b/app/controllers/plantings_controller.rb
@@ -42,15 +42,15 @@ class PlantingsController < ApplicationController
def new
@planting = Planting.new(
planted_at: Time.zone.today,
- owner: current_member,
- garden: current_member.gardens.first
+ owner: current_member,
+ garden: current_member.gardens.first
)
@seed = Seed.find_by(slug: params[:seed_id]) if params[:seed_id]
@crop = Crop.approved.find_by(id: params[:crop_id]) || Crop.new
if params[:garden_id]
@planting.garden = Garden.find_by(
owner: current_member,
- id: params[:garden_id]
+ id: params[:garden_id]
)
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index af0d1505b..4cdda2b98 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -53,9 +53,9 @@ module ApplicationHelper
return uri.to_s
end
- Gravatar.new(member.email).image_url(size: size,
+ Gravatar.new(member.email).image_url(size: size,
default: :identicon,
- ssl: true)
+ ssl: true)
end
# Returns a string with the quantity and the right pluralization for a
diff --git a/app/helpers/auto_suggest_helper.rb b/app/helpers/auto_suggest_helper.rb
index 1f9030fd8..85a3f0cbc 100644
--- a/app/helpers/auto_suggest_helper.rb
+++ b/app/helpers/auto_suggest_helper.rb
@@ -1,5 +1,4 @@
module AutoSuggestHelper
- # rubocop:disable Rails/OutputSafety
def auto_suggest(resource, source, options = {})
if options[:default] && !options[:default].new_record?
default = options[:default]
@@ -22,5 +21,4 @@ module AutoSuggestHelper
type="hidden" name="#{resource}[#{source}_id]" value="#{default_id}">
).html_safe
end
- # rubocop:enable Rails/OutputSafety
end
diff --git a/app/helpers/buttons_helper.rb b/app/helpers/buttons_helper.rb
index 05fc2798d..1c4eb5306 100644
--- a/app/helpers/buttons_helper.rb
+++ b/app/helpers/buttons_helper.rb
@@ -31,14 +31,14 @@ module ButtonsHelper
def crop_plant_button(crop)
create_button(Planting,
- new_planting_path(params: { crop_id: crop.id }),
- planting_icon, t('buttons.plant'))
+ new_planting_path(params: { crop_id: crop.id }),
+ planting_icon, t('buttons.plant'))
end
def crop_save_seeds_button(crop)
create_button(Seed,
- new_seed_path(params: { crop_id: crop.id }),
- seed_icon, t('buttons.save_seeds'))
+ new_seed_path(params: { crop_id: crop.id }),
+ seed_icon, t('buttons.save_seeds'))
end
def create_button(model_to_create, path, icon, label)
diff --git a/app/helpers/editable_form_helper.rb b/app/helpers/editable_form_helper.rb
index 00cabebad..007eeb624 100644
--- a/app/helpers/editable_form_helper.rb
+++ b/app/helpers/editable_form_helper.rb
@@ -1,6 +1,6 @@
module EditableFormHelper
def editable(field_type, model, field, display_field:, collection: [])
render 'shared/editable/form', field_type: field_type,
- model: model, field: field, display_field: display_field, collection: collection
+ model: model, field: field, display_field: display_field, collection: collection
end
end
diff --git a/app/helpers/gardens_helper.rb b/app/helpers/gardens_helper.rb
index 1ebb589f0..1f50d18f4 100644
--- a/app/helpers/gardens_helper.rb
+++ b/app/helpers/gardens_helper.rb
@@ -17,7 +17,6 @@ module GardensHelper
if plantings.blank?
"None"
else
- # rubocop:disable Rails/OutputSafety
output = '
'
plantings.each do |planting|
output += "- "
@@ -27,7 +26,7 @@ module GardensHelper
end
output += '
'
output.html_safe
- # rubocop:enable Rails/OutputSafety
+
end
end
end
diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb
index c2beeec1a..fd676e8d9 100644
--- a/app/helpers/posts_helper.rb
+++ b/app/helpers/posts_helper.rb
@@ -2,6 +2,6 @@ module PostsHelper
def display_post_truncated(post)
length = 300
truncate(strip_tags(post.body), length: length,
- separator: ' ', omission: '... ') { link_to "Read more", post_path(post) }
+ separator: ' ', omission: '... ') { link_to "Read more", post_path(post) }
end
end
diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb
index da8618cf9..d3ab4b2c5 100644
--- a/app/mailers/notifier.rb
+++ b/app/mailers/notifier.rb
@@ -19,7 +19,7 @@ class Notifier < ApplicationMailer
message = { member_id: @notification.recipient.id, type: :send_notification_email }
@signed_message = verifier.generate(message)
- mail(to: @notification.recipient.email,
+ mail(to: @notification.recipient.email,
subject: @notification.subject)
end
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 9b0882350..62ebdde7e 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -11,10 +11,10 @@ class Comment < ApplicationRecord
if recipient != sender
Notification.create(
recipient_id: recipient,
- sender_id: sender,
- subject: "#{author} commented on #{post.subject}",
- body: body,
- post_id: post.id
+ sender_id: sender,
+ subject: "#{author} commented on #{post.subject}",
+ body: body,
+ post_id: post.id
)
end
end
diff --git a/app/models/concerns/crop_search.rb b/app/models/concerns/crop_search.rb
index 503c6a9ad..edeffe36b 100644
--- a/app/models/concerns/crop_search.rb
+++ b/app/models/concerns/crop_search.rb
@@ -4,10 +4,10 @@ module CropSearch
included do
####################################
# Elastic search configuration
- searchkick word_start: %i(name alternate_names scientific_names),
+ searchkick word_start: %i(name alternate_names scientific_names),
case_sensitive: false,
merge_mappings: true,
- mappings: {
+ mappings: {
properties: {
created_at: { type: :integer }
}
@@ -22,19 +22,19 @@ module CropSearch
def search_data
{
- name: name,
- slug: slug,
- alternate_names: alternate_names.pluck(:name),
+ name: name,
+ slug: slug,
+ alternate_names: alternate_names.pluck(:name),
scientific_names: scientific_names.pluck(:name),
# boost the crops that are planted the most
- plantings_count: plantings_count,
+ plantings_count: plantings_count,
# boost this crop for these members
- planters_ids: plantings.pluck(:owner_id),
- has_photos: photos.size.positive?,
- photo: default_photo&.thumbnail_url,
- scientific_name: default_scientific_name&.name,
- description: description,
- created_at: created_at.to_i
+ planters_ids: plantings.pluck(:owner_id),
+ has_photos: photos.size.positive?,
+ photo: default_photo&.thumbnail_url,
+ scientific_name: default_scientific_name&.name,
+ description: description,
+ created_at: created_at.to_i
}
end
end
diff --git a/app/models/concerns/member_flickr.rb b/app/models/concerns/member_flickr.rb
index 2f1e22eec..d5d591dc8 100644
--- a/app/models/concerns/member_flickr.rb
+++ b/app/models/concerns/member_flickr.rb
@@ -1,7 +1,7 @@
module MemberFlickr
extend ActiveSupport::Concern
- included do # rubocop:disable Metrics/BlockLength
+ included do
# Authenticates against Flickr and returns an object we can use for subsequent api calls
def flickr
if @flickr.nil?
@@ -24,13 +24,13 @@ module MemberFlickr
result = if set
flickr.photosets.getPhotos(
photoset_id: set,
- page: page_num,
- per_page: 30
+ page: page_num,
+ per_page: 30
)
else
flickr.people.getPhotos(
- user_id: 'me',
- page: page_num,
+ user_id: 'me',
+ page: page_num,
per_page: 30
)
end
diff --git a/app/models/concerns/member_newsletter.rb b/app/models/concerns/member_newsletter.rb
index 938ba2237..882bac7cb 100644
--- a/app/models/concerns/member_newsletter.rb
+++ b/app/models/concerns/member_newsletter.rb
@@ -1,7 +1,7 @@
module MemberNewsletter
extend ActiveSupport::Concern
- included do # rubocop:disable Metrics/BlockLength
+ included do
after_save :update_newsletter_subscription
before_destroy :newsletter_unsubscribe
@@ -29,9 +29,9 @@ module MemberNewsletter
return true if Rails.env.test? && !testing
gibbon.lists.subscribe(
- id: Rails.application.config.newsletter_list_id,
- email: { email: email },
- merge_vars: { login_name: login_name },
+ id: Rails.application.config.newsletter_list_id,
+ email: { email: email },
+ merge_vars: { login_name: login_name },
double_optin: false # they already confirmed their email with us
)
end
@@ -39,7 +39,7 @@ module MemberNewsletter
def newsletter_unsubscribe(gibbon = Gibbon::API.new, testing = false)
return true if Rails.env.test? && !testing
- gibbon.lists.unsubscribe(id: Rails.application.config.newsletter_list_id,
+ gibbon.lists.unsubscribe(id: Rails.application.config.newsletter_list_id,
email: { email: email })
end
end
diff --git a/app/models/concerns/open_farm_data.rb b/app/models/concerns/open_farm_data.rb
index 077971574..e7d2306ed 100644
--- a/app/models/concerns/open_farm_data.rb
+++ b/app/models/concerns/open_farm_data.rb
@@ -1,7 +1,7 @@
module OpenFarmData
extend ActiveSupport::Concern
- included do # rubocop:disable Metrics/BlockLength
+ included do
def update_openfarm_data!
OpenfarmService.new.update_crop(self)
end
diff --git a/app/models/concerns/ownable.rb b/app/models/concerns/ownable.rb
index 9328743fd..6cd40a2e6 100644
--- a/app/models/concerns/ownable.rb
+++ b/app/models/concerns/ownable.rb
@@ -2,7 +2,7 @@ module Ownable
extend ActiveSupport::Concern
included do
- belongs_to :owner, class_name: 'Member', # rubocop:disable Rails/InverseOf
+ belongs_to :owner, class_name: 'Member',
foreign_key: 'owner_id', counter_cache: true
default_scope { joins(:owner).merge(Member.kept) } # Ensures the owner still exists
diff --git a/app/models/concerns/predict_harvest.rb b/app/models/concerns/predict_harvest.rb
index 51224a2a6..4ea241530 100644
--- a/app/models/concerns/predict_harvest.rb
+++ b/app/models/concerns/predict_harvest.rb
@@ -1,7 +1,7 @@
module PredictHarvest
extend ActiveSupport::Concern
- included do # rubocop:disable Metrics/BlockLength
+ included do
# dates
def first_harvest_date
harvests_with_dates.minimum(:harvested_at)
diff --git a/app/models/concerns/predict_planting.rb b/app/models/concerns/predict_planting.rb
index b43a70149..e542568ec 100644
--- a/app/models/concerns/predict_planting.rb
+++ b/app/models/concerns/predict_planting.rb
@@ -1,7 +1,7 @@
module PredictPlanting
extend ActiveSupport::Concern
- included do # rubocop:disable Metrics/BlockLength
+ included do
## Triggers
before_save :calculate_lifespan
diff --git a/app/models/crop.rb b/app/models/crop.rb
index 43cbeb974..78da0337a 100644
--- a/app/models/crop.rb
+++ b/app/models/crop.rb
@@ -48,10 +48,10 @@ class Crop < ApplicationRecord
## Wikipedia urls are only necessary when approving a crop
validates :en_wikipedia_url,
format: {
- with: %r{\Ahttps?:\/\/en\.wikipedia\.org\/wiki\/[[:alnum:]%_\.()-]+\z},
+ with: %r{\Ahttps?:\/\/en\.wikipedia\.org\/wiki\/[[:alnum:]%_\.()-]+\z},
message: 'is not a valid English Wikipedia URL'
},
- if: :approved?
+ if: :approved?
def to_s
name
diff --git a/app/models/csv_importer.rb b/app/models/csv_importer.rb
index d228bb3e1..d3b992aba 100644
--- a/app/models/csv_importer.rb
+++ b/app/models/csv_importer.rb
@@ -11,7 +11,7 @@ class CsvImporter
@crop = Crop.find_or_create_by(name: name)
@crop.update(
en_wikipedia_url: en_wikipedia_url,
- creator_id: cropbot.id
+ creator_id: cropbot.id
)
add_parent(parent_name) if parent_name
diff --git a/app/models/follow.rb b/app/models/follow.rb
index 6562ca92c..a70fd15f6 100644
--- a/app/models/follow.rb
+++ b/app/models/follow.rb
@@ -6,9 +6,9 @@ class Follow < ApplicationRecord
after_create do
Notification.create(
recipient_id: followed_id,
- sender_id: follower_id,
- subject: "#{follower.login_name} is now following you",
- body: "#{follower.login_name} just followed you on #{ENV['GROWSTUFF_SITE_NAME']}. "
+ sender_id: follower_id,
+ subject: "#{follower.login_name} is now following you",
+ body: "#{follower.login_name} just followed you on #{ENV['GROWSTUFF_SITE_NAME']}. "
)
end
end
diff --git a/app/models/garden.rb b/app/models/garden.rb
index 7aee416fc..865c11d6d 100644
--- a/app/models/garden.rb
+++ b/app/models/garden.rb
@@ -32,7 +32,7 @@ class Garden < ApplicationRecord
validates :area,
numericality: { only_integer: false, greater_than_or_equal_to: 0 },
- allow_nil: true
+ allow_nil: true
scope :located, lambda {
where.not(gardens: { location: '' })
@@ -41,12 +41,12 @@ class Garden < ApplicationRecord
}
AREA_UNITS_VALUES = {
"square metres" => "square metre",
- "square feet" => "square foot",
- "hectares" => "hectare",
- "acres" => "acre"
+ "square feet" => "square foot",
+ "hectares" => "hectare",
+ "acres" => "acre"
}.freeze
- validates :area_unit, inclusion: { in: AREA_UNITS_VALUES.values,
- message: "%s is not a valid area unit" },
+ validates :area_unit, inclusion: { in: AREA_UNITS_VALUES.values,
+ message: "%s is not a valid area unit" },
allow_blank: true
after_validation :cleanup_area
diff --git a/app/models/harvest.rb b/app/models/harvest.rb
index 36f61965f..4b40e56c4 100644
--- a/app/models/harvest.rb
+++ b/app/models/harvest.rb
@@ -9,15 +9,15 @@ class Harvest < ApplicationRecord
# Constants
UNITS_VALUES = {
"individual" => "individual",
- "bunches" => "bunch",
- "sprigs" => "sprig",
- "handfuls" => "handful",
- "litres" => "litre",
- "pints" => "pint",
- "quarts" => "quart",
- "buckets" => "bucket",
- "baskets" => "basket",
- "bushels" => "bushel"
+ "bunches" => "bunch",
+ "sprigs" => "sprig",
+ "handfuls" => "handful",
+ "litres" => "litre",
+ "pints" => "pint",
+ "quarts" => "quart",
+ "buckets" => "bucket",
+ "baskets" => "basket",
+ "bushels" => "bushel"
}.freeze
WEIGHT_UNITS_VALUES = {
diff --git a/app/models/member.rb b/app/models/member.rb
index cc86c8b14..2762a6020 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -17,7 +17,7 @@ class Member < ApplicationRecord
has_many :plantings, foreign_key: 'owner_id', dependent: :destroy, inverse_of: :owner
has_many :seeds, foreign_key: 'owner_id', dependent: :destroy, inverse_of: :owner
has_many :harvests, foreign_key: 'owner_id', dependent: :destroy, inverse_of: :owner
- has_and_belongs_to_many :roles # rubocop:disable Rails/HasAndBelongsToMany
+ has_and_belongs_to_many :roles
has_many :notifications, foreign_key: 'recipient_id', inverse_of: :recipient
has_many :sent_notifications, foreign_key: 'sender_id', inverse_of: :sender
has_many :authentications, dependent: :destroy
@@ -76,13 +76,13 @@ class Member < ApplicationRecord
# Requires acceptance of the Terms of Service
validates :tos_agreement, acceptance: { allow_nil: true, accept: true }
validates :login_name,
- length: {
+ length: {
minimum: 2, maximum: 25, message: "should be between 2 and 25 characters long"
},
- exclusion: {
+ exclusion: {
in: %w(growstuff admin moderator staff nearby), message: "name is reserved"
},
- format: {
+ format: {
with: /\A\w+\z/, message: "may only include letters, numbers, or underscores"
},
uniqueness: {
diff --git a/app/models/photo.rb b/app/models/photo.rb
index 1490c33dc..3bdbe2554 100644
--- a/app/models/photo.rb
+++ b/app/models/photo.rb
@@ -13,8 +13,8 @@ class Photo < ApplicationRecord
# creates a relationship for each assignee type
PHOTO_CAPABLE.each do |type|
has_many type.downcase.pluralize.to_s.to_sym,
- through: :photo_associations,
- source: :photographable,
+ through: :photo_associations,
+ source: :photographable,
source_type: type
end
@@ -31,13 +31,13 @@ class Photo < ApplicationRecord
licenses = flickr.photos.licenses.getInfo
license = licenses.find { |l| l.id == info.license }
{
- title: calculate_title(info),
- license_name: license.name,
- license_url: license.url,
+ title: calculate_title(info),
+ license_name: license.name,
+ license_url: license.url,
thumbnail_url: FlickRaw.url_q(info),
- fullsize_url: FlickRaw.url_z(info),
- link_url: FlickRaw.url_photopage(info),
- date_taken: info.dates.taken
+ fullsize_url: FlickRaw.url_z(info),
+ link_url: FlickRaw.url_photopage(info),
+ date_taken: info.dates.taken
}
end
diff --git a/app/models/planting.rb b/app/models/planting.rb
index 5539b6268..716468342 100644
--- a/app/models/planting.rb
+++ b/app/models/planting.rb
@@ -21,14 +21,14 @@ class Planting < ApplicationRecord
#
# Ancestry of food
- belongs_to :parent_seed, class_name: 'Seed', # parent
+ belongs_to :parent_seed, class_name: 'Seed', # parent
foreign_key: 'parent_seed_id',
- optional: true,
- inverse_of: :child_plantings
- has_many :child_seeds, class_name: 'Seed', # children
+ optional: true,
+ inverse_of: :child_plantings
+ has_many :child_seeds, class_name: 'Seed', # children
foreign_key: 'parent_planting_id',
- inverse_of: :parent_planting,
- dependent: :nullify
+ inverse_of: :parent_planting,
+ dependent: :nullify
##
## Scopes
@@ -111,7 +111,7 @@ class Planting < ApplicationRecord
.where(crop: crop)
.located
.where('gardens.latitude < ? AND gardens.latitude > ?',
- latitude + 10, latitude - 10)
+ latitude + 10, latitude - 10)
end
private
diff --git a/app/models/post.rb b/app/models/post.rb
index b2a8b88fd..fd5abb130 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -87,9 +87,9 @@ class Post < ApplicationRecord
Notification.create(
recipient_id: recipient_id,
- sender_id: sender,
- subject: "#{author} mentioned you in their post #{subject}",
- body: body
+ sender_id: sender,
+ subject: "#{author} mentioned you in their post #{subject}",
+ body: body
)
end
end
diff --git a/app/models/role.rb b/app/models/role.rb
index ea17cfb91..cd985d115 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -3,7 +3,7 @@ class Role < ApplicationRecord
friendly_id :name, use: %i(slugged finders)
validates :name, uniqueness: true, presence: true
- has_and_belongs_to_many :members # rubocop:disable Rails/HasAndBelongsToMany
+ has_and_belongs_to_many :members
class << self
%i(crop_wranglers admins).each do |method|
diff --git a/app/models/seed.rb b/app/models/seed.rb
index 32c0ef6a5..cc1cecaa2 100644
--- a/app/models/seed.rb
+++ b/app/models/seed.rb
@@ -23,23 +23,23 @@ class Seed < ApplicationRecord
# Validations
validates :crop, approved: true
validates :crop, presence: { message: "must be present and exist in our database" }
- validates :quantity, allow_nil: true,
+ validates :quantity, allow_nil: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
- validates :days_until_maturity_min, allow_nil: true,
+ validates :days_until_maturity_min, allow_nil: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
- 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 }
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" }
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" }
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" }
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" }
#
diff --git a/app/services/crop_search_service.rb b/app/services/crop_search_service.rb
index be6b2a3de..645505e04 100644
--- a/app/services/crop_search_service.rb
+++ b/app/services/crop_search_service.rb
@@ -2,12 +2,12 @@ class CropSearchService
# Crop.search(string)
def self.search(query, page: 1, per_page: 12, current_member: nil)
search_params = {
- page: page,
- per_page: per_page,
- fields: %i(name^5 alternate_names scientific_names),
- match: :word_start,
- boost_by: [:plantings_count],
- includes: %i(scientific_names alternate_names),
+ page: page,
+ per_page: per_page,
+ fields: %i(name^5 alternate_names scientific_names),
+ match: :word_start,
+ boost_by: [:plantings_count],
+ includes: %i(scientific_names alternate_names),
misspellings: { edit_distance: 2 }
}
# prioritise crops the member has planted
@@ -20,22 +20,22 @@ class CropSearchService
body = {
"query": {
"function_score": {
- "query": { "query_string": { "query": 'has_photos:true' } },
+ "query": { "query_string": { "query": 'has_photos:true' } },
"random_score": { "seed": DateTime.now.to_i }
}
}
}
Crop.search(
limit: limit,
- load: false,
- body: body
+ load: false,
+ body: body
)
end
def self.recent(limit)
Crop.search(
- limit: limit,
- load: false,
+ limit: limit,
+ load: false,
boost_by: { created_at: { factor: 100 } } # default factor is 1
)
end
diff --git a/app/services/openfarm_service.rb b/app/services/openfarm_service.rb
index b9cd243c6..0b408fe63 100644
--- a/app/services/openfarm_service.rb
+++ b/app/services/openfarm_service.rb
@@ -52,14 +52,14 @@ class OpenfarmService
next if Photo.find_by(source_id: picture.fetch('id'), source: 'openfarm')
photo = Photo.new(
- source_id: picture.fetch('id'),
- source: 'openfarm',
- owner: @cropbot,
+ source_id: picture.fetch('id'),
+ source: 'openfarm',
+ owner: @cropbot,
thumbnail_url: data.fetch('thumbnail_url'),
- fullsize_url: data.fetch('image_url'),
- title: 'Open Farm photo',
- license_name: 'No rights reserved',
- link_url: "https://openfarm.cc/en/crops/#{name_to_slug(crop.name)}"
+ fullsize_url: data.fetch('image_url'),
+ title: 'Open Farm photo',
+ license_name: 'No rights reserved',
+ link_url: "https://openfarm.cc/en/crops/#{name_to_slug(crop.name)}"
)
if photo.valid?
Photo.transaction do
diff --git a/config.rb b/config.rb
index e63707f3f..214d25ef0 100644
--- a/config.rb
+++ b/config.rb
@@ -1,5 +1,4 @@
# Require any additional compass plugins here.
-# rubocop:disable Lint/UselessAssignment
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "app/assets/stylesheets"
@@ -21,4 +20,3 @@ images_dir = "app/assets/images"
preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
-# rubocop:enable Lint/UselessAssignment
diff --git a/config/compass.rb b/config/compass.rb
index 028c02792..2b22d5d7c 100644
--- a/config/compass.rb
+++ b/config/compass.rb
@@ -1,4 +1,2 @@
# Require any additional compass plugins here.
-# rubocop:disable Lint/UselessAssignment
project_type = :rails
-# rubocop:enable Lint/UselessAssignment
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 9adee7c27..6ffdc773b 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -57,12 +57,12 @@ Rails.application.configure do
# Use a different cache store in production.
config.cache_store = :mem_cache_store,
(ENV["MEMCACHIER_SERVERS"] || "").split(","),
- { username: ENV["MEMCACHIER_USERNAME"],
- password: ENV["MEMCACHIER_PASSWORD"],
- failover: true,
- socket_timeout: 1.5,
+ { username: ENV["MEMCACHIER_USERNAME"],
+ password: ENV["MEMCACHIER_PASSWORD"],
+ failover: true,
+ socket_timeout: 1.5,
socket_failure_delay: 0.2,
- down_retry_delay: 60 }
+ down_retry_delay: 60 }
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
@@ -90,12 +90,12 @@ Rails.application.configure do
config.action_mailer.default_url_options = { host: ENV['HOST'] }
config.action_mailer.smtp_settings = {
- user_name: ENV['SENDGRID_USERNAME'],
- password: ENV['SENDGRID_PASSWORD'],
- domain: ENV['GROWSTUFF_EMAIL_DOMAIN'],
- address: 'smtp.sendgrid.net',
- port: 587,
- authentication: :plain,
+ user_name: ENV['SENDGRID_USERNAME'],
+ password: ENV['SENDGRID_PASSWORD'],
+ domain: ENV['GROWSTUFF_EMAIL_DOMAIN'],
+ address: 'smtp.sendgrid.net',
+ port: 587,
+ authentication: :plain,
enable_starttls_auto: true
}
ActionMailer::Base.delivery_method = :smtp
diff --git a/config/environments/test.rb b/config/environments/test.rb
index fe03b6e1a..2a0efb6bf 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -59,7 +59,7 @@ Geocoder.configure(lookup: :test)
Geocoder::Lookup::Test.add_stub(
"Amundsen-Scott Base, Antarctica", [
{
- 'latitude' => -90.0,
+ 'latitude' => -90.0,
'longitude' => 0.0
}
]
@@ -68,12 +68,12 @@ Geocoder::Lookup::Test.add_stub(
Geocoder::Lookup::Test.add_stub(
"Philippines", [
{
- 'latitude' => 12.7503486,
- 'longitude' => 122.7312101,
- 'address' => 'Manila, Mnl, Philippines',
- 'state' => 'Manila',
- 'state_code' => 'Mnl',
- 'country' => 'Philippines',
+ 'latitude' => 12.7503486,
+ 'longitude' => 122.7312101,
+ 'address' => 'Manila, Mnl, Philippines',
+ 'state' => 'Manila',
+ 'state_code' => 'Mnl',
+ 'country' => 'Philippines',
'country_code' => 'PH'
}
]
@@ -82,7 +82,7 @@ Geocoder::Lookup::Test.add_stub(
Geocoder::Lookup::Test.add_stub(
"Greenwich, UK", [
{
- 'latitude' => 51.483061,
+ 'latitude' => 51.483061,
'longitude' => -0.004151
}
]
@@ -91,7 +91,7 @@ Geocoder::Lookup::Test.add_stub(
Geocoder::Lookup::Test.add_stub(
"Edinburgh", [
{
- 'latitude' => 55.953252,
+ 'latitude' => 55.953252,
'longitude' => -3.188267
}
]
@@ -107,15 +107,15 @@ end
OmniAuth.config.test_mode = true
# Fake the omniauth
-OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(provider: 'facebook',
- uid: '123545',
- info: {
- name: "John Testerson",
+OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(provider: 'facebook',
+ uid: '123545',
+ info: {
+ name: "John Testerson",
nickname: 'JohnnyT',
- email: 'example.oauth.facebook@example.com',
- image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
+ email: 'example.oauth.facebook@example.com',
+ image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
},
credentials: {
- token: "token",
+ token: "token",
secret: "donttell"
})
diff --git a/config/initializers/comfortable_mexican_sofa.rb b/config/initializers/comfortable_mexican_sofa.rb
index 43630ef0a..dc8148fdc 100644
--- a/config/initializers/comfortable_mexican_sofa.rb
+++ b/config/initializers/comfortable_mexican_sofa.rb
@@ -54,12 +54,9 @@ ComfortableMexicanSofa.configure do |config|
# a previous version using this system. You can control how many revisions per
# object you want to keep. Set it to 0 if you wish to turn this feature off.
# config.revisions_limit = 25
-
- # rubocop:disable Style/AsciiComments
# Locale definitions. If you want to define your own locale merge
# {:locale => 'Locale Title'} with this.
# config.locales = {:en => 'English', :es => 'EspaƱol'}
- # rubocop:enable Style/AsciiComments
# Admin interface will respect the locale of the site being managed. However you can
# force it to English by setting this to `:en`
diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb
index 7b0b683bb..1a2f76e54 100644
--- a/config/initializers/geocoder.rb
+++ b/config/initializers/geocoder.rb
@@ -1,12 +1,12 @@
require 'geocodable'
Geocoder.configure(
- units: :km,
- timeout: 10,
+ units: :km,
+ timeout: 10,
http_headers: {
"User-Agent" =>
"#{Rails.application.config.user_agent} #{Rails.application.config.user_agent_email}",
- "From" => Rails.application.config.user_agent_email
+ "From" => Rails.application.config.user_agent_email
}
)
# This configuration takes precedence over environment/test.rb
diff --git a/config/routes.rb b/config/routes.rb
index e0014ae0d..7efb4d799 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -7,9 +7,9 @@ Rails.application.routes.draw do
resources :plant_parts
devise_for :members, controllers: {
- registrations: "registrations",
- passwords: "passwords",
- sessions: "sessions",
+ registrations: "registrations",
+ passwords: "passwords",
+ sessions: "sessions",
omniauth_callbacks: "omniauth_callbacks"
}
devise_scope :member do
diff --git a/db/migrate/20150201052245_create_cms.rb b/db/migrate/20150201052245_create_cms.rb
index 71ba20b11..4dc1a5d2d 100644
--- a/db/migrate/20150201052245_create_cms.rb
+++ b/db/migrate/20150201052245_create_cms.rb
@@ -103,7 +103,7 @@ class CreateCms < ActiveRecord::Migration[4.2]
t.datetime :created_at
end
add_index :comfy_cms_revisions, %i(record_type record_id created_at),
- name: 'index_cms_revisions_on_rtype_and_rid_and_created_at'
+ name: 'index_cms_revisions_on_rtype_and_rid_and_created_at'
# -- Categories ---------------------------------------------------------
create_table :comfy_cms_categories, force: true do |t|
@@ -112,8 +112,8 @@ class CreateCms < ActiveRecord::Migration[4.2]
t.string :categorized_type, null: false
end
add_index :comfy_cms_categories, %i(site_id categorized_type label),
- unique: true,
- name: 'index_cms_categories_on_site_id_and_cat_type_and_label'
+ unique: true,
+ name: 'index_cms_categories_on_site_id_and_cat_type_and_label'
create_table :comfy_cms_categorizations, force: true do |t|
t.integer :category_id, null: false
@@ -121,8 +121,8 @@ class CreateCms < ActiveRecord::Migration[4.2]
t.integer :categorized_id, null: false
end
add_index :comfy_cms_categorizations, %i(category_id categorized_type categorized_id),
- unique: true,
- name: 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
+ unique: true,
+ name: 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
end
def self.down
diff --git a/db/migrate/20171129041341_create_photographings.rb b/db/migrate/20171129041341_create_photographings.rb
index a0563fa3c..a80245b54 100644
--- a/db/migrate/20171129041341_create_photographings.rb
+++ b/db/migrate/20171129041341_create_photographings.rb
@@ -10,9 +10,9 @@ class CreatePhotographings < ActiveRecord::Migration[4.2]
add_foreign_key :photographings, :photos
add_index :photographings, %i(photographable_id photographable_type photo_id),
- unique: true, name: 'items_to_photos_idx'
+ unique: true, name: 'items_to_photos_idx'
add_index :photographings, %i(photographable_id photographable_type),
- name: 'photographable_idx'
+ name: 'photographable_idx'
migrate_data
end
diff --git a/db/migrate/20180213005731_seed_usage.rb b/db/migrate/20180213005731_seed_usage.rb
index 0e1332ab3..8f7112e47 100644
--- a/db/migrate/20180213005731_seed_usage.rb
+++ b/db/migrate/20180213005731_seed_usage.rb
@@ -7,16 +7,16 @@ class SeedUsage < ActiveRecord::Migration[4.2]
# plantings can be grown from a seed
add_column(:plantings, :parent_seed_id, :integer)
add_foreign_key(:plantings, :seeds,
- column: :parent_seed_id,
- primary_key: :id,
- name: :parent_seed,
- on_delete: :nullify)
+ column: :parent_seed_id,
+ primary_key: :id,
+ name: :parent_seed,
+ on_delete: :nullify)
# seeds can be harvest from planting
add_column(:seeds, :parent_planting_id, :integer)
add_foreign_key(:seeds, :plantings,
- column: :parent_planting_id,
- primary_key: :id,
- name: :parent_planting,
- on_delete: :nullify)
+ column: :parent_planting_id,
+ primary_key: :id,
+ name: :parent_planting,
+ on_delete: :nullify)
end
end
diff --git a/db/migrate/20190720000555_create_mailboxer.mailboxer_engine.rb b/db/migrate/20190720000555_create_mailboxer.mailboxer_engine.rb
index ff7eaea51..943d04e89 100644
--- a/db/migrate/20190720000555_create_mailboxer.mailboxer_engine.rb
+++ b/db/migrate/20190720000555_create_mailboxer.mailboxer_engine.rb
@@ -45,10 +45,10 @@ class CreateMailboxer < ActiveRecord::Migration[4.2]
# Conversations
# Receipts
add_foreign_key "mailboxer_receipts", "mailboxer_notifications",
- name: "receipts_on_notification_id", column: "notification_id"
+ name: "receipts_on_notification_id", column: "notification_id"
# Messages
add_foreign_key "mailboxer_notifications", "mailboxer_conversations",
- name: "notifications_on_conversation_id", column: "conversation_id"
+ name: "notifications_on_conversation_id", column: "conversation_id"
end
def self.down
diff --git a/db/migrate/20190720000556_add_conversation_optout.mailboxer_engine.rb b/db/migrate/20190720000556_add_conversation_optout.mailboxer_engine.rb
index 19190febd..50eeeed02 100644
--- a/db/migrate/20190720000556_add_conversation_optout.mailboxer_engine.rb
+++ b/db/migrate/20190720000556_add_conversation_optout.mailboxer_engine.rb
@@ -7,7 +7,7 @@ class AddConversationOptout < ActiveRecord::Migration[4.2]
t.timestamps null: false
end
add_foreign_key "mailboxer_conversation_opt_outs", "mailboxer_conversations",
- name: "mb_opt_outs_on_conversations_id", column: "conversation_id"
+ name: "mb_opt_outs_on_conversations_id", column: "conversation_id"
end
def self.down
diff --git a/db/migrate/20190720000557_add_missing_indices.mailboxer_engine.rb b/db/migrate/20190720000557_add_missing_indices.mailboxer_engine.rb
index b079f4a3d..87c154832 100644
--- a/db/migrate/20190720000557_add_missing_indices.mailboxer_engine.rb
+++ b/db/migrate/20190720000557_add_missing_indices.mailboxer_engine.rb
@@ -4,7 +4,7 @@ class AddMissingIndices < ActiveRecord::Migration[4.2]
# We'll explicitly specify its name, as the auto-generated name is too long and exceeds 63
# characters limitation.
add_index :mailboxer_conversation_opt_outs, %i(unsubscriber_id unsubscriber_type),
- name: 'index_mailboxer_conversation_opt_outs_on_unsubscriber_id_type'
+ name: 'index_mailboxer_conversation_opt_outs_on_unsubscriber_id_type'
add_index :mailboxer_conversation_opt_outs, :conversation_id
add_index :mailboxer_notifications, :type
@@ -13,7 +13,7 @@ class AddMissingIndices < ActiveRecord::Migration[4.2]
# We'll explicitly specify its name, as the auto-generated name is too long and exceeds 63
# characters limitation.
add_index :mailboxer_notifications, %i(notified_object_id notified_object_type),
- name: 'index_mailboxer_notifications_on_notified_object_id_and_type'
+ name: 'index_mailboxer_notifications_on_notified_object_id_and_type'
add_index :mailboxer_receipts, %i(receiver_id receiver_type)
end
diff --git a/db/seeds.rb b/db/seeds.rb
index e3bc51088..ed57b6b7e 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -57,9 +57,9 @@ def load_test_users # rubocop:disable Metrics/AbcSize
(1..member_size).each do |i|
@user = Member.new(
- login_name: "test#{i}",
- email: "test#{i}@example.com",
- password: "password#{i}",
+ login_name: "test#{i}",
+ email: "test#{i}@example.com",
+ password: "password#{i}",
tos_agreement: true
)
@user.skip_confirmation!
@@ -79,11 +79,11 @@ def load_test_users # rubocop:disable Metrics/AbcSize
# Create a planting by the member
Planting.create(
- owner_id: @user.id,
- garden_id: @user.gardens.first.id,
- planted_at: Time.zone.today,
- crop_id: Crop.find(i % Crop.all.size + 1).id,
- sunniness: select_random_item(Planting::SUNNINESS_VALUES),
+ owner_id: @user.id,
+ garden_id: @user.gardens.first.id,
+ planted_at: Time.zone.today,
+ crop_id: Crop.find(i % Crop.all.size + 1).id,
+ sunniness: select_random_item(Planting::SUNNINESS_VALUES),
planted_from: select_random_item(Planting::PLANTED_FROM_VALUES)
)
end
@@ -94,9 +94,9 @@ end
def load_admin_users
puts "Adding admin and crop wrangler members..."
@admin_user = Member.new(
- login_name: "admin1",
- email: "admin1@example.com",
- password: "password1",
+ login_name: "admin1",
+ email: "admin1@example.com",
+ password: "password1",
tos_agreement: true
)
@admin_user.skip_confirmation!
@@ -104,9 +104,9 @@ def load_admin_users
@admin_user.save!
@wrangler_user = Member.new(
- login_name: "wrangler1",
- email: "wrangler1@example.com",
- password: "password1",
+ login_name: "wrangler1",
+ email: "wrangler1@example.com",
+ password: "password1",
tos_agreement: true
)
@wrangler_user.skip_confirmation!
@@ -118,9 +118,9 @@ def create_cropbot
return if Member.find_by(login_name: 'cropbot')
@cropbot_user = Member.new(
- login_name: "cropbot",
- email: Rails.application.config.bot_email,
- password: SecureRandom.urlsafe_base64(64),
+ login_name: "cropbot",
+ email: Rails.application.config.bot_email,
+ password: SecureRandom.urlsafe_base64(64),
tos_agreement: true
)
@cropbot_user.skip_confirmation!
diff --git a/lib/actions/oauth_signup_action.rb b/lib/actions/oauth_signup_action.rb
index 3d80cee25..de274dc35 100644
--- a/lib/actions/oauth_signup_action.rb
+++ b/lib/actions/oauth_signup_action.rb
@@ -41,14 +41,14 @@ class Growstuff::OauthSignupAction
authentication = member.authentications
.create_with(
- name: name,
- token: auth['credentials']['token'],
+ name: name,
+ token: auth['credentials']['token'],
secret: auth['credentials']['secret']
)
.find_or_create_by(
- provider: auth['provider'],
- uid: auth['uid'],
- name: name,
+ provider: auth['provider'],
+ uid: auth['uid'],
+ name: name,
member_id: member.id
)
diff --git a/lib/haml/filters/growstuff_markdown.rb b/lib/haml/filters/growstuff_markdown.rb
index 0a7c34000..52dff7098 100644
--- a/lib/haml/filters/growstuff_markdown.rb
+++ b/lib/haml/filters/growstuff_markdown.rb
@@ -1,6 +1,6 @@
require 'bluecloth'
-module Haml::Filters # rubocop:disable Style/ClassAndModuleChildren
+module Haml::Filters
module GrowstuffMarkdown
include Haml::Filters::Base
diff --git a/lib/tasks/hooks.rake b/lib/tasks/hooks.rake
index 7543404b2..67cc41cba 100644
--- a/lib/tasks/hooks.rake
+++ b/lib/tasks/hooks.rake
@@ -1,5 +1,5 @@
desc "Install git hooks"
task :hooks do
FileUtils.symlink '../../script/pre-commit.sh', '.git/hooks/pre-commit',
- force: true
+ force: true
end
diff --git a/spec/controllers/api/v1/plantings_controller_spec.rb b/spec/controllers/api/v1/plantings_controller_spec.rb
index b807c724e..4ede14391 100644
--- a/spec/controllers/api/v1/plantings_controller_spec.rb
+++ b/spec/controllers/api/v1/plantings_controller_spec.rb
@@ -15,25 +15,25 @@ RSpec.describe Api::V1::PlantingsController, type: :controller do
let!(:my_planting) { FactoryBot.create(:planting, owner: member, planted_at: '2000-01-01') }
let(:expected_attributes) do
{
- 'crop-name' => my_planting.crop.name,
- 'crop-slug' => my_planting.crop.slug,
- 'description' => my_planting.description,
- 'expected-lifespan' => nil,
+ 'crop-name' => my_planting.crop.name,
+ 'crop-slug' => my_planting.crop.slug,
+ 'description' => my_planting.description,
+ 'expected-lifespan' => nil,
'finish-predicted-at' => nil,
- 'finished' => my_planting.finished,
- 'finished-at' => my_planting.finished_at,
- 'first-harvest-date' => nil,
- 'last-harvest-date' => nil,
- 'latitude' => my_planting.garden.latitude,
- 'longitude' => my_planting.garden.longitude,
- 'location' => my_planting.garden.location,
- 'percentage-grown' => nil,
- 'planted-at' => '2000-01-01',
- 'planted-from' => my_planting.planted_from,
- 'quantity' => my_planting.quantity,
- 'slug' => my_planting.slug,
- 'sunniness' => nil,
- 'thumbnail' => nil
+ 'finished' => my_planting.finished,
+ 'finished-at' => my_planting.finished_at,
+ 'first-harvest-date' => nil,
+ 'last-harvest-date' => nil,
+ 'latitude' => my_planting.garden.latitude,
+ 'longitude' => my_planting.garden.longitude,
+ 'location' => my_planting.garden.location,
+ 'percentage-grown' => nil,
+ 'planted-at' => '2000-01-01',
+ 'planted-from' => my_planting.planted_from,
+ 'quantity' => my_planting.quantity,
+ 'slug' => my_planting.slug,
+ 'sunniness' => nil,
+ 'thumbnail' => nil
}
end
@@ -49,25 +49,25 @@ RSpec.describe Api::V1::PlantingsController, type: :controller do
let(:expected_attributes) do
{
- 'crop-name' => my_planting.crop.name,
- 'crop-slug' => my_planting.crop.slug,
- 'description' => my_planting.description,
- 'expected-lifespan' => nil,
+ 'crop-name' => my_planting.crop.name,
+ 'crop-slug' => my_planting.crop.slug,
+ 'description' => my_planting.description,
+ 'expected-lifespan' => nil,
'finish-predicted-at' => nil,
- 'finished' => my_planting.finished,
- 'finished-at' => my_planting.finished_at,
- 'first-harvest-date' => nil,
- 'last-harvest-date' => nil,
- 'latitude' => my_planting.garden.latitude,
- 'longitude' => my_planting.garden.longitude,
- 'location' => my_planting.garden.location,
- 'percentage-grown' => nil,
- 'planted-at' => '2000-01-01',
- 'planted-from' => my_planting.planted_from,
- 'quantity' => my_planting.quantity,
- 'slug' => my_planting.slug,
- 'sunniness' => nil,
- 'thumbnail' => photo.thumbnail_url
+ 'finished' => my_planting.finished,
+ 'finished-at' => my_planting.finished_at,
+ 'first-harvest-date' => nil,
+ 'last-harvest-date' => nil,
+ 'latitude' => my_planting.garden.latitude,
+ 'longitude' => my_planting.garden.longitude,
+ 'location' => my_planting.garden.location,
+ 'percentage-grown' => nil,
+ 'planted-at' => '2000-01-01',
+ 'planted-from' => my_planting.planted_from,
+ 'quantity' => my_planting.quantity,
+ 'slug' => my_planting.slug,
+ 'sunniness' => nil,
+ 'thumbnail' => photo.thumbnail_url
}
end
let(:photo) { FactoryBot.create(:photo, owner: my_planting.owner) }
diff --git a/spec/controllers/authentications_controller_spec.rb b/spec/controllers/authentications_controller_spec.rb
index 7da3d0501..372d44c42 100644
--- a/spec/controllers/authentications_controller_spec.rb
+++ b/spec/controllers/authentications_controller_spec.rb
@@ -7,9 +7,9 @@ describe AuthenticationsController do
controller.stub(:current_member) { @member }
@auth = FactoryBot.create(:authentication, member: @member)
request.env['omniauth.auth'] = {
- 'provider' => 'foo',
- 'uid' => 'bar',
- 'info' => { 'nickname' => 'blah' },
+ 'provider' => 'foo',
+ 'uid' => 'bar',
+ 'info' => { 'nickname' => 'blah' },
'credentials' => { 'token' => 'blah', 'secret' => 'blah' }
}
end
diff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rb
index aeca681c1..5c59473cb 100644
--- a/spec/controllers/forums_controller_spec.rb
+++ b/spec/controllers/forums_controller_spec.rb
@@ -5,9 +5,9 @@ describe ForumsController do
def valid_attributes
{
- "name" => "MyString",
+ "name" => "MyString",
"description" => "Something",
- "owner_id" => 1
+ "owner_id" => 1
}
end
diff --git a/spec/controllers/harvests_controller_spec.rb b/spec/controllers/harvests_controller_spec.rb
index e45f2c4c2..b77eb9b57 100644
--- a/spec/controllers/harvests_controller_spec.rb
+++ b/spec/controllers/harvests_controller_spec.rb
@@ -5,10 +5,10 @@ describe HarvestsController do
def valid_attributes
{
- owner_id: subject.current_member.id,
- crop_id: FactoryBot.create(:crop).id,
+ owner_id: subject.current_member.id,
+ crop_id: FactoryBot.create(:crop).id,
plant_part_id: FactoryBot.create(:plant_part).id,
- harvested_at: '2017-01-01'
+ harvested_at: '2017-01-01'
}
end
@@ -187,7 +187,7 @@ describe HarvestsController do
describe "does not save planting_id" do
before do
- put :update, params: { id: harvest.to_param,
+ put :update, params: { id: harvest.to_param,
harvest: valid_attributes.merge(planting_id: not_my_planting.id) }
end
diff --git a/spec/controllers/photo_associations_controller_spec.rb b/spec/controllers/photo_associations_controller_spec.rb
index 9cfe11a96..21ed0aa29 100644
--- a/spec/controllers/photo_associations_controller_spec.rb
+++ b/spec/controllers/photo_associations_controller_spec.rb
@@ -6,8 +6,8 @@ describe PhotoAssociationsController do
describe "destroy" do
let(:valid_params) do
{
- id: harvest.id,
- type: 'harvest',
+ id: harvest.id,
+ type: 'harvest',
photo_id: photo.id
}
end
diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb
index 7a0e08c7c..4cf8140bd 100644
--- a/spec/controllers/photos_controller_spec.rb
+++ b/spec/controllers/photos_controller_spec.rb
@@ -71,12 +71,12 @@ describe PhotosController do
describe "POST create" do
before do
- Photo.any_instance.stub(:flickr_metadata).and_return(title: "A Heartbreaking work of staggering genius",
- license_name: "CC-BY",
- license_url: "http://example.com/aybpl",
+ Photo.any_instance.stub(:flickr_metadata).and_return(title: "A Heartbreaking work of staggering genius",
+ license_name: "CC-BY",
+ license_url: "http://example.com/aybpl",
thumbnail_url: "http://example.com/thumb.jpg",
- fullsize_url: "http://example.com/full.jpg",
- link_url: "http://example.com")
+ fullsize_url: "http://example.com/full.jpg",
+ link_url: "http://example.com")
end
let(:member) { FactoryBot.create(:member) }
diff --git a/spec/controllers/plantings_controller_spec.rb b/spec/controllers/plantings_controller_spec.rb
index 4562be128..c055d7768 100644
--- a/spec/controllers/plantings_controller_spec.rb
+++ b/spec/controllers/plantings_controller_spec.rb
@@ -6,7 +6,7 @@ describe PlantingsController do
def valid_attributes
{
garden_id: FactoryBot.create(:garden, owner: subject.current_member).id,
- crop_id: FactoryBot.create(:crop).id
+ crop_id: FactoryBot.create(:crop).id
}
end
diff --git a/spec/features/crops/crop_detail_page_spec.rb b/spec/features/crops/crop_detail_page_spec.rb
index c06a03de0..cec0579ac 100644
--- a/spec/features/crops/crop_detail_page_spec.rb
+++ b/spec/features/crops/crop_detail_page_spec.rb
@@ -123,8 +123,8 @@ describe "crop detail page", js: true do
context 'predictions' do
let!(:planting) do
- FactoryBot.create(:planting, crop: crop,
- planted_at: 100.days.ago,
+ FactoryBot.create(:planting, crop: crop,
+ planted_at: 100.days.ago,
finished_at: 1.day.ago)
end
diff --git a/spec/features/crops/scientific_name_spec.rb b/spec/features/crops/scientific_name_spec.rb
index 56616b81b..63fad9ee1 100644
--- a/spec/features/crops/scientific_name_spec.rb
+++ b/spec/features/crops/scientific_name_spec.rb
@@ -40,7 +40,7 @@ describe "Scientific names", js: true do
visit crop_path(zea_mays.crop)
click_link zea_mays.name
expect(page).to have_link "Delete",
- href: scientific_name_path(zea_mays)
+ href: scientific_name_path(zea_mays)
within('.scientific_names') do
accept_confirm do
click_link 'Delete'
@@ -54,7 +54,7 @@ describe "Scientific names", js: true do
it "Crop wranglers can add scientific names" do
visit crop_path(crop)
expect(page).to have_link "Add",
- href: new_scientific_name_path(crop_id: crop.id)
+ href: new_scientific_name_path(crop_id: crop.id)
within('.scientific_names') { click_on "Add" }
# expect(page.status_code).to equal 200
expect(page).to have_css "option[value='#{crop.id}'][selected=selected]"
@@ -69,7 +69,7 @@ describe "Scientific names", js: true do
visit scientific_name_path(zea_mays)
# expect(page.status_code).to equal 200
expect(page).to have_link zea_mays.crop.name,
- href: crop_path(zea_mays.crop)
+ href: crop_path(zea_mays.crop)
end
context "When scientific name is pending" do
diff --git a/spec/features/gardens/index_spec.rb b/spec/features/gardens/index_spec.rb
index ba3d137d2..b5eb5d3dc 100644
--- a/spec/features/gardens/index_spec.rb
+++ b/spec/features/gardens/index_spec.rb
@@ -77,12 +77,12 @@ describe "Gardens#index", :js do
# time to harvest = 50 day
# time to finished = 90 days
FactoryBot.create(:harvest,
- harvested_at: 50.days.ago,
- crop: crop,
- planting: FactoryBot.create(:planting,
- crop: crop,
- planted_at: 100.days.ago,
- finished_at: 10.days.ago))
+ harvested_at: 50.days.ago,
+ crop: crop,
+ planting: FactoryBot.create(:planting,
+ crop: crop,
+ planted_at: 100.days.ago,
+ finished_at: 10.days.ago))
crop.plantings.each(&:update_harvest_days!)
crop.update_lifespan_medians
crop.update_harvest_medians
@@ -95,10 +95,10 @@ describe "Gardens#index", :js do
describe 'harvest still growing' do
let!(:planting) do
FactoryBot.create :planting,
- crop: crop,
- owner: member,
- garden: garden,
- planted_at: Time.zone.today
+ crop: crop,
+ owner: member,
+ garden: garden,
+ planted_at: Time.zone.today
end
it { expect(page).to have_link href: planting_path(planting) }
@@ -110,9 +110,9 @@ describe "Gardens#index", :js do
describe 'harvesting now' do
let!(:planting) do
FactoryBot.create :planting,
- crop: crop,
- owner: member, garden: garden,
- planted_at: 51.days.ago
+ crop: crop,
+ owner: member, garden: garden,
+ planted_at: 51.days.ago
end
it { expect(crop.median_days_to_first_harvest).to eq 50 }
@@ -125,8 +125,8 @@ describe "Gardens#index", :js do
describe 'super late' do
let!(:planting) do
FactoryBot.create :planting,
- crop: crop, owner: member,
- garden: garden, planted_at: 260.days.ago
+ crop: crop, owner: member,
+ garden: garden, planted_at: 260.days.ago
end
it { expect(page).to have_text 'super late' }
diff --git a/spec/features/percy/percy_spec.rb b/spec/features/percy/percy_spec.rb
index 5cf9973a4..05efb57ff 100644
--- a/spec/features/percy/percy_spec.rb
+++ b/spec/features/percy/percy_spec.rb
@@ -19,9 +19,9 @@ describe 'Test with visual testing', type: :feature, js: true do
let(:tomato_photo) do
FactoryBot.create :photo,
- title: 'look at my tomatoes',
- owner: member,
- fullsize_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_z.jpg',
+ title: 'look at my tomatoes',
+ owner: member,
+ fullsize_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_z.jpg',
thumbnail_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_q.jpg'
end
let(:post_body) do
@@ -69,26 +69,26 @@ rest of the garden.
Timecop.freeze(Time.zone.local(2019, 1, 1))
{
- chard: 'https://farm9.staticflickr.com/8516/8519911893_1759c28965_q.jpg',
- apple: 'https://farm5.staticflickr.com/4748/38932178855_6fe9bcdb48_q.jpg',
- pear: 'https://farm1.staticflickr.com/113/250984726_0fc31fea6d_q.jpg',
- popcorn: 'https://farm8.staticflickr.com/7893/33150160528_24a689c6bc_q.jpg',
+ chard: 'https://farm9.staticflickr.com/8516/8519911893_1759c28965_q.jpg',
+ apple: 'https://farm5.staticflickr.com/4748/38932178855_6fe9bcdb48_q.jpg',
+ pear: 'https://farm1.staticflickr.com/113/250984726_0fc31fea6d_q.jpg',
+ popcorn: 'https://farm8.staticflickr.com/7893/33150160528_24a689c6bc_q.jpg',
eggplant: 'https://farm8.staticflickr.com/7856/47068736892_1af9b8a4ba_q.jpg',
- maize: 'https://farm66.staticflickr.com/65535/46739264475_7cb55b2cbb_q.jpg'
+ maize: 'https://farm66.staticflickr.com/65535/46739264475_7cb55b2cbb_q.jpg'
}.each do |crop_type, photo_url|
crop = FactoryBot.create crop_type, creator: someone_else
crop.reindex
owner = FactoryBot.create :interesting_member, login_name: crop_type.to_s.reverse, email: "#{crop.name}@example.com"
planting = FactoryBot.create :planting, crop: crop, owner: owner, garden: owner.gardens.first
photo = FactoryBot.create(:photo, owner: owner,
- thumbnail_url: "#{photo_url}_q.jpg", fullsize_url: "#{photo_url}_z.jpg")
+ thumbnail_url: "#{photo_url}_q.jpg", fullsize_url: "#{photo_url}_z.jpg")
planting.photos << photo
harvest = FactoryBot.create :harvest, crop: crop, owner: owner, plant_part: plant_part
harvest.photos << photo
FactoryBot.create :planting, crop: tomato,
- planted_at: 1.year.ago, finished_at: 2.months.ago,
- sunniness: 'sun', planted_from: 'seed'
+ planted_at: 1.year.ago, finished_at: 2.months.ago,
+ sunniness: 'sun', planted_from: 'seed'
end
FactoryBot.create :seed, owner: member, tradable_to: 'nationally'
@@ -110,9 +110,9 @@ rest of the garden.
planting = FactoryBot.create :planting, planted_at: 1.year.ago, sunniness: 'sun', planted_from: 'seed', crop: tomato
FactoryBot.create(:harvest,
- crop: tomato,
- plant_part: FactoryBot.create(:plant_part, name: 'berry'),
- planting: planting,
+ crop: tomato,
+ plant_part: FactoryBot.create(:plant_part, name: 'berry'),
+ planting: planting,
harvested_at: 1.day.ago)
post = FactoryBot.create :post, subject: 'tomatoes are delicious'
@@ -153,7 +153,7 @@ rest of the garden.
# with some lettuce (finished)
FactoryBot.create(
:planting, crop: FactoryBot.create(:crop, name: 'lettuce'),
- garden: garden, owner: member, finished_at: 2.weeks.ago
+ garden: garden, owner: member, finished_at: 2.weeks.ago
)
# tomato still growing
tomato_planting = FactoryBot.create :planting, garden: garden, owner: member, crop: tomato
diff --git a/spec/features/photos/show_photo_spec.rb b/spec/features/photos/show_photo_spec.rb
index f7b101c48..68bf8ea88 100644
--- a/spec/features/photos/show_photo_spec.rb
+++ b/spec/features/photos/show_photo_spec.rb
@@ -15,7 +15,7 @@ describe "show photo page" do
it {
expect(page).to have_link "#{planting.crop.name} planting in #{planting.garden.name} by #{planting.owner}",
- href: planting_path(planting)
+ href: planting_path(planting)
}
it { expect(page).to have_link planting.crop.name }
end
diff --git a/spec/features/plantings/prediction_spec.rb b/spec/features/plantings/prediction_spec.rb
index 5f3020a08..1efa4ac54 100644
--- a/spec/features/plantings/prediction_spec.rb
+++ b/spec/features/plantings/prediction_spec.rb
@@ -33,21 +33,21 @@ describe "Display a planting", :js do
# Near by planting with harvests
nearby_garden = FactoryBot.create :garden, location: 'Greenwich, UK'
nearby_planting = FactoryBot.create :planting, crop: crop,
- garden: nearby_garden, owner: nearby_garden.owner, planted_at: '1 January 2000'
+ garden: nearby_garden, owner: nearby_garden.owner, planted_at: '1 January 2000'
FactoryBot.create :harvest, planting: nearby_planting, crop: crop,
- harvested_at: '1 May 2019'
+ harvested_at: '1 May 2019'
FactoryBot.create :harvest, planting: nearby_planting, crop: crop,
- harvested_at: '18 June 2019'
+ harvested_at: '18 June 2019'
FactoryBot.create_list :harvest, 4, planting: nearby_planting, crop: crop,
- harvested_at: '18 August 2008'
+ harvested_at: '18 August 2008'
# far away planting harvests
faraway_garden = FactoryBot.create :garden, location: 'Amundsen-Scott Base, Antarctica'
faraway_planting = FactoryBot.create :planting, garden: faraway_garden, crop: crop,
- owner: faraway_garden.owner, planted_at: '16 May 2001'
+ owner: faraway_garden.owner, planted_at: '16 May 2001'
FactoryBot.create_list :harvest, 4, planting: faraway_planting, crop: crop,
- harvested_at: '18 December 2006'
+ harvested_at: '18 December 2006'
end
before { visit planting_path(planting) }
it { expect(page.find("#month-1")[:class]).not_to include("badge-harvesting") }
diff --git a/spec/helpers/gardens_helper_spec.rb b/spec/helpers/gardens_helper_spec.rb
index c22b51b79..57db618bd 100644
--- a/spec/helpers/gardens_helper_spec.rb
+++ b/spec/helpers/gardens_helper_spec.rb
@@ -4,28 +4,28 @@ describe GardensHelper do
describe "garden description" do
it "is missing" do
garden = FactoryBot.create(:garden,
- description: nil)
+ description: nil)
result = helper.display_garden_description(garden)
expect(result).to eq "no description provided."
end
it "is less than 130 characters long" do
garden = FactoryBot.create(:garden,
- description: 'a' * 20)
+ description: 'a' * 20)
result = helper.display_garden_description(garden)
expect(result).to eq 'a' * 20
end
it "is 130 characters long" do
garden = FactoryBot.create(:garden,
- description: 'a' * 130)
+ description: 'a' * 130)
result = helper.display_garden_description(garden)
expect(result).to eq 'a' * 130
end
it "is more than 130 characters long" do
garden = FactoryBot.create(:garden,
- description: 'a' * 140)
+ description: 'a' * 140)
result = helper.display_garden_description(garden)
expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", garden_path(garden))
end
diff --git a/spec/helpers/harvests_helper_spec.rb b/spec/helpers/harvests_helper_spec.rb
index d720f1318..4286c326a 100644
--- a/spec/helpers/harvests_helper_spec.rb
+++ b/spec/helpers/harvests_helper_spec.rb
@@ -4,65 +4,65 @@ describe HarvestsHelper do
describe "display_quantity" do
it "blank" do
harvest = FactoryBot.create(:harvest,
- quantity: nil,
- weight_quantity: nil)
+ quantity: nil,
+ weight_quantity: nil)
result = helper.display_quantity(harvest)
result.should eq 'not specified'
end
it '3 individual' do
harvest = FactoryBot.create(:harvest,
- quantity: 3,
- unit: 'individual',
- weight_quantity: nil)
+ quantity: 3,
+ unit: 'individual',
+ weight_quantity: nil)
result = helper.display_quantity(harvest)
result.should eq '3'
end
it '1 bunch' do
harvest = FactoryBot.create(:harvest,
- quantity: 1,
- unit: 'bunch',
- weight_quantity: nil)
+ quantity: 1,
+ unit: 'bunch',
+ weight_quantity: nil)
result = helper.display_quantity(harvest)
result.should eq '1 bunch'
end
it '3 bunches' do
harvest = FactoryBot.create(:harvest,
- quantity: 3,
- unit: 'bunch',
- weight_quantity: nil)
+ quantity: 3,
+ unit: 'bunch',
+ weight_quantity: nil)
result = helper.display_quantity(harvest)
result.should eq '3 bunches'
end
it '3 kg' do
harvest = FactoryBot.create(:harvest,
- quantity: nil,
- unit: nil,
- weight_quantity: 3,
- weight_unit: 'kg')
+ quantity: nil,
+ unit: nil,
+ weight_quantity: 3,
+ weight_unit: 'kg')
result = helper.display_quantity(harvest)
result.should eq '3 kg'
end
it '3 individual weighing 3 kg' do
harvest = FactoryBot.create(:harvest,
- quantity: 3,
- unit: 'individual',
- weight_quantity: 3,
- weight_unit: 'kg')
+ quantity: 3,
+ unit: 'individual',
+ weight_quantity: 3,
+ weight_unit: 'kg')
result = helper.display_quantity(harvest)
result.should eq '3, weighing 3 kg'
end
it '3 bunches weighing 3 kg' do
harvest = FactoryBot.create(:harvest,
- quantity: 3,
- unit: 'bunch',
- weight_quantity: 3,
- weight_unit: 'kg')
+ quantity: 3,
+ unit: 'bunch',
+ weight_quantity: 3,
+ weight_unit: 'kg')
result = helper.display_quantity(harvest)
result.should eq '3 bunches, weighing 3 kg'
end
diff --git a/spec/helpers/plantings_helper_spec.rb b/spec/helpers/plantings_helper_spec.rb
index af69f9c49..d28ed90d4 100644
--- a/spec/helpers/plantings_helper_spec.rb
+++ b/spec/helpers/plantings_helper_spec.rb
@@ -6,18 +6,18 @@ describe PlantingsHelper do
it "does not have a quantity nor a planted from value provided" do
planting = FactoryBot.build(:planting,
- quantity: nil,
- planted_from: '',
- owner: member)
+ quantity: nil,
+ planted_from: '',
+ owner: member)
result = helper.display_planting(planting)
expect(result).to eq "crop_lady planted magic bean."
end
it "does not have a quantity provided" do
planting = FactoryBot.build(:planting,
- quantity: nil,
- planted_from: 'seed',
- owner: member)
+ quantity: nil,
+ planted_from: 'seed',
+ owner: member)
result = helper.display_planting(planting)
expect(result).to eq "crop_lady planted seeds."
end
@@ -25,18 +25,18 @@ describe PlantingsHelper do
context "when quantity is greater than 1" do
it "does not have a planted from value provided" do
planting = FactoryBot.build(:planting,
- quantity: 10,
- planted_from: '',
- owner: member)
+ quantity: 10,
+ planted_from: '',
+ owner: member)
result = helper.display_planting(planting)
expect(result).to eq "crop_lady planted 10 units."
end
it "does have a planted from value provided" do
planting = FactoryBot.build(:planting,
- quantity: 5,
- planted_from: 'seed',
- owner: member)
+ quantity: 5,
+ planted_from: 'seed',
+ owner: member)
result = helper.display_planting(planting)
expect(result).to eq "crop_lady planted 5 seeds."
end
@@ -45,18 +45,18 @@ describe PlantingsHelper do
context "when quantity is 1" do
it "does not have a planted from value provided" do
planting = FactoryBot.build(:planting,
- quantity: 1,
- planted_from: '',
- owner: member)
+ quantity: 1,
+ planted_from: '',
+ owner: member)
result = helper.display_planting(planting)
expect(result).to eq "crop_lady planted 1 unit."
end
it "does have a planted from value provided" do
planting = FactoryBot.build(:planting,
- quantity: 1,
- planted_from: 'seed',
- owner: member)
+ quantity: 1,
+ planted_from: 'seed',
+ owner: member)
result = helper.display_planting(planting)
expect(result).to eq "crop_lady planted 1 seed."
end
diff --git a/spec/helpers/seeds_helper_spec.rb b/spec/helpers/seeds_helper_spec.rb
index fd9887cb4..7fa751321 100644
--- a/spec/helpers/seeds_helper_spec.rb
+++ b/spec/helpers/seeds_helper_spec.rb
@@ -4,28 +4,28 @@ describe SeedsHelper do
describe "seed description" do
it "is missing" do
seed = FactoryBot.create(:seed,
- description: nil)
+ description: nil)
result = helper.display_seed_description(seed)
expect(result).to eq ""
end
it "is less than 130 characters long" do
seed = FactoryBot.create(:seed,
- description: 'a' * 20)
+ description: 'a' * 20)
result = helper.display_seed_description(seed)
expect(result).to eq 'a' * 20
end
it "is 130 characters long" do
seed = FactoryBot.create(:seed,
- description: 'a' * 130)
+ description: 'a' * 130)
result = helper.display_seed_description(seed)
expect(result).to eq 'a' * 130
end
it "is more than 130 characters long" do
seed = FactoryBot.create(:seed,
- description: 'a' * 140)
+ description: 'a' * 140)
result = helper.display_seed_description(seed)
expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", seed_path(seed))
end
diff --git a/spec/lib/actions/oauth_signup_action_spec.rb b/spec/lib/actions/oauth_signup_action_spec.rb
index c6006e7c4..dd8310d04 100644
--- a/spec/lib/actions/oauth_signup_action_spec.rb
+++ b/spec/lib/actions/oauth_signup_action_spec.rb
@@ -8,16 +8,16 @@ describe 'Growstuff::OauthSignupAction' do
context 'with a valid authentication' do
before do
- @auth = OmniAuth::AuthHash.new('provider' => 'facebook',
- 'uid' => '123545',
- 'info' => {
- 'name' => "John Testerson's Brother",
+ @auth = OmniAuth::AuthHash.new('provider' => 'facebook',
+ 'uid' => '123545',
+ 'info' => {
+ 'name' => "John Testerson's Brother",
'nickname' => 'JohnnyB',
- 'email' => 'example.oauth.facebook@example.com',
- 'image' => 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
+ 'email' => 'example.oauth.facebook@example.com',
+ 'image' => 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
},
'credentials' => {
- 'token' => "token",
+ 'token' => "token",
'secret' => "donttell"
})
end
@@ -74,8 +74,8 @@ describe 'Growstuff::OauthSignupAction' do
@auth['info']['email'] = 'never.used.oauth@yahoo.com'
Member.where(email: @auth['info']['email']).delete_all
- @existing_member = create :member, email: @auth['info']['email'],
- login_name: 'existing',
+ @existing_member = create :member, email: @auth['info']['email'],
+ login_name: 'existing',
preferred_avatar_uri: 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg'
@member = @action.find_or_create_from_authorization(@auth)
@@ -118,13 +118,13 @@ describe 'Growstuff::OauthSignupAction' do
Member.where(email: @auth['info']['email']).delete_all
Authentication.delete_all
- @existing_member = create :member, email: @auth['info']['email'],
- login_name: 'schrodingerscat',
+ @existing_member = create :member, email: @auth['info']['email'],
+ login_name: 'schrodingerscat',
preferred_avatar_uri: 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg'
- @existing_authentication = @existing_member.authentications.create(provider: 'facebook',
- uid: '123545',
- name: "John Testerson's Brother",
+ @existing_authentication = @existing_member.authentications.create(provider: 'facebook',
+ uid: '123545',
+ name: "John Testerson's Brother",
member_id: @existing_member.id)
@member = @action.find_or_create_from_authorization(@auth)
diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb
index 9a2ad8e29..389ae9937 100644
--- a/spec/models/ability_spec.rb
+++ b/spec/models/ability_spec.rb
@@ -13,20 +13,20 @@ describe Ability do
it "member can't view someone else's notifications" do
notification = FactoryBot.create(:notification,
- recipient: FactoryBot.create(:member))
+ recipient: FactoryBot.create(:member))
ability.should_not be_able_to(:read, notification)
end
it "member can't send messages to themself" do
ability.should_not be_able_to(:create,
- FactoryBot.create(:notification,
- recipient: member,
- sender: member))
+ FactoryBot.create(:notification,
+ recipient: member,
+ sender: member))
end
it "member can send messages to someone else" do
ability.should be_able_to(:create,
- FactoryBot.create(:notification,
- recipient: FactoryBot.create(:member),
- sender: member))
+ FactoryBot.create(:notification,
+ recipient: FactoryBot.create(:member),
+ sender: member))
end
end
diff --git a/spec/models/alternate_name_spec.rb b/spec/models/alternate_name_spec.rb
index f7123d701..5881121c8 100644
--- a/spec/models/alternate_name_spec.rb
+++ b/spec/models/alternate_name_spec.rb
@@ -10,8 +10,8 @@ describe AlternateName do
it 'is possible to add multiple alternate names to a crop' do
crop = an.crop
an2 = AlternateName.create(
- name: "really alternative tomato",
- crop_id: crop.id,
+ name: "really alternative tomato",
+ crop_id: crop.id,
creator_id: an.creator.id
)
crop.alternate_names << an2
diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb
index 5ab66c522..98ba51366 100644
--- a/spec/models/crop_spec.rb
+++ b/spec/models/crop_spec.rb
@@ -271,20 +271,20 @@ describe Crop do
@root = FactoryBot.create(:plant_part, name: 'root')
@bulb = FactoryBot.create(:plant_part, name: 'bulb')
@harvest1 = FactoryBot.create(:harvest,
- crop: crop,
- plant_part: @fruit)
+ crop: crop,
+ plant_part: @fruit)
@harvest2 = FactoryBot.create(:harvest,
- crop: crop,
- plant_part: @fruit)
+ crop: crop,
+ plant_part: @fruit)
@harvest3 = FactoryBot.create(:harvest,
- crop: crop,
- plant_part: @seed)
+ crop: crop,
+ plant_part: @seed)
@harvest4 = FactoryBot.create(:harvest,
- crop: crop,
- plant_part: @root)
+ crop: crop,
+ plant_part: @root)
crop.popular_plant_parts.should == { [@fruit.id, @fruit.name] => 2,
- [@seed.id, @seed.name] => 1,
- [@root.id, @root.name] => 1 }
+ [@seed.id, @seed.name] => 1,
+ [@root.id, @root.name] => 1 }
end
end
@@ -540,15 +540,15 @@ describe Crop do
context "crop rejections" do
let!(:rejected_reason) do
- FactoryBot.create(:crop, name: 'tomato',
- approval_status: 'rejected',
+ FactoryBot.create(:crop, name: 'tomato',
+ approval_status: 'rejected',
reason_for_rejection: 'not edible')
end
let!(:rejected_other) do
- FactoryBot.create(:crop, name: 'tomato',
- approval_status: 'rejected',
+ FactoryBot.create(:crop, name: 'tomato',
+ approval_status: 'rejected',
reason_for_rejection: 'other',
- rejection_notes: 'blah blah blah')
+ rejection_notes: 'blah blah blah')
end
describe "rejecting a crop" do
diff --git a/spec/models/harvest_spec.rb b/spec/models/harvest_spec.rb
index 168b2bcdc..f4b110849 100644
--- a/spec/models/harvest_spec.rb
+++ b/spec/models/harvest_spec.rb
@@ -150,74 +150,74 @@ describe Harvest do
let(:crop) { FactoryBot.create(:crop, name: "apricot") }
it "apricots" do
- @h = FactoryBot.create(:harvest, crop: crop,
- quantity: nil,
- unit: nil,
+ @h = FactoryBot.create(:harvest, crop: crop,
+ quantity: nil,
+ unit: nil,
weight_quantity: nil,
- weight_unit: nil)
+ weight_unit: nil)
expect(@h.to_s).to eq "apricots"
end
it "1 individual apricot" do
- @h = FactoryBot.create(:harvest, crop: crop,
- quantity: 1,
- unit: 'individual',
+ @h = FactoryBot.create(:harvest, crop: crop,
+ quantity: 1,
+ unit: 'individual',
weight_quantity: nil,
- weight_unit: nil)
+ weight_unit: nil)
expect(@h.to_s).to eq "1 individual apricot"
end
it "10 individual apricots" do
- @h = FactoryBot.create(:harvest, crop: crop,
- quantity: 10,
- unit: 'individual',
+ @h = FactoryBot.create(:harvest, crop: crop,
+ quantity: 10,
+ unit: 'individual',
weight_quantity: nil,
- weight_unit: nil)
+ weight_unit: nil)
expect(@h.to_s).to eq "10 individual apricots"
end
it "1 bushel of apricots" do
- @h = FactoryBot.create(:harvest, crop: crop,
- quantity: 1,
- unit: 'bushel',
+ @h = FactoryBot.create(:harvest, crop: crop,
+ quantity: 1,
+ unit: 'bushel',
weight_quantity: nil,
- weight_unit: nil)
+ weight_unit: nil)
expect(@h.to_s).to eq "1 bushel of apricots"
end
it "1.5 bushels of apricots" do
- @h = FactoryBot.create(:harvest, crop: crop,
- quantity: 1.5,
- unit: 'bushel',
+ @h = FactoryBot.create(:harvest, crop: crop,
+ quantity: 1.5,
+ unit: 'bushel',
weight_quantity: nil,
- weight_unit: nil)
+ weight_unit: nil)
expect(@h.to_s).to eq "1.5 bushels of apricots"
end
it "10 bushels of apricots" do
- @h = FactoryBot.create(:harvest, crop: crop,
- quantity: 10,
- unit: 'bushel',
+ @h = FactoryBot.create(:harvest, crop: crop,
+ quantity: 10,
+ unit: 'bushel',
weight_quantity: nil,
- weight_unit: nil)
+ weight_unit: nil)
expect(@h.to_s).to eq "10 bushels of apricots"
end
it "apricots weighing 1.2 kg" do
- @h = FactoryBot.create(:harvest, crop: crop,
- quantity: nil,
- unit: nil,
+ @h = FactoryBot.create(:harvest, crop: crop,
+ quantity: nil,
+ unit: nil,
weight_quantity: 1.2,
- weight_unit: 'kg')
+ weight_unit: 'kg')
expect(@h.to_s).to eq "apricots weighing 1.2 kg"
end
it "10 bushels of apricots weighing 100 kg" do
- @h = FactoryBot.create(:harvest, crop: crop,
- quantity: 10,
- unit: 'bushel',
+ @h = FactoryBot.create(:harvest, crop: crop,
+ quantity: 10,
+ unit: 'bushel',
weight_quantity: 100,
- weight_unit: 'kg')
+ weight_unit: 'kg')
expect(@h.to_s).to eq "10 bushels of apricots weighing 100 kg"
end
end
diff --git a/spec/models/plant_part_spec.rb b/spec/models/plant_part_spec.rb
index 66612e5ad..ba1e56241 100644
--- a/spec/models/plant_part_spec.rb
+++ b/spec/models/plant_part_spec.rb
@@ -11,11 +11,11 @@ describe PlantPart do
@tomato = FactoryBot.create(:tomato)
@pp1 = FactoryBot.create(:plant_part)
@h1 = FactoryBot.create(:harvest,
- crop: @tomato,
- plant_part: @pp1)
+ crop: @tomato,
+ plant_part: @pp1)
@h2 = FactoryBot.create(:harvest,
- crop: @maize,
- plant_part: @pp1)
+ crop: @maize,
+ plant_part: @pp1)
@pp1.crops.should include @tomato
@pp1.crops.should include @maize
end
@@ -24,11 +24,11 @@ describe PlantPart do
@maize = FactoryBot.create(:maize)
@pp1 = FactoryBot.create(:plant_part)
@h1 = FactoryBot.create(:harvest,
- crop: @maize,
- plant_part: @pp1)
+ crop: @maize,
+ plant_part: @pp1)
@h2 = FactoryBot.create(:harvest,
- crop: @maize,
- plant_part: @pp1)
+ crop: @maize,
+ plant_part: @pp1)
@pp1.crops.should eq [@maize]
end
end
diff --git a/spec/models/planting_spec.rb b/spec/models/planting_spec.rb
index 565fb5801..f19123d29 100644
--- a/spec/models/planting_spec.rb
+++ b/spec/models/planting_spec.rb
@@ -177,8 +177,8 @@ describe Planting do
before do
FactoryBot.create(:harvest,
- planting: planting,
- crop: planting.crop,
+ planting: planting,
+ crop: planting.crop,
harvested_at: 10.days.ago)
planting.update_harvest_days!
planting.crop.update_harvest_medians
@@ -231,21 +231,21 @@ describe Planting do
# Near by planting with harvests
nearby_garden = FactoryBot.create :garden, location: 'Greenwich, UK'
nearby_planting = FactoryBot.create :planting, crop: crop,
- garden: nearby_garden, owner: nearby_garden.owner, planted_at: '1 January 2000'
+ garden: nearby_garden, owner: nearby_garden.owner, planted_at: '1 January 2000'
FactoryBot.create :harvest, planting: nearby_planting, crop: crop,
- harvested_at: '1 May 2019'
+ harvested_at: '1 May 2019'
FactoryBot.create :harvest, planting: nearby_planting, crop: crop,
- harvested_at: '18 June 2019'
+ harvested_at: '18 June 2019'
FactoryBot.create_list :harvest, 4, planting: nearby_planting, crop: crop,
- harvested_at: '18 August 2008'
+ harvested_at: '18 August 2008'
# far away planting harvests
faraway_garden = FactoryBot.create :garden, location: 'Amundsen-Scott Base, Antarctica'
faraway_planting = FactoryBot.create :planting, garden: faraway_garden, crop: crop,
- owner: faraway_garden.owner, planted_at: '16 May 2001'
+ owner: faraway_garden.owner, planted_at: '16 May 2001'
FactoryBot.create_list :harvest, 4, planting: faraway_planting, crop: crop,
- harvested_at: '18 December 2006'
+ harvested_at: '18 December 2006'
end
it { expect(planting.harvest_months).to eq(5 => 1, 6 => 1, 8 => 4) }
end
@@ -443,8 +443,8 @@ describe Planting do
# this one is newer, and has the same owner, through the garden
@planting2 = FactoryBot.create(:planting,
created_at: 1.minute.ago,
- garden: @planting1.garden,
- owner: @planting1.owner)
+ garden: @planting1.garden,
+ owner: @planting1.owner)
@planting2.photos << FactoryBot.create(:photo, owner: @planting2.owner)
@planting2.save
diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb
index 340495efa..e8bf3cf54 100644
--- a/spec/models/post_spec.rb
+++ b/spec/models/post_spec.rb
@@ -71,7 +71,7 @@ describe Post do
end
it "sets recent activity to comment time" do
- comment = FactoryBot.create(:comment, post: post,
+ comment = FactoryBot.create(:comment, post: post,
created_at: 1.hour.ago)
post.recent_activity.to_i.should eq comment.created_at.to_i
end
diff --git a/spec/requests/api/v1/crop_request_spec.rb b/spec/requests/api/v1/crop_request_spec.rb
index c31d8bb97..9eaab0194 100644
--- a/spec/requests/api/v1/crop_request_spec.rb
+++ b/spec/requests/api/v1/crop_request_spec.rb
@@ -6,16 +6,16 @@ RSpec.describe 'Crops', type: :request do
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
let!(:crop) { FactoryBot.create :crop }
let(:crop_encoded_as_json_api) do
- { "id" => crop.id.to_s,
- "type" => "crops",
- "links" => { "self" => resource_url },
- "attributes" => attributes,
+ { "id" => crop.id.to_s,
+ "type" => "crops",
+ "links" => { "self" => resource_url },
+ "attributes" => attributes,
"relationships" => {
"plantings" => plantings_as_json_api,
- "parent" => parent_as_json_api,
- "harvests" => harvests_as_json_api,
- "seeds" => seeds_as_json_api,
- "photos" => photos_as_json_api
+ "parent" => parent_as_json_api,
+ "harvests" => harvests_as_json_api,
+ "seeds" => seeds_as_json_api,
+ "photos" => photos_as_json_api
} }
end
@@ -23,43 +23,43 @@ RSpec.describe 'Crops', type: :request do
let(:seeds_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/seeds",
+ { "self" => "#{resource_url}/relationships/seeds",
"related" => "#{resource_url}/seeds" } }
end
let(:harvests_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/harvests",
+ { "self" => "#{resource_url}/relationships/harvests",
"related" => "#{resource_url}/harvests" } }
end
let(:parent_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/parent",
+ { "self" => "#{resource_url}/relationships/parent",
"related" => "#{resource_url}/parent" } }
end
let(:plantings_as_json_api) do
{ "links" =>
- { "self" =>
+ { "self" =>
"#{resource_url}/relationships/plantings",
"related" => "#{resource_url}/plantings" } }
end
let(:photos_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/photos",
+ { "self" => "#{resource_url}/relationships/photos",
"related" => "#{resource_url}/photos" } }
end
let(:attributes) do
{
- "name" => crop.name,
- "en-wikipedia-url" => crop.en_wikipedia_url,
- "perennial" => false,
- "median-lifespan" => nil,
+ "name" => crop.name,
+ "en-wikipedia-url" => crop.en_wikipedia_url,
+ "perennial" => false,
+ "median-lifespan" => nil,
"median-days-to-first-harvest" => nil,
- "median-days-to-last-harvest" => nil
+ "median-days-to-last-harvest" => nil
}
end
diff --git a/spec/requests/api/v1/gardens_request_spec.rb b/spec/requests/api/v1/gardens_request_spec.rb
index 89bb2e8ee..12a729a35 100644
--- a/spec/requests/api/v1/gardens_request_spec.rb
+++ b/spec/requests/api/v1/gardens_request_spec.rb
@@ -6,35 +6,35 @@ RSpec.describe 'Gardens', type: :request do
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
let!(:garden) { FactoryBot.create :garden }
let(:garden_encoded_as_json_api) do
- { "id" => garden.id.to_s,
- "type" => "gardens",
- "links" => { "self" => resource_url },
- "attributes" => { "name" => garden.name },
+ { "id" => garden.id.to_s,
+ "type" => "gardens",
+ "links" => { "self" => resource_url },
+ "attributes" => { "name" => garden.name },
"relationships" =>
{
- "owner" => owner_as_json_api,
+ "owner" => owner_as_json_api,
"plantings" => plantings_as_json_api,
- "photos" => photos_as_json_api
+ "photos" => photos_as_json_api
} }
end
let(:resource_url) { "http://www.example.com/api/v1/gardens/#{garden.id}" }
let(:plantings_as_json_api) do
{ "links" =>
- { "self" =>
+ { "self" =>
"#{resource_url}/relationships/plantings",
"related" => "#{resource_url}/plantings" } }
end
let(:owner_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/owner",
+ { "self" => "#{resource_url}/relationships/owner",
"related" => "#{resource_url}/owner" } }
end
let(:photos_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/photos",
+ { "self" => "#{resource_url}/relationships/photos",
"related" => "#{resource_url}/photos" } }
end
diff --git a/spec/requests/api/v1/harvest_request_spec.rb b/spec/requests/api/v1/harvest_request_spec.rb
index 18a1fe4ab..b958f7938 100644
--- a/spec/requests/api/v1/harvest_request_spec.rb
+++ b/spec/requests/api/v1/harvest_request_spec.rb
@@ -6,15 +6,15 @@ RSpec.describe 'Harvests', type: :request do
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
let!(:harvest) { FactoryBot.create :harvest }
let(:harvest_encoded_as_json_api) do
- { "id" => harvest.id.to_s,
- "type" => "harvests",
- "links" => { "self" => resource_url },
- "attributes" => attributes,
+ { "id" => harvest.id.to_s,
+ "type" => "harvests",
+ "links" => { "self" => resource_url },
+ "attributes" => attributes,
"relationships" => {
- "crop" => crop_as_json_api,
+ "crop" => crop_as_json_api,
"planting" => planting_as_json_api,
- "owner" => owner_as_json_api,
- "photos" => photos_as_json_api
+ "owner" => owner_as_json_api,
+ "photos" => photos_as_json_api
} }
end
@@ -22,38 +22,38 @@ RSpec.describe 'Harvests', type: :request do
let(:crop_as_json_api) do
{ "links" =>
- { "self" =>
+ { "self" =>
"#{resource_url}/relationships/crop",
"related" => "#{resource_url}/crop" } }
end
let(:owner_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/owner",
+ { "self" => "#{resource_url}/relationships/owner",
"related" => "#{resource_url}/owner" } }
end
let(:planting_as_json_api) do
{ "links" =>
- { "self" =>
+ { "self" =>
"#{resource_url}/relationships/planting",
"related" => "#{resource_url}/planting" } }
end
let(:photos_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/photos",
+ { "self" => "#{resource_url}/relationships/photos",
"related" => "#{resource_url}/photos" } }
end
let(:attributes) do
{
- "harvested-at" => "2015-09-17",
- "description" => harvest.description,
- "unit" => harvest.unit,
+ "harvested-at" => "2015-09-17",
+ "description" => harvest.description,
+ "unit" => harvest.unit,
"weight-quantity" => harvest.weight_quantity.to_s,
- "weight-unit" => harvest.weight_unit,
- "si-weight" => harvest.si_weight
+ "weight-unit" => harvest.weight_unit,
+ "si-weight" => harvest.si_weight
}
end
diff --git a/spec/requests/api/v1/member_request_spec.rb b/spec/requests/api/v1/member_request_spec.rb
index 279f5ac8c..0f1d78122 100644
--- a/spec/requests/api/v1/member_request_spec.rb
+++ b/spec/requests/api/v1/member_request_spec.rb
@@ -6,16 +6,16 @@ RSpec.describe 'Members', type: :request do
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
let!(:member) { FactoryBot.create :member }
let(:member_encoded_as_json_api) do
- { "id" => member.id.to_s,
- "type" => "members",
- "links" => { "self" => resource_url },
- "attributes" => attributes,
+ { "id" => member.id.to_s,
+ "type" => "members",
+ "links" => { "self" => resource_url },
+ "attributes" => attributes,
"relationships" => {
- "gardens" => gardens_as_json_api,
- "harvests" => harvests_as_json_api,
- "photos" => photos_as_json_api,
+ "gardens" => gardens_as_json_api,
+ "harvests" => harvests_as_json_api,
+ "photos" => photos_as_json_api,
"plantings" => plantings_as_json_api,
- "seeds" => seeds_as_json_api
+ "seeds" => seeds_as_json_api
} }
end
@@ -23,38 +23,38 @@ RSpec.describe 'Members', type: :request do
let(:harvests_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/harvests",
+ { "self" => "#{resource_url}/relationships/harvests",
"related" => "#{resource_url}/harvests" } }
end
let(:photos_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/photos",
+ { "self" => "#{resource_url}/relationships/photos",
"related" => "#{resource_url}/photos" } }
end
let(:seeds_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/seeds",
+ { "self" => "#{resource_url}/relationships/seeds",
"related" => "#{resource_url}/seeds" } }
end
let(:plantings_as_json_api) do
{ "links" =>
- { "self" =>
+ { "self" =>
"#{resource_url}/relationships/plantings",
"related" => "#{resource_url}/plantings" } }
end
let(:gardens_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/gardens",
+ { "self" => "#{resource_url}/relationships/gardens",
"related" => "#{resource_url}/gardens" } }
end
let(:attributes) do
{
"login-name" => member.login_name,
- "slug" => member.slug
+ "slug" => member.slug
}
end
@@ -83,7 +83,7 @@ RSpec.describe 'Members', type: :request do
it '#update' do
expect do
- post "/api/v1/members/#{member.id}", params: {
+ post "/api/v1/members/#{member.id}", params: {
'member' => { 'login_name' => 'can i modify this' }
},
headers: headers
diff --git a/spec/requests/api/v1/photos_request_spec.rb b/spec/requests/api/v1/photos_request_spec.rb
index 82959eb0d..d194e237e 100644
--- a/spec/requests/api/v1/photos_request_spec.rb
+++ b/spec/requests/api/v1/photos_request_spec.rb
@@ -6,15 +6,15 @@ RSpec.describe 'Photos', type: :request do
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
let!(:photo) { FactoryBot.create :photo }
let(:photo_encoded_as_json_api) do
- { "id" => photo.id.to_s,
- "type" => "photos",
- "links" => { "self" => resource_url },
- "attributes" => attributes,
+ { "id" => photo.id.to_s,
+ "type" => "photos",
+ "links" => { "self" => resource_url },
+ "attributes" => attributes,
"relationships" => {
- "owner" => owner_as_json_api,
+ "owner" => owner_as_json_api,
"plantings" => plantings_as_json_api,
- "harvests" => harvests_as_json_api,
- "gardens" => gardens_as_json_api
+ "harvests" => harvests_as_json_api,
+ "gardens" => gardens_as_json_api
} }
end
@@ -22,25 +22,25 @@ RSpec.describe 'Photos', type: :request do
let(:owner_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/owner",
+ { "self" => "#{resource_url}/relationships/owner",
"related" => "#{resource_url}/owner" } }
end
let(:harvests_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/harvests",
+ { "self" => "#{resource_url}/relationships/harvests",
"related" => "#{resource_url}/harvests" } }
end
let(:gardens_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/gardens",
+ { "self" => "#{resource_url}/relationships/gardens",
"related" => "#{resource_url}/gardens" } }
end
let(:plantings_as_json_api) do
{ "links" =>
- { "self" =>
+ { "self" =>
"#{resource_url}/relationships/plantings",
"related" => "#{resource_url}/plantings" } }
end
@@ -48,10 +48,10 @@ RSpec.describe 'Photos', type: :request do
let(:attributes) do
{
"thumbnail-url" => photo.thumbnail_url,
- "fullsize-url" => photo.fullsize_url,
- "link-url" => photo.link_url,
- "license-name" => photo.license_name,
- "title" => photo.title
+ "fullsize-url" => photo.fullsize_url,
+ "link-url" => photo.link_url,
+ "license-name" => photo.license_name,
+ "title" => photo.title
}
end
diff --git a/spec/requests/api/v1/plantings_request_spec.rb b/spec/requests/api/v1/plantings_request_spec.rb
index 705c23c6f..8c811f511 100644
--- a/spec/requests/api/v1/plantings_request_spec.rb
+++ b/spec/requests/api/v1/plantings_request_spec.rb
@@ -6,15 +6,15 @@ RSpec.describe 'Plantings', type: :request do
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
let!(:planting) { FactoryBot.create :planting }
let(:planting_encoded_as_json_api) do
- { "id" => planting.id.to_s,
- "type" => "plantings",
- "links" => { "self" => resource_url },
- "attributes" => attributes,
+ { "id" => planting.id.to_s,
+ "type" => "plantings",
+ "links" => { "self" => resource_url },
+ "attributes" => attributes,
"relationships" => {
- "garden" => garden_as_json_api,
- "crop" => crop_as_json_api,
- "owner" => owner_as_json_api,
- "photos" => photos_as_json_api,
+ "garden" => garden_as_json_api,
+ "crop" => crop_as_json_api,
+ "owner" => owner_as_json_api,
+ "photos" => photos_as_json_api,
"harvests" => harvests_as_json_api
} }
end
@@ -23,55 +23,55 @@ RSpec.describe 'Plantings', type: :request do
let(:harvests_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/harvests",
+ { "self" => "#{resource_url}/relationships/harvests",
"related" => "#{resource_url}/harvests" } }
end
let(:photos_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/photos",
+ { "self" => "#{resource_url}/relationships/photos",
"related" => "#{resource_url}/photos" } }
end
let(:owner_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/owner",
+ { "self" => "#{resource_url}/relationships/owner",
"related" => "#{resource_url}/owner" } }
end
let(:crop_as_json_api) do
{ "links" =>
- { "self" =>
+ { "self" =>
"#{resource_url}/relationships/crop",
"related" => "#{resource_url}/crop" } }
end
let(:garden_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/garden",
+ { "self" => "#{resource_url}/relationships/garden",
"related" => "#{resource_url}/garden" } }
end
let(:attributes) do
{
- "slug" => planting.slug,
- "planted-at" => "2014-07-30",
- "finished-at" => nil,
- "finished" => false,
- "quantity" => 33,
- "description" => planting.description,
- "crop-name" => planting.crop.name,
- "crop-slug" => planting.crop.slug,
- "sunniness" => nil,
- "planted-from" => nil,
- "expected-lifespan" => nil,
+ "slug" => planting.slug,
+ "planted-at" => "2014-07-30",
+ "finished-at" => nil,
+ "finished" => false,
+ "quantity" => 33,
+ "description" => planting.description,
+ "crop-name" => planting.crop.name,
+ "crop-slug" => planting.crop.slug,
+ "sunniness" => nil,
+ "planted-from" => nil,
+ "expected-lifespan" => nil,
"finish-predicted-at" => nil,
- "percentage-grown" => nil,
- "first-harvest-date" => nil,
- "last-harvest-date" => nil,
- "thumbnail" => nil,
- "location" => planting.garden.location,
- "longitude" => planting.garden.longitude,
- "latitude" => planting.garden.latitude
+ "percentage-grown" => nil,
+ "first-harvest-date" => nil,
+ "last-harvest-date" => nil,
+ "thumbnail" => nil,
+ "location" => planting.garden.location,
+ "longitude" => planting.garden.longitude,
+ "latitude" => planting.garden.latitude
}
end
diff --git a/spec/requests/api/v1/seeds_request_spec.rb b/spec/requests/api/v1/seeds_request_spec.rb
index 90d3da22a..a65243c50 100644
--- a/spec/requests/api/v1/seeds_request_spec.rb
+++ b/spec/requests/api/v1/seeds_request_spec.rb
@@ -6,13 +6,13 @@ RSpec.describe 'Photos', type: :request do
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }
let!(:seed) { FactoryBot.create :seed }
let(:seed_encoded_as_json_api) do
- { "id" => seed.id.to_s,
- "type" => "seeds",
- "links" => { "self" => resource_url },
- "attributes" => attributes,
+ { "id" => seed.id.to_s,
+ "type" => "seeds",
+ "links" => { "self" => resource_url },
+ "attributes" => attributes,
"relationships" => {
"owner" => owner_as_json_api,
- "crop" => crop_as_json_api
+ "crop" => crop_as_json_api
} }
end
@@ -20,27 +20,27 @@ RSpec.describe 'Photos', type: :request do
let(:owner_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/owner",
+ { "self" => "#{resource_url}/relationships/owner",
"related" => "#{resource_url}/owner" } }
end
let(:crop_as_json_api) do
{ "links" =>
- { "self" => "#{resource_url}/relationships/crop",
+ { "self" => "#{resource_url}/relationships/crop",
"related" => "#{resource_url}/crop" } }
end
let(:attributes) do
{
- "description" => seed.description,
- "quantity" => seed.quantity,
- "plant-before" => "2013-07-15",
- "tradable-to" => seed.tradable_to,
+ "description" => seed.description,
+ "quantity" => seed.quantity,
+ "plant-before" => "2013-07-15",
+ "tradable-to" => seed.tradable_to,
"days-until-maturity-min" => seed.days_until_maturity_min,
"days-until-maturity-max" => seed.days_until_maturity_max,
- "organic" => seed.organic,
- "gmo" => seed.gmo,
- "heirloom" => seed.heirloom
+ "organic" => seed.organic,
+ "gmo" => seed.gmo,
+ "heirloom" => seed.heirloom
}
end
diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb
index 2f55171f7..327b2c804 100644
--- a/spec/swagger_helper.rb
+++ b/spec/swagger_helper.rb
@@ -15,11 +15,11 @@ RSpec.configure do |config|
config.swagger_docs = {
'v1/swagger.yaml' => {
openapi: '3.0.1',
- info: {
- title: 'API V1',
+ info: {
+ title: 'API V1',
version: 'v1'
},
- paths: {}
+ paths: {}
}
}
diff --git a/spec/views/admin/roles/edit.html.haml_spec.rb b/spec/views/admin/roles/edit.html.haml_spec.rb
index 62dfaf3b3..859ac2492 100644
--- a/spec/views/admin/roles/edit.html.haml_spec.rb
+++ b/spec/views/admin/roles/edit.html.haml_spec.rb
@@ -3,8 +3,8 @@ require 'rails_helper'
describe "admin/roles/edit" do
before do
@role = assign(:role, stub_model(Role,
- name: "MyString",
- description: "MyText"))
+ name: "MyString",
+ description: "MyText"))
end
it "renders the edit role form" do
diff --git a/spec/views/admin/roles/index.html.haml_spec.rb b/spec/views/admin/roles/index.html.haml_spec.rb
index b94d20dba..f852dd0d0 100644
--- a/spec/views/admin/roles/index.html.haml_spec.rb
+++ b/spec/views/admin/roles/index.html.haml_spec.rb
@@ -5,11 +5,11 @@ describe "admin/roles/index" do
controller.stub(:current_user) { nil }
assign(:roles, [
stub_model(Role,
- name: "Name",
- description: "MyText"),
+ name: "Name",
+ description: "MyText"),
stub_model(Role,
- name: "Name",
- description: "MyText")
+ name: "Name",
+ description: "MyText")
])
end
diff --git a/spec/views/admin/roles/new.html.haml_spec.rb b/spec/views/admin/roles/new.html.haml_spec.rb
index 6c27927f2..3ce6b0c85 100644
--- a/spec/views/admin/roles/new.html.haml_spec.rb
+++ b/spec/views/admin/roles/new.html.haml_spec.rb
@@ -3,8 +3,8 @@ require 'rails_helper'
describe "admin/roles/new" do
before do
assign(:role, stub_model(Role,
- name: "MyString",
- description: "MyText").as_new_record)
+ name: "MyString",
+ description: "MyText").as_new_record)
end
it "renders new role form" do
diff --git a/spec/views/crops/_grown_for.html.haml_spec.rb b/spec/views/crops/_grown_for.html.haml_spec.rb
index 239b26dfd..f3beba7a2 100644
--- a/spec/views/crops/_grown_for.html.haml_spec.rb
+++ b/spec/views/crops/_grown_for.html.haml_spec.rb
@@ -5,8 +5,8 @@ describe "crops/_grown_for" do
let(:plant_path) { FactoryBot.create(:plant_part) }
let!(:harvest) do
FactoryBot.create(:harvest,
- crop: crop,
- plant_part: plant_path)
+ crop: crop,
+ plant_part: plant_path)
end
it 'shows plant parts' do
diff --git a/spec/views/forums/edit.html.haml_spec.rb b/spec/views/forums/edit.html.haml_spec.rb
index 1782bb7b7..57747391e 100644
--- a/spec/views/forums/edit.html.haml_spec.rb
+++ b/spec/views/forums/edit.html.haml_spec.rb
@@ -3,9 +3,9 @@ require 'rails_helper'
describe "forums/edit" do
before do
@forum = assign(:forum, stub_model(Forum,
- name: "MyString",
- description: "MyText",
- owner_id: 1))
+ name: "MyString",
+ description: "MyText",
+ owner_id: 1))
end
it "renders the edit forum form" do
diff --git a/spec/views/harvests/edit.html.haml_spec.rb b/spec/views/harvests/edit.html.haml_spec.rb
index 7733e28f4..38307f503 100644
--- a/spec/views/harvests/edit.html.haml_spec.rb
+++ b/spec/views/harvests/edit.html.haml_spec.rb
@@ -10,7 +10,7 @@ describe "harvests/edit" do
assert_select "form", action: harvests_path, method: "post" do
assert_select "input#crop", class: "ui-autocomplete-input"
assert_select "input#harvest_crop_id", name: "harvest[crop_id]"
- assert_select 'input', id: "harvest_plant_part_id_#{PlantPart.first.id}",
+ assert_select 'input', id: "harvest_plant_part_id_#{PlantPart.first.id}",
name: "harvest[plant_part_id]"
assert_select "input#harvest_quantity", name: "harvest[quantity]"
assert_select "input#harvest_weight_quantity", name: "harvest[quantity]"
diff --git a/spec/views/harvests/index.html.haml_spec.rb b/spec/views/harvests/index.html.haml_spec.rb
index 294256ade..1ce56c492 100644
--- a/spec/views/harvests/index.html.haml_spec.rb
+++ b/spec/views/harvests/index.html.haml_spec.rb
@@ -13,12 +13,12 @@ describe "harvests/index" do
harvests = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
FactoryBot.create(:harvest,
- crop: @tomato,
- owner: @member),
+ crop: @tomato,
+ owner: @member),
FactoryBot.create(:harvest,
- crop: @maize,
- plant_part: @pp,
- owner: @member)
+ crop: @maize,
+ plant_part: @pp,
+ owner: @member)
])
end
assign(:harvests, harvests)
diff --git a/spec/views/harvests/index.rss.haml_spec.rb b/spec/views/harvests/index.rss.haml_spec.rb
index 3bb73bca1..e3f1d20b2 100644
--- a/spec/views/harvests/index.rss.haml_spec.rb
+++ b/spec/views/harvests/index.rss.haml_spec.rb
@@ -13,13 +13,13 @@ describe 'harvests/index.rss.haml' do
harvests = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
FactoryBot.create(:harvest,
- crop: @tomato,
- owner: @member),
+ crop: @tomato,
+ owner: @member),
FactoryBot.create(:harvest,
- crop: @maize,
- plant_part: @pp,
- owner: @member,
- quantity: 2)
+ crop: @maize,
+ plant_part: @pp,
+ owner: @member,
+ quantity: 2)
])
end
assign(:harvests, harvests)
diff --git a/spec/views/harvests/new.html.haml_spec.rb b/spec/views/harvests/new.html.haml_spec.rb
index 37ce3388a..abe1b547e 100644
--- a/spec/views/harvests/new.html.haml_spec.rb
+++ b/spec/views/harvests/new.html.haml_spec.rb
@@ -10,7 +10,7 @@ describe "harvests/new" do
assert_select "form", action: harvests_path, method: "post" do
assert_select "input#crop", class: "ui-autocomplete-input"
assert_select "input#harvest_crop_id", name: "harvest[crop_id]"
- assert_select 'input', id: "harvest_plant_part_id_#{PlantPart.first.id}",
+ assert_select 'input', id: "harvest_plant_part_id_#{PlantPart.first.id}",
name: "harvest[plant_part_id]"
# some browsers interpret without a step as "integer"
assert_select "input#harvest_quantity[step=any]", name: "harvest[quantity]"
diff --git a/spec/views/photos/edit.html.haml_spec.rb b/spec/views/photos/edit.html.haml_spec.rb
index a4491a226..ba481b104 100644
--- a/spec/views/photos/edit.html.haml_spec.rb
+++ b/spec/views/photos/edit.html.haml_spec.rb
@@ -3,9 +3,9 @@ require 'rails_helper'
describe "photos/edit" do
before do
@photo = assign(:photo, stub_model(Photo,
- owner_id: 1,
- flickr_photo_id: 1,
- thumbnail_url: "MyString",
- fullsize_url: "MyString"))
+ owner_id: 1,
+ flickr_photo_id: 1,
+ thumbnail_url: "MyString",
+ fullsize_url: "MyString"))
end
end
diff --git a/spec/views/plant_parts/edit.html.haml_spec.rb b/spec/views/plant_parts/edit.html.haml_spec.rb
index 3eaa4fbac..cc6070fb0 100644
--- a/spec/views/plant_parts/edit.html.haml_spec.rb
+++ b/spec/views/plant_parts/edit.html.haml_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe "plant_parts/edit" do
before do
@plant_part = assign(:plant_part, stub_model(PlantPart,
- name: "MyString"))
+ name: "MyString"))
end
it "renders the edit plant_part form" do
diff --git a/spec/views/plant_parts/new.html.haml_spec.rb b/spec/views/plant_parts/new.html.haml_spec.rb
index 90a1465f4..b0067273c 100644
--- a/spec/views/plant_parts/new.html.haml_spec.rb
+++ b/spec/views/plant_parts/new.html.haml_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
describe "plant_parts/new" do
before do
assign(:plant_part, stub_model(PlantPart,
- name: "MyString").as_new_record)
+ name: "MyString").as_new_record)
end
it "renders new plant_part form" do
diff --git a/spec/views/plantings/_form.html.haml_spec.rb b/spec/views/plantings/_form.html.haml_spec.rb
index e6eb07563..0f4c6f1af 100644
--- a/spec/views/plantings/_form.html.haml_spec.rb
+++ b/spec/views/plantings/_form.html.haml_spec.rb
@@ -9,10 +9,10 @@ describe "plantings/_form" do
@crop = @lowercase # needed to render the form
@planting = FactoryBot.create(:planting,
- garden: @garden,
- crop: @crop,
- owner: @member,
- planted_at: Date.new(2013, 3, 1))
+ garden: @garden,
+ crop: @crop,
+ owner: @member,
+ planted_at: Date.new(2013, 3, 1))
@gardens = @member.gardens
sign_in @member
diff --git a/spec/views/plantings/edit.html.haml_spec.rb b/spec/views/plantings/edit.html.haml_spec.rb
index 7870d1ac0..6baf126f1 100644
--- a/spec/views/plantings/edit.html.haml_spec.rb
+++ b/spec/views/plantings/edit.html.haml_spec.rb
@@ -3,8 +3,8 @@ require 'rails_helper'
describe "plantings/edit" do
before do
@member = FactoryBot.create(:member,
- login_name: 'right',
- email: 'right@example.com')
+ login_name: 'right',
+ email: 'right@example.com')
# creating two crops to make sure that the correct one is selected
# in the form.
@@ -17,7 +17,7 @@ describe "plantings/edit" do
@gardens = @member.gardens
@planting = assign(:planting,
- FactoryBot.create(:planting, garden: @garden, crop: @tomato, owner: @member))
+ FactoryBot.create(:planting, garden: @garden, crop: @tomato, owner: @member))
end
context "logged in" do
diff --git a/spec/views/plantings/index.html.haml_spec.rb b/spec/views/plantings/index.html.haml_spec.rb
index 09b990c9a..4284eada6 100644
--- a/spec/views/plantings/index.html.haml_spec.rb
+++ b/spec/views/plantings/index.html.haml_spec.rb
@@ -14,22 +14,22 @@ describe "plantings/index" do
plantings = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
FactoryBot.create(:planting,
- garden: garden,
- crop: tomato,
- owner: member),
+ garden: garden,
+ crop: tomato,
+ owner: member),
FactoryBot.create(:planting,
- garden: garden,
- crop: maize,
- owner: garden.owner,
- description: '',
- planted_at: Time.zone.local(2013, 1, 13)),
+ garden: garden,
+ crop: maize,
+ owner: garden.owner,
+ description: '',
+ planted_at: Time.zone.local(2013, 1, 13)),
FactoryBot.create(:planting,
- garden: garden,
- owner: garden.owner,
- crop: tomato,
- planted_at: Time.zone.local(2013, 1, 13),
- finished_at: Time.zone.local(2013, 1, 20),
- finished: true)
+ garden: garden,
+ owner: garden.owner,
+ crop: tomato,
+ planted_at: Time.zone.local(2013, 1, 13),
+ finished_at: Time.zone.local(2013, 1, 20),
+ finished: true)
])
end
assign(:plantings, plantings)
diff --git a/spec/views/plantings/new.html.haml_spec.rb b/spec/views/plantings/new.html.haml_spec.rb
index 01f83680d..3376d5cc0 100644
--- a/spec/views/plantings/new.html.haml_spec.rb
+++ b/spec/views/plantings/new.html.haml_spec.rb
@@ -11,7 +11,7 @@ describe "plantings/new" do
@crop1 = FactoryBot.create(:tomato)
@crop2 = FactoryBot.create(:maize)
@planting = FactoryBot.create(:planting,
- garden: @garden_a, crop: @crop2, owner: @member)
+ garden: @garden_a, crop: @crop2, owner: @member)
assign(:planting, @planting)
end
@@ -43,7 +43,7 @@ describe "plantings/new" do
it "selects a garden given in a param" do
assert_select "input", id: "planting_garden_id_#{@garden_z.id}",
- type: 'radio', value: @garden_z.id, checked: "checked"
+ type: 'radio', value: @garden_z.id, checked: "checked"
end
end
end
diff --git a/spec/views/posts/edit.html.haml_spec.rb b/spec/views/posts/edit.html.haml_spec.rb
index b8a72ca74..2119f80b5 100644
--- a/spec/views/posts/edit.html.haml_spec.rb
+++ b/spec/views/posts/edit.html.haml_spec.rb
@@ -32,8 +32,8 @@ describe "posts/edit" do
before do
@forum = assign(:forum, FactoryBot.create(:forum))
assign(:post, FactoryBot.create(:post,
- forum: @forum,
- author: @author))
+ forum: @forum,
+ author: @author))
render
end
diff --git a/spec/views/posts/index.html.haml_spec.rb b/spec/views/posts/index.html.haml_spec.rb
index b8e8b5ba5..c865b2980 100644
--- a/spec/views/posts/index.html.haml_spec.rb
+++ b/spec/views/posts/index.html.haml_spec.rb
@@ -10,9 +10,9 @@ describe "posts/index" do
posts = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
FactoryBot.create(:post, author: @author,
- subject: 'A Post', body: 'This is some text.'),
+ subject: 'A Post', body: 'This is some text.'),
FactoryBot.create(:post, author: @author,
- subject: 'A Post', body: 'This is some text.')
+ subject: 'A Post', body: 'This is some text.')
])
end
assign(:posts, posts)
diff --git a/spec/views/scientific_names/show.html.haml_spec.rb b/spec/views/scientific_names/show.html.haml_spec.rb
index c8e64a6dc..ed815c55d 100644
--- a/spec/views/scientific_names/show.html.haml_spec.rb
+++ b/spec/views/scientific_names/show.html.haml_spec.rb
@@ -4,7 +4,7 @@ describe "scientific_names/show" do
before do
controller.stub(:current_user) { nil }
@scientific_name = assign(:scientific_name,
- FactoryBot.create(:zea_mays))
+ FactoryBot.create(:zea_mays))
end
it "renders attributes in " do