diff --git a/.rubocop.yml b/.rubocop.yml
index 2f2b2f8e0..2631b0f0d 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -16,6 +16,14 @@ Style/FileName:
Style/StringLiterals:
Enabled: false
+Style/MultilineMethodCallIndentation:
+ EnforcedStyle: indented
+
+# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
+# SupportedStyles: with_first_parameter, with_fixed_indentation
+Style/AlignParameters:
+ EnforcedStyle: with_fixed_indentation
+
Metrics/MethodLength:
Description: 'Avoid methods longer than 30 lines of code.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 737bc1082..93b7ab7c0 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -32,15 +32,6 @@ Lint/AssignmentInCondition:
Exclude:
- 'app/models/member.rb'
-# Offense count: 5
-# Cop supports --auto-correct.
-# Configuration parameters: AlignWith, SupportedStyles.
-# SupportedStyles: either, start_of_block, start_of_line
-Lint/BlockAlignment:
- Exclude:
- - 'spec/features/signin_spec.rb'
- - 'spec/models/seed_spec.rb'
-
# Offense count: 2
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
@@ -48,17 +39,6 @@ Lint/DeprecatedClassMethods:
- 'app/controllers/robots_controller.rb'
- 'config/boot.rb'
-# Offense count: 4
-# Cop supports --auto-correct.
-# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
-# SupportedStyles: keyword, variable, start_of_line
-Lint/EndAlignment:
- Exclude:
- - 'app/controllers/registrations_controller.rb'
- - 'app/controllers/robots_controller.rb'
- - 'app/helpers/seeds_helper.rb'
- - 'db/migrate/20150201052245_create_cms.rb'
-
# Offense count: 1
Lint/HandleExceptions:
Exclude:
@@ -297,107 +277,6 @@ Rails/Validation:
- 'app/models/member.rb'
- 'app/models/order_item.rb'
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
-# SupportedStyles: outdent, indent
-Style/AccessModifierIndentation:
- Exclude:
- - 'app/controllers/passwords_controller.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-Style/AlignArray:
- Exclude:
- - 'spec/models/planting_spec.rb'
-
-# Offense count: 93
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
-# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
-Style/AlignHash:
- Exclude:
- - 'app/mailers/notifier.rb'
- - 'app/models/crop.rb'
- - 'app/models/garden.rb'
- - 'app/models/harvest.rb'
- - 'app/models/member.rb'
- - 'app/models/planting.rb'
- - 'app/models/seed.rb'
- - 'db/migrate/20150201052245_create_cms.rb'
- - 'spec/models/harvest_spec.rb'
- - 'spec/models/post_spec.rb'
- - 'spec/views/notifications/index.html.haml_spec.rb'
- - 'spec/views/photos/show.html.haml_spec.rb'
- - 'spec/views/places/_map_attribution.html.haml_spec.rb'
- - 'spec/views/plantings/show.html.haml_spec.rb'
- - 'spec/views/posts/show.html.haml_spec.rb'
-
-# Offense count: 143
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
-# SupportedStyles: with_first_parameter, with_fixed_indentation
-Style/AlignParameters:
- Exclude:
- - 'app/controllers/application_controller.rb'
- - 'app/controllers/comments_controller.rb'
- - 'app/controllers/gardens_controller.rb'
- - 'app/controllers/harvests_controller.rb'
- - 'app/controllers/plantings_controller.rb'
- - 'app/controllers/products_controller.rb'
- - 'app/helpers/application_helper.rb'
- - 'app/models/crop.rb'
- - 'app/models/garden.rb'
- - 'app/models/harvest.rb'
- - 'app/models/member.rb'
- - 'app/models/planting.rb'
- - 'app/models/post.rb'
- - 'app/models/product.rb'
- - 'app/models/seed.rb'
- - 'db/migrate/20150201052245_create_cms.rb'
- - 'lib/tasks/hooks.rake'
- - 'spec/controllers/order_items_controller_spec.rb'
- - 'spec/helpers/gardens_helper_spec.rb'
- - 'spec/helpers/harvests_helper_spec.rb'
- - 'spec/helpers/plantings_helper_spec.rb'
- - 'spec/helpers/seeds_helper_spec.rb'
- - 'spec/models/ability_spec.rb'
- - 'spec/models/crop_spec.rb'
- - 'spec/models/member_spec.rb'
- - 'spec/models/order_spec.rb'
- - 'spec/models/plant_part_spec.rb'
- - 'spec/models/planting_spec.rb'
- - 'spec/models/post_spec.rb'
- - 'spec/views/account_types/edit.html.haml_spec.rb'
- - 'spec/views/account_types/new.html.haml_spec.rb'
- - 'spec/views/account_types/show.html.haml_spec.rb'
- - 'spec/views/crops/_grown_for.html.haml_spec.rb'
- - 'spec/views/crops/_planting_advice.html.haml_spec.rb'
- - 'spec/views/forums/edit.html.haml_spec.rb'
- - 'spec/views/harvests/index.html.haml_spec.rb'
- - 'spec/views/notifications/index.html.haml_spec.rb'
- - 'spec/views/orders/show.html.haml_spec.rb'
- - 'spec/views/photos/edit.html.haml_spec.rb'
- - 'spec/views/plant_parts/edit.html.haml_spec.rb'
- - 'spec/views/plant_parts/new.html.haml_spec.rb'
- - 'spec/views/plantings/_form.html.haml_spec.rb'
- - 'spec/views/plantings/edit.html.haml_spec.rb'
- - 'spec/views/plantings/index.html.haml_spec.rb'
- - 'spec/views/plantings/new.html.haml_spec.rb'
- - 'spec/views/plantings/show.html.haml_spec.rb'
- - 'spec/views/posts/edit.html.haml_spec.rb'
- - 'spec/views/posts/index.html.haml_spec.rb'
- - 'spec/views/posts/show.html.haml_spec.rb'
- - 'spec/views/products/edit.html.haml_spec.rb'
- - 'spec/views/products/new.html.haml_spec.rb'
- - 'spec/views/roles/edit.html.haml_spec.rb'
- - 'spec/views/roles/index.html.haml_spec.rb'
- - 'spec/views/roles/new.html.haml_spec.rb'
- - 'spec/views/roles/show.html.haml_spec.rb'
- - 'spec/views/scientific_names/edit.html.haml_spec.rb'
- - 'spec/views/scientific_names/show.html.haml_spec.rb'
- - 'spec/views/seeds/show.html.haml_spec.rb'
-
# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -488,16 +367,6 @@ Style/BracesAroundHashParameters:
- 'spec/views/notifier/notify.html.haml_spec.rb'
- 'spec/views/photos/new.html.haml_spec.rb'
-# Offense count: 13
-# Cop supports --auto-correct.
-# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep, IndentationWidth.
-# SupportedStyles: case, end
-Style/CaseIndentation:
- Exclude:
- - 'app/helpers/application_helper.rb'
- - 'app/models/order.rb'
- - 'db/migrate/20150201052245_create_cms.rb'
-
# Offense count: 4
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
@@ -519,52 +388,6 @@ Style/ClassMethods:
- 'app/models/post.rb'
- 'app/models/seed.rb'
-# Offense count: 90
-# Cop supports --auto-correct.
-Style/ClosingParenthesisIndentation:
- Exclude:
- - 'app/controllers/application_controller.rb'
- - 'app/models/account.rb'
- - 'app/models/crop.rb'
- - 'spec/controllers/order_items_controller_spec.rb'
- - 'spec/helpers/gardens_helper_spec.rb'
- - 'spec/helpers/harvests_helper_spec.rb'
- - 'spec/helpers/plantings_helper_spec.rb'
- - 'spec/helpers/seeds_helper_spec.rb'
- - 'spec/models/ability_spec.rb'
- - 'spec/models/crop_spec.rb'
- - 'spec/models/harvest_spec.rb'
- - 'spec/models/member_spec.rb'
- - 'spec/models/order_spec.rb'
- - 'spec/models/plant_part_spec.rb'
- - 'spec/models/planting_spec.rb'
- - 'spec/models/post_spec.rb'
- - 'spec/views/account_types/edit.html.haml_spec.rb'
- - 'spec/views/account_types/new.html.haml_spec.rb'
- - 'spec/views/account_types/show.html.haml_spec.rb'
- - 'spec/views/crops/_grown_for.html.haml_spec.rb'
- - 'spec/views/crops/_planting_advice.html.haml_spec.rb'
- - 'spec/views/forums/edit.html.haml_spec.rb'
- - 'spec/views/harvests/index.html.haml_spec.rb'
- - 'spec/views/orders/show.html.haml_spec.rb'
- - 'spec/views/photos/edit.html.haml_spec.rb'
- - 'spec/views/plant_parts/edit.html.haml_spec.rb'
- - 'spec/views/plant_parts/new.html.haml_spec.rb'
- - 'spec/views/plantings/_form.html.haml_spec.rb'
- - 'spec/views/plantings/edit.html.haml_spec.rb'
- - 'spec/views/plantings/index.html.haml_spec.rb'
- - 'spec/views/plantings/new.html.haml_spec.rb'
- - 'spec/views/plantings/show.html.haml_spec.rb'
- - 'spec/views/posts/edit.html.haml_spec.rb'
- - 'spec/views/products/edit.html.haml_spec.rb'
- - 'spec/views/products/new.html.haml_spec.rb'
- - 'spec/views/roles/edit.html.haml_spec.rb'
- - 'spec/views/roles/index.html.haml_spec.rb'
- - 'spec/views/roles/new.html.haml_spec.rb'
- - 'spec/views/roles/show.html.haml_spec.rb'
- - 'spec/views/scientific_names/edit.html.haml_spec.rb'
- - 'spec/views/scientific_names/show.html.haml_spec.rb'
-
# Offense count: 2
# Cop supports --auto-correct.
Style/ColonMethodCall:
@@ -580,37 +403,6 @@ Style/CommentAnnotation:
Exclude:
- 'app/controllers/crops_controller.rb'
-# Offense count: 11
-# Cop supports --auto-correct.
-Style/CommentIndentation:
- Exclude:
- - 'app/controllers/registrations_controller.rb'
- - 'app/models/crop.rb'
- - 'config/application.rb'
- - 'config/initializers/comfortable_mexican_sofa.rb'
- - 'config/routes.rb'
- - 'spec/factories/comments.rb'
- - 'spec/features/footer_spec.rb'
- - 'spec/spec_helper.rb'
- - 'spec/views/harvests/new.html.haml_spec.rb'
- - 'spec/views/members/show.rss.haml_spec.rb'
- - 'spec/views/posts/new.html.haml_spec.rb'
-
-# Offense count: 5
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
-# SupportedStyles: assign_to_condition, assign_inside_condition
-Style/ConditionalAssignment:
- Exclude:
- - 'app/controllers/crops_controller.rb'
- - 'app/controllers/harvests_controller.rb'
- - 'app/models/harvest.rb'
- - 'app/models/member.rb'
- - 'app/controllers/posts_controller.rb'
- - 'app/controllers/plantings_controller.rb'
- - 'app/controllers/members_controller.rb'
- - 'app/controllers/seeds_controller.rb'
-
# Offense count: 1
# Cop supports --auto-correct.
Style/DefWithParentheses:
@@ -806,442 +598,12 @@ Style/EachForSimpleLoop:
- 'spec/models/crop_spec.rb'
- 'spec/views/home/_crops.html.haml_spec.rb'
-# Offense count: 2
-# Cop supports --auto-correct.
-Style/ElseAlignment:
- Exclude:
- - 'app/controllers/registrations_controller.rb'
- - 'app/helpers/seeds_helper.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: empty, nil, both
-Style/EmptyElse:
- Exclude:
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: AllowAdjacentOneLineDefs.
-Style/EmptyLineBetweenDefs:
- Exclude:
- - 'app/controllers/omniauth_callbacks_controller.rb'
- - 'db/migrate/20130601011725_change_flickr_photo_id_to_string.rb'
-
-# Offense count: 536
-# Cop supports --auto-correct.
-Style/EmptyLines:
- Exclude:
- - 'app/controllers/gardens_controller.rb'
- - 'app/models/follow.rb'
- - 'app/models/member.rb'
- - 'app/models/post.rb'
- - 'config.rb'
- - 'config/application.rb'
- - 'config/routes.rb'
- - 'db/migrate/20120903092956_devise_create_users.rb'
- - 'db/seeds.rb'
- - 'lib/tasks/growstuff.rake'
- - 'spec/controllers/account_types_controller_spec.rb'
- - 'spec/controllers/accounts_controller_spec.rb'
- - 'spec/controllers/admin/orders_controller_spec.rb'
- - 'spec/controllers/admin_controller_spec.rb'
- - 'spec/controllers/authentications_controller_spec.rb'
- - 'spec/controllers/comments_controller_spec.rb'
- - 'spec/controllers/crops_controller_spec.rb'
- - 'spec/controllers/forums_controller_spec.rb'
- - 'spec/controllers/gardens_controller_spec.rb'
- - 'spec/controllers/harvests_controller_spec.rb'
- - 'spec/controllers/home_controller_spec.rb'
- - 'spec/controllers/member_controller_spec.rb'
- - 'spec/controllers/notifications_controller_spec.rb'
- - 'spec/controllers/order_items_controller_spec.rb'
- - 'spec/controllers/orders_controller_spec.rb'
- - 'spec/controllers/places_controller_spec.rb'
- - 'spec/controllers/plant_parts_controller_spec.rb'
- - 'spec/controllers/plantings_controller_spec.rb'
- - 'spec/controllers/posts_controller_spec.rb'
- - 'spec/controllers/products_controller_spec.rb'
- - 'spec/controllers/registrations_controller_spec.rb'
- - 'spec/controllers/roles_controller_spec.rb'
- - 'spec/controllers/scientific_names_controller_spec.rb'
- - 'spec/controllers/seeds_controller_spec.rb'
- - 'spec/controllers/shop_controller_spec.rb'
- - 'spec/features/crops/crop_wranglers_spec.rb'
- - 'spec/features/signin_spec.rb'
- - 'spec/helpers/notifications_helper_spec.rb'
- - 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
- - 'spec/mailers/notifier_spec.rb'
- - 'spec/models/ability_spec.rb'
- - 'spec/models/crop_spec.rb'
- - 'spec/models/harvest_spec.rb'
- - 'spec/models/seed_spec.rb'
- - 'spec/views/account_types/edit.html.haml_spec.rb'
- - 'spec/views/account_types/index.html.haml_spec.rb'
- - 'spec/views/account_types/new.html.haml_spec.rb'
- - 'spec/views/account_types/show.html.haml_spec.rb'
- - 'spec/views/accounts/edit.html.haml_spec.rb'
- - 'spec/views/accounts/index.html.haml_spec.rb'
- - 'spec/views/accounts/new.html.haml_spec.rb'
- - 'spec/views/accounts/show.html.haml_spec.rb'
- - 'spec/views/admin/index_spec.rb'
- - 'spec/views/admin/newsletter_spec.rb'
- - 'spec/views/admin/orders/index_spec.rb'
- - 'spec/views/comments/edit.html.haml_spec.rb'
- - 'spec/views/comments/index.html.haml_spec.rb'
- - 'spec/views/comments/index.rss.haml_spec.rb'
- - 'spec/views/comments/new.html.haml_spec.rb'
- - 'spec/views/comments/show.html.haml_spec.rb'
- - 'spec/views/crops/_grown_for.html.haml_spec.rb'
- - 'spec/views/crops/_planting_advice.html.haml_spec.rb'
- - 'spec/views/crops/_popover.html.haml_spec.rb'
- - 'spec/views/crops/edit.html.haml_spec.rb'
- - 'spec/views/crops/hierarchy.html.haml_spec.rb'
- - 'spec/views/crops/index.html.haml_spec.rb'
- - 'spec/views/crops/index.rss.haml_spec.rb'
- - 'spec/views/crops/new.html.haml_spec.rb'
- - 'spec/views/crops/wrangle.html.haml_spec.rb'
- - 'spec/views/devise/mailer/confirmation_instructions_spec.rb'
- - 'spec/views/devise/mailer/reset_password_instructions_spec.rb'
- - 'spec/views/devise/mailer/unlock_instructions_spec.rb'
- - 'spec/views/devise/registrations/edit_spec.rb'
- - 'spec/views/devise/registrations/new_spec.rb'
- - 'spec/views/devise/sessions/new_spec.rb'
- - 'spec/views/devise/unlocks/new_spec.rb'
- - 'spec/views/forums/edit.html.haml_spec.rb'
- - 'spec/views/forums/index.html.haml_spec.rb'
- - 'spec/views/forums/new.html.haml_spec.rb'
- - 'spec/views/forums/show.html.haml_spec.rb'
- - 'spec/views/gardens/edit.html.haml_spec.rb'
- - 'spec/views/gardens/new.html.haml_spec.rb'
- - 'spec/views/gardens/show.html.haml_spec.rb'
- - 'spec/views/harvests/edit.html.haml_spec.rb'
- - 'spec/views/harvests/index.html.haml_spec.rb'
- - 'spec/views/harvests/new.html.haml_spec.rb'
- - 'spec/views/harvests/show.html.haml_spec.rb'
- - 'spec/views/home/_blurb.html.haml_spec.rb'
- - 'spec/views/home/_crops.html.haml_spec.rb'
- - 'spec/views/home/_members.html.haml_spec.rb'
- - 'spec/views/home/_seeds.html.haml_spec.rb'
- - 'spec/views/home/_stats.html.haml_spec.rb'
- - 'spec/views/home/index_spec.rb'
- - 'spec/views/layouts/_header_spec.rb'
- - 'spec/views/layouts/_meta_spec.rb'
- - 'spec/views/layouts/application_spec.rb'
- - 'spec/views/members/_location.html.haml_spec.rb'
- - 'spec/views/members/index.html.haml_spec.rb'
- - 'spec/views/members/show.rss.haml_spec.rb'
- - 'spec/views/notifications/index.html.haml_spec.rb'
- - 'spec/views/notifications/new.html.haml_spec.rb'
- - 'spec/views/notifications/show.html.haml_spec.rb'
- - 'spec/views/notifier/notify.html.haml_spec.rb'
- - 'spec/views/orders/index.html.haml_spec.rb'
- - 'spec/views/orders/show.html.haml_spec.rb'
- - 'spec/views/photos/edit.html.haml_spec.rb'
- - 'spec/views/photos/index.html.haml_spec.rb'
- - 'spec/views/photos/new.html.haml_spec.rb'
- - 'spec/views/photos/show.html.haml_spec.rb'
- - 'spec/views/places/_map_attribution.html.haml_spec.rb'
- - 'spec/views/places/index.html.haml_spec.rb'
- - 'spec/views/places/show.html.haml_spec.rb'
- - 'spec/views/plant_parts/edit.html.haml_spec.rb'
- - 'spec/views/plant_parts/index.html.haml_spec.rb'
- - 'spec/views/plant_parts/new.html.haml_spec.rb'
- - 'spec/views/plant_parts/show.html.haml_spec.rb'
- - 'spec/views/plantings/_form.html.haml_spec.rb'
- - 'spec/views/plantings/edit.html.haml_spec.rb'
- - 'spec/views/plantings/index.html.haml_spec.rb'
- - 'spec/views/plantings/index.rss.haml_spec.rb'
- - 'spec/views/plantings/new.html.haml_spec.rb'
- - 'spec/views/plantings/show.html.haml_spec.rb'
- - 'spec/views/posts/_single.html.haml_spec.rb'
- - 'spec/views/posts/edit.html.haml_spec.rb'
- - 'spec/views/posts/index.html.haml_spec.rb'
- - 'spec/views/posts/index.rss.haml_spec.rb'
- - 'spec/views/posts/new.html.haml_spec.rb'
- - 'spec/views/posts/show.html.haml_spec.rb'
- - 'spec/views/posts/show.rss.haml_spec.rb'
- - 'spec/views/products/edit.html.haml_spec.rb'
- - 'spec/views/products/index.html.haml_spec.rb'
- - 'spec/views/products/new.html.haml_spec.rb'
- - 'spec/views/products/show.html.haml_spec.rb'
- - 'spec/views/roles/edit.html.haml_spec.rb'
- - 'spec/views/roles/index.html.haml_spec.rb'
- - 'spec/views/roles/new.html.haml_spec.rb'
- - 'spec/views/roles/show.html.haml_spec.rb'
- - 'spec/views/scientific_names/edit.html.haml_spec.rb'
- - 'spec/views/scientific_names/index.html.haml_spec.rb'
- - 'spec/views/scientific_names/new.html.haml_spec.rb'
- - 'spec/views/scientific_names/show.html.haml_spec.rb'
- - 'spec/views/seeds/edit.html.haml_spec.rb'
- - 'spec/views/seeds/index.rss.haml_spec.rb'
- - 'spec/views/seeds/new.html.haml_spec.rb'
- - 'spec/views/seeds/show.html.haml_spec.rb'
- - 'spec/views/shop/index_spec.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-Style/EmptyLinesAroundAccessModifier:
- Exclude:
- - 'app/controllers/passwords_controller.rb'
- - 'app/models/post.rb'
-
-# Offense count: 314
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: empty_lines, no_empty_lines
-Style/EmptyLinesAroundBlockBody:
- Exclude:
- - 'config/environments/test.rb'
- - 'config/initializers/comfortable_mexican_sofa.rb'
- - 'config/routes.rb'
- - 'config/unicorn.rb'
- - 'lib/tasks/growstuff.rake'
- - 'spec/controllers/account_types_controller_spec.rb'
- - 'spec/controllers/accounts_controller_spec.rb'
- - 'spec/controllers/admin/orders_controller_spec.rb'
- - 'spec/controllers/admin_controller_spec.rb'
- - 'spec/controllers/authentications_controller_spec.rb'
- - 'spec/controllers/comments_controller_spec.rb'
- - 'spec/controllers/crops_controller_spec.rb'
- - 'spec/controllers/forums_controller_spec.rb'
- - 'spec/controllers/gardens_controller_spec.rb'
- - 'spec/controllers/harvests_controller_spec.rb'
- - 'spec/controllers/home_controller_spec.rb'
- - 'spec/controllers/member_controller_spec.rb'
- - 'spec/controllers/notifications_controller_spec.rb'
- - 'spec/controllers/order_items_controller_spec.rb'
- - 'spec/controllers/orders_controller_spec.rb'
- - 'spec/controllers/places_controller_spec.rb'
- - 'spec/controllers/plant_parts_controller_spec.rb'
- - 'spec/controllers/plantings_controller_spec.rb'
- - 'spec/controllers/posts_controller_spec.rb'
- - 'spec/controllers/products_controller_spec.rb'
- - 'spec/controllers/registrations_controller_spec.rb'
- - 'spec/controllers/roles_controller_spec.rb'
- - 'spec/controllers/scientific_names_controller_spec.rb'
- - 'spec/controllers/shop_controller_spec.rb'
- - 'spec/factories/account_types.rb'
- - 'spec/factories/crop.rb'
- - 'spec/factories/follows.rb'
- - 'spec/factories/garden.rb'
- - 'spec/factories/member.rb'
- - 'spec/factories/post.rb'
- - 'spec/factories/scientific_name.rb'
- - 'spec/features/crops/browse_crops_spec.rb'
- - 'spec/features/crops/crop_detail_page_spec.rb'
- - 'spec/features/crops/crop_wranglers_spec.rb'
- - 'spec/features/footer_spec.rb'
- - 'spec/features/gardens_spec.rb'
- - 'spec/features/harvests/browse_harvests_spec.rb'
- - 'spec/features/locale_spec.rb'
- - 'spec/features/member_profile_spec.rb'
- - 'spec/features/signout_spec.rb'
- - 'spec/features/signup_spec.rb'
- - 'spec/helpers/harvests_helper_spec.rb'
- - 'spec/helpers/notifications_helper_spec.rb'
- - 'spec/helpers/plantings_helper_spec.rb'
- - 'spec/lib/haml/filters/escaped_markdown_spec.rb'
- - 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
- - 'spec/mailers/notifier_spec.rb'
- - 'spec/models/ability_spec.rb'
- - 'spec/models/account_spec.rb'
- - 'spec/models/alternate_name_spec.rb'
- - 'spec/models/authentication_spec.rb'
- - 'spec/models/comment_spec.rb'
- - 'spec/models/crop_spec.rb'
- - 'spec/models/follow_spec.rb'
- - 'spec/models/forum_spec.rb'
- - 'spec/models/garden_spec.rb'
- - 'spec/models/harvest_spec.rb'
- - 'spec/models/member_spec.rb'
- - 'spec/models/notification_spec.rb'
- - 'spec/models/order_item_spec.rb'
- - 'spec/models/order_spec.rb'
- - 'spec/models/photo_spec.rb'
- - 'spec/models/plant_part_spec.rb'
- - 'spec/models/planting_spec.rb'
- - 'spec/models/post_spec.rb'
- - 'spec/models/product_spec.rb'
- - 'spec/models/scientific_name_spec.rb'
- - 'spec/models/seed_spec.rb'
- - 'spec/routing/account_types_routing_spec.rb'
- - 'spec/routing/authentications_routing_spec.rb'
- - 'spec/routing/comments_routing_spec.rb'
- - 'spec/routing/crops_routing_spec.rb'
- - 'spec/routing/follows_routing_spec.rb'
- - 'spec/routing/forums_routing_spec.rb'
- - 'spec/routing/gardens_routing_spec.rb'
- - 'spec/routing/harvests_routing_spec.rb'
- - 'spec/routing/notifications_routing_spec.rb'
- - 'spec/routing/order_items_routing_spec.rb'
- - 'spec/routing/orders_routing_spec.rb'
- - 'spec/routing/photos_routing_spec.rb'
- - 'spec/routing/plant_parts_routing_spec.rb'
- - 'spec/routing/plantings_routing_spec.rb'
- - 'spec/routing/products_routing_spec.rb'
- - 'spec/routing/roles_routing_spec.rb'
- - 'spec/routing/scientific_names_routing_spec.rb'
- - 'spec/routing/seeds_routing_spec.rb'
- - 'spec/routing/updates_routing_spec.rb'
- - 'spec/spec_helper.rb'
- - 'spec/support/database_cleaner.rb'
- - 'spec/views/comments/index.rss.haml_spec.rb'
- - 'spec/views/comments/new.html.haml_spec.rb'
- - 'spec/views/crops/_planting_advice.html.haml_spec.rb'
- - 'spec/views/crops/_popover.html.haml_spec.rb'
- - 'spec/views/crops/edit.html.haml_spec.rb'
- - 'spec/views/crops/index.rss.haml_spec.rb'
- - 'spec/views/crops/new.html.haml_spec.rb'
- - 'spec/views/crops/wrangle.html.haml_spec.rb'
- - 'spec/views/devise/confirmations/new_spec.rb'
- - 'spec/views/devise/mailer/confirmation_instructions_spec.rb'
- - 'spec/views/devise/mailer/reset_password_instructions_spec.rb'
- - 'spec/views/devise/registrations/edit_spec.rb'
- - 'spec/views/devise/registrations/new_spec.rb'
- - 'spec/views/devise/sessions/new_spec.rb'
- - 'spec/views/devise/shared/_links_spec.rb'
- - 'spec/views/devise/unlocks/new_spec.rb'
- - 'spec/views/forums/index.html.haml_spec.rb'
- - 'spec/views/gardens/edit.html.haml_spec.rb'
- - 'spec/views/gardens/show.html.haml_spec.rb'
- - 'spec/views/harvests/index.html.haml_spec.rb'
- - 'spec/views/harvests/show.html.haml_spec.rb'
- - 'spec/views/home/_blurb.html.haml_spec.rb'
- - 'spec/views/home/_members.html.haml_spec.rb'
- - 'spec/views/home/index_spec.rb'
- - 'spec/views/layouts/_header_spec.rb'
- - 'spec/views/layouts/_meta_spec.rb'
- - 'spec/views/layouts/application_spec.rb'
- - 'spec/views/members/_location.html.haml_spec.rb'
- - 'spec/views/members/index.html.haml_spec.rb'
- - 'spec/views/members/show.rss.haml_spec.rb'
- - 'spec/views/notifications/index.html.haml_spec.rb'
- - 'spec/views/notifications/new.html.haml_spec.rb'
- - 'spec/views/notifications/show.html.haml_spec.rb'
- - 'spec/views/notifier/notify.html.haml_spec.rb'
- - 'spec/views/orders/show.html.haml_spec.rb'
- - 'spec/views/photos/edit.html.haml_spec.rb'
- - 'spec/views/photos/new.html.haml_spec.rb'
- - 'spec/views/photos/show.html.haml_spec.rb'
- - 'spec/views/places/show.html.haml_spec.rb'
- - 'spec/views/plant_parts/index.html.haml_spec.rb'
- - 'spec/views/plantings/_form.html.haml_spec.rb'
- - 'spec/views/plantings/edit.html.haml_spec.rb'
- - 'spec/views/plantings/new.html.haml_spec.rb'
- - 'spec/views/posts/_single.html.haml_spec.rb'
- - 'spec/views/posts/edit.html.haml_spec.rb'
- - 'spec/views/posts/index.rss.haml_spec.rb'
- - 'spec/views/posts/new.html.haml_spec.rb'
- - 'spec/views/posts/show.html.haml_spec.rb'
- - 'spec/views/posts/show.rss.haml_spec.rb'
- - 'spec/views/scientific_names/edit.html.haml_spec.rb'
- - 'spec/views/scientific_names/new.html.haml_spec.rb'
- - 'spec/views/scientific_names/show.html.haml_spec.rb'
- - 'spec/views/seeds/index.rss.haml_spec.rb'
- - 'spec/views/seeds/new.html.haml_spec.rb'
- - 'spec/views/seeds/show.html.haml_spec.rb'
- - 'spec/views/shop/index_spec.rb'
-
-# Offense count: 21
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: empty_lines, empty_lines_except_namespace, no_empty_lines
-Style/EmptyLinesAroundClassBody:
- Exclude:
- - 'app/controllers/accounts_controller.rb'
- - 'app/controllers/application_controller.rb'
- - 'app/controllers/home_controller.rb'
- - 'app/controllers/passwords_controller.rb'
- - 'app/controllers/places_controller.rb'
- - 'app/controllers/robots_controller.rb'
- - 'app/mailers/notifier.rb'
- - 'app/models/account.rb'
- - 'app/models/comment.rb'
- - 'app/models/crop.rb'
- - 'app/models/follow.rb'
- - 'app/models/forum.rb'
- - 'app/models/garden.rb'
- - 'app/models/harvest.rb'
- - 'app/models/notification.rb'
- - 'app/models/order.rb'
- - 'app/models/photo.rb'
- - 'app/models/plant_part.rb'
- - 'app/models/product.rb'
- - 'db/migrate/20130518002942_rename_account_detail_to_account.rb'
- - 'lib/actions/oauth_signup_action.rb'
-
-# Offense count: 14
-# Cop supports --auto-correct.
-Style/EmptyLinesAroundMethodBody:
- Exclude:
- - 'app/controllers/admin/orders_controller.rb'
- - 'app/controllers/crops_controller.rb'
- - 'app/controllers/follows_controller.rb'
- - 'app/controllers/home_controller.rb'
- - 'app/controllers/orders_controller.rb'
- - 'app/controllers/registrations_controller.rb'
- - 'app/models/crop.rb'
- - 'app/models/photo.rb'
- - 'app/models/seed.rb'
- - 'lib/haml/filters/growstuff_markdown.rb'
-
-# Offense count: 14
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: empty_lines, empty_lines_except_namespace, no_empty_lines
-Style/EmptyLinesAroundModuleBody:
- Exclude:
- - 'app/helpers/application_helper.rb'
- - 'app/helpers/auto_suggest_helper.rb'
- - 'app/helpers/gardens_helper.rb'
- - 'app/helpers/harvests_helper.rb'
- - 'app/helpers/plantings_helper.rb'
- - 'app/helpers/seeds_helper.rb'
- - 'lib/geocodable.rb'
- - 'lib/haml/filters/escaped_markdown.rb'
- - 'lib/haml/filters/growstuff_markdown.rb'
- - 'spec/support/feature_helpers.rb'
-
# Offense count: 1
# Cop supports --auto-correct.
Style/EmptyLiteral:
Exclude:
- 'app/models/member.rb'
-# Offense count: 23
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
-Style/ExtraSpacing:
- Exclude:
- - 'app/controllers/harvests_controller.rb'
- - 'app/controllers/seeds_controller.rb'
- - 'app/models/ability.rb'
- - 'app/models/crop.rb'
- - 'app/models/member.rb'
- - 'app/models/post.rb'
- - 'bin/rails'
- - 'config.ru'
- - 'config/environments/test.rb'
- - 'db/migrate/20150201052245_create_cms.rb'
- - 'script/rails'
- - 'spec/features/crops/browse_crops_spec.rb'
- - 'spec/lib/actions/oauth_signup_action_spec.rb'
- - 'spec/models/planting_spec.rb'
- - 'spec/models/role_spec.rb'
- - 'spec/views/crops/_planting_advice.html.haml_spec.rb'
- - 'spec/views/devise/shared/_links_spec.rb'
- - 'spec/views/gardens/show.html.haml_spec.rb'
- - 'spec/views/photos/new.html.haml_spec.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
-# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
-Style/FirstParameterIndentation:
- Exclude:
- - 'db/seeds.rb'
-
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: for, each
@@ -1312,73 +674,6 @@ Style/IfUnlessModifier:
- 'config/initializers/geocoder.rb'
- 'lib/tasks/growstuff.rake'
-# Offense count: 18
-# Cop supports --auto-correct.
-# Configuration parameters: SupportedStyles, IndentationWidth.
-# SupportedStyles: special_inside_parentheses, consistent, align_brackets
-Style/IndentArray:
- EnforcedStyle: consistent
-
-# Offense count: 24
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
-# SupportedStyles: special_inside_parentheses, consistent, align_braces
-Style/IndentHash:
- Exclude:
- - 'app/controllers/crops_controller.rb'
- - 'app/helpers/application_helper.rb'
- - 'app/models/crop.rb'
- - 'app/models/member.rb'
- - 'app/models/order.rb'
- - 'config/environments/development.rb'
- - 'config/environments/production.rb'
- - 'config/environments/staging.rb'
- - 'config/environments/test.rb'
- - 'spec/lib/actions/oauth_signup_action_spec.rb'
-
-# Offense count: 25
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: normal, rails
-Style/IndentationConsistency:
- Exclude:
- - 'app/models/crop.rb'
- - 'app/models/garden.rb'
- - 'app/models/post.rb'
- - 'lib/haml/filters/escaped_markdown.rb'
- - 'lib/haml/filters/growstuff_markdown.rb'
- - 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
- - 'spec/models/garden_spec.rb'
- - 'spec/support/controller_macros.rb'
- - 'spec/views/scientific_names/edit.html.haml_spec.rb'
-
-# Offense count: 29
-# Cop supports --auto-correct.
-# Configuration parameters: Width.
-Style/IndentationWidth:
- Exclude:
- - 'app/controllers/application_controller.rb'
- - 'app/controllers/crops_controller.rb'
- - 'app/controllers/registrations_controller.rb'
- - 'app/controllers/robots_controller.rb'
- - 'app/helpers/seeds_helper.rb'
- - 'app/models/crop.rb'
- - 'config/initializers/comfortable_mexican_sofa.rb'
- - 'db/migrate/20121109130033_add_creation_index_to_updates.rb'
- - 'db/migrate/20141119130555_change_follows_member_id_to_follower_id.rb'
- - 'lib/tasks/hooks.rake'
- - 'spec/controllers/harvests_controller_spec.rb'
- - 'spec/features/signin_spec.rb'
- - 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
- - 'spec/models/garden_spec.rb'
- - 'spec/models/seed_spec.rb'
- - 'spec/support/controller_macros.rb'
- - 'spec/views/crops/index.html.haml_spec.rb'
- - 'spec/views/devise/registrations/new_spec.rb'
- - 'spec/views/devise/sessions/new_spec.rb'
- - 'spec/views/devise/unlocks/new_spec.rb'
- - 'spec/views/posts/_single.html.haml_spec.rb'
-
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -1388,16 +683,6 @@ Style/Lambda:
- 'spec/controllers/member_controller_spec.rb'
- 'spec/models/photo_spec.rb'
-# Offense count: 6
-# Cop supports --auto-correct.
-Style/LeadingCommentSpace:
- Exclude:
- - 'app/controllers/application_controller.rb'
- - 'app/controllers/omniauth_callbacks_controller.rb'
- - 'app/controllers/plantings_controller.rb'
- - 'app/controllers/posts_controller.rb'
- - 'app/controllers/seeds_controller.rb'
- - 'spec/factories/crop.rb'
# Offense count: 3
# Cop supports --auto-correct.
@@ -1501,23 +786,6 @@ Style/MultilineMethodCallBraceLayout:
- 'spec/views/scientific_names/edit.html.haml_spec.rb'
- 'spec/views/scientific_names/show.html.haml_spec.rb'
-# Offense count: 4
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
-# SupportedStyles: aligned, indented, indented_relative_to_receiver
-Style/MultilineMethodCallIndentation:
- Exclude:
- - 'app/controllers/authentications_controller.rb'
- - 'lib/actions/oauth_signup_action.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
-# SupportedStyles: aligned, indented
-Style/MultilineOperationIndentation:
- Exclude:
- - 'app/controllers/registrations_controller.rb'
-
# Offense count: 2
Style/MultilineTernaryOperator:
Exclude:
@@ -1723,166 +991,6 @@ Style/SelfAssignment:
Exclude:
- 'app/helpers/crops_helper.rb'
-# Offense count: 20
-# Cop supports --auto-correct.
-Style/SpaceAfterComma:
- Exclude:
- - 'app/models/crop.rb'
- - 'db/seeds.rb'
- - 'lib/actions/oauth_signup_action.rb'
- - 'spec/models/harvest_spec.rb'
- - 'spec/rails_helper.rb'
-
-# Offense count: 6
-# Cop supports --auto-correct.
-Style/SpaceAfterNot:
- Exclude:
- - 'app/helpers/harvests_helper.rb'
- - 'app/models/crop.rb'
- - 'app/models/garden.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyleInsidePipes, SupportedStyles.
-# SupportedStyles: space, no_space
-Style/SpaceAroundBlockParameters:
- Exclude:
- - 'spec/custom_matchers.rb'
-
-# Offense count: 14
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: space, no_space
-Style/SpaceAroundEqualsInParameterDefault:
- Exclude:
- - 'app/helpers/application_helper.rb'
- - 'app/helpers/auto_suggest_helper.rb'
- - 'app/models/crop.rb'
- - 'app/models/member.rb'
- - 'app/models/order.rb'
- - 'app/models/planting.rb'
- - 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
- - 'spec/support/controller_macros.rb'
- - 'spec/support/feature_helpers.rb'
-
-# Offense count: 13
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment.
-Style/SpaceAroundOperators:
- Exclude:
- - 'app/controllers/harvests_controller.rb'
- - 'app/controllers/seeds_controller.rb'
- - 'app/models/planting.rb'
- - 'app/models/post.rb'
- - 'config/environments/test.rb'
- - 'db/seeds.rb'
- - 'spec/views/crops/_planting_advice.html.haml_spec.rb'
- - 'spec/views/gardens/show.html.haml_spec.rb'
- - 'spec/views/harvests/index.html.haml_spec.rb'
- - 'spec/views/plantings/index.html.haml_spec.rb'
-
-# Offense count: 2
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: space, no_space
-Style/SpaceBeforeBlockBraces:
- Exclude:
- - 'app/models/crop.rb'
- - 'app/models/post.rb'
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Style/SpaceBeforeComma:
- Exclude:
- - 'spec/controllers/member_controller_spec.rb'
-
-# Offense count: 16
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
-# SupportedStyles: space, no_space
-Style/SpaceInsideBlockBraces:
- Exclude:
- - 'app/helpers/crops_helper.rb'
- - 'app/models/crop.rb'
- - 'app/models/member.rb'
- - 'app/models/post.rb'
- - 'spec/factories/member.rb'
- - 'spec/rails_helper.rb'
- - 'spec/support/elasticsearch_helpers.rb'
- - 'spec/views/notifications/new.html.haml_spec.rb'
-
-# Offense count: 43
-# Cop supports --auto-correct.
-Style/SpaceInsideBrackets:
- Exclude:
- - 'app/models/crop.rb'
- - 'config/initializers/devise.rb'
- - 'spec/controllers/member_controller_spec.rb'
- - 'spec/factories/member.rb'
- - 'spec/models/crop_spec.rb'
- - 'spec/models/member_spec.rb'
- - 'spec/views/crops/index.html.haml_spec.rb'
- - 'spec/views/crops/wrangle.html.haml_spec.rb'
- - 'spec/views/forums/index.html.haml_spec.rb'
- - 'spec/views/members/index.html.haml_spec.rb'
- - 'spec/views/notifications/index.html.haml_spec.rb'
- - 'spec/views/orders/index.html.haml_spec.rb'
- - 'spec/views/plantings/index.rss.haml_spec.rb'
- - 'spec/views/seeds/index.rss.haml_spec.rb'
-
-# Offense count: 137
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
-# SupportedStyles: space, no_space, compact
-Style/SpaceInsideHashLiteralBraces:
- Exclude:
- - 'app/controllers/admin/orders_controller.rb'
- - 'app/controllers/crops_controller.rb'
- - 'app/models/crop.rb'
- - 'app/models/harvest.rb'
- - 'app/models/member.rb'
- - 'app/models/planting.rb'
- - 'app/models/seed.rb'
- - 'db/migrate/20150201052245_create_cms.rb'
- - 'lib/geocodable.rb'
- - 'spec/controllers/admin/orders_controller_spec.rb'
- - 'spec/controllers/comments_controller_spec.rb'
- - 'spec/controllers/gardens_controller_spec.rb'
- - 'spec/controllers/harvests_controller_spec.rb'
- - 'spec/controllers/member_controller_spec.rb'
- - 'spec/controllers/notifications_controller_spec.rb'
- - 'spec/controllers/order_items_controller_spec.rb'
- - 'spec/controllers/orders_controller_spec.rb'
- - 'spec/controllers/plantings_controller_spec.rb'
- - 'spec/controllers/seeds_controller_spec.rb'
- - 'spec/views/notifications/show.html.haml_spec.rb'
- - 'spec/views/photos/new.html.haml_spec.rb'
- - 'spec/views/posts/_single.html.haml_spec.rb'
- - 'spec/views/posts/show.html.haml_spec.rb'
-
-# Offense count: 5
-# Cop supports --auto-correct.
-Style/SpaceInsideParens:
- Exclude:
- - 'app/models/crop.rb'
- - 'config/environments/test.rb'
- - 'spec/lib/haml/filters/growstuff_markdown_spec.rb'
- - 'spec/views/posts/edit.html.haml_spec.rb'
-
-# Offense count: 12
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: space, no_space
-Style/SpaceInsideStringInterpolation:
- Exclude:
- - 'app/controllers/follows_controller.rb'
- - 'app/controllers/robots_controller.rb'
- - 'spec/controllers/robots_controller_spec.rb'
- - 'spec/features/crops/crop_detail_page_spec.rb'
- - 'spec/features/rss/plantings_spec.rb'
- - 'spec/features/rss/posts_spec.rb'
- - 'spec/features/rss/seeds_spec.rb'
-
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles.
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index a4904646c..b2daf95ed 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -43,5 +43,4 @@ class AccountsController < ApplicationController
def account_params
params.require(:account).permit(:account_type_id, :member_id, :paid_until)
end
-
end
diff --git a/app/controllers/admin/orders_controller.rb b/app/controllers/admin/orders_controller.rb
index c092ba7f2..574afc024 100644
--- a/app/controllers/admin/orders_controller.rb
+++ b/app/controllers/admin/orders_controller.rb
@@ -8,7 +8,7 @@ class Admin::OrdersController < ApplicationController
def search
authorize! :manage, :all
- @orders = Order.search({by: params[:search_by], for: params[:search_text]})
+ @orders = Order.search({ by: params[:search_by], for: params[:search_text] })
if @orders.empty?
flash[:alert] = "Couldn't find order with #{params[:search_by]} = #{params[:search_text]}"
@@ -17,6 +17,5 @@ class Admin::OrdersController < ApplicationController
respond_to do |format|
format.html # index.html.haml
end
-
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f082d13cf..45c657b64 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
request.path != "/members/confirmation" &&
request.path != "/members/sign_out" &&
!request.xhr?)
- store_location_for(:member, request.fullpath)
+ store_location_for(:member, request.fullpath)
end
end
@@ -73,10 +73,9 @@ class ApplicationController < ActionController::Base
:bio, :location, :latitude, :longitude,
# email settings
:show_email, :newsletter, :send_notification_email, :send_planting_reminder,
- #update password
+ # update password
:current_password
)
end
end
-
end
diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb
index 34ed65aa8..886715373 100644
--- a/app/controllers/authentications_controller.rb
+++ b/app/controllers/authentications_controller.rb
@@ -10,15 +10,15 @@ class AuthenticationsController < ApplicationController
name = Growstuff::OauthSignupAction.new.determine_name(auth)
@authentication = current_member.authentications
- .create_with(
- name: name,
- token: auth['credentials']['token'],
- secret: auth['credentials']['secret']
- )
- .find_or_create_by(
- provider: auth['provider'],
- uid: auth['uid'],
- name: name)
+ .create_with(
+ name: name,
+ token: auth['credentials']['token'],
+ secret: auth['credentials']['secret']
+ )
+ .find_or_create_by(
+ provider: auth['provider'],
+ uid: auth['uid'],
+ name: name)
flash[:notice] = "Authentication successful."
else
diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb
index 784073ed8..7139d3f04 100644
--- a/app/controllers/crops_controller.rb
+++ b/app/controllers/crops_controller.rb
@@ -11,11 +11,11 @@ class CropsController < ApplicationController
@sort = params[:sort]
if @sort == 'alpha'
# alphabetical order
- @crops = Crop.includes(:scientific_names, {plantings: :photos})
+ @crops = Crop.includes(:scientific_names, { plantings: :photos })
@paginated_crops = @crops.approved.paginate(page: params[:page])
else
# default to sorting by popularity
- @crops = Crop.popular.includes(:scientific_names, {plantings: :photos})
+ @crops = Crop.popular.includes(:scientific_names, { plantings: :photos })
@paginated_crops = @crops.approved.paginate(page: params[:page])
end
@@ -37,14 +37,14 @@ class CropsController < ApplicationController
# GET /crops/wrangle
def wrangle
@approval_status = params[:approval_status]
- case @approval_status
- when "pending"
- @crops = Crop.pending_approval
- when "rejected"
- @crops = Crop.rejected
- else
- @crops = Crop.recent
- end
+ @crops = case @approval_status
+ when "pending"
+ Crop.pending_approval
+ when "rejected"
+ Crop.rejected
+ else
+ Crop.recent
+ end
@crops = @crops.paginate(page: params[:page])
@@ -77,7 +77,7 @@ class CropsController < ApplicationController
# GET /crops/1
# GET /crops/1.json
def show
- @crop = Crop.includes(:scientific_names, {plantings: :photos}).find(params[:id])
+ @crop = Crop.includes(:scientific_names, { plantings: :photos }).find(params[:id])
@posts = @crop.posts.paginate(page: params[:page])
respond_to do |format|
@@ -90,10 +90,10 @@ class CropsController < ApplicationController
}
}
render json: @crop.to_json(include: {
- plantings: {
- include: owner_structure
- }
- })
+ plantings: {
+ include: owner_structure
+ }
+ })
end
end
end
@@ -116,13 +116,11 @@ class CropsController < ApplicationController
@crop = Crop.find(params[:id])
@crop.alternate_names.build if @crop.alternate_names.blank?
@crop.scientific_names.build if @crop.scientific_names.blank?
-
end
# POST /crops
# POST /crops.json
def create
-
@crop = Crop.new(crop_params)
if current_member.has_role? :crop_wrangler
@@ -220,14 +218,14 @@ class CropsController < ApplicationController
def crop_params
params.require(:crop).permit(:en_wikipedia_url,
- :name,
- :parent_id,
- :creator_id,
- :approval_status,
- :request_notes,
- :reason_for_rejection,
- :rejection_notes, scientific_names_attributes: [:scientific_name,
- :_destroy,
- :id])
+ :name,
+ :parent_id,
+ :creator_id,
+ :approval_status,
+ :request_notes,
+ :reason_for_rejection,
+ :rejection_notes, scientific_names_attributes: [:scientific_name,
+ :_destroy,
+ :id])
end
end
diff --git a/app/controllers/follows_controller.rb b/app/controllers/follows_controller.rb
index 2e2e5ec48..58a1ce795 100644
--- a/app/controllers/follows_controller.rb
+++ b/app/controllers/follows_controller.rb
@@ -5,11 +5,10 @@ class FollowsController < ApplicationController
# POST /follows
def create
-
@follow = current_member.follows.build(followed_id: follow_params[:followed_id])
if @follow.save
- flash[:notice] = "Followed #{ @follow.followed.login_name }"
+ flash[:notice] = "Followed #{@follow.followed.login_name}"
redirect_to :back
else
flash[:error] = "Already following or error while following."
@@ -23,7 +22,7 @@ class FollowsController < ApplicationController
unfollowed_name = @follow.followed.login_name
@follow.destroy
- flash[:notice] = "Unfollowed #{ unfollowed_name }"
+ flash[:notice] = "Unfollowed #{unfollowed_name}"
redirect_to root_path
end
diff --git a/app/controllers/gardens_controller.rb b/app/controllers/gardens_controller.rb
index 6fe5347be..5820b83d3 100644
--- a/app/controllers/gardens_controller.rb
+++ b/app/controllers/gardens_controller.rb
@@ -2,7 +2,6 @@ class GardensController < ApplicationController
before_filter :authenticate_member!, except: [:index, :show]
load_and_authorize_resource
-
# GET /gardens
# GET /gardens.json
def index
@@ -98,6 +97,6 @@ class GardensController < ApplicationController
def garden_params
params.require(:garden).permit(:name, :slug, :owner_id, :description, :active,
- :location, :latitude, :longitude, :area, :area_unit)
+ :location, :latitude, :longitude, :area, :area_unit)
end
end
diff --git a/app/controllers/harvests_controller.rb b/app/controllers/harvests_controller.rb
index d7f153016..051cb1132 100644
--- a/app/controllers/harvests_controller.rb
+++ b/app/controllers/harvests_controller.rb
@@ -7,13 +7,13 @@ class HarvestsController < ApplicationController
def index
@owner = Member.find_by_slug(params[:owner])
@crop = Crop.find_by_slug(params[:crop])
- if @owner
- @harvests = @owner.harvests.includes(:owner, :crop)
- elsif @crop
- @harvests = @crop.harvests.includes(:owner, :crop)
- else
- @harvests = Harvest.includes(:owner, :crop)
- end
+ @harvests = if @owner
+ @owner.harvests.includes(:owner, :crop)
+ elsif @crop
+ @crop.harvests.includes(:owner, :crop)
+ else
+ Harvest.includes(:owner, :crop)
+ end
respond_to do |format|
format.html { @harvests = @harvests.paginate(page: params[:page]) }
@@ -32,7 +32,7 @@ class HarvestsController < ApplicationController
@harvest = Harvest.new('harvested_at' => Date.today)
# using find_by_id here because it returns nil, unlike find
- @crop = Crop.find_by_id(params[:crop_id]) || Crop.new
+ @crop = Crop.find_by_id(params[:crop_id]) || Crop.new
respond_to do |format|
format.html # new.html.erb
@@ -95,6 +95,6 @@ class HarvestsController < ApplicationController
def harvest_params
params.require(:harvest).permit(:crop_id, :harvested_at, :description, :owner_id,
- :quantity, :unit, :weight_quantity, :weight_unit, :plant_part_id, :slug, :si_weight)
+ :quantity, :unit, :weight_quantity, :weight_unit, :plant_part_id, :slug, :si_weight)
end
end
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 69e9a95a2..9eb6e5003 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -2,7 +2,6 @@ class HomeController < ApplicationController
skip_authorize_resource
def index
-
# we were previously generating a lot of instance variables like
# @members_count and @interesting_crops in here, but now we call
# the relevant class methods directly in the view, so that fragment
@@ -12,5 +11,4 @@ class HomeController < ApplicationController
format.html # index.html.haml
end
end
-
end
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index 027b40f21..d13a5e843 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -7,18 +7,18 @@ class MembersController < ApplicationController
def index
@sort = params[:sort]
- if @sort == 'recently_joined'
- @members = Member.confirmed.recently_joined.paginate(page: params[:page])
- else
- @members = Member.confirmed.paginate(page: params[:page])
- end
+ @members = if @sort == 'recently_joined'
+ Member.confirmed.recently_joined.paginate(page: params[:page])
+ else
+ Member.confirmed.paginate(page: params[:page])
+ end
respond_to do |format|
format.html # index.html.haml
format.json {
render json: @members.to_json(only: [
- :id, :login_name, :slug, :bio, :created_at, :location, :latitude, :longitude
- ])
+ :id, :login_name, :slug, :bio, :created_at, :location, :latitude, :longitude
+ ])
}
end
end
@@ -38,8 +38,8 @@ class MembersController < ApplicationController
format.html # show.html.haml
format.json {
render json: @member.to_json(only: [
- :id, :login_name, :bio, :created_at, :slug, :location, :latitude, :longitude
- ])
+ :id, :login_name, :bio, :created_at, :slug, :location, :latitude, :longitude
+ ])
}
format.rss { render(
layout: false,
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb
index bf479ccbc..e89f7577a 100644
--- a/app/controllers/omniauth_callbacks_controller.rb
+++ b/app/controllers/omniauth_callbacks_controller.rb
@@ -10,6 +10,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
create
end
+
def failure
flash[:alert] = "Authentication failed."
redirect_to request.env['omniauth.origin'] || "/"
@@ -27,7 +28,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
@authentication = action.establish_authentication(auth, member)
unless action.member_created?
- sign_in_and_redirect member, event: :authentication #this will throw if @user is not activated
+ sign_in_and_redirect member, event: :authentication # this will throw if @user is not activated
set_flash_message(:notice, :success, kind: auth['provider']) if is_navigational_format?
else
raise "Invalid provider" unless ['facebook', 'twitter', 'flickr'].index(auth['provider'].to_s)
diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb
index 82bb337f9..234c760f2 100644
--- a/app/controllers/orders_controller.rb
+++ b/app/controllers/orders_controller.rb
@@ -49,7 +49,6 @@ class OrdersController < ApplicationController
format.html { render action: "show" }
end
end
-
end
def complete
@@ -78,7 +77,6 @@ class OrdersController < ApplicationController
respond_to do |format|
format.html # new.html.erb
end
-
end
def cancel
diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb
index 1ec2486cc..c14a02b40 100644
--- a/app/controllers/passwords_controller.rb
+++ b/app/controllers/passwords_controller.rb
@@ -1,6 +1,6 @@
class PasswordsController < Devise::PasswordsController
+ protected
-protected
def after_resetting_password_path_for(resource)
root_path
end
diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb
index 64583a143..ba2d24cee 100644
--- a/app/controllers/photos_controller.rb
+++ b/app/controllers/photos_controller.rb
@@ -102,7 +102,7 @@ class PhotosController < ApplicationController
def photo_params
params.require(:photo).permit(:flickr_photo_id, :owner_id, :title, :license_name,
- :license_url, :thumbnail_url, :fullsize_url, :link_url)
+ :license_url, :thumbnail_url, :fullsize_url, :link_url)
end
def find_or_create_photo_from_flickr_photo
diff --git a/app/controllers/places_controller.rb b/app/controllers/places_controller.rb
index 2f7331b3a..4982b1830 100644
--- a/app/controllers/places_controller.rb
+++ b/app/controllers/places_controller.rb
@@ -7,8 +7,8 @@ class PlacesController < ApplicationController
# json response is whatever we want to map here
format.json do
render json: Member.located.to_json(only: [
- :id, :login_name, :slug, :location, :latitude, :longitude
- ])
+ :id, :login_name, :slug, :location, :latitude, :longitude
+ ])
end
end
end
@@ -22,8 +22,8 @@ class PlacesController < ApplicationController
format.html # show.html.haml
format.json do
render json: @nearby_members.to_json(only: [
- :id, :login_name, :slug, :location, :latitude, :longitude
- ])
+ :id, :login_name, :slug, :location, :latitude, :longitude
+ ])
end
end
end
@@ -43,5 +43,4 @@ class PlacesController < ApplicationController
end
end
end
-
end
diff --git a/app/controllers/plantings_controller.rb b/app/controllers/plantings_controller.rb
index ca9de8ef0..2c4589e40 100644
--- a/app/controllers/plantings_controller.rb
+++ b/app/controllers/plantings_controller.rb
@@ -7,18 +7,18 @@ class PlantingsController < ApplicationController
def index
@owner = Member.find_by_slug(params[:owner])
@crop = Crop.find_by_slug(params[:crop])
- if @owner
- @plantings = @owner.plantings.includes(:owner, :crop, :garden).paginate(page: params[:page])
- elsif @crop
- @plantings = @crop.plantings.includes(:owner, :crop, :garden).paginate(page: params[:page])
- else
- @plantings = Planting.includes(:owner, :crop, :garden).paginate(page: params[:page])
- end
+ @plantings = if @owner
+ @owner.plantings.includes(:owner, :crop, :garden).paginate(page: params[:page])
+ elsif @crop
+ @crop.plantings.includes(:owner, :crop, :garden).paginate(page: params[:page])
+ else
+ Planting.includes(:owner, :crop, :garden).paginate(page: params[:page])
+ end
respond_to do |format|
format.html { @plantings = @plantings.paginate(page: params[:page]) }
format.json { render json: @plantings }
- format.rss { render layout: false } #index.rss.builder
+ format.rss { render layout: false } # index.rss.builder
format.csv do
specifics = (@owner ? "#{@owner.login_name}-" : @crop ? "#{@crop.name}-" : nil)
@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_s(:number)}.csv"
@@ -120,8 +120,8 @@ class PlantingsController < ApplicationController
def planting_params
params.require(:planting).permit(:crop_id, :description, :garden_id, :planted_at,
- :quantity, :sunniness, :planted_from, :owner_id, :finished,
- :finished_at)
+ :quantity, :sunniness, :planted_from, :owner_id, :finished,
+ :finished_at)
end
def update_days_before_maturity(planting, crop_id)
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index e30ea1f7f..48216ac87 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -7,16 +7,16 @@ class PostsController < ApplicationController
def index
@author = Member.find_by_slug(params[:author])
- if @author
- @posts = @author.posts.includes(:author, { comments: :author }).paginate(page: params[:page])
- else
- @posts = Post.includes(:author, { comments: :author }).paginate(page: params[:page])
- end
+ @posts = if @author
+ @author.posts.includes(:author, { comments: :author }).paginate(page: params[:page])
+ else
+ Post.includes(:author, { comments: :author }).paginate(page: params[:page])
+ end
respond_to do |format|
format.html # index.html.haml
format.json { render json: @posts }
- format.rss { render layout: false } #index.rss.builder
+ format.rss { render layout: false } # index.rss.builder
end
end
diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb
index 1ed69703f..be3e923dd 100644
--- a/app/controllers/products_controller.rb
+++ b/app/controllers/products_controller.rb
@@ -74,6 +74,6 @@ class ProductsController < ApplicationController
def product_params
params.require(:product).permit(:description, :min_price, :recommended_price, :name,
- :account_type_id, :paid_months)
+ :account_type_id, :paid_months)
end
end
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index f251983eb..98651eb00 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -8,23 +8,22 @@ class RegistrationsController < Devise::RegistrationsController
render "edit"
end
-# we need this subclassed method so that Devise doesn't force people to
-# change their password every time they want to edit their settings.
-# we also check that they give their current password to change their password.
-# Code copied from
-# https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password
+ # we need this subclassed method so that Devise doesn't force people to
+ # change their password every time they want to edit their settings.
+ # we also check that they give their current password to change their password.
+ # Code copied from
+ # https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password
def update
-
@member = Member.find(current_member.id)
- successfully_updated = if needs_password?(@member, params)
- @member.update_with_password(devise_parameter_sanitizer.sanitize(:account_update))
+ if needs_password?(@member, params)
+ successfully_updated = @member.update_with_password(devise_parameter_sanitizer.sanitize(:account_update))
else
# remove the virtual current_password attribute
# update_without_password doesn't know how to ignore it
params[:member].delete(:current_password)
- @member.update_without_password(devise_parameter_sanitizer.sanitize(:account_update))
+ successfully_updated = @member.update_without_password(devise_parameter_sanitizer.sanitize(:account_update))
end
if successfully_updated
@@ -35,12 +34,11 @@ class RegistrationsController < Devise::RegistrationsController
else
render "edit"
end
-
end
end
# check if we need the current password to update fields
def needs_password?(member, params)
params[:member][:password].present? ||
- params[:member][:password_confirmation].present?
+ params[:member][:password_confirmation].present?
end
diff --git a/app/controllers/robots_controller.rb b/app/controllers/robots_controller.rb
index 090e0e031..d74ffe20f 100644
--- a/app/controllers/robots_controller.rb
+++ b/app/controllers/robots_controller.rb
@@ -1,14 +1,9 @@
class RobotsController < ApplicationController
-
DEFAULT_FILENAME = 'config/robots.txt'.freeze
def robots
- filename = if subdomain && subdomain != 'www'
- "config/robots.#{ subdomain }.txt"
- end
-
+ filename = "config/robots.#{subdomain}.txt" if subdomain && subdomain != 'www'
file_to_render = File.exists?(filename.to_s) ? filename : DEFAULT_FILENAME
-
render file: file_to_render, layout: false, content_type: 'text/plain'
end
diff --git a/app/controllers/seeds_controller.rb b/app/controllers/seeds_controller.rb
index 70f3936a1..188855f45 100644
--- a/app/controllers/seeds_controller.rb
+++ b/app/controllers/seeds_controller.rb
@@ -7,18 +7,18 @@ class SeedsController < ApplicationController
def index
@owner = Member.find_by_slug(params[:owner])
@crop = Crop.find_by_slug(params[:crop])
- if @owner
- @seeds = @owner.seeds.includes(:owner, :crop).paginate(page: params[:page])
- elsif @crop
- @seeds = @crop.seeds.includes(:owner, :crop).paginate(page: params[:page])
- else
- @seeds = Seed.includes(:owner, :crop).paginate(page: params[:page])
- end
+ @seeds = if @owner
+ @owner.seeds.includes(:owner, :crop).paginate(page: params[:page])
+ elsif @crop
+ @crop.seeds.includes(:owner, :crop).paginate(page: params[:page])
+ else
+ Seed.includes(:owner, :crop).paginate(page: params[:page])
+ end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @seeds }
- format.rss { render layout: false } #index.rss.builder
+ format.rss { render layout: false } # index.rss.builder
format.csv do
if @owner
@filename = "Growstuff-#{@owner}-Seeds-#{Time.zone.now.to_s(:number)}.csv"
@@ -49,7 +49,7 @@ class SeedsController < ApplicationController
@seed = Seed.new
# using find_by_id here because it returns nil, unlike find
- @crop = Crop.find_by_id(params[:crop_id]) || Crop.new
+ @crop = Crop.find_by_id(params[:crop_id]) || Crop.new
respond_to do |format|
format.html # new.html.erb
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 89646d8b3..0aa552bdf 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,5 +1,4 @@
module ApplicationHelper
-
def price_in_dollars(price)
return sprintf('%.2f', price / 100.0)
end
@@ -7,7 +6,7 @@ module ApplicationHelper
# 999 cents becomes 9.99 AUD -- for products/orders/etc
def price_with_currency(price)
return sprintf('%.2f %s', price / 100.0,
- Growstuff::Application.config.currency)
+ Growstuff::Application.config.currency)
end
def parse_date(str)
@@ -26,20 +25,20 @@ module ApplicationHelper
def build_alert_classes(alert_type = :info)
classes = 'alert alert-dismissable '
case alert_type.to_sym
- when :alert, :danger, :error, :validation_errors
- classes += 'alert-danger'
- when :warning, :todo
- classes += 'alert-warning'
- when :notice, :success
- classes += 'alert-success'
- when :info
- classes += 'alert-info'
+ when :alert, :danger, :error, :validation_errors
+ classes += 'alert-danger'
+ when :warning, :todo
+ classes += 'alert-warning'
+ when :notice, :success
+ classes += 'alert-success'
+ when :info
+ classes += 'alert-info'
end
classes
end
# Produces a cache key for uniquely identifying cached fragments.
- def cache_key_for(klass, identifier="all")
+ def cache_key_for(klass, identifier = "all")
count = klass.count
max_updated_at = klass.maximum(:updated_at).try(:utc).try(:to_s, :number)
"#{klass.name.downcase.pluralize}/#{identifier}-#{count}-#{max_updated_at}"
@@ -73,9 +72,9 @@ module ApplicationHelper
end
Gravatar.new(member.email).image_url({
- size: size,
- default: :identicon
- })
+ size: size,
+ default: :identicon
+ })
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 9750b342b..a8a86de56 100644
--- a/app/helpers/auto_suggest_helper.rb
+++ b/app/helpers/auto_suggest_helper.rb
@@ -1,6 +1,5 @@
module AutoSuggestHelper
-
- def auto_suggest(resource, source, options={})
+ def auto_suggest(resource, source, options = {})
if options[:default] && !options[:default].new_record?
default = options[:default]
default_id = options[:default].try(:id)
@@ -23,5 +22,4 @@ module AutoSuggestHelper
type="hidden" name="#{resource}[#{source}_id]" value="#{default_id}">
}.html_safe
end
-
end
diff --git a/app/helpers/crops_helper.rb b/app/helpers/crops_helper.rb
index 512efce8d..da3f72f10 100644
--- a/app/helpers/crops_helper.rb
+++ b/app/helpers/crops_helper.rb
@@ -2,7 +2,7 @@ module CropsHelper
def display_seed_availability(member, crop)
total_quantity = 0
- seeds = member.seeds.select {|seed| seed.crop.name == crop.name }
+ seeds = member.seeds.select { |seed| seed.crop.name == crop.name }
seeds.each do |seed|
total_quantity = total_quantity + seed.quantity if seed.quantity
diff --git a/app/helpers/gardens_helper.rb b/app/helpers/gardens_helper.rb
index fc2beae4f..5d1895e8f 100644
--- a/app/helpers/gardens_helper.rb
+++ b/app/helpers/gardens_helper.rb
@@ -1,5 +1,4 @@
module GardensHelper
-
def display_garden_description(garden)
if garden.description.nil?
"no description provided."
diff --git a/app/helpers/harvests_helper.rb b/app/helpers/harvests_helper.rb
index b5f695a9d..d848d919f 100644
--- a/app/helpers/harvests_helper.rb
+++ b/app/helpers/harvests_helper.rb
@@ -1,5 +1,4 @@
module HarvestsHelper
-
def display_quantity(harvest)
human_quantity = display_human_quantity(harvest)
weight = display_weight(harvest)
@@ -16,10 +15,10 @@ module HarvestsHelper
end
def display_human_quantity(harvest)
- if ! harvest.quantity.blank? && harvest.quantity > 0
+ if !harvest.quantity.blank? && harvest.quantity > 0
if harvest.unit == 'individual' # just the number
number_to_human(harvest.quantity, strip_insignificant_zeros: true)
- elsif ! harvest.unit.blank? # pluralize anything else
+ elsif !harvest.unit.blank? # pluralize anything else
return pluralize(number_to_human(harvest.quantity, strip_insignificant_zeros: true), harvest.unit)
else
return "#{number_to_human(harvest.quantity, strip_insignificant_zeros: true)} #{harvest.unit}"
@@ -30,7 +29,7 @@ module HarvestsHelper
end
def display_weight(harvest)
- if ! harvest.weight_quantity.blank? && harvest.weight_quantity > 0
+ if !harvest.weight_quantity.blank? && harvest.weight_quantity > 0
return "#{number_to_human(harvest.weight_quantity, strip_insignificant_zeros: true)} #{harvest.weight_unit}"
else
return nil
@@ -44,5 +43,4 @@ module HarvestsHelper
harvest.description
end
end
-
end
diff --git a/app/helpers/plantings_helper.rb b/app/helpers/plantings_helper.rb
index fb6e2e7dc..e237ae27d 100644
--- a/app/helpers/plantings_helper.rb
+++ b/app/helpers/plantings_helper.rb
@@ -1,5 +1,4 @@
module PlantingsHelper
-
def display_days_before_maturity(planting)
if planting.finished?
0
@@ -41,5 +40,4 @@ module PlantingsHelper
return "#{planting.owner}."
end
end
-
end
diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb
index 57974620c..281f0b6ee 100644
--- a/app/mailers/notifier.rb
+++ b/app/mailers/notifier.rb
@@ -33,7 +33,7 @@ class Notifier < ActionMailer::Base
if @member.send_planting_reminder
mail(to: @member.email,
- subject: "What have you planted lately?")
+ subject: "What have you planted lately?")
end
end
@@ -51,5 +51,4 @@ class Notifier < ActionMailer::Base
@member, @crop = member, crop
mail(to: @member.email, subject: "#{crop.name.capitalize} has been rejected")
end
-
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index d0b9c2f56..4ce056438 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -108,7 +108,7 @@ class Ability
can :cancel, Order, member_id: member.id, completed_at: nil
can :destroy, Order, member_id: member.id, completed_at: nil
- can :create, OrderItem
+ can :create, OrderItem
# for now, let's not let people mess with individual order items
cannot :read, OrderItem, order: { member_id: member.id }
cannot :update, OrderItem, order: { member_id: member.id, completed_at: nil }
diff --git a/app/models/account.rb b/app/models/account.rb
index 926640b30..449697e05 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -21,5 +21,4 @@ class Account < ActiveRecord::Base
return paid_until.to_s
end
end
-
end
diff --git a/app/models/comment.rb b/app/models/comment.rb
index e649eb2b4..c1a49a2bb 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -19,5 +19,4 @@ class Comment < ActiveRecord::Base
)
end
end
-
end
diff --git a/app/models/crop.rb b/app/models/crop.rb
index 67694b8d0..60fd79f42 100644
--- a/app/models/crop.rb
+++ b/app/models/crop.rb
@@ -19,7 +19,7 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
belongs_to :parent, class_name: 'Crop'
has_many :varieties, class_name: 'Crop', foreign_key: 'parent_id'
has_and_belongs_to_many :posts
- before_destroy {|crop| crop.posts.clear}
+ before_destroy { |crop| crop.posts.clear }
default_scope { order("lower(name) asc") }
scope :recent, lambda {
@@ -31,7 +31,7 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
scope :popular, lambda {
where(approval_status: "approved").reorder("plantings_count desc, lower(name) asc")
}
- scope :randomized, lambda {
+ scope :randomized, lambda {
# ok on sqlite and psql, but not on mysql
where(approval_status: "approved").reorder('random()')
}
@@ -66,24 +66,24 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
# use Rails.env as a part of index name (eg. development_growstuff)
index_name [Rails.env, "growstuff"].join('_')
settings index: { number_of_shards: 1 },
- analysis: {
- tokenizer: {
- gs_edgeNGram_tokenizer: {
- type: "edgeNGram", # edgeNGram: NGram match from the start of a token
- min_gram: 3,
- max_gram: 10,
- # token_chars: Elasticsearch will split on characters
- # that don’t belong to any of these classes
- token_chars: [ "letter", "digit" ]
- }
- },
- analyzer: {
- gs_edgeNGram_analyzer: {
- tokenizer: "gs_edgeNGram_tokenizer",
- filter: ["lowercase"]
- }
- },
- } do
+ analysis: {
+ tokenizer: {
+ gs_edgeNGram_tokenizer: {
+ type: "edgeNGram", # edgeNGram: NGram match from the start of a token
+ min_gram: 3,
+ max_gram: 10,
+ # token_chars: Elasticsearch will split on characters
+ # that don’t belong to any of these classes
+ token_chars: ["letter", "digit"]
+ }
+ },
+ analyzer: {
+ gs_edgeNGram_analyzer: {
+ tokenizer: "gs_edgeNGram_tokenizer",
+ filter: ["lowercase"]
+ }
+ },
+ } do
mappings dynamic: 'false' do
indexes :id, type: 'long'
indexes :name, type: 'string', analyzer: 'gs_edgeNGram_analyzer'
@@ -103,13 +103,13 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
end
end
- def as_indexed_json(options={})
+ def as_indexed_json(options = {})
self.as_json(
only: [:id, :name, :approval_status],
include: {
scientific_names: { only: :name },
alternate_names: { only: :name }
- })
+ })
end
# update the Elasticsearch index (only if we're using it in this
@@ -196,18 +196,18 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
end
def approval_statuses
- [ 'rejected', 'pending', 'approved' ]
+ ['rejected', 'pending', 'approved']
end
def reasons_for_rejection
- [ "already in database", "not edible", "not enough information", "other" ]
+ ["already in database", "not edible", "not enough information", "other"]
end
# Crop.interesting
# returns a list of interesting crops, for use on the homepage etc
def Crop.interesting
- howmany = 12 # max number to find
- interesting_crops = []
+ howmany = 12 # max number to find
+ interesting_crops = []
Crop.includes(:photos).randomized.each do |c|
break if interesting_crops.size == howmany
next unless c.interesting?
@@ -216,16 +216,16 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
return interesting_crops
end
-# Crop.create_from_csv(row)
-# used by db/seeds.rb and rake growstuff:import_crops
-# CSV fields:
-# - name (required)
-# - en_wikipedia_url (required)
-# - parent (name, optional)
-# - scientific name (optional, can be picked up from parent if it has one)
+ # Crop.create_from_csv(row)
+ # used by db/seeds.rb and rake growstuff:import_crops
+ # CSV fields:
+ # - name (required)
+ # - en_wikipedia_url (required)
+ # - parent (name, optional)
+ # - scientific name (optional, can be picked up from parent if it has one)
def Crop.create_from_csv(row)
- name,en_wikipedia_url,parent,scientific_names,alternate_names = row
+ name, en_wikipedia_url, parent, scientific_names, alternate_names = row
cropbot = Member.find_by_login_name('cropbot')
raise "cropbot account not found: run rake db:seed" unless cropbot
@@ -247,12 +247,11 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
crop.add_scientific_names_from_csv(scientific_names)
crop.add_alternate_names_from_csv(alternate_names)
-
end
def add_scientific_names_from_csv(scientific_names)
names_to_add = []
- if ! scientific_names.blank? # i.e. we actually passed something in, which isn't a given
+ if !scientific_names.blank? # i.e. we actually passed something in, which isn't a given
names_to_add = scientific_names.split(%r{,\s*})
elsif parent && parent.scientific_names.size > 0 # pick up from parent
names_to_add = parent.scientific_names.map{|s| s.name}
@@ -273,7 +272,8 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
cropbot = Member.find_by_login_name('cropbot')
names_to_add = []
- if ! alternate_names.blank? # i.e. we actually passed something in, which isn't a given
+
+ if !alternate_names.blank? # i.e. we actually passed something in, which isn't a given
raise "cropbot account not found: run rake db:seed" unless cropbot
names_to_add = alternate_names.split(%r{,\s*})
@@ -293,21 +293,23 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
def self.search(query)
if ENV['GROWSTUFF_ELASTICSEARCH'] == "true"
search_str = query.nil? ? "" : query.downcase
- response = __elasticsearch__.search( {
- # Finds documents which match any field, but uses the _score from
- # the best field insead of adding up _score from each field.
- query: {
- multi_match: {
- query: "#{search_str}",
- analyzer: "standard",
- fields: ["name", "scientific_names.scientific_name", "alternate_names.name"]
- }
- },
- filter: {
- term: {approval_status: "approved"}
- },
- size: 50
- }
+ response = __elasticsearch__.search({
+ # Finds documents which match any field, but uses the _score from
+ # the best field insead of adding up _score from each field.
+ query: {
+ multi_match: {
+ query: "#{search_str}",
+ analyzer: "standard",
+ fields: ["name",
+ "scientific_names.scientific_name",
+ "alternate_names.name"]
+ }
+ },
+ filter: {
+ term: { approval_status: "approved" }
+ },
+ size: 50
+ }
)
return response.records.to_a
else
@@ -387,5 +389,4 @@ class Crop < ActiveRecord::Base # rubocop:disable Metrics/ClassLength
errors.add(:rejection_notes, "must be added if the reason for rejection is \"other\"")
end
end
-
end
diff --git a/app/models/follow.rb b/app/models/follow.rb
index 997352ebf..733c4fb43 100644
--- a/app/models/follow.rb
+++ b/app/models/follow.rb
@@ -11,6 +11,4 @@ class Follow < ActiveRecord::Base
body: "#{self.follower.login_name} just followed you on #{ENV["GROWSTUFF_SITE_NAME"]}. "
)
end
-
-
end
diff --git a/app/models/forum.rb b/app/models/forum.rb
index 0e2e2615d..810653d7c 100644
--- a/app/models/forum.rb
+++ b/app/models/forum.rb
@@ -8,5 +8,4 @@ class Forum < ActiveRecord::Base
def to_s
return name
end
-
end
diff --git a/app/models/garden.rb b/app/models/garden.rb
index 332200f04..ec4aea94f 100644
--- a/app/models/garden.rb
+++ b/app/models/garden.rb
@@ -9,14 +9,14 @@ class Garden < ActiveRecord::Base
has_and_belongs_to_many :photos
- before_destroy do |garden|
- photolist = garden.photos.to_a # save a temp copy of the photo list
- garden.photos.clear # clear relationship b/w garden and photo
+ before_destroy do |garden|
+ photolist = garden.photos.to_a # save a temp copy of the photo list
+ garden.photos.clear # clear relationship b/w garden and photo
- photolist.each do |photo|
- photo.destroy_if_unused
- end
- end
+ photolist.each do |photo|
+ photo.destroy_if_unused
+ end
+ end
# set up geocoding
geocoded_by :location
@@ -50,9 +50,9 @@ class Garden < ActiveRecord::Base
"acres" => "acre"
}
validates :area_unit, inclusion: { in: AREA_UNITS_VALUES.values,
- message: "%{value} is not a valid area unit" },
- allow_nil: true,
- allow_blank: true
+ message: "%{value} is not a valid area unit" },
+ allow_nil: true,
+ allow_blank: true
after_validation :cleanup_area
@@ -76,7 +76,7 @@ class Garden < ActiveRecord::Base
seen_crops = []
plantings.each do |p|
- if (! seen_crops.include?(p.crop))
+ if (!seen_crops.include?(p.crop))
unique_plantings.push(p)
seen_crops.push(p.crop)
end
@@ -103,5 +103,4 @@ class Garden < ActiveRecord::Base
def default_photo
return photos.first
end
-
end
diff --git a/app/models/harvest.rb b/app/models/harvest.rb
index 176562d9d..04f4608f2 100644
--- a/app/models/harvest.rb
+++ b/app/models/harvest.rb
@@ -22,9 +22,9 @@ class Harvest < ActiveRecord::Base
validates :crop, approved: true
- validates :crop, presence: {message: "must be present and exist in our database"}
+ validates :crop, presence: { message: "must be present and exist in our database" }
- validates :plant_part, presence: {message: "must be present and exist in our database"}
+ validates :plant_part, presence: { message: "must be present and exist in our database" }
validates :quantity,
numericality: {
@@ -45,9 +45,9 @@ class Harvest < ActiveRecord::Base
"bushels" => "bushel"
}
validates :unit, inclusion: { in: UNITS_VALUES.values,
- message: "%{value} is not a valid unit" },
- allow_nil: true,
- allow_blank: true
+ message: "%{value} is not a valid unit" },
+ allow_nil: true,
+ allow_blank: true
validates :weight_quantity,
numericality: { only_integer: false },
@@ -59,9 +59,9 @@ class Harvest < ActiveRecord::Base
"oz" => "oz"
}
validates :weight_unit, inclusion: { in: WEIGHT_UNITS_VALUES.values,
- message: "%{value} is not a valid unit" },
- allow_nil: true,
- allow_blank: true
+ message: "%{value} is not a valid unit" },
+ allow_nil: true,
+ allow_blank: true
after_validation :cleanup_quantities
@@ -105,24 +105,22 @@ class Harvest < ActiveRecord::Base
string = ''
if self.quantity
string += "#{number_to_human(self.quantity.to_s, strip_insignificant_zeros: true)} "
- if self.unit == 'individual'
- string += 'individual '
- else
- if self.quantity == 1
- string += "#{self.unit} of "
- else
- string += "#{self.unit.pluralize} of "
- end
- end
+ string += if self.unit == 'individual'
+ 'individual '
+ elsif self.quantity == 1
+ "#{self.unit} of "
+ else
+ "#{self.unit.pluralize} of "
+ end
end
- if self.unit != 'individual' # buckets of apricot*s*
- string += "#{self.crop.name.pluralize}"
- elsif self.quantity == 1
- string += "#{self.crop.name}"
- else
- string += "#{self.crop.name.pluralize}"
- end
+ string += if self.unit != 'individual' # buckets of apricot*s*
+ "#{self.crop.name.pluralize}"
+ elsif self.quantity == 1
+ "#{self.crop.name}"
+ else
+ "#{self.crop.name.pluralize}"
+ end
if self.weight_quantity
string += " weighing #{number_to_human(self.weight_quantity, strip_insignificant_zeros: true)}"\
@@ -135,5 +133,4 @@ class Harvest < ActiveRecord::Base
def default_photo
return photos.first || crop.default_photo
end
-
end
diff --git a/app/models/member.rb b/app/models/member.rb
index 5db62f2d7..018860365 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -4,7 +4,7 @@ class Member < ActiveRecord::Base
friendly_id :login_name, use: [:slugged, :finders]
- has_many :posts, foreign_key: 'author_id'
+ has_many :posts, foreign_key: 'author_id'
has_many :comments, foreign_key: 'author_id'
has_many :forums, foreign_key: 'owner_id'
@@ -27,7 +27,6 @@ class Member < ActiveRecord::Base
has_many :photos
-
default_scope { order("lower(login_name) asc") }
scope :confirmed, -> { where('confirmed_at IS NOT NULL') }
scope :located, -> { where("location <> '' and latitude IS NOT NULL and longitude IS NOT NULL") }
@@ -45,8 +44,8 @@ class Member < ActiveRecord::Base
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable,
- :confirmable, :lockable, :timeoutable, :omniauthable
+ :recoverable, :rememberable, :trackable, :validatable,
+ :confirmable, :lockable, :timeoutable, :omniauthable
# set up geocoding
geocoded_by :location
@@ -59,7 +58,7 @@ class Member < ActiveRecord::Base
# Requires acceptance of the Terms of Service
validates_acceptance_of :tos_agreement, allow_nil: true,
- accept: true
+ accept: true
validates :login_name,
length: {
@@ -80,12 +79,12 @@ class Member < ActiveRecord::Base
}
# Give each new member a default garden
- after_create {|member| Garden.create(name: "Garden", owner_id: member.id) }
+ after_create { |member| Garden.create(name: "Garden", owner_id: member.id) }
# and an account record (for paid accounts etc)
# we use find_or_create to avoid accidentally creating a second one,
# which can happen sometimes especially with FactoryGirl associations
- after_create {|member| Account.find_or_create_by(member_id: member.id) }
+ after_create { |member| Account.find_or_create_by(member_id: member.id) }
after_save :update_newsletter_subscription
@@ -159,21 +158,21 @@ class Member < ActiveRecord::Base
# Fetches a collection of photos from Flickr
# Returns a [[page of photos], total] pair.
# Total is needed for pagination.
- def flickr_photos(page_num=1, set=nil)
+ def flickr_photos(page_num = 1, set = nil)
result = false
- if set
- result = flickr.photosets.getPhotos(
- photoset_id: set,
- page: page_num,
- per_page: 30
- )
- else
- result = flickr.people.getPhotos(
- user_id: 'me',
- page: page_num,
- per_page: 30
- )
- end
+ result = if set
+ flickr.photosets.getPhotos(
+ photoset_id: set,
+ page: page_num,
+ per_page: 30
+ )
+ else
+ flickr.people.getPhotos(
+ user_id: 'me',
+ page: page_num,
+ per_page: 30
+ )
+ end
if result
return [result.photo, result.total]
else
@@ -213,7 +212,7 @@ class Member < ActiveRecord::Base
def Member.nearest_to(place)
nearby_members = []
if place
- latitude, longitude = Geocoder.coordinates(place, params: {limit: 1})
+ latitude, longitude = Geocoder.coordinates(place, params: { limit: 1 })
if latitude && longitude
nearby_members = Member.located.sort_by { |x| x.distance_from([latitude, longitude]) }
end
@@ -235,24 +234,24 @@ class Member < ActiveRecord::Base
end
end
- def newsletter_subscribe(testing=false)
+ def newsletter_subscribe(testing = false)
return true if (Rails.env.test? && !testing)
gb = Gibbon::API.new
res = gb.lists.subscribe({
- id: Growstuff::Application.config.newsletter_list_id,
- email: { email: email },
- merge_vars: { login_name: login_name },
- double_optin: false # they already confirmed their email with us
- })
+ id: Growstuff::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
- def newsletter_unsubscribe(testing=false)
+ def newsletter_unsubscribe(testing = false)
return true if (Rails.env.test? && !testing)
gb = Gibbon::API.new
res = gb.lists.unsubscribe({
- id: Growstuff::Application.config.newsletter_list_id,
- email: { email: email }
- })
+ id: Growstuff::Application.config.newsletter_list_id,
+ email: { email: email }
+ })
end
def already_following?(member)
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 567867b00..c970d4218 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -26,5 +26,4 @@ class Notification < ActiveRecord::Base
Notifier.notify(self).deliver_later
end
end
-
end
diff --git a/app/models/order.rb b/app/models/order.rb
index 8ccdaa9db..df8609184 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -27,10 +27,10 @@ class Order < ActiveRecord::Base
items = []
order_items.each do |i|
items.push({
- name: i.product.name,
- quantity: i.quantity,
- amount: i.price
- })
+ name: i.product.name,
+ quantity: i.quantity,
+ amount: i.price
+ })
end
return items
end
@@ -62,35 +62,34 @@ class Order < ActiveRecord::Base
# search orders (used by admin/orders)
# usage: Order.search({ :by => 'member', :for => 'Skud' })
# can search by: member, order_id, paypal_token, paypal_payer_id,
- def Order.search(args={})
+ def Order.search(args = {})
if args[:for]
case args[:by]
- when "member"
- member = Member.find_by_login_name(args[:for])
- if member
- return member.orders
- end
- when "order_id"
- order = Order.find_by_id(args[:for])
- if order
- return [order]
- end
- when "paypal_token"
- order = Order.find_by_paypal_express_token(args[:for])
- if order
- return [order]
- end
- when "paypal_payer_id"
- order = Order.find_by_paypal_express_payer_id(args[:for])
- if order
- return [order]
- end
- when "referral_code"
- # coerce to uppercase
- return Order.where(referral_code: args[:for].upcase)
+ when "member"
+ member = Member.find_by_login_name(args[:for])
+ if member
+ return member.orders
+ end
+ when "order_id"
+ order = Order.find_by_id(args[:for])
+ if order
+ return [order]
+ end
+ when "paypal_token"
+ order = Order.find_by_paypal_express_token(args[:for])
+ if order
+ return [order]
+ end
+ when "paypal_payer_id"
+ order = Order.find_by_paypal_express_payer_id(args[:for])
+ if order
+ return [order]
+ end
+ when "referral_code"
+ # coerce to uppercase
+ return Order.where(referral_code: args[:for].upcase)
end
end
return []
end
-
end
diff --git a/app/models/photo.rb b/app/models/photo.rb
index 1abef6047..6d7fdbcba 100644
--- a/app/models/photo.rb
+++ b/app/models/photo.rb
@@ -34,11 +34,9 @@ class Photo < ActiveRecord::Base
fullsize_url: FlickRaw.url_z(info),
link_url: FlickRaw.url_photopage(info)
}
-
end
def set_flickr_metadata
self.update_attributes(flickr_metadata)
end
-
end
diff --git a/app/models/plant_part.rb b/app/models/plant_part.rb
index 652bc894b..16f23822a 100644
--- a/app/models/plant_part.rb
+++ b/app/models/plant_part.rb
@@ -20,5 +20,4 @@ class PlantPart < ActiveRecord::Base
def crops
return super.reorder('name')
end
-
end
diff --git a/app/models/planting.rb b/app/models/planting.rb
index e8eb55635..8dc339687 100644
--- a/app/models/planting.rb
+++ b/app/models/planting.rb
@@ -32,7 +32,7 @@ class Planting < ActiveRecord::Base
validates :crop, approved: true
- validates :crop, presence: {message: "must be present and exist in our database"}
+ validates :crop, presence: { message: "must be present and exist in our database" }
validates :quantity,
numericality: {
@@ -42,9 +42,9 @@ class Planting < ActiveRecord::Base
SUNNINESS_VALUES = %w(sun semi-shade shade)
validates :sunniness, inclusion: { in: SUNNINESS_VALUES,
- message: "%{value} is not a valid sunniness value" },
- allow_nil: true,
- allow_blank: true
+ message: "%{value} is not a valid sunniness value" },
+ allow_nil: true,
+ allow_blank: true
PLANTED_FROM_VALUES = [
'seed',
@@ -60,9 +60,9 @@ class Planting < ActiveRecord::Base
'layering'
]
validates :planted_from, inclusion: { in: PLANTED_FROM_VALUES,
- message: "%{value} is not a valid planting method" },
- allow_nil: true,
- allow_blank: true
+ message: "%{value} is not a valid planting method" },
+ allow_nil: true,
+ allow_blank: true
validate :finished_must_be_after_planted
@@ -105,7 +105,7 @@ class Planting < ActiveRecord::Base
if differences.compact.empty?
nil
else
- differences.compact.sum/differences.compact.size
+ differences.compact.sum / differences.compact.size
end
end
@@ -120,7 +120,7 @@ class Planting < ActiveRecord::Base
return 0 if current_date < planted_at
return 100 if days > days_before_maturity
- percent = (days/days_before_maturity*100).to_i
+ percent = (days / days_before_maturity * 100).to_i
if percent >= 100
percent = 100
@@ -132,7 +132,7 @@ class Planting < ActiveRecord::Base
# return a list of interesting plantings, for the homepage etc.
# we can't do this via a scope (as far as we know) so sadly we have to
# do it this way.
- def Planting.interesting(howmany=12, require_photo=true)
+ def Planting.interesting(howmany = 12, require_photo = true)
interesting_plantings = []
seen_owners = Hash.new(false) # keep track of which owners we've seen already
diff --git a/app/models/post.rb b/app/models/post.rb
index 776a35c7c..ed4bcad73 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -5,14 +5,14 @@ class Post < ActiveRecord::Base
belongs_to :forum
has_many :comments, dependent: :destroy
has_and_belongs_to_many :crops
- before_destroy {|post| post.crops.clear}
+ before_destroy { |post| post.crops.clear }
after_save :update_crops_posts_association
# also has_many notifications, but kinda meaningless to get at them
# from this direction, so we won't set up an association for now.
after_create do
recipients = []
- sender = self.author.id
+ sender = self.author.id
self.body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_REGEX) do |m|
# find member case-insensitively and add to list of recipients
member = Member.where('lower(login_name) = ?', $1.downcase).first
@@ -24,7 +24,7 @@ class Post < ActiveRecord::Base
recipients << member if member && !recipients.include?(member)
end
# don't send notifications to yourself
- recipients.map{ |r| r.id }.each do |recipient|
+ recipients.map { |r| r.id }.each do |recipient|
if recipient != sender
Notification.create(
recipient_id: recipient,
@@ -44,7 +44,6 @@ class Post < ActiveRecord::Base
},
length: { maximum: 255 }
-
def author_date_subject
# slugs are created before created_at is set
time = created_at || Time.zone.now
@@ -70,14 +69,15 @@ class Post < ActiveRecord::Base
end
private
- def update_crops_posts_association
- self.crops.destroy_all
- # look for crops mentioned in the post. eg. [tomato](crop)
- self.body.scan(Haml::Filters::GrowstuffMarkdown::CROP_REGEX) do |m|
- # find crop case-insensitively
- crop = Crop.where('lower(name) = ?', $1.downcase).first
- # create association
- self.crops << crop if crop && !self.crops.include?(crop)
- end
+
+ def update_crops_posts_association
+ self.crops.destroy_all
+ # look for crops mentioned in the post. eg. [tomato](crop)
+ self.body.scan(Haml::Filters::GrowstuffMarkdown::CROP_REGEX) do |m|
+ # find crop case-insensitively
+ crop = Crop.where('lower(name) = ?', $1.downcase).first
+ # create association
+ self.crops << crop if crop && !self.crops.include?(crop)
end
+ end
end
diff --git a/app/models/product.rb b/app/models/product.rb
index 942e2603b..8cab945a7 100644
--- a/app/models/product.rb
+++ b/app/models/product.rb
@@ -11,5 +11,4 @@ class Product < ActiveRecord::Base
def to_s
name
end
-
end
diff --git a/app/models/seed.rb b/app/models/seed.rb
index 9592fb1c4..4c8a1c1c7 100644
--- a/app/models/seed.rb
+++ b/app/models/seed.rb
@@ -9,7 +9,7 @@ class Seed < ActiveRecord::Base
validates :crop, approved: true
- validates :crop, presence: {message: "must be present and exist in our database"}
+ validates :crop, presence: { message: "must be present and exist in our database" }
validates :quantity,
numericality: {
only_integer: true,
@@ -30,9 +30,10 @@ class Seed < ActiveRecord::Base
TRADABLE_TO_VALUES = %w(nowhere locally nationally internationally)
validates :tradable_to, inclusion: { in: TRADABLE_TO_VALUES,
- message: "You may only trade seed nowhere, locally, nationally, or internationally" },
- allow_nil: false,
- allow_blank: false
+ message: "You may only trade seed nowhere, "\
+ "locally, nationally, or internationally" },
+ allow_nil: false,
+ allow_blank: false
ORGANIC_VALUES = [
'certified organic',
@@ -40,9 +41,10 @@ class Seed < ActiveRecord::Base
'conventional/non-organic',
'unknown']
validates :organic, inclusion: { in: ORGANIC_VALUES,
- message: "You must say whether the seeds are organic or not, or that you don't know" },
- allow_nil: false,
- allow_blank: false
+ message: "You must say whether the seeds "\
+ "are organic or not, or that you don't know" },
+ allow_nil: false,
+ allow_blank: false
GMO_VALUES = [
'certified GMO-free',
@@ -50,15 +52,16 @@ class Seed < ActiveRecord::Base
'GMO',
'unknown']
validates :gmo, inclusion: { in: GMO_VALUES,
- message: "You must say whether the seeds are genetically modified or not, or that you don't know" },
- allow_nil: false,
- allow_blank: false
+ message: "You must say whether the seeds are "\
+ "genetically modified or not, or that you don't know" },
+ allow_nil: false,
+ allow_blank: false
HEIRLOOM_VALUES = %w(heirloom hybrid unknown)
validates :heirloom, inclusion: { in: HEIRLOOM_VALUES,
- message: "You must say whether the seeds are heirloom, hybrid, or unknown" },
- allow_nil: false,
- allow_blank: false
+ message: "You must say whether the seeds are heirloom, hybrid, or unknown" },
+ allow_nil: false,
+ allow_blank: false
def tradable?
if self.tradable_to == 'nowhere'
@@ -89,7 +92,6 @@ class Seed < ActiveRecord::Base
end
return interesting_seeds
-
end
def seed_slug
diff --git a/bin/rails b/bin/rails
index 728cd85aa..5191e6927 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
-APP_PATH = File.expand_path('../../config/application', __FILE__)
+APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
diff --git a/config.rb b/config.rb
index 609849e17..bb4bb0a7d 100644
--- a/config.rb
+++ b/config.rb
@@ -16,7 +16,6 @@ images_dir = "app/assets/images"
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
-
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
preferred_syntax = :sass
diff --git a/config.ru b/config.ru
index f2d9c08c2..d30ee4f18 100644
--- a/config.ru
+++ b/config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.
-require ::File.expand_path('../config/environment', __FILE__)
+require ::File.expand_path('../config/environment', __FILE__)
run Growstuff::Application
diff --git a/config/application.rb b/config/application.rb
index 2dff668c1..5280dce7e 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -82,7 +82,6 @@ module Growstuff
g.javascripts false
end
-
# Growstuff-specific configuration variables
config.currency = 'AUD'
config.bot_email = "noreply@growstuff.org"
@@ -90,7 +89,7 @@ module Growstuff
config.user_agent_email = "info@growstuff.org"
Gibbon::API.api_key = ENV['GROWSTUFF_MAILCHIMP_APIKEY'] || 'notarealkey'
- # API key can't be blank or tests fail
+ # API key can't be blank or tests fail
Gibbon::API.timeout = 10
Gibbon::API.throws_exceptions = false
config.newsletter_list_id = ENV['GROWSTUFF_MAILCHIMP_NEWSLETTER_ID']
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 344fddc63..2ed9b8f0a 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -48,11 +48,11 @@ Growstuff::Application.configure do
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.smtp_settings = {
- port: '587',
- address: 'smtp.mandrillapp.com',
- user_name: ENV['GROWSTUFF_MANDRILL_USERNAME'],
- password: ENV['GROWSTUFF_MANDRILL_APIKEY'],
- authentication: :login
+ port: '587',
+ address: 'smtp.mandrillapp.com',
+ user_name: ENV['GROWSTUFF_MANDRILL_USERNAME'],
+ password: ENV['GROWSTUFF_MANDRILL_APIKEY'],
+ authentication: :login
}
config.host = 'localhost:8080'
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 923ff4e7c..c931c058e 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -70,12 +70,12 @@ Growstuff::Application.configure do
config.action_mailer.default_url_options = { host: 'growstuff.org' }
ActionMailer::Base.smtp_settings = {
- port: ENV['SPARKPOST_SMTP_PORT'],
- address: ENV['SPARKPOST_SMTP_HOST'],
- user_name: ENV['SPARKPOST_SMTP_USERNAME'],
- password: ENV['SPARKPOST_SMTP_PASSWORD'],
- authentication: :login,
- enable_starttls_auto: true
+ port: ENV['SPARKPOST_SMTP_PORT'],
+ address: ENV['SPARKPOST_SMTP_HOST'],
+ user_name: ENV['SPARKPOST_SMTP_USERNAME'],
+ password: ENV['SPARKPOST_SMTP_PASSWORD'],
+ authentication: :login,
+ enable_starttls_auto: true
}
ActionMailer::Base.delivery_method = :smtp
diff --git a/config/environments/staging.rb b/config/environments/staging.rb
index 467b626d1..a9e242381 100644
--- a/config/environments/staging.rb
+++ b/config/environments/staging.rb
@@ -72,12 +72,12 @@ Growstuff::Application.configure do
config.action_mailer.default_url_options = { host: 'staging.growstuff.org' }
ActionMailer::Base.smtp_settings = {
- port: ENV['SPARKPOST_SMTP_PORT'],
- address: ENV['SPARKPOST_SMTP_HOST'],
- user_name: ENV['SPARKPOST_SMTP_USERNAME'],
- password: ENV['SPARKPOST_SMTP_PASSWORD'],
- authentication: :login,
- enable_starttls_auto: true
+ port: ENV['SPARKPOST_SMTP_PORT'],
+ address: ENV['SPARKPOST_SMTP_HOST'],
+ user_name: ENV['SPARKPOST_SMTP_USERNAME'],
+ password: ENV['SPARKPOST_SMTP_PASSWORD'],
+ authentication: :login,
+ enable_starttls_auto: true
}
ActionMailer::Base.delivery_method = :smtp
diff --git a/config/environments/test.rb b/config/environments/test.rb
index f59962926..35836c90b 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -26,7 +26,7 @@ Growstuff::Application.configure do
config.action_dispatch.show_exceptions = true
# Disable request forgery protection in test environment
- config.action_controller.allow_forgery_protection = false
+ config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
@@ -54,7 +54,6 @@ Growstuff::Application.configure do
::STANDARD_GATEWAY = ActiveMerchant::Billing::PaypalBogusGateway.new
::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalBogusGateway.new
end
-
end
Geocoder.configure(lookup: :test)
@@ -101,7 +100,7 @@ Geocoder::Lookup::Test.add_stub(
)
# Unknown location
-Geocoder::Lookup::Test.add_stub( "Tatooine", [])
+Geocoder::Lookup::Test.add_stub("Tatooine", [])
Capybara.configure do |config|
config.always_include_port = true
@@ -110,16 +109,16 @@ 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",
- nickname: 'JohnnyT',
- email: 'example.oauth.facebook@example.com',
- image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png'
- },
- credentials: {
- token: "token",
- secret: "donttell"
- }
-})
+ 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'
+ },
+ credentials: {
+ token: "token",
+ secret: "donttell"
+ }
+ })
diff --git a/config/initializers/comfortable_mexican_sofa.rb b/config/initializers/comfortable_mexican_sofa.rb
index fc5025933..3206e14d9 100644
--- a/config/initializers/comfortable_mexican_sofa.rb
+++ b/config/initializers/comfortable_mexican_sofa.rb
@@ -9,7 +9,7 @@ ComfortableMexicanSofa.configure do |config|
# Module responsible for authentication. You can replace it with your own.
# It simply needs to have #authenticate method. See http_auth.rb for reference.
- config.admin_auth = 'CmsDeviseAuth'
+ config.admin_auth = 'CmsDeviseAuth'
# Module responsible for authorization on admin side. It should have #authorize
# method that returns true or false based on params and loaded instance
@@ -91,7 +91,6 @@ ComfortableMexicanSofa.configure do |config|
# Reveal partials that can be overwritten in the admin area.
# Default is false.
# config.reveal_cms_partials = false
-
end
module CmsDeviseAuth
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 3a7e49d44..ad33e335d 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -26,7 +26,7 @@ Devise.setup do |config|
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
- config.authentication_keys = [ :login ]
+ config.authentication_keys = [:login]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
@@ -38,12 +38,12 @@ Devise.setup do |config|
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
- config.case_insensitive_keys = [ :email ]
+ config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
- config.strip_whitespace_keys = [ :email, :login_name ]
+ config.strip_whitespace_keys = [:email, :login_name]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
@@ -102,7 +102,7 @@ Devise.setup do |config|
config.reconfirmable = true
# Defines which key will be used when confirming an account
- config.confirmation_keys = [ :login ]
+ config.confirmation_keys = [:login]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
@@ -158,7 +158,7 @@ Devise.setup do |config|
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
- config.reset_password_keys = [ :login ]
+ config.reset_password_keys = [:login]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
diff --git a/config/routes.rb b/config/routes.rb
index 4f0438a11..e12cca00e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,4 @@
Growstuff::Application.routes.draw do # rubocop:disable Metrics/BlockLength
-
get '/robots.txt' => 'robots#robots'
resources :plant_parts
@@ -58,7 +57,6 @@ Growstuff::Application.routes.draw do # rubocop:disable Metrics/BlockLength
get '/members/:login_name/follows' => 'members#view_follows', :as => 'member_follows'
get '/members/:login_name/followers' => 'members#view_followers', :as => 'member_followers'
-
get '/places' => 'places#index'
get '/places/search' => 'places#search', :as => 'search_places'
get '/places/:place' => 'places#show', :as => 'place'
@@ -91,7 +89,6 @@ Growstuff::Application.routes.draw do # rubocop:disable Metrics/BlockLength
get '/.well-known/acme-challenge/:id' => 'pages#letsencrypt'
-# CMS stuff -- must remain LAST
+ # CMS stuff -- must remain LAST
comfy_route :cms, path: '/', sitemap: false
-
end
diff --git a/config/unicorn.rb b/config/unicorn.rb
index dfd7ac833..e4153a81f 100644
--- a/config/unicorn.rb
+++ b/config/unicorn.rb
@@ -4,7 +4,6 @@ timeout 30
preload_app true
before_fork do |server, worker|
-
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
@@ -15,7 +14,6 @@ before_fork do |server, worker|
end
after_fork do |server, worker|
-
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
end
diff --git a/db/migrate/20120903092956_devise_create_users.rb b/db/migrate/20120903092956_devise_create_users.rb
index f956c1e5a..cf02cbe2a 100644
--- a/db/migrate/20120903092956_devise_create_users.rb
+++ b/db/migrate/20120903092956_devise_create_users.rb
@@ -33,7 +33,6 @@ class DeviseCreateUsers < ActiveRecord::Migration
## Token authenticatable
# t.string :authentication_token
-
t.timestamps null: true
end
diff --git a/db/migrate/20121109130033_add_creation_index_to_updates.rb b/db/migrate/20121109130033_add_creation_index_to_updates.rb
index cb94c6b26..4e3f4c560 100644
--- a/db/migrate/20121109130033_add_creation_index_to_updates.rb
+++ b/db/migrate/20121109130033_add_creation_index_to_updates.rb
@@ -1,5 +1,5 @@
class AddCreationIndexToUpdates < ActiveRecord::Migration
def change
- add_index :updates, [:created_at, :user_id]
+ add_index :updates, [:created_at, :user_id]
end
end
diff --git a/db/migrate/20130518002942_rename_account_detail_to_account.rb b/db/migrate/20130518002942_rename_account_detail_to_account.rb
index 8c2243431..0a8434694 100644
--- a/db/migrate/20130518002942_rename_account_detail_to_account.rb
+++ b/db/migrate/20130518002942_rename_account_detail_to_account.rb
@@ -2,5 +2,4 @@ class RenameAccountDetailToAccount < ActiveRecord::Migration
def change
rename_table :account_details, :accounts
end
-
end
diff --git a/db/migrate/20130601011725_change_flickr_photo_id_to_string.rb b/db/migrate/20130601011725_change_flickr_photo_id_to_string.rb
index 84cf7a7b4..01afc35d3 100644
--- a/db/migrate/20130601011725_change_flickr_photo_id_to_string.rb
+++ b/db/migrate/20130601011725_change_flickr_photo_id_to_string.rb
@@ -3,6 +3,7 @@ class ChangeFlickrPhotoIdToString < ActiveRecord::Migration
remove_column :photos, :flickr_photo_id
add_column :photos, :flickr_photo_id, :string
end
+
def down
# Postgres doesn't allow you to cast strings to integers
# Hence there's no way of rolling back this migration without losing
diff --git a/db/migrate/20150201052245_create_cms.rb b/db/migrate/20150201052245_create_cms.rb
index 312bff94f..2a187e66f 100644
--- a/db/migrate/20150201052245_create_cms.rb
+++ b/db/migrate/20150201052245_create_cms.rb
@@ -1,11 +1,11 @@
class CreateCms < ActiveRecord::Migration
- def self.up
+ def self.up # rubocop:disable Metrics/MethodLength
text_limit = case ActiveRecord::Base.connection.adapter_name
- when 'PostgreSQL'
- { }
- else
- { limit: 16777215 }
- end
+ when 'PostgreSQL'
+ {}
+ else
+ { limit: 16777215 }
+ end
# -- Sites --------------------------------------------------------------
create_table :comfy_cms_sites do |t|
@@ -42,7 +42,7 @@ class CreateCms < ActiveRecord::Migration
t.integer :layout_id
t.integer :parent_id
t.integer :target_page_id
- t.string :label, null: false
+ t.string :label, null: false
t.string :slug
t.string :full_path, null: false
t.text :content_cache, text_limit
@@ -80,7 +80,7 @@ class CreateCms < ActiveRecord::Migration
# -- Files --------------------------------------------------------------
create_table :comfy_cms_files do |t|
- t.integer :site_id, null: false
+ t.integer :site_id, null: false
t.integer :block_id
t.string :label, null: false
t.string :file_file_name, null: false
@@ -111,7 +111,8 @@ class CreateCms < ActiveRecord::Migration
t.string :label, null: false
t.string :categorized_type, null: false
end
- add_index :comfy_cms_categories, [:site_id, :categorized_type, :label], unique: true,
+ add_index :comfy_cms_categories, [:site_id, :categorized_type, :label],
+ unique: true,
name: 'index_cms_categories_on_site_id_and_cat_type_and_label'
create_table :comfy_cms_categorizations, force: true do |t|
@@ -119,7 +120,8 @@ class CreateCms < ActiveRecord::Migration
t.string :categorized_type, null: false
t.integer :categorized_id, null: false
end
- add_index :comfy_cms_categorizations, [:category_id, :categorized_type, :categorized_id], unique: true,
+ add_index :comfy_cms_categorizations, [:category_id, :categorized_type, :categorized_id],
+ unique: true,
name: 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id'
end
diff --git a/db/seeds.rb b/db/seeds.rb
index c718a544b..6503cde74 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -69,16 +69,15 @@ def load_test_users
puts "Warning: unable to open suburbs.csv"
end
-
# rake parameter (eg. 'rake db:seed member_size=10')
member_size = ENV['member_size'] ? ENV['member_size'].to_i : 3
(1..member_size).each do |i|
@user = Member.new(
- login_name: "test#{i}",
- email: "test#{i}@example.com",
- password: "password#{i}",
- tos_agreement: true
+ login_name: "test#{i}",
+ email: "test#{i}@example.com",
+ password: "password#{i}",
+ tos_agreement: true
)
@user.skip_confirmation!
@user.save!
@@ -88,7 +87,7 @@ def load_test_users
suburb_file.pos = 0 if suburb_file.eof?
row = CSV.parse(suburb_file.readline)
- suburb,country,state,latitude,longitude = row[0]
+ suburb, country, state, latitude, longitude = row[0]
# Using 'update_column' method instead of 'update' so that
# it avoids accessing Geocoding service for faster processing
@user.gardens.first.update_columns(location: suburb, latitude: latitude, longitude: longitude)
@@ -199,7 +198,7 @@ def load_plant_parts
end
def select_random_item(array)
- array[rand(0..array.size-1) % array.size]
+ array[rand(0..array.size - 1) % array.size]
end
load_data
diff --git a/lib/actions/oauth_signup_action.rb b/lib/actions/oauth_signup_action.rb
index 5c8825495..7d4913c21 100644
--- a/lib/actions/oauth_signup_action.rb
+++ b/lib/actions/oauth_signup_action.rb
@@ -1,5 +1,4 @@
class Growstuff::OauthSignupAction
-
#
# Inspects the omniauth information
# and determines if we have an existing member
@@ -12,14 +11,14 @@ class Growstuff::OauthSignupAction
def find_or_create_from_authorization(auth)
member ||= Member.where(email: auth.info.email).first_or_create do |m|
m.email = auth.info.email
- m.password = Devise.friendly_token[0,20]
+ m.password = Devise.friendly_token[0, 20]
# First, try the nickname or friendly generate from the email
m.login_name = auth.info.nickname || auth.info.email.split("@").first.gsub(/[^A-Za-z]+/, '_').underscore
# Do we have a collision with an existing account? Generate a 20 character long random name
# so the user can update it later
- m.login_name = Devise.friendly_token[0,20] if Member.where(login_name: m.login_name).any?
+ m.login_name = Devise.friendly_token[0, 20] if Member.where(login_name: m.login_name).any?
m.preferred_avatar_uri = auth.info.image # assuming the user model has an image
m.skip_confirmation!
diff --git a/lib/geocodable.rb b/lib/geocodable.rb
index 2b914b535..68b137acf 100644
--- a/lib/geocodable.rb
+++ b/lib/geocodable.rb
@@ -8,7 +8,7 @@ module Geocodable
def geocode
unless self.location.blank?
self.latitude, self.longitude =
- Geocoder.coordinates(location, params: {limit: 1})
+ Geocoder.coordinates(location, params: { limit: 1 })
end
end
@@ -18,5 +18,4 @@ module Geocodable
self.longitude = nil
end
end
-
end
diff --git a/lib/haml/filters/escaped_markdown.rb b/lib/haml/filters/escaped_markdown.rb
index 4b0c7e9cc..1986b905d 100644
--- a/lib/haml/filters/escaped_markdown.rb
+++ b/lib/haml/filters/escaped_markdown.rb
@@ -9,8 +9,7 @@ module Haml::Filters
end
end
-# Register it as the handler for the :escaped_markdown HAML command.
-# The automatic system gives us :escapedmarkdown, which is ugly.
-defined['escaped_markdown'] = EscapedMarkdown
-
+ # Register it as the handler for the :escaped_markdown HAML command.
+ # The automatic system gives us :escapedmarkdown, which is ugly.
+ defined['escaped_markdown'] = EscapedMarkdown
end
diff --git a/lib/haml/filters/growstuff_markdown.rb b/lib/haml/filters/growstuff_markdown.rb
index bb665e810..ebd3ecebe 100644
--- a/lib/haml/filters/growstuff_markdown.rb
+++ b/lib/haml/filters/growstuff_markdown.rb
@@ -9,7 +9,6 @@ module Haml::Filters
include Haml::Filters::Base
def render(text)
-
# turn [tomato](crop) into [tomato](http://growstuff.org/crops/tomato)
expanded = text.gsub(CROP_REGEX) do |m|
crop_str = $1
@@ -52,12 +51,10 @@ module Haml::Filters
expanded = expanded.gsub(MEMBER_ESCAPE_AT_REGEX, "")
return BlueCloth.new(expanded).to_html
-
end
end
-# Register it as the handler for the :growstuff_markdown HAML command.
-# The automatic system gives us :growstuffmarkdown, which is ugly.
-defined['growstuff_markdown'] = GrowstuffMarkdown
-
+ # Register it as the handler for the :growstuff_markdown HAML command.
+ # The automatic system gives us :growstuffmarkdown, which is ugly.
+ defined['growstuff_markdown'] = GrowstuffMarkdown
end
diff --git a/lib/tasks/growstuff.rake b/lib/tasks/growstuff.rake
index 89be5f63f..fd0258309 100644
--- a/lib/tasks/growstuff.rake
+++ b/lib/tasks/growstuff.rake
@@ -1,5 +1,4 @@
namespace :growstuff do
-
desc "Add an admin user, by name"
# usage: rake growstuff:admin_user name=skud
@@ -38,7 +37,6 @@ namespace :growstuff do
end
Rails.cache.delete('full_crop_hierarchy')
puts "Finished loading crops"
-
end
desc "Send planting reminder email"
@@ -73,10 +71,8 @@ namespace :growstuff do
desc "One-off tasks needed at various times and kept for posterity"
namespace :oneoff do
-
desc "May 2013: replace any empty notification subjects with (no subject)"
task empty_subjects: :environment do
-
# this is inefficient as it checks every Notification, but the
# site is small and there aren't many of them, so it shouldn't matter
# for this one-off script.
@@ -88,7 +84,6 @@ namespace :growstuff do
desc "May 2013: replace any empty garden names with Garden"
task empty_garden_names: :environment do
-
# this is inefficient as it checks every Garden, but the
# site is small and there aren't many of them, so it shouldn't matter
# for this one-off script.
@@ -100,7 +95,6 @@ namespace :growstuff do
end
end
-
desc "June 2013: create account types and products."
task setup_shop: :environment do
puts "Adding account types..."
@@ -163,7 +157,6 @@ namespace :growstuff do
desc "June 2013: replace nil account_types with free accounts"
task nil_account_type: :environment do
-
free = AccountType.find_by_name("Free")
raise "Free account type not found: run rake growstuff:oneoff:setup_shop"\
unless free
@@ -177,7 +170,6 @@ namespace :growstuff do
desc "July 2013: replace nil seed.tradable_to with nowhere"
task tradable_to_nowhere: :environment do
-
Seed.all.each do |s|
unless s.tradable_to
s.tradable_to = 'nowhere'
@@ -188,7 +180,6 @@ namespace :growstuff do
desc "August 2013: set up plantings_count cache on crop"
task reset_crop_plantings_count: :environment do
-
Crop.find_each do |c|
Crop.reset_counters c.id, :plantings
end
@@ -196,7 +187,6 @@ namespace :growstuff do
desc "August 2013: set default creator on existing crops"
task set_default_crop_creator: :environment do
-
cropbot = Member.find_by_login_name("cropbot")
raise "cropbot not found: create cropbot member on site or run rake db:seed" unless cropbot
cropbot.account.account_type = AccountType.find_by_name("Staff") # set this just because it's nice
@@ -213,7 +203,6 @@ namespace :growstuff do
sn.save
end
end
-
end
desc "August 2013: set planting owner"
@@ -339,5 +328,4 @@ namespace :growstuff do
Crop.import
end
end # end oneoff section
-
end
diff --git a/lib/tasks/hooks.rake b/lib/tasks/hooks.rake
index 93d599831..7543404b2 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
+ FileUtils.symlink '../../script/pre-commit.sh', '.git/hooks/pre-commit',
+ force: true
end
diff --git a/script/rails b/script/rails
index 8c7d72b27..9092f9f3c 100755
--- a/script/rails
+++ b/script/rails
@@ -2,6 +2,6 @@
# This command will automatically be run when you run "rails"
# with Rails 3 gems installed from the root of your application.
-APP_PATH = File.expand_path('../../config/application', __FILE__)
-require File.expand_path('../../config/boot', __FILE__)
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
diff --git a/spec/controllers/account_types_controller_spec.rb b/spec/controllers/account_types_controller_spec.rb
index 4fd0450aa..633311b6e 100644
--- a/spec/controllers/account_types_controller_spec.rb
+++ b/spec/controllers/account_types_controller_spec.rb
@@ -10,19 +10,13 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe AccountTypesController do
-
# This automatically creates a "Free" account type
login_member(:admin_member)
def valid_attributes
{ "name" => "MyString" }
end
-
end
diff --git a/spec/controllers/accounts_controller_spec.rb b/spec/controllers/accounts_controller_spec.rb
index e8d6648e5..da21a1ba3 100644
--- a/spec/controllers/accounts_controller_spec.rb
+++ b/spec/controllers/accounts_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe AccountsController do
-
login_member(:admin_member)
def valid_attributes
@@ -32,5 +27,4 @@ describe AccountsController do
member = FactoryGirl.create(:member)
return member.account
end
-
end
diff --git a/spec/controllers/admin/orders_controller_spec.rb b/spec/controllers/admin/orders_controller_spec.rb
index b5e66b3b1..4c407c34d 100644
--- a/spec/controllers/admin/orders_controller_spec.rb
+++ b/spec/controllers/admin/orders_controller_spec.rb
@@ -10,29 +10,22 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
-
require 'rails_helper'
describe Admin::OrdersController do
-
login_member(:admin_member)
describe "GET search" do
it "assigns @orders" do
order = FactoryGirl.create(:order)
- get :search, {search_by: 'order_id', search_text: order.id}
+ get :search, { search_by: 'order_id', search_text: order.id }
assigns(:orders).should eq([order])
end
it "sets an error message if nothing found" do
order = FactoryGirl.create(:order)
- get :search, {search_by: 'order_id', search_text: 'foo'}
+ get :search, { search_by: 'order_id', search_text: 'foo' }
flash[:alert].should match /Couldn't find order with/
end
end
-
end
diff --git a/spec/controllers/admin_controller_spec.rb b/spec/controllers/admin_controller_spec.rb
index bb669d80c..0b36fe583 100644
--- a/spec/controllers/admin_controller_spec.rb
+++ b/spec/controllers/admin_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe AdminController do
-
login_member(:admin_member)
describe "GET admin/newsletter" do
diff --git a/spec/controllers/authentications_controller_spec.rb b/spec/controllers/authentications_controller_spec.rb
index 91de89aae..47be30487 100644
--- a/spec/controllers/authentications_controller_spec.rb
+++ b/spec/controllers/authentications_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe AuthenticationsController do
-
before(:each) do
@member = FactoryGirl.create(:member)
sign_in @member
@@ -30,5 +25,4 @@ describe AuthenticationsController do
'credentials' => { 'token' => 'blah', 'secret' => 'blah' }
}
end
-
end
diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb
index 36b77fdf9..01d41e7b7 100644
--- a/spec/controllers/comments_controller_spec.rb
+++ b/spec/controllers/comments_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe CommentsController do
-
before(:each) do
@member = FactoryGirl.create(:member)
sign_in @member
@@ -41,14 +36,14 @@ describe CommentsController do
describe "GET new" do
it "picks up post from params" do
post = FactoryGirl.create(:post)
- get :new, {post_id: post.id}
+ get :new, { post_id: post.id }
assigns(:post).should eq(post)
end
it "assigns the old comments as @comments" do
post = FactoryGirl.create(:post)
old_comment = FactoryGirl.create(:comment, post: post)
- get :new, {post_id: post.id}
+ get :new, { post_id: post.id }
assigns(:comments).should eq [old_comment]
end
@@ -63,7 +58,7 @@ describe CommentsController do
post = FactoryGirl.create(:post)
old_comment = FactoryGirl.create(:comment, post: post)
comment = FactoryGirl.create(:comment, post: post, author: @member)
- get :edit, {id: comment.to_param}
+ get :edit, { id: comment.to_param }
assigns(:comments).should eq([comment, old_comment])
end
end
@@ -72,7 +67,7 @@ describe CommentsController do
describe "with valid params" do
it "redirects to the comment's post" do
comment = Comment.create! valid_attributes
- put :update, {id: comment.to_param, comment: valid_attributes}
+ put :update, { id: comment.to_param, comment: valid_attributes }
response.should redirect_to(comment.post)
end
end
@@ -82,9 +77,8 @@ describe CommentsController do
it "redirects to the post the comment was on" do
comment = Comment.create! valid_attributes
post = comment.post
- delete :destroy, {id: comment.to_param}
+ delete :destroy, { id: comment.to_param }
response.should redirect_to(post)
end
end
-
end
diff --git a/spec/controllers/crops_controller_spec.rb b/spec/controllers/crops_controller_spec.rb
index 876c289d4..9a0a1dcdc 100644
--- a/spec/controllers/crops_controller_spec.rb
+++ b/spec/controllers/crops_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe CropsController do
-
login_member(:crop_wrangling_member)
def valid_attributes
@@ -61,5 +56,4 @@ describe CropsController do
response.content_type.should eq("application/rss+xml")
end
end
-
end
diff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rb
index 233654d53..f320204e2 100644
--- a/spec/controllers/forums_controller_spec.rb
+++ b/spec/controllers/forums_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe ForumsController do
-
login_member(:admin_member)
def valid_attributes
@@ -31,5 +26,4 @@ describe ForumsController do
def valid_session
{}
end
-
end
diff --git a/spec/controllers/gardens_controller_spec.rb b/spec/controllers/gardens_controller_spec.rb
index 869cbad98..790e1f8be 100644
--- a/spec/controllers/gardens_controller_spec.rb
+++ b/spec/controllers/gardens_controller_spec.rb
@@ -10,19 +10,13 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe GardensController do
-
login_member
def valid_attributes
member = FactoryGirl.create(:member)
- {name: 'My Garden', owner_id: member.id }
+ { name: 'My Garden', owner_id: member.id }
end
-
end
diff --git a/spec/controllers/harvests_controller_spec.rb b/spec/controllers/harvests_controller_spec.rb
index 753f6fbee..b07f1c08a 100644
--- a/spec/controllers/harvests_controller_spec.rb
+++ b/spec/controllers/harvests_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe HarvestsController do
-
login_member
def valid_attributes
@@ -44,27 +39,27 @@ describe HarvestsController do
end
it "picks up owner from params and shows owner's harvests only" do
- get :index, {owner: @member1.slug}
+ get :index, { owner: @member1.slug }
assigns(:owner).should eq @member1
assigns(:harvests).should eq [@harvest1]
end
it "picks up crop from params and shows the harvests for the crop only" do
- get :index, {crop: @maize.name}
+ get :index, { crop: @maize.name }
assigns(:crop).should eq @maize
assigns(:harvests).should eq [@harvest2]
end
it "generates a csv" do
- get :index, {format: "csv"}
- response.status.should eq 200
+ get :index, { format: "csv" }
+ response.status.should eq 200
end
end
describe "GET show" do
it "assigns the requested harvest as @harvest" do
harvest = Harvest.create! valid_attributes
- get :show, {id: harvest.to_param}
+ get :show, { id: harvest.to_param }
assigns(:harvest).should eq(harvest)
end
end
@@ -79,7 +74,7 @@ describe HarvestsController do
describe "GET edit" do
it "assigns the requested harvest as @harvest" do
harvest = Harvest.create! valid_attributes
- get :edit, {id: harvest.to_param}
+ get :edit, { id: harvest.to_param }
assigns(:harvest).should eq(harvest)
end
end
@@ -88,18 +83,18 @@ describe HarvestsController do
describe "with valid params" do
it "creates a new Harvest" do
expect {
- post :create, {harvest: valid_attributes}
+ post :create, { harvest: valid_attributes }
}.to change(Harvest, :count).by(1)
end
it "assigns a newly created harvest as @harvest" do
- post :create, {harvest: valid_attributes}
+ post :create, { harvest: valid_attributes }
assigns(:harvest).should be_a(Harvest)
assigns(:harvest).should be_persisted
end
it "redirects to the created harvest" do
- post :create, {harvest: valid_attributes}
+ post :create, { harvest: valid_attributes }
response.should redirect_to(Harvest.last)
end
end
@@ -108,14 +103,14 @@ describe HarvestsController do
it "assigns a newly created but unsaved harvest as @harvest" do
# Trigger the behavior that occurs when invalid params are submitted
Harvest.any_instance.stub(:save).and_return(false)
- post :create, {harvest: { "crop_id" => "invalid value" }}
+ post :create, { harvest: { "crop_id" => "invalid value" } }
assigns(:harvest).should be_a_new(Harvest)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Harvest.any_instance.stub(:save).and_return(false)
- post :create, {harvest: { "crop_id" => "invalid value" }}
+ post :create, { harvest: { "crop_id" => "invalid value" } }
response.should render_template("new")
end
end
@@ -130,18 +125,18 @@ describe HarvestsController do
# receives the :update message with whatever params are
# submitted in the request.
Harvest.any_instance.should_receive(:update).with({ "crop_id" => "1" })
- put :update, {id: harvest.to_param, harvest: { "crop_id" => "1" }}
+ put :update, { id: harvest.to_param, harvest: { "crop_id" => "1" } }
end
it "assigns the requested harvest as @harvest" do
harvest = Harvest.create! valid_attributes
- put :update, {id: harvest.to_param, harvest: valid_attributes}
+ put :update, { id: harvest.to_param, harvest: valid_attributes }
assigns(:harvest).should eq(harvest)
end
it "redirects to the harvest" do
harvest = Harvest.create! valid_attributes
- put :update, {id: harvest.to_param, harvest: valid_attributes}
+ put :update, { id: harvest.to_param, harvest: valid_attributes }
response.should redirect_to(harvest)
end
end
@@ -151,7 +146,7 @@ describe HarvestsController do
harvest = Harvest.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Harvest.any_instance.stub(:save).and_return(false)
- put :update, {id: harvest.to_param, harvest: { "crop_id" => "invalid value" }}
+ put :update, { id: harvest.to_param, harvest: { "crop_id" => "invalid value" } }
assigns(:harvest).should eq(harvest)
end
@@ -159,7 +154,7 @@ describe HarvestsController do
harvest = Harvest.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Harvest.any_instance.stub(:save).and_return(false)
- put :update, {id: harvest.to_param, harvest: { "crop_id" => "invalid value" }}
+ put :update, { id: harvest.to_param, harvest: { "crop_id" => "invalid value" } }
response.should render_template("edit")
end
end
@@ -169,15 +164,14 @@ describe HarvestsController do
it "destroys the requested harvest" do
harvest = Harvest.create! valid_attributes
expect {
- delete :destroy, {id: harvest.to_param}
+ delete :destroy, { id: harvest.to_param }
}.to change(Harvest, :count).by(-1)
end
it "redirects to the harvests list" do
harvest = Harvest.create! valid_attributes
- delete :destroy, {id: harvest.to_param}
+ delete :destroy, { id: harvest.to_param }
response.should redirect_to(harvests_url)
end
end
-
end
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index ba3d4fce8..eb71e1f4a 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe HomeController do
-
describe "GET index" do
end
end
diff --git a/spec/controllers/member_controller_spec.rb b/spec/controllers/member_controller_spec.rb
index 77912b2df..735a4c825 100644
--- a/spec/controllers/member_controller_spec.rb
+++ b/spec/controllers/member_controller_spec.rb
@@ -10,17 +10,12 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe MembersController do
-
before :each do
@member = FactoryGirl.create(:member)
- @posts = [ FactoryGirl.create(:post, author: @member) ]
+ @posts = [FactoryGirl.create(:post, author: @member)]
@twitter_auth = FactoryGirl.create(:authentication, member: @member)
@flickr_auth = FactoryGirl.create(:flickr_authentication, member: @member)
end
@@ -40,36 +35,34 @@ describe MembersController do
end
describe "GET show" do
-
it "provides JSON for member profile" do
- get :show, { id: @member.id , format: 'json' }
+ get :show, { id: @member.id, format: 'json' }
response.should be_success
end
it "assigns @posts with the member's posts" do
- get :show, {id: @member.id}
+ get :show, { id: @member.id }
assigns(:posts).should eq(@posts)
end
it "assigns @twitter_auth" do
- get :show, {id: @member.id}
+ get :show, { id: @member.id }
assigns(:twitter_auth).should eq(@twitter_auth)
end
it "assigns @flickr_auth" do
- get :show, {id: @member.id}
+ get :show, { id: @member.id }
assigns(:flickr_auth).should eq(@flickr_auth)
end
it "doesn't show completely nonsense members" do
- lambda { get :show, {id: 9999} }.should raise_error(ActiveRecord::RecordNotFound)
+ lambda { get :show, { id: 9999 } }.should raise_error(ActiveRecord::RecordNotFound)
end
it "doesn't show unconfirmed members" do
@member2 = FactoryGirl.create(:unconfirmed_member)
- lambda { get :show, {id: @member2.id} }.should raise_error(ActiveRecord::RecordNotFound)
+ lambda { get :show, { id: @member2.id } }.should raise_error(ActiveRecord::RecordNotFound)
end
-
end
describe "GET member's RSS feed" do
@@ -80,5 +73,4 @@ describe MembersController do
response.content_type.should eq("application/rss+xml")
end
end
-
end
diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb
index c4366bf6a..2231edaad 100644
--- a/spec/controllers/notifications_controller_spec.rb
+++ b/spec/controllers/notifications_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe NotificationsController do
-
login_member
def valid_attributes
@@ -56,14 +51,14 @@ describe NotificationsController do
describe "GET show" do
it "assigns the requested notification as @notification" do
notification = FactoryGirl.create(:notification, recipient_id: subject.current_member.id)
- get :show, {id: notification.to_param}
+ get :show, { id: notification.to_param }
assigns(:notification).should eq(notification)
end
it "assigns the reply link for a post comment" do
notification = FactoryGirl.create(:notification, recipient_id: subject.current_member.id)
- get :show, {id: notification.to_param}
+ get :show, { id: notification.to_param }
assigns(:reply_link).should_not be_nil
assigns(:reply_link).should eq new_comment_url(
post_id: notification.post.id
@@ -72,7 +67,7 @@ describe NotificationsController do
it "marks notifications as read" do
notification = FactoryGirl.create(:notification, recipient_id: subject.current_member.id)
- get :show, {id: notification.to_param}
+ get :show, { id: notification.to_param }
# we need to fetch it from the db again, can't test against the old one
n = Notification.find(notification.id)
n.read.should eq true
@@ -82,7 +77,7 @@ describe NotificationsController do
describe "GET reply" do
it "marks notifications as read" do
notification = FactoryGirl.create(:notification, recipient_id: subject.current_member.id)
- get :reply, {id: notification.to_param}
+ get :reply, { id: notification.to_param }
# we need to fetch it from the db again, can't test against the old one
n = Notification.find(notification.id)
n.read.should eq true
@@ -92,7 +87,7 @@ describe NotificationsController do
describe "GET new" do
it "assigns a recipient" do
@recipient = FactoryGirl.create(:member)
- get :new, {recipient_id: @recipient.id }
+ get :new, { recipient_id: @recipient.id }
assigns(:recipient).should be_an_instance_of(Member)
end
end
@@ -105,6 +100,5 @@ describe NotificationsController do
response.should redirect_to(notifications_path)
end
end
-
end
end
diff --git a/spec/controllers/order_items_controller_spec.rb b/spec/controllers/order_items_controller_spec.rb
index 4170e140e..d455cbe9b 100644
--- a/spec/controllers/order_items_controller_spec.rb
+++ b/spec/controllers/order_items_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe OrderItemsController do
-
login_member(:admin_member)
before(:each) do
@@ -33,14 +28,13 @@ describe OrderItemsController do
end
describe "POST create" do
-
it "redirects to order" do
@order = FactoryGirl.create(:order, member: @member)
- post :create, {order_item: {
+ post :create, { order_item: {
order_id: @order.id,
product_id: @product.id,
price: @product.min_price
- }}
+ } }
response.should redirect_to(OrderItem.last.order)
end
@@ -49,10 +43,10 @@ describe OrderItemsController do
sign_in @member
@product = FactoryGirl.create(:product)
expect {
- post :create, {order_item: {
+ post :create, { order_item: {
product_id: @product.id,
price: @product.min_price
- }}
+ } }
}.to change(Order, :count).by(1)
OrderItem.last.order.should be_an_instance_of Order
end
@@ -62,11 +56,11 @@ describe OrderItemsController do
@order = FactoryGirl.create(:order, member: @member)
@product = FactoryGirl.create(:product, min_price: 1)
expect {
- post :create, {order_item: {
+ post :create, { order_item: {
order_id: @order.id,
product_id: @product.id,
price: 3.33
- }}
+ } }
}.to change(OrderItem, :count).by(1)
OrderItem.last.price.should eq 333
end
diff --git a/spec/controllers/orders_controller_spec.rb b/spec/controllers/orders_controller_spec.rb
index cb408b051..78bc0b99a 100644
--- a/spec/controllers/orders_controller_spec.rb
+++ b/spec/controllers/orders_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe OrdersController do
-
login_member(:admin_member)
def valid_attributes
@@ -33,7 +28,7 @@ describe OrdersController do
member = FactoryGirl.create(:member)
sign_in member
order = Order.create!(member_id: member.id)
- get :checkout, {id: order.to_param, referral_code: 'FOOBAR'}
+ get :checkout, { id: order.to_param, referral_code: 'FOOBAR' }
order.reload
order.referral_code.should eq 'FOOBAR'
end
@@ -42,7 +37,7 @@ describe OrdersController do
member = FactoryGirl.create(:member)
sign_in member
order = Order.create!(member_id: member.id)
- get :checkout, {id: order.to_param}
+ get :checkout, { id: order.to_param }
response.status.should eq 302
response.redirect_url.should match /paypal\.com/
end
@@ -53,7 +48,7 @@ describe OrdersController do
member = FactoryGirl.create(:member)
sign_in member
order = Order.create!(member_id: member.id)
- get :complete, {id: order.to_param}
+ get :complete, { id: order.to_param }
assigns(:order).should eq(order)
end
end
@@ -63,9 +58,8 @@ describe OrdersController do
member = FactoryGirl.create(:member)
sign_in member
order = Order.create!(member_id: member.id)
- delete :destroy, {id: order.id}
+ delete :destroy, { id: order.id }
response.should redirect_to(shop_url)
end
end
-
end
diff --git a/spec/controllers/places_controller_spec.rb b/spec/controllers/places_controller_spec.rb
index 9dc3110e5..e635d82b3 100644
--- a/spec/controllers/places_controller_spec.rb
+++ b/spec/controllers/places_controller_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe PlacesController do
@@ -36,7 +32,6 @@ describe PlacesController do
get :show, { place: @member_london.location }
assigns(:nearby_members).should eq [@member_london, @member_south_pole]
end
-
end
describe "GET search" do
diff --git a/spec/controllers/plant_parts_controller_spec.rb b/spec/controllers/plant_parts_controller_spec.rb
index 4784cfbdf..239422efa 100644
--- a/spec/controllers/plant_parts_controller_spec.rb
+++ b/spec/controllers/plant_parts_controller_spec.rb
@@ -10,12 +10,7 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe PlantPartsController do
-
end
diff --git a/spec/controllers/plantings_controller_spec.rb b/spec/controllers/plantings_controller_spec.rb
index d7d143498..f51086114 100644
--- a/spec/controllers/plantings_controller_spec.rb
+++ b/spec/controllers/plantings_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe PlantingsController do
-
login_member
def valid_attributes
@@ -43,23 +38,22 @@ describe PlantingsController do
end
it "picks up owner from params and shows owner's plantings only" do
- get :index, {owner: @member1.slug}
+ get :index, { owner: @member1.slug }
assigns(:owner).should eq @member1
assigns(:plantings).should eq [@planting1]
end
it "picks up crop from params and shows the plantings for the crop only" do
- get :index, {crop: @maize.name}
+ get :index, { crop: @maize.name }
assigns(:crop).should eq @maize
assigns(:plantings).should eq [@planting2]
end
end
describe "GET new" do
-
it "picks up crop from params" do
crop = FactoryGirl.create(:crop)
- get :new, {crop_id: crop.id}
+ get :new, { crop_id: crop.id }
assigns(:crop).should eq(crop)
end
@@ -71,7 +65,7 @@ describe PlantingsController do
it "picks up garden from params" do
member = FactoryGirl.create(:member)
garden = FactoryGirl.create(:garden, owner: member)
- get :new, {garden_id: garden.id}
+ get :new, { garden_id: garden.id }
assigns(:garden).should eq(garden)
end
@@ -89,7 +83,5 @@ describe PlantingsController do
post :create, { planting: valid_attributes }
assigns(:planting).owner.should eq subject.current_member
end
-
end
-
end
diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb
index 6074d0655..1c26cfe12 100644
--- a/spec/controllers/posts_controller_spec.rb
+++ b/spec/controllers/posts_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe PostsController do
-
login_member
def valid_attributes
@@ -43,5 +38,4 @@ describe PostsController do
response.content_type.should eq("application/rss+xml")
end
end
-
end
diff --git a/spec/controllers/products_controller_spec.rb b/spec/controllers/products_controller_spec.rb
index ad56da174..63c17aa66 100644
--- a/spec/controllers/products_controller_spec.rb
+++ b/spec/controllers/products_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe ProductsController do
-
login_member(:admin_member)
def valid_attributes
@@ -31,5 +26,4 @@ describe ProductsController do
def valid_session
{}
end
-
end
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index 053c67b8c..56d277b75 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe RegistrationsController do
-
before :each do
@member = FactoryGirl.create(:member)
sign_in @member
@@ -43,5 +38,4 @@ describe RegistrationsController do
assigns(:flickr_auth).should eq @auth
end
end
-
end
diff --git a/spec/controllers/robots_controller_spec.rb b/spec/controllers/robots_controller_spec.rb
index 16220cfe2..e8917aa29 100644
--- a/spec/controllers/robots_controller_spec.rb
+++ b/spec/controllers/robots_controller_spec.rb
@@ -6,7 +6,7 @@ describe RobotsController do
let(:staging_filename) { 'config/robots.staging.txt' }
before do
- @request.host = "#{ subdomain }.localhost.com"
+ @request.host = "#{subdomain}.localhost.com"
end
context 'subdomain is staging' do
diff --git a/spec/controllers/roles_controller_spec.rb b/spec/controllers/roles_controller_spec.rb
index 402d1c61c..f62289379 100644
--- a/spec/controllers/roles_controller_spec.rb
+++ b/spec/controllers/roles_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe RolesController do
-
def valid_attributes
{ "name" => "MyString" }
end
@@ -32,5 +27,4 @@ describe RolesController do
assigns(:roles).should eq([Role.find_by_name('admin'), role])
end
end
-
end
diff --git a/spec/controllers/scientific_names_controller_spec.rb b/spec/controllers/scientific_names_controller_spec.rb
index 1c492cc9d..c134a35a1 100644
--- a/spec/controllers/scientific_names_controller_spec.rb
+++ b/spec/controllers/scientific_names_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe ScientificNamesController do
-
login_member(:crop_wrangling_member)
before(:each) do
@@ -33,6 +28,5 @@ describe ScientificNamesController do
get :new, { crop_id: 1 }
assigns(:crop).should be_an_instance_of Crop
end
-
end
end
diff --git a/spec/controllers/seeds_controller_spec.rb b/spec/controllers/seeds_controller_spec.rb
index fbf57fc81..b17a948c4 100644
--- a/spec/controllers/seeds_controller_spec.rb
+++ b/spec/controllers/seeds_controller_spec.rb
@@ -10,17 +10,13 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe SeedsController do
describe "GET index" do
it "picks up owner from params" do
owner = FactoryGirl.create(:member)
- get :index, {owner: owner.slug}
+ get :index, { owner: owner.slug }
assigns(:owner).should eq(owner)
end
end
diff --git a/spec/controllers/shop_controller_spec.rb b/spec/controllers/shop_controller_spec.rb
index 7abdbd5d7..82b07a4b4 100644
--- a/spec/controllers/shop_controller_spec.rb
+++ b/spec/controllers/shop_controller_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe ShopController do
-
before :each do
@product1 = FactoryGirl.create(:product)
@product2 = FactoryGirl.create(:product)
@@ -46,7 +41,5 @@ describe ShopController do
get :index, {}
assigns(:order).should eq @order
end
-
end
-
end
diff --git a/spec/custom_matchers.rb b/spec/custom_matchers.rb
index 6d52388bb..1cb9d61ab 100644
--- a/spec/custom_matchers.rb
+++ b/spec/custom_matchers.rb
@@ -1,6 +1,6 @@
require 'rspec/expectations'
-RSpec::Matchers.define :have_optional do | expected |
+RSpec::Matchers.define :have_optional do |expected|
match do |actual|
actual.has_selector? "#{expected} + span", text: '(Optional)'
end
diff --git a/spec/factories/account_types.rb b/spec/factories/account_types.rb
index 832ddf0ce..0187a9e3d 100644
--- a/spec/factories/account_types.rb
+++ b/spec/factories/account_types.rb
@@ -24,5 +24,4 @@ FactoryGirl.define do
is_permanent_paid true
end
end
-
end
diff --git a/spec/factories/comments.rb b/spec/factories/comments.rb
index b1a88a7a6..eb9f43e9c 100644
--- a/spec/factories/comments.rb
+++ b/spec/factories/comments.rb
@@ -3,6 +3,6 @@ FactoryGirl.define do
post
author
sequence(:body) { |n| "OMG LOL #{n}" } # because our commenters are more
- # polite than YouTube's
+ # polite than YouTube's
end
end
diff --git a/spec/factories/crop.rb b/spec/factories/crop.rb
index 5857c9828..6467cb813 100644
--- a/spec/factories/crop.rb
+++ b/spec/factories/crop.rb
@@ -1,5 +1,4 @@
FactoryGirl.define do
-
factory :crop do
name "magic bean"
en_wikipedia_url "http://en.wikipedia.org/wiki/Magic_bean"
@@ -59,7 +58,7 @@ FactoryGirl.define do
creator "cropbot"
end
- #for testing crop request
+ # for testing crop request
factory :crop_request do
name "Ultra berry"
en_wikipedia_url ""
@@ -73,7 +72,5 @@ FactoryGirl.define do
approval_status "rejected"
reason_for_rejection "Totally fake"
end
-
end
-
end
diff --git a/spec/factories/follows.rb b/spec/factories/follows.rb
index 4bf6b33ac..f54acc0e8 100644
--- a/spec/factories/follows.rb
+++ b/spec/factories/follows.rb
@@ -3,5 +3,4 @@ FactoryGirl.define do
follower
followed
end
-
end
diff --git a/spec/factories/garden.rb b/spec/factories/garden.rb
index 8730c079c..8d6429e2a 100644
--- a/spec/factories/garden.rb
+++ b/spec/factories/garden.rb
@@ -20,6 +20,5 @@ FactoryGirl.define do
factory :garden_z do
name 'Zzzz this garden makes me sleepy'
end
-
end
end
diff --git a/spec/factories/member.rb b/spec/factories/member.rb
index b8b23a58a..7fb02594b 100644
--- a/spec/factories/member.rb
+++ b/spec/factories/member.rb
@@ -60,12 +60,12 @@ FactoryGirl.define do
end
factory :admin_member do
- roles { [ FactoryGirl.create(:admin) ] }
+ roles { [FactoryGirl.create(:admin)] }
end
factory :crop_wrangling_member do
- roles { [ FactoryGirl.create(:crop_wrangler) ] }
- sequence(:login_name) {|n| "wrangler#{n}"}
+ roles { [FactoryGirl.create(:crop_wrangler)] }
+ sequence(:login_name) { |n| "wrangler#{n}" }
end
factory :invalid_member_shortname do
@@ -103,7 +103,5 @@ FactoryGirl.define do
factory :no_email_notifications_member do
send_notification_email false
end
-
end
-
end
diff --git a/spec/factories/post.rb b/spec/factories/post.rb
index d9e6e0be5..562912214 100644
--- a/spec/factories/post.rb
+++ b/spec/factories/post.rb
@@ -1,5 +1,4 @@
FactoryGirl.define do
-
factory :post do
subject "A Post"
body "This is some text."
@@ -20,5 +19,4 @@ FactoryGirl.define do
forum
end
end
-
end
diff --git a/spec/factories/scientific_name.rb b/spec/factories/scientific_name.rb
index e1d1c8c36..4584cebf8 100644
--- a/spec/factories/scientific_name.rb
+++ b/spec/factories/scientific_name.rb
@@ -13,6 +13,5 @@ FactoryGirl.define do
association :crop, factory: :tomato
name "Solanum lycopersicum"
end
-
end
end
diff --git a/spec/features/crops/alternate_name_spec.rb b/spec/features/crops/alternate_name_spec.rb
index de8843708..319f4d7e1 100644
--- a/spec/features/crops/alternate_name_spec.rb
+++ b/spec/features/crops/alternate_name_spec.rb
@@ -42,7 +42,7 @@ feature "Alternate names", js: true do
scenario "Crop wranglers can delete alternate names" do
visit crop_path(alternate_eggplant.crop)
expect(page).to have_link "Delete",
- href: alternate_name_path(alternate_eggplant)
+ href: alternate_name_path(alternate_eggplant)
within('.alternate_names') { click_on "Delete" }
expect(page.status_code).to equal 200
expect(page).to_not have_content alternate_eggplant.name
@@ -52,7 +52,7 @@ feature "Alternate names", js: true do
scenario "Crop wranglers can add alternate names" do
visit crop_path(crop)
expect(page).to have_link "Add",
- href: new_alternate_name_path(crop_id: crop.id)
+ href: new_alternate_name_path(crop_id: crop.id)
within('.alternate_names') { click_on "Add" }
expect(page.status_code).to equal 200
expect(page).to have_css "option[value='#{crop.id}'][selected=selected]"
diff --git a/spec/features/crops/browse_crops_spec.rb b/spec/features/crops/browse_crops_spec.rb
index 1345d8738..72e63c8fd 100644
--- a/spec/features/crops/browse_crops_spec.rb
+++ b/spec/features/crops/browse_crops_spec.rb
@@ -1,10 +1,9 @@
require 'rails_helper'
feature "browse crops" do
-
let(:tomato) { create :tomato }
let(:maize) { create :maize }
- let(:pending_crop) { create :crop_request }
+ let(:pending_crop) { create :crop_request }
let(:rejected_crop) { create :rejected_crop }
scenario "has a form for sorting by" do
diff --git a/spec/features/crops/crop_detail_page_spec.rb b/spec/features/crops/crop_detail_page_spec.rb
index 3e6a71cea..cf2d3f502 100644
--- a/spec/features/crops/crop_detail_page_spec.rb
+++ b/spec/features/crops/crop_detail_page_spec.rb
@@ -35,7 +35,6 @@ feature "crop detail page", js: true do
let!(:roma4) { create :crop, name: 'Roma tomato 4', parent: crop }
scenario "The crop has 4 varieties" do
-
subject
within ".varieties" do
@@ -52,7 +51,6 @@ feature "crop detail page", js: true do
subject
within ".varieties" do
-
# It lists the first 5 items (note: including the top level item.)
# It HAS have "Show all" toggle link but not "Show less" link
expect(page).to have_selector('li', text: /tomato/i, count: 5)
@@ -96,7 +94,6 @@ feature "crop detail page", js: true do
end
context "action buttons" do
-
background { subject }
scenario "has a link to plant the crop" do
@@ -108,42 +105,40 @@ feature "crop detail page", js: true do
scenario "has a link to add seeds" do
expect(page).to have_link "Add seeds to stash", href: new_seed_path(crop_id: crop.id)
end
-
end
context "SEO" do
-
background { subject }
scenario "has seed heading with SEO" do
- expect(page).to have_content "Find #{ crop.name } seeds"
+ expect(page).to have_content "Find #{crop.name} seeds"
end
scenario "has harvest heading with SEO" do
- expect(page).to have_content "#{ crop.name.capitalize } harvests"
+ expect(page).to have_content "#{crop.name.capitalize} harvests"
end
scenario "has planting heading with SEO" do
- expect(page).to have_content "See who's planted #{ crop.name.pluralize }"
+ expect(page).to have_content "See who's planted #{crop.name.pluralize}"
end
scenario "has planting advice with SEO" do
- expect(page).to have_content "How to grow #{ crop.name }"
+ expect(page).to have_content "How to grow #{crop.name}"
end
scenario "has a link to Wikipedia with SEO" do
- expect(page).to have_content "Learn more about #{ crop.name }"
+ expect(page).to have_content "Learn more about #{crop.name}"
expect(page).to have_link "Wikipedia (English)", href: crop.en_wikipedia_url
end
scenario "has a link to OpenFarm" do
expect(page).to have_link "OpenFarm - Growing guide",
- href: "https://openfarm.cc/en/crops/#{URI.escape crop.name}"
+ href: "https://openfarm.cc/en/crops/#{URI.escape crop.name}"
end
scenario "has a link to gardenate" do
expect(page).to have_link "Gardenate - Planting reminders",
- href: "http://www.gardenate.com/plant/#{URI.escape crop.name}"
+ href: "http://www.gardenate.com/plant/#{URI.escape crop.name}"
end
end
end
diff --git a/spec/features/crops/crop_wranglers_spec.rb b/spec/features/crops/crop_wranglers_spec.rb
index 620034fb2..817f01ae7 100644
--- a/spec/features/crops/crop_wranglers_spec.rb
+++ b/spec/features/crops/crop_wranglers_spec.rb
@@ -62,8 +62,6 @@ feature "crop wranglers", js: true do
visit crop_path(rejected_crop)
expect(page).to have_content "This crop was rejected for the following reason: Totally fake"
end
-
-
end
context "signed in non-wrangler" do
diff --git a/spec/features/footer_spec.rb b/spec/features/footer_spec.rb
index 8a2c21bbd..b7d109773 100644
--- a/spec/features/footer_spec.rb
+++ b/spec/features/footer_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
feature "footer", js: true do
-
before { visit root_path }
scenario "footer is on home page" do
@@ -12,6 +11,6 @@ feature "footer", js: true do
expect(page).to have_selector 'a[href="http://opendefinition.org/ossd/"]'
end
-# NB: not testing specific content in the footer since I'm going to put them
-# in the CMS and they'll be variable.
+ # NB: not testing specific content in the footer since I'm going to put them
+ # in the CMS and they'll be variable.
end
diff --git a/spec/features/gardens_spec.rb b/spec/features/gardens_spec.rb
index 90f2f9ed7..78a7c1285 100644
--- a/spec/features/gardens_spec.rb
+++ b/spec/features/gardens_spec.rb
@@ -46,7 +46,6 @@ feature "Planting a crop", js: true do
end
context "Clicking edit from the index page" do
-
background do
visit gardens_path
end
diff --git a/spec/features/harvests/browse_harvests_spec.rb b/spec/features/harvests/browse_harvests_spec.rb
index 28784d7a8..d103ec3c9 100644
--- a/spec/features/harvests/browse_harvests_spec.rb
+++ b/spec/features/harvests/browse_harvests_spec.rb
@@ -18,7 +18,6 @@ feature "browse harvests" do
scenario 'read more' do
expect(page).not_to have_link "Read more"
end
-
end
feature "filled in optional fields" do
diff --git a/spec/features/locale_spec.rb b/spec/features/locale_spec.rb
index 74cf208be..01d164f3c 100644
--- a/spec/features/locale_spec.rb
+++ b/spec/features/locale_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
feature "Changing locales", js: true do
-
after { I18n.locale = :en }
scenario "Locale can be set with a query param" do
diff --git a/spec/features/member_profile_spec.rb b/spec/features/member_profile_spec.rb
index 0551e3873..0c27c7be2 100644
--- a/spec/features/member_profile_spec.rb
+++ b/spec/features/member_profile_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
feature "member profile", js: true do
-
context "signed out member" do
let(:member) { create :member }
@@ -42,7 +41,6 @@ feature "member profile", js: true do
expect(page).not_to have_css("#membermap")
expect(page).not_to have_content "See other members"
end
-
end
context "email privacy" do
@@ -70,7 +68,6 @@ feature "member profile", js: true do
end
context "activity stats" do
-
scenario "with no activity" do
visit member_path(member)
expect(page).to have_content "Activity"
@@ -91,7 +88,6 @@ feature "member profile", js: true do
expect(page).to have_link "4 seeds", href: seeds_by_owner_path(owner: member)
expect(page).to have_link "5 posts", href: posts_by_author_path(author: member)
end
-
end
scenario "twitter link" do
diff --git a/spec/features/notifications_spec.rb b/spec/features/notifications_spec.rb
index 05d02c764..28436a3b2 100644
--- a/spec/features/notifications_spec.rb
+++ b/spec/features/notifications_spec.rb
@@ -7,10 +7,10 @@ feature "Notifications", :js do
context "On existing notification" do
let!(:notification) {
create :notification,
- sender: sender,
- recipient: recipient,
- body: "Notification body",
- post_id: nil
+ sender: sender,
+ recipient: recipient,
+ body: "Notification body",
+ post_id: nil
}
background do
diff --git a/spec/features/rss/plantings_spec.rb b/spec/features/rss/plantings_spec.rb
index 597d82c01..59833eff1 100644
--- a/spec/features/rss/plantings_spec.rb
+++ b/spec/features/rss/plantings_spec.rb
@@ -9,6 +9,6 @@ feature 'Plantings RSS feed' do
scenario 'The index title is what we expect' do
visit plantings_path(format: 'rss')
expect(page).to have_content "Recent plantings from "\
- "#{ @owner ? @owner : 'all members' } (#{ENV['GROWSTUFF_SITE_NAME']})"
+ "#{@owner ? @owner : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})"
end
end
diff --git a/spec/features/rss/posts_spec.rb b/spec/features/rss/posts_spec.rb
index 8c48ad5d2..445a50cca 100644
--- a/spec/features/rss/posts_spec.rb
+++ b/spec/features/rss/posts_spec.rb
@@ -9,6 +9,6 @@ feature 'Posts RSS feed' do
scenario 'The index title is what we expect' do
visit posts_path(format: 'rss')
expect(page).to have_content "Recent posts from "\
- "#{ @author ? @author : 'all members' } (#{ENV['GROWSTUFF_SITE_NAME']})"
+ "#{@author ? @author : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})"
end
end
diff --git a/spec/features/rss/seeds_spec.rb b/spec/features/rss/seeds_spec.rb
index 0d3957f19..888cc42ec 100644
--- a/spec/features/rss/seeds_spec.rb
+++ b/spec/features/rss/seeds_spec.rb
@@ -9,6 +9,6 @@ feature 'Seeds RSS feed' do
scenario 'The index title is what we expect' do
visit seeds_path(format: 'rss')
expect(page).to have_content "Recent seeds from "\
- "#{ @owner ? @owner : 'all members' } (#{ENV['GROWSTUFF_SITE_NAME']})"
+ "#{@owner ? @owner : 'all members'} (#{ENV['GROWSTUFF_SITE_NAME']})"
end
end
diff --git a/spec/features/scientific_name_spec.rb b/spec/features/scientific_name_spec.rb
index 852f2c997..812d6c4de 100644
--- a/spec/features/scientific_name_spec.rb
+++ b/spec/features/scientific_name_spec.rb
@@ -42,7 +42,7 @@ feature "Scientific names", js: true do
scenario "Crop wranglers can delete scientific names" do
visit crop_path(zea_mays.crop)
expect(page).to have_link "Delete",
- href: scientific_name_path(zea_mays)
+ href: scientific_name_path(zea_mays)
within('.scientific_names') { click_on "Delete" }
expect(page.status_code).to equal 200
expect(page).to_not have_content zea_mays.name
@@ -52,7 +52,7 @@ feature "Scientific names", js: true do
scenario "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]"
@@ -67,7 +67,7 @@ feature "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/signin_spec.rb b/spec/features/signin_spec.rb
index 0424f85bb..41aa1ecd1 100644
--- a/spec/features/signin_spec.rb
+++ b/spec/features/signin_spec.rb
@@ -1,6 +1,5 @@
require 'rails_helper'
-
feature "signin", js: true do
let(:member) { create :member }
let(:recipient) { create :member }
@@ -63,7 +62,7 @@ feature "signin", js: true do
end
context "with facebook" do
- scenario "sign in" do
+ scenario "sign in" do
# Ordinarily done by database_cleaner
Member.where(login_name: 'tdawg').delete_all
diff --git a/spec/features/signout_spec.rb b/spec/features/signout_spec.rb
index 2d5d1a230..433286078 100644
--- a/spec/features/signout_spec.rb
+++ b/spec/features/signout_spec.rb
@@ -26,5 +26,4 @@ feature "signout" do
expect(current_path).to eq new_member_session_path
end
end
-
end
diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb
index d3ebaad8d..6afb28119 100644
--- a/spec/features/signup_spec.rb
+++ b/spec/features/signup_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
feature "signup", js: true do
-
scenario "sign up for new account from top menubar" do
visit crops_path # something other than front page, which has multiple signup links
click_link 'Sign up'
diff --git a/spec/helpers/harvests_helper_spec.rb b/spec/helpers/harvests_helper_spec.rb
index c65d8b36e..15cafc9c5 100644
--- a/spec/helpers/harvests_helper_spec.rb
+++ b/spec/helpers/harvests_helper_spec.rb
@@ -2,7 +2,6 @@ require 'rails_helper'
describe HarvestsHelper do
describe "display_quantity" do
-
it "blank" do
harvest = FactoryGirl.create(:harvest,
quantity: nil,
@@ -74,6 +73,5 @@ describe HarvestsHelper do
result = helper.display_quantity(harvest)
result.should eq '3 bunches, weighing 3 kg'
end
-
end
end
diff --git a/spec/helpers/notifications_helper_spec.rb b/spec/helpers/notifications_helper_spec.rb
index abbc17b0b..d79ea409d 100644
--- a/spec/helpers/notifications_helper_spec.rb
+++ b/spec/helpers/notifications_helper_spec.rb
@@ -2,7 +2,6 @@ require 'rails_helper'
describe NotificationsHelper do
describe "reply_link" do
-
let(:member) { FactoryGirl.create(:member) }
it "replies to PMs with PMs" do
@@ -23,7 +22,5 @@ describe NotificationsHelper do
post_id: notification.post.id
)
end
-
-
end
end
diff --git a/spec/helpers/plantings_helper_spec.rb b/spec/helpers/plantings_helper_spec.rb
index b7acfaaca..9485af81d 100644
--- a/spec/helpers/plantings_helper_spec.rb
+++ b/spec/helpers/plantings_helper_spec.rb
@@ -2,7 +2,6 @@ require 'rails_helper'
describe PlantingsHelper do
describe "display_planting" do
-
let!(:member) { FactoryGirl.build(:member, login_name: 'crop_lady') }
it "does not have a quantity nor a planted from value provided" do
@@ -67,8 +66,6 @@ describe PlantingsHelper do
result = helper.display_planting(planting)
expect(result).to eq "crop_lady planted 1 seed."
end
-
end
-
end
end
diff --git a/spec/lib/actions/oauth_signup_action_spec.rb b/spec/lib/actions/oauth_signup_action_spec.rb
index da654e8e6..4bb4f74bb 100644
--- a/spec/lib/actions/oauth_signup_action_spec.rb
+++ b/spec/lib/actions/oauth_signup_action_spec.rb
@@ -9,26 +9,26 @@ describe 'Growstuff::OauthSignupAction' do
context 'with a valid authentication' do
before :each do
@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'
- },
- 'credentials' => {
- 'token' => "token",
- 'secret' => "donttell"
- }
- })
+ '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'
+ },
+ 'credentials' => {
+ 'token' => "token",
+ 'secret' => "donttell"
+ }
+ })
end
context 'no existing user' do
before :each do
@auth['info']['email'] = 'no.existing.user@gmail.com'
- Member.where(email: @auth['info']['email']).delete_all
+ Member.where(email: @auth['info']['email']).delete_all
@member = @action.find_or_create_from_authorization(@auth)
@authentication = @action.establish_authentication(@auth, @member)
@@ -129,11 +129,11 @@ describe 'Growstuff::OauthSignupAction' do
}
@existing_authentication = @existing_member.authentications.create({
- provider: 'facebook',
- uid: '123545',
- name: "John Testerson's Brother",
- member_id: @existing_member.id
- })
+ provider: 'facebook',
+ uid: '123545',
+ name: "John Testerson's Brother",
+ member_id: @existing_member.id
+ })
@member = @action.find_or_create_from_authorization(@auth)
@authentication = @action.establish_authentication(@auth, @member)
diff --git a/spec/lib/haml/filters/escaped_markdown_spec.rb b/spec/lib/haml/filters/escaped_markdown_spec.rb
index 60066160f..23f275f96 100644
--- a/spec/lib/haml/filters/escaped_markdown_spec.rb
+++ b/spec/lib/haml/filters/escaped_markdown_spec.rb
@@ -19,5 +19,4 @@ describe 'Haml::Filters::Escaped_Markdown' do
rendered = Haml::Filters::EscapedMarkdown.render("[#{@crop.name}](crop)")
rendered.should match /<a href="/
end
-
end
diff --git a/spec/lib/haml/filters/growstuff_markdown_spec.rb b/spec/lib/haml/filters/growstuff_markdown_spec.rb
index 2aba8fb89..debce3111 100644
--- a/spec/lib/haml/filters/growstuff_markdown_spec.rb
+++ b/spec/lib/haml/filters/growstuff_markdown_spec.rb
@@ -6,7 +6,7 @@ def input_link(name)
return "[#{name}](crop)"
end
-def output_link(crop, name=nil)
+def output_link(crop, name = nil)
url = Rails.application.routes.url_helpers.crop_url(crop, host: Growstuff::Application.config.host)
if name
return "#{name}"
@@ -19,7 +19,7 @@ def input_member_link(name)
return "[#{name}](member)"
end
-def output_member_link(member, name=nil)
+def output_member_link(member, name = nil)
url = Rails.application.routes.url_helpers.member_url(member, only_path: true)
if name
return "#{name}"
@@ -28,12 +28,11 @@ def output_member_link(member, name=nil)
end
end
-
describe 'Haml::Filters::Growstuff_Markdown' do
- it 'is registered as the handler for :growstuff_markdown' do
- Haml::Filters::defined['growstuff_markdown'].should ==
- Haml::Filters::GrowstuffMarkdown
- end
+ it 'is registered as the handler for :growstuff_markdown' do
+ Haml::Filters::defined['growstuff_markdown'].should ==
+ Haml::Filters::GrowstuffMarkdown
+ end
it 'converts quick crop links' do
@crop = FactoryGirl.create(:crop)
@@ -48,7 +47,7 @@ describe 'Haml::Filters::Growstuff_Markdown' do
it "doesn't convert escaped crop links" do
@crop = FactoryGirl.create(:crop)
- rendered = Haml::Filters::GrowstuffMarkdown.render( "\\" << input_link(@crop.name))
+ rendered = Haml::Filters::GrowstuffMarkdown.render("\\" << input_link(@crop.name))
rendered.should match /\[#{@crop.name}\]\(crop\)/
end
@@ -97,7 +96,6 @@ describe 'Haml::Filters::Growstuff_Markdown' do
rendered.should match /\[#{@member.login_name}\]\(member\)/
end
-
it 'converts @ member links' do
@member = FactoryGirl.create(:member)
rendered = Haml::Filters::GrowstuffMarkdown.render("Hey @#{@member.login_name}! What's up")
@@ -122,5 +120,4 @@ describe 'Haml::Filters::Growstuff_Markdown' do
rendered = Haml::Filters::GrowstuffMarkdown.render("Hey \\@#{@member.login_name}! What's up")
rendered.should match /Hey @#{@member.login_name}!/
end
-
end
diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb
index ce552f99b..c766528b7 100644
--- a/spec/mailers/notifier_spec.rb
+++ b/spec/mailers/notifier_spec.rb
@@ -1,7 +1,6 @@
require "rails_helper"
describe Notifier do
-
describe "notifications" do
let(:notification) { FactoryGirl.create(:notification) }
let(:mail) { Notifier.notify(notification) }
@@ -42,10 +41,8 @@ describe Notifier do
it 'includes the new harvest URL' do
mail.body.encoded.should match new_harvest_path
end
-
end
-
describe "new crop request" do
let(:member) { FactoryGirl.create(:crop_wrangling_member) }
let(:crop) { FactoryGirl.create(:crop_request) }
@@ -94,7 +91,6 @@ describe Notifier do
expect(mail.body.encoded).to match "#{new_harvest_url}\\?crop_id=#{crop.id}"
expect(mail.body.encoded).to match "#{new_seed_url}\\?crop_id=#{crop.id}"
end
-
end
describe "crop rejected" do
@@ -122,6 +118,4 @@ describe Notifier do
expect(mail.body.encoded).to match "Totally fake"
end
end
-
-
end
diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb
index 53a820bd3..4bb68c674 100644
--- a/spec/models/ability_spec.rb
+++ b/spec/models/ability_spec.rb
@@ -2,12 +2,10 @@ require 'rails_helper'
require 'cancan/matchers'
describe Ability do
-
let(:member) { FactoryGirl.create(:member) }
let(:ability) { Ability.new(member) }
context "notifications" do
-
it 'member can view their own notifications' do
notification = FactoryGirl.create(:notification, recipient: member)
ability.should be_able_to(:read, notification)
@@ -38,7 +36,6 @@ describe Ability do
end
context "crop wrangling" do
-
let(:crop) { FactoryGirl.create(:crop) }
context "standard member" do
@@ -57,7 +54,6 @@ describe Ability do
end
context "crop wrangler" do
-
let(:role) { FactoryGirl.create(:crop_wrangler) }
before(:each) do
@@ -81,7 +77,6 @@ describe Ability do
end
context "products" do
-
let(:product) { FactoryGirl.create(:product) }
context "standard member" do
@@ -91,11 +86,9 @@ describe Ability do
ability.should_not be_able_to(:update, product)
ability.should_not be_able_to(:destroy, product)
end
-
end
context "admin" do
-
let(:role) { FactoryGirl.create(:admin) }
before do
@@ -122,17 +115,16 @@ describe Ability do
end
context "orders" do
-
let(:order) { FactoryGirl.create(:order, member: member) }
let(:strangers_order) { FactoryGirl.create(:order,
- member: FactoryGirl.create(:member)) }
+ member: FactoryGirl.create(:member)) }
let(:completed_order) { FactoryGirl.create(:completed_order,
- member: member) }
+ member: member) }
let(:order_item) { FactoryGirl.create(:order_item, order: order) }
let(:strangers_order_item) { FactoryGirl.create(:order_item,
- order: strangers_order) }
+ order: strangers_order) }
let(:completed_order_item) { FactoryGirl.create(:order_item,
- order: completed_order) }
+ order: completed_order) }
context "standard member" do
it "can read their own orders" do
@@ -208,12 +200,9 @@ describe Ability do
it "can't delete items from completed orders" do
ability.should_not be_able_to(:destroy, completed_order_item)
end
-
-
end
context "admin" do
-
let(:role) { FactoryGirl.create(:admin) }
before do
@@ -239,12 +228,10 @@ describe Ability do
it "cannot delete orders" do
ability.should_not be_able_to(:destroy, order)
end
-
end
end
context 'account details' do
-
let(:account) { member.account }
context 'ordinary member' do
@@ -259,7 +246,6 @@ describe Ability do
end
context 'admin' do
-
let(:role) { FactoryGirl.create(:admin) }
before do
@@ -274,13 +260,10 @@ describe Ability do
ability.should be_able_to(:update, account)
ability.should be_able_to(:destroy, account)
end
-
end
-
end
context 'plant parts' do
-
let(:plant_part) { FactoryGirl.create(:plant_part) }
context 'ordinary member' do
@@ -295,7 +278,6 @@ describe Ability do
end
context 'admin' do
-
let(:role) { FactoryGirl.create(:admin) }
before do
@@ -318,8 +300,6 @@ describe Ability do
@harvest = FactoryGirl.create(:harvest, plant_part: plant_part)
ability.should_not be_able_to(:destroy, plant_part)
end
-
end
end
-
end
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index 1274a825e..52caf725f 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Account do
-
let(:member) { FactoryGirl.create(:member) }
it "auto-creates an account detail record when a member is created" do
@@ -25,5 +24,4 @@ describe Account do
member.account.paid_until = @time
member.account.paid_until_string.should eq @time.to_s
end
-
end
diff --git a/spec/models/alternate_name_spec.rb b/spec/models/alternate_name_spec.rb
index 5e12b02de..ec5684bcb 100644
--- a/spec/models/alternate_name_spec.rb
+++ b/spec/models/alternate_name_spec.rb
@@ -18,5 +18,4 @@ describe AlternateName do
expect(crop.alternate_names).to include an
expect(crop.alternate_names).to include an2
end
-
end
diff --git a/spec/models/authentication_spec.rb b/spec/models/authentication_spec.rb
index 0159361ff..10f6ac3d6 100644
--- a/spec/models/authentication_spec.rb
+++ b/spec/models/authentication_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Authentication do
-
it 'creates an authentication' do
@auth = FactoryGirl.create(:authentication)
@auth.should be_an_instance_of Authentication
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb
index d26653f0d..0badd5be6 100644
--- a/spec/models/comment_spec.rb
+++ b/spec/models/comment_spec.rb
@@ -1,9 +1,7 @@
require 'rails_helper'
describe Comment do
-
context "basic" do
-
let(:comment) { FactoryGirl.create(:comment) }
it "belongs to a post" do
@@ -16,7 +14,6 @@ describe Comment do
end
context "notifications" do
-
let(:comment) { FactoryGirl.create(:comment) }
it "sends a notification when a comment is posted" do
@@ -60,5 +57,4 @@ describe Comment do
Comment.post_order.should eq [@c1, @c2]
end
end
-
end
diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb
index 1171697ae..61ec1cbdb 100644
--- a/spec/models/crop_spec.rb
+++ b/spec/models/crop_spec.rb
@@ -2,7 +2,6 @@ require 'rails_helper'
describe Crop do
context 'all fields present' do
-
let(:crop) { FactoryGirl.create(:tomato) }
it 'should save a basic crop' do
@@ -51,7 +50,6 @@ describe Crop do
end
context 'popularity' do
-
let(:tomato) { FactoryGirl.create(:tomato) }
let(:maize) { FactoryGirl.create(:maize) }
let(:cucumber) { FactoryGirl.create(:crop, name: 'cucumber') }
@@ -66,7 +64,6 @@ describe Crop do
FactoryGirl.create_list(:planting, 10, crop: tomato)
Crop.popular.first.should eq tomato
end
-
end
it 'finds a default scientific name' do
@@ -135,7 +132,7 @@ describe Crop do
it 'toplevel scope works' do
@tomato = FactoryGirl.create(:tomato)
@roma = FactoryGirl.create(:roma, parent_id: @tomato.id)
- Crop.toplevel.should eq [ @tomato ]
+ Crop.toplevel.should eq [@tomato]
end
end
@@ -181,7 +178,6 @@ describe Crop do
end
end
-
context 'with no plantings or harvests' do
it 'has no default photo' do
@crop.default_photo.should eq nil
@@ -190,7 +186,6 @@ describe Crop do
end
context 'sunniness' do
-
let(:crop) { FactoryGirl.create(:tomato) }
it 'returns a hash of sunniness values' do
@@ -218,7 +213,6 @@ describe Crop do
end
context 'planted_from' do
-
let(:crop) { FactoryGirl.create(:tomato) }
it 'returns a hash of sunniness values' do
@@ -246,7 +240,6 @@ describe Crop do
end
context 'popular plant parts' do
-
let(:crop) { FactoryGirl.create(:tomato) }
it 'returns a hash of plant_part values' do
@@ -276,7 +269,6 @@ describe Crop do
)
crop.popular_plant_parts.should == { @fruit => 2, @seed => 1, @root => 1 }
end
-
end
context 'interesting' do
@@ -327,7 +319,6 @@ describe Crop do
Crop.interesting.should include @crop1
Crop.interesting.should_not include @crop2
Crop.interesting.size.should == 1
-
end
it 'ignores crops without photos' do
@@ -354,7 +345,6 @@ describe Crop do
Crop.interesting.should_not include @crop2
Crop.interesting.size.should == 1
end
-
end
context "harvests" do
@@ -396,7 +386,6 @@ describe Crop do
end
context "search" do
-
let(:mushroom) { FactoryGirl.create(:crop, name: 'mushroom') }
before do
@@ -428,7 +417,6 @@ describe Crop do
end
context "csv loading" do
-
before(:each) do
# don't use 'let' for this -- we need to actually create it,
# regardless of whether it's used.
@@ -436,7 +424,6 @@ describe Crop do
end
context "scientific names" do
-
it "adds a scientific name to a crop that has none" do
tomato = FactoryGirl.create(:tomato)
expect(tomato.scientific_names.size).to eq 0
@@ -501,7 +488,6 @@ describe Crop do
tomato.add_scientific_names_from_csv("Baz, Quux") # multiple spaces
expect(tomato.scientific_names.size).to eq 4
end
-
end # scientific names
context "alternate names" do
@@ -603,9 +589,7 @@ describe Crop do
expect(loaded.name).to eq "tomato"
expect(loaded.en_wikipedia_url).to eq 'http://en.wikipedia.org/wiki/Tomato'
expect(loaded.creator).to eq @cropbot
-
end
-
end
context "crop-post association" do
diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb
index 6005583f8..2fd0b6b80 100644
--- a/spec/models/follow_spec.rb
+++ b/spec/models/follow_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
describe Follow do
-
before(:each) do
@member1 = FactoryGirl.create(:member)
@member2 = FactoryGirl.create(:member)
@@ -21,7 +20,6 @@ describe Follow do
end
context "when follow is created" do
-
before (:each) do
@follow = Follow.create(follower_id: @member1.id, followed_id: @member2.id)
end
@@ -41,5 +39,4 @@ describe Follow do
expect(@member2.followers).not_to include(@member1)
end
end
-
end
diff --git a/spec/models/forum_spec.rb b/spec/models/forum_spec.rb
index 72fafd31c..4c1c42275 100644
--- a/spec/models/forum_spec.rb
+++ b/spec/models/forum_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Forum do
-
let(:forum) { FactoryGirl.create(:forum) }
it "belongs to an owner" do
@@ -27,5 +26,4 @@ describe Forum do
@post2 = FactoryGirl.create(:forum_post, forum: forum, created_at: 1.day.ago)
forum.posts.first.should eq @post2
end
-
end
diff --git a/spec/models/garden_spec.rb b/spec/models/garden_spec.rb
index bfb53f1eb..4ffb1bfc5 100644
--- a/spec/models/garden_spec.rb
+++ b/spec/models/garden_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Garden do
-
let(:owner) { FactoryGirl.create(:member) }
let(:garden) { FactoryGirl.create(:garden, owner: owner) }
@@ -52,7 +51,6 @@ describe Garden do
end
context "featured plantings" do
-
let(:tomato) { FactoryGirl.create(:tomato) }
let(:maize) { FactoryGirl.create(:maize) }
let(:chard) { FactoryGirl.create(:chard) }
@@ -65,7 +63,6 @@ describe Garden do
@p2 = FactoryGirl.create(:planting, crop: maize, garden: garden)
garden.featured_plantings.should eq [@p2, @p1]
-
end
it "should fetch most recent 4 featured plantings" do
@@ -168,7 +165,6 @@ describe Garden do
end
context 'active scopes' do
-
let(:active) { FactoryGirl.create(:garden) }
let(:inactive) { FactoryGirl.create(:inactive_garden) }
@@ -219,7 +215,6 @@ describe Garden do
end
context 'photos' do
-
let(:garden) { FactoryGirl.create(:garden) }
let(:photo) { FactoryGirl.create(:photo) }
@@ -234,18 +229,17 @@ describe Garden do
it 'deletes association with photos when photo is deleted' do
photo.destroy
garden.reload
- garden.photos.should be_empty
+ garden.photos.should be_empty
end
it 'has a default photo' do
- garden.default_photo.should eq photo
+ garden.default_photo.should eq photo
end
it 'chooses the most recent photo' do
- @photo2 = FactoryGirl.create(:photo)
+ @photo2 = FactoryGirl.create(:photo)
garden.photos << @photo2
garden.default_photo.should eq @photo2
end
end
-
end
diff --git a/spec/models/harvest_spec.rb b/spec/models/harvest_spec.rb
index 3933b752a..a3aedddf2 100644
--- a/spec/models/harvest_spec.rb
+++ b/spec/models/harvest_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Harvest do
-
it "has an owner" do
harvest = FactoryGirl.create(:harvest)
harvest.owner.should be_an_instance_of Member
@@ -46,7 +45,8 @@ describe Harvest do
context 'units' do
it 'all valid units should work' do
- ['individual','bunch','sprig','handful','litre','pint','quart','bucket','basket','bushel', nil, ''].each do |s|
+ ['individual', 'bunch', 'sprig', 'handful', 'litre',
+ 'pint', 'quart', 'bucket', 'basket', 'bushel', nil, ''].each do |s|
@harvest = FactoryGirl.build(:harvest, unit: s)
@harvest.should be_valid
end
@@ -147,92 +147,89 @@ describe Harvest do
end
context "stringification" do
-
let(:crop) { FactoryGirl.create(:crop, name: "apricot") }
it "apricots" do
@h = FactoryGirl.create(:harvest, crop: crop,
- quantity: nil,
- unit: nil,
- weight_quantity: nil,
- weight_unit: nil
+ quantity: nil,
+ unit: nil,
+ weight_quantity: nil,
+ weight_unit: nil
)
@h.to_s.should eq "apricots"
end
it "1 individual apricot" do
@h = FactoryGirl.create(:harvest, crop: crop,
- quantity: 1,
- unit: 'individual',
- weight_quantity: nil,
- weight_unit: nil
+ quantity: 1,
+ unit: 'individual',
+ weight_quantity: nil,
+ weight_unit: nil
)
@h.to_s.should eq "1 individual apricot"
end
it "10 individual apricots" do
@h = FactoryGirl.create(:harvest, crop: crop,
- quantity: 10,
- unit: 'individual',
- weight_quantity: nil,
- weight_unit: nil
+ quantity: 10,
+ unit: 'individual',
+ weight_quantity: nil,
+ weight_unit: nil
)
@h.to_s.should eq "10 individual apricots"
end
it "1 bushel of apricots" do
@h = FactoryGirl.create(:harvest, crop: crop,
- quantity: 1,
- unit: 'bushel',
- weight_quantity: nil,
- weight_unit: nil
+ quantity: 1,
+ unit: 'bushel',
+ weight_quantity: nil,
+ weight_unit: nil
)
@h.to_s.should eq "1 bushel of apricots"
end
it "1.5 bushels of apricots" do
@h = FactoryGirl.create(:harvest, crop: crop,
- quantity: 1.5,
- unit: 'bushel',
- weight_quantity: nil,
- weight_unit: nil
+ quantity: 1.5,
+ unit: 'bushel',
+ weight_quantity: nil,
+ weight_unit: nil
)
@h.to_s.should eq "1.5 bushels of apricots"
end
it "10 bushels of apricots" do
@h = FactoryGirl.create(:harvest, crop: crop,
- quantity: 10,
- unit: 'bushel',
- weight_quantity: nil,
- weight_unit: nil
+ quantity: 10,
+ unit: 'bushel',
+ weight_quantity: nil,
+ weight_unit: nil
)
@h.to_s.should eq "10 bushels of apricots"
end
it "apricots weighing 1.2 kg" do
@h = FactoryGirl.create(:harvest, crop: crop,
- quantity: nil,
- unit: nil,
- weight_quantity: 1.2,
- weight_unit: 'kg'
+ quantity: nil,
+ unit: nil,
+ weight_quantity: 1.2,
+ weight_unit: 'kg'
)
@h.to_s.should eq "apricots weighing 1.2 kg"
end
it "10 bushels of apricots weighing 100 kg" do
@h = FactoryGirl.create(:harvest, crop: crop,
- quantity: 10,
- unit: 'bushel',
- weight_quantity: 100,
- weight_unit: 'kg')
+ quantity: 10,
+ unit: 'bushel',
+ weight_quantity: 100,
+ weight_unit: 'kg')
@h.to_s.should eq "10 bushels of apricots weighing 100 kg"
end
-
end
context 'photos' do
-
before :each do
@harvest = FactoryGirl.create(:harvest)
end
@@ -288,7 +285,6 @@ describe Harvest do
end
end
-
context 'and a second photo' do
before :each do
@photo2 = FactoryGirl.create(:photo)
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb
index 474819018..cc6281fc4 100644
--- a/spec/models/member_spec.rb
+++ b/spec/models/member_spec.rb
@@ -1,9 +1,7 @@
require 'rails_helper'
describe 'member' do
-
context 'valid member' do
-
let(:member) { FactoryGirl.create(:member) }
it 'should be fetchable from the database' do
@@ -91,11 +89,9 @@ describe 'member' do
member.latitude.should be_nil
member.longitude.should be_nil
end
-
end
context 'no TOS agreement' do
-
let(:member) { FactoryGirl.build(:no_tos_member) }
it "should refuse to save a member who hasn't agreed to the TOS" do
@@ -188,7 +184,6 @@ describe 'member' do
end
context 'roles' do
-
let(:member) { FactoryGirl.create(:member) }
let(:role) { FactoryGirl.create(:role) }
@@ -280,10 +275,8 @@ describe 'member' do
@member2.updated_at = 2.days.ago
@member3.updated_at = 1.days.ago
- Member.interesting.should eq [ @member3, @member2, @member1 ]
-
+ Member.interesting.should eq [@member3, @member2, @member1]
end
-
end
context 'orders' do
@@ -303,19 +296,18 @@ describe 'member' do
end
context "paid accounts" do
-
let(:member) { FactoryGirl.create(:member) }
it "recognises a permanent paid account" do
@account_type = FactoryGirl.create(:account_type,
- is_paid: true, is_permanent_paid: true)
+ is_paid: true, is_permanent_paid: true)
member.account.account_type = @account_type
member.is_paid?.should be(true)
end
it "recognises a current paid account" do
@account_type = FactoryGirl.create(:account_type,
- is_paid: true, is_permanent_paid: false)
+ is_paid: true, is_permanent_paid: false)
member.account.account_type = @account_type
member.account.paid_until = Time.zone.now + 1.month
member.is_paid?.should be(true)
@@ -323,7 +315,7 @@ describe 'member' do
it "recognises an expired paid account" do
@account_type = FactoryGirl.create(:account_type,
- is_paid: true, is_permanent_paid: false)
+ is_paid: true, is_permanent_paid: false)
member.account.account_type = @account_type
member.account.paid_until = Time.zone.now - 1.minute
member.is_paid?.should be(false)
@@ -331,23 +323,21 @@ describe 'member' do
it "recognises a free account" do
@account_type = FactoryGirl.create(:account_type,
- is_paid: false, is_permanent_paid: false)
+ is_paid: false, is_permanent_paid: false)
member.account.account_type = @account_type
member.is_paid?.should be(false)
end
it "recognises a free account even with paid_until set" do
@account_type = FactoryGirl.create(:account_type,
- is_paid: false, is_permanent_paid: false)
+ is_paid: false, is_permanent_paid: false)
member.account.account_type = @account_type
member.account.paid_until = Time.zone.now + 1.month
member.is_paid?.should be(false)
end
-
end
context "update account" do
-
let(:product) { FactoryGirl.create(:product,
paid_months: 3
)}
@@ -407,7 +397,5 @@ describe 'member' do
expect(member1.get_follow(member3)).to be_nil
end
end
-
end
-
end
diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb
index e38444d5d..04cb028f3 100644
--- a/spec/models/notification_spec.rb
+++ b/spec/models/notification_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Notification do
-
let(:notification) { FactoryGirl.create(:notification) }
it "belongs to a post" do
@@ -56,5 +55,4 @@ describe Notification do
notification = FactoryGirl.create(:notification, subject: " ")
notification.subject.should == "(no subject)"
end
-
end
diff --git a/spec/models/order_item_spec.rb b/spec/models/order_item_spec.rb
index 67f86415c..a6ede25d8 100644
--- a/spec/models/order_item_spec.rb
+++ b/spec/models/order_item_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe OrderItem do
-
let(:order_item) { FactoryGirl.create(:order_item) }
it "has an order and a product" do
@@ -24,5 +23,4 @@ describe OrderItem do
@order_item2 = FactoryGirl.build(:order_item, order: @order)
@order_item2.should_not be_valid
end
-
end
diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb
index 0f12d9b2f..89c29785d 100644
--- a/spec/models/order_spec.rb
+++ b/spec/models/order_spec.rb
@@ -81,7 +81,6 @@ describe Order do
quantity: 1,
amount: 1111
}]
-
end
context "referral codes" do
@@ -126,7 +125,5 @@ describe Order do
order = FactoryGirl.create(:order, referral_code: 'baz')
Order.search(by: 'referral_code', for: 'baz').should eq [order]
end
-
end
-
end
diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb
index bd6335be2..5ec32bf73 100644
--- a/spec/models/photo_spec.rb
+++ b/spec/models/photo_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Photo do
-
describe 'add/delete functionality' do
let(:photo) { FactoryGirl.create(:photo) }
let(:planting) { FactoryGirl.create(:planting) }
@@ -105,9 +104,7 @@ describe Photo do
planting.destroy # photo is still used by the harvest
expect(photo).to be_an_instance_of Photo
end
-
end # removing photos
-
end # add/delete functionality
describe 'flickr_metadata' do
diff --git a/spec/models/plant_part_spec.rb b/spec/models/plant_part_spec.rb
index ef3705ef2..bd2ee6407 100644
--- a/spec/models/plant_part_spec.rb
+++ b/spec/models/plant_part_spec.rb
@@ -35,5 +35,4 @@ describe PlantPart do
)
@pp1.crops.should eq [@maize]
end
-
end
diff --git a/spec/models/planting_spec.rb b/spec/models/planting_spec.rb
index 97bfcbe2c..327379fc3 100644
--- a/spec/models/planting_spec.rb
+++ b/spec/models/planting_spec.rb
@@ -1,12 +1,11 @@
require 'rails_helper'
describe Planting do
-
let(:crop) { FactoryGirl.create(:tomato) }
let(:garden_owner) { FactoryGirl.create(:member) }
let(:garden) { FactoryGirl.create(:garden, owner: garden_owner) }
let(:planting) { FactoryGirl.create(:planting,
- crop: crop, garden: garden)}
+ crop: crop, garden: garden)}
it 'has an owner' do
planting.owner.should be_an_instance_of Member
@@ -123,7 +122,6 @@ describe Planting do
end
context 'sunniness' do
-
let(:planting) { FactoryGirl.create(:sunny_planting) }
it 'should have a sunniness value' do
@@ -152,8 +150,8 @@ describe Planting do
it 'all valid planted_from values should work' do
['seed', 'seedling', 'cutting', 'root division',
- 'runner', 'bare root plant', 'advanced plant',
- 'graft', 'layering', 'bulb', 'root/tuber', nil, ''].each do |p|
+ 'runner', 'bare root plant', 'advanced plant',
+ 'graft', 'layering', 'bulb', 'root/tuber', nil, ''].each do |p|
@planting = FactoryGirl.build(:planting, planted_from: p)
@planting.should be_valid
end
@@ -169,7 +167,6 @@ describe Planting do
# we decided that all the tests for the planting/photo association would
# be done on this side, not on the photos side
context 'photos' do
-
let(:planting) { FactoryGirl.create(:planting) }
let(:photo) { FactoryGirl.create(:photo) }
@@ -278,7 +275,6 @@ describe Planting do
Planting.interesting(3, false).size.should eq 3
end
end
-
end # interesting plantings
context "finished" do
@@ -304,7 +300,7 @@ describe Planting do
context "finished date validation" do
it 'requires finished date after planting date' do
- @f = FactoryGirl.build(:finished_planting, planted_at: '2014-01-01', finished_at: '2013-01-01')
+ @f = FactoryGirl.build(:finished_planting, planted_at: '2014-01-01', finished_at: '2013-01-01')
@f.should_not be_valid
end
diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb
index 2c4e7ae95..375b56586 100644
--- a/spec/models/post_spec.rb
+++ b/spec/models/post_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Post do
-
let(:member) { FactoryGirl.create(:member) }
it "should be sorted in reverse order" do
@@ -66,7 +65,6 @@ describe Post do
end
context "recent activity" do
-
before do
Time.stub(now: Time.now)
end
@@ -79,7 +77,7 @@ describe Post do
it "sets recent activity to comment time" do
@comment = FactoryGirl.create(:comment, post: post,
- created_at: 1.hour.ago)
+ created_at: 1.hour.ago)
post.recent_activity.to_i.should eq @comment.created_at.to_i
end
diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb
index af1a02ba5..6526ecf27 100644
--- a/spec/models/product_spec.rb
+++ b/spec/models/product_spec.rb
@@ -1,10 +1,8 @@
require 'rails_helper'
describe Product do
-
it "stringifies using the name" do
@product = FactoryGirl.create(:product)
@product.to_s.should eq @product.name
end
-
end
diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb
index 6ea5d1a9d..f8393ae84 100644
--- a/spec/models/role_spec.rb
+++ b/spec/models/role_spec.rb
@@ -1,7 +1,7 @@
require 'rails_helper'
describe Role do
- let(:member) { FactoryGirl.create(:member) }
+ let(:member) { FactoryGirl.create(:member) }
subject do
role = FactoryGirl.create(:role, name: 'Crop Wrangler')
diff --git a/spec/models/scientific_name_spec.rb b/spec/models/scientific_name_spec.rb
index 43de4ef32..3be2f36ac 100644
--- a/spec/models/scientific_name_spec.rb
+++ b/spec/models/scientific_name_spec.rb
@@ -2,7 +2,6 @@ require 'rails_helper'
describe ScientificName do
context 'all fields present' do
-
let(:sn) { FactoryGirl.create(:zea_mays) }
it 'should save a basic scientific name' do
diff --git a/spec/models/seed_spec.rb b/spec/models/seed_spec.rb
index aa2238d54..5e6a9ff19 100644
--- a/spec/models/seed_spec.rb
+++ b/spec/models/seed_spec.rb
@@ -1,7 +1,6 @@
require 'rails_helper'
describe Seed do
-
let(:seed) { FactoryGirl.build(:seed) }
it 'should save a basic seed' do
@@ -85,14 +84,13 @@ describe Seed do
@untradable = FactoryGirl.create(:untradable_seed)
Seed.tradable.should include @tradable
Seed.tradable.should_not include @untradable
-
end
end
context 'organic, gmo, heirloom' do
it 'all valid organic values should work' do
- ['certified organic', 'non-certified organic',
- 'conventional/non-organic', 'unknown'].each do |t|
+ ['certified organic', 'non-certified organic',
+ 'conventional/non-organic', 'unknown'].each do |t|
@seed = FactoryGirl.build(:seed, organic: t)
@seed.should be_valid
end
@@ -107,7 +105,7 @@ describe Seed do
end
it 'all valid heirloom values should work' do
- %w(heirloom hybrid unknown).each do |t|
+ %w(heirloom hybrid unknown).each do |t|
@seed = FactoryGirl.build(:seed, heirloom: t)
@seed.should be_valid
end
@@ -131,10 +129,8 @@ describe Seed do
end
end
-
context 'interesting' do
it 'lists interesting seeds' do
-
# to be interesting a seed must:
# 1) be tradable
# 2) the owner must have a location set
@@ -152,5 +148,4 @@ describe Seed do
Seed.interesting.size.should == 1
end
end
-
end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index c9ab1e79e..cdfb951cb 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -5,9 +5,9 @@ require 'coveralls'
# output coverage locally AND send it to coveralls
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
- SimpleCov::Formatter::HTMLFormatter,
- Coveralls::SimpleCov::Formatter
-])
+ SimpleCov::Formatter::HTMLFormatter,
+ Coveralls::SimpleCov::Formatter
+ ])
# fail if there's a significant test coverage drop
SimpleCov.maximum_coverage_drop 1
@@ -37,7 +37,7 @@ if ENV['GROWSTUFF_CAPYBARA_DRIVER'].present?
end
Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example|
- "screenshot_#{example.description.gsub(' ', '-').gsub(/^.*\/spec\//,'')}"
+ "screenshot_#{example.description.gsub(' ', '-').gsub(/^.*\/spec\//, '')}"
end
Capybara.app_host = 'http://localhost'
@@ -59,7 +59,7 @@ include Warden::Test::Helpers
# require only the support files necessary.
#
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
-Dir[Rails.root.join("spec/features/shared_examples/**/*.rb")].each {|f| require f}
+Dir[Rails.root.join("spec/features/shared_examples/**/*.rb")].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
diff --git a/spec/routing/account_types_routing_spec.rb b/spec/routing/account_types_routing_spec.rb
index 83dba34a5..8402dd727 100644
--- a/spec/routing/account_types_routing_spec.rb
+++ b/spec/routing/account_types_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe AccountTypesController do
describe "routing" do
-
it "routes to #index" do
get("/account_types").should route_to("account_types#index")
end
@@ -30,6 +29,5 @@ describe AccountTypesController do
it "routes to #destroy" do
delete("/account_types/1").should route_to("account_types#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/authentications_routing_spec.rb b/spec/routing/authentications_routing_spec.rb
index 75f86fd49..0601b9924 100644
--- a/spec/routing/authentications_routing_spec.rb
+++ b/spec/routing/authentications_routing_spec.rb
@@ -9,6 +9,5 @@ describe AuthenticationsController do
it "routes to #destroy" do
delete("/authentications/1").should route_to("authentications#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/comments_routing_spec.rb b/spec/routing/comments_routing_spec.rb
index b5466af43..5390ab066 100644
--- a/spec/routing/comments_routing_spec.rb
+++ b/spec/routing/comments_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe CommentsController do
describe "routing" do
-
it "routes to #index" do
get("/comments").should route_to("comments#index")
end
@@ -30,6 +29,5 @@ describe CommentsController do
it "routes to #destroy" do
delete("/comments/1").should route_to("comments#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/crops_routing_spec.rb b/spec/routing/crops_routing_spec.rb
index 95985917f..97c1a874c 100644
--- a/spec/routing/crops_routing_spec.rb
+++ b/spec/routing/crops_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe CropsController do
describe "routing" do
-
it "routes to #index" do
get("/crops").should route_to("crops#index")
end
@@ -30,6 +29,5 @@ describe CropsController do
it "routes to #destroy" do
delete("/crops/1").should route_to("crops#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/follows_routing_spec.rb b/spec/routing/follows_routing_spec.rb
index 4158502c7..ddb01e00c 100644
--- a/spec/routing/follows_routing_spec.rb
+++ b/spec/routing/follows_routing_spec.rb
@@ -2,7 +2,6 @@ require "spec_helper"
describe FollowsController do
describe "routing" do
-
it "routes to #create" do
post("/follows").should route_to("follows#create")
end
@@ -10,6 +9,5 @@ describe FollowsController do
it "routes to #destroy" do
delete("/follows/1").should route_to("follows#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/forums_routing_spec.rb b/spec/routing/forums_routing_spec.rb
index 12730c556..9ce6f427b 100644
--- a/spec/routing/forums_routing_spec.rb
+++ b/spec/routing/forums_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe ForumsController do
describe "routing" do
-
it "routes to #index" do
get("/forums").should route_to("forums#index")
end
@@ -30,6 +29,5 @@ describe ForumsController do
it "routes to #destroy" do
delete("/forums/1").should route_to("forums#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/gardens_routing_spec.rb b/spec/routing/gardens_routing_spec.rb
index 5270195ec..6888f099f 100644
--- a/spec/routing/gardens_routing_spec.rb
+++ b/spec/routing/gardens_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe GardensController do
describe "routing" do
-
it "routes to #index" do
get("/gardens").should route_to("gardens#index")
end
@@ -30,6 +29,5 @@ describe GardensController do
it "routes to #destroy" do
delete("/gardens/1").should route_to("gardens#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/harvests_routing_spec.rb b/spec/routing/harvests_routing_spec.rb
index 4d532bcfc..c6890df15 100644
--- a/spec/routing/harvests_routing_spec.rb
+++ b/spec/routing/harvests_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe HarvestsController do
describe "routing" do
-
it "routes to #index" do
get("/harvests").should route_to("harvests#index")
end
@@ -30,6 +29,5 @@ describe HarvestsController do
it "routes to #destroy" do
delete("/harvests/1").should route_to("harvests#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/notifications_routing_spec.rb b/spec/routing/notifications_routing_spec.rb
index d3c2b9f61..bb7335e1b 100644
--- a/spec/routing/notifications_routing_spec.rb
+++ b/spec/routing/notifications_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe NotificationsController do
describe "routing" do
-
it "routes to #index" do
get("/notifications").should route_to("notifications#index")
end
@@ -30,6 +29,5 @@ describe NotificationsController do
it "routes to #destroy" do
delete("/notifications/1").should route_to("notifications#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/order_items_routing_spec.rb b/spec/routing/order_items_routing_spec.rb
index 6562e3a17..7487cb9f5 100644
--- a/spec/routing/order_items_routing_spec.rb
+++ b/spec/routing/order_items_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe OrderItemsController do
describe "routing" do
-
it "routes to #index" do
get("/order_items").should route_to("order_items#index")
end
@@ -30,6 +29,5 @@ describe OrderItemsController do
it "routes to #destroy" do
delete("/order_items/1").should route_to("order_items#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/orders_routing_spec.rb b/spec/routing/orders_routing_spec.rb
index 61410745e..38184ef33 100644
--- a/spec/routing/orders_routing_spec.rb
+++ b/spec/routing/orders_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe OrdersController do
describe "routing" do
-
it "routes to #index" do
get("/orders").should route_to("orders#index")
end
@@ -30,6 +29,5 @@ describe OrdersController do
it "routes to #destroy" do
delete("/orders/1").should route_to("orders#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/photos_routing_spec.rb b/spec/routing/photos_routing_spec.rb
index fb96758c2..a645d0a60 100644
--- a/spec/routing/photos_routing_spec.rb
+++ b/spec/routing/photos_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe PhotosController do
describe "routing" do
-
it "routes to #index" do
get("/photos").should route_to("photos#index")
end
@@ -30,6 +29,5 @@ describe PhotosController do
it "routes to #destroy" do
delete("/photos/1").should route_to("photos#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/plant_parts_routing_spec.rb b/spec/routing/plant_parts_routing_spec.rb
index 4a4137cd6..966047f3f 100644
--- a/spec/routing/plant_parts_routing_spec.rb
+++ b/spec/routing/plant_parts_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe PlantPartsController do
describe "routing" do
-
it "routes to #index" do
get("/plant_parts").should route_to("plant_parts#index")
end
@@ -30,6 +29,5 @@ describe PlantPartsController do
it "routes to #destroy" do
delete("/plant_parts/1").should route_to("plant_parts#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/plantings_routing_spec.rb b/spec/routing/plantings_routing_spec.rb
index 1be8416d4..473fe827e 100644
--- a/spec/routing/plantings_routing_spec.rb
+++ b/spec/routing/plantings_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe PlantingsController do
describe "routing" do
-
it "routes to #index" do
get("/plantings").should route_to("plantings#index")
end
@@ -30,6 +29,5 @@ describe PlantingsController do
it "routes to #destroy" do
delete("/plantings/1").should route_to("plantings#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/products_routing_spec.rb b/spec/routing/products_routing_spec.rb
index 189bbe59a..15166a805 100644
--- a/spec/routing/products_routing_spec.rb
+++ b/spec/routing/products_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe ProductsController do
describe "routing" do
-
it "routes to #index" do
get("/products").should route_to("products#index")
end
@@ -30,6 +29,5 @@ describe ProductsController do
it "routes to #destroy" do
delete("/products/1").should route_to("products#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/roles_routing_spec.rb b/spec/routing/roles_routing_spec.rb
index 752bd7c49..7b6469efb 100644
--- a/spec/routing/roles_routing_spec.rb
+++ b/spec/routing/roles_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe RolesController do
describe "routing" do
-
it "routes to #index" do
get("/roles").should route_to("roles#index")
end
@@ -30,6 +29,5 @@ describe RolesController do
it "routes to #destroy" do
delete("/roles/1").should route_to("roles#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/scientific_names_routing_spec.rb b/spec/routing/scientific_names_routing_spec.rb
index f5bfa780e..7bbbfa764 100644
--- a/spec/routing/scientific_names_routing_spec.rb
+++ b/spec/routing/scientific_names_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe ScientificNamesController do
describe "routing" do
-
it "routes to #index" do
get("/scientific_names").should route_to("scientific_names#index")
end
@@ -30,6 +29,5 @@ describe ScientificNamesController do
it "routes to #destroy" do
delete("/scientific_names/1").should route_to("scientific_names#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/seeds_routing_spec.rb b/spec/routing/seeds_routing_spec.rb
index 5ac7ae02c..74f4aff64 100644
--- a/spec/routing/seeds_routing_spec.rb
+++ b/spec/routing/seeds_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe SeedsController do
describe "routing" do
-
it "routes to #index" do
get("/seeds").should route_to("seeds#index")
end
@@ -30,6 +29,5 @@ describe SeedsController do
it "routes to #destroy" do
delete("/seeds/1").should route_to("seeds#destroy", id: "1")
end
-
end
end
diff --git a/spec/routing/updates_routing_spec.rb b/spec/routing/updates_routing_spec.rb
index 32be13b86..966647515 100644
--- a/spec/routing/updates_routing_spec.rb
+++ b/spec/routing/updates_routing_spec.rb
@@ -2,7 +2,6 @@ require "rails_helper"
describe PostsController do
describe "routing" do
-
it "routes to #index" do
get("/posts").should route_to("posts#index")
end
@@ -30,6 +29,5 @@ describe PostsController do
it "routes to #destroy" do
delete("/posts/1").should route_to("posts#destroy", id: "1")
end
-
end
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 8c7b0b9fe..7b314e901 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -42,8 +42,8 @@ RSpec.configure do |config|
mocks.syntax = [:should, :expect]
end
-# The settings below are suggested to provide a good initial experience
-# with RSpec, but feel free to customize to your heart's content.
+ # The settings below are suggested to provide a good initial experience
+ # with RSpec, but feel free to customize to your heart's content.
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
@@ -85,5 +85,4 @@ RSpec.configure do |config|
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
-
end
diff --git a/spec/support/controller_macros.rb b/spec/support/controller_macros.rb
index ce2e124fd..393d7221b 100644
--- a/spec/support/controller_macros.rb
+++ b/spec/support/controller_macros.rb
@@ -1,6 +1,6 @@
# Taken unashamedly from https://github.com/plataformatec/devise/wiki/How-To%3a-Controllers-and-Views-tests-with-Rails-3-%28and-rspec%29
module ControllerMacros
- def login_member(member_factory=:member)
+ def login_member(member_factory = :member)
let(:member) { member = FactoryGirl.create(member_factory || :member) }
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:member]
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb
index 36c994e6f..e0dbc9aa8 100644
--- a/spec/support/database_cleaner.rb
+++ b/spec/support/database_cleaner.rb
@@ -1,5 +1,4 @@
RSpec.configure do |config|
-
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
@@ -19,5 +18,4 @@ RSpec.configure do |config|
config.after(:each) do
DatabaseCleaner.clean
end
-
end
diff --git a/spec/support/elasticsearch_helpers.rb b/spec/support/elasticsearch_helpers.rb
index 94cf447ff..1d1db1db3 100644
--- a/spec/support/elasticsearch_helpers.rb
+++ b/spec/support/elasticsearch_helpers.rb
@@ -1,7 +1,7 @@
module ElasticsearchHelpers
def sync_elasticsearch(crops)
if ENV['GROWSTUFF_ELASTICSEARCH'] == "true"
- crops.each {|crop| crop.__elasticsearch__.index_document}
+ crops.each { |crop| crop.__elasticsearch__.index_document }
Crop.__elasticsearch__.refresh_index!
end
end
diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb
index bf23c2854..dbe4f327b 100644
--- a/spec/support/feature_helpers.rb
+++ b/spec/support/feature_helpers.rb
@@ -1,6 +1,5 @@
module FeatureHelpers
-
- def fill_autocomplete(field, options={})
+ def fill_autocomplete(field, options = {})
fill_in field, with: options[:with]
page.execute_script %Q{ $('##{field}').trigger('focus'); }
@@ -12,7 +11,6 @@ module FeatureHelpers
selector = %Q{ul.ui-autocomplete li.ui-menu-item a:contains("#{select}")}
page.execute_script %Q{ $('#{selector}').mouseenter().click() }
end
-
end
RSpec.configure do |config|
diff --git a/spec/views/account_types/edit.html.haml_spec.rb b/spec/views/account_types/edit.html.haml_spec.rb
index 6ab88a3b7..c53272c0e 100644
--- a/spec/views/account_types/edit.html.haml_spec.rb
+++ b/spec/views/account_types/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "account_types/edit" do
diff --git a/spec/views/account_types/index.html.haml_spec.rb b/spec/views/account_types/index.html.haml_spec.rb
index fb583fc5d..ca86626f3 100644
--- a/spec/views/account_types/index.html.haml_spec.rb
+++ b/spec/views/account_types/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "account_types/index" do
diff --git a/spec/views/account_types/new.html.haml_spec.rb b/spec/views/account_types/new.html.haml_spec.rb
index ea3864926..01e1f025a 100644
--- a/spec/views/account_types/new.html.haml_spec.rb
+++ b/spec/views/account_types/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "account_types/new" do
diff --git a/spec/views/account_types/show.html.haml_spec.rb b/spec/views/account_types/show.html.haml_spec.rb
index e04be6b75..adad83ad8 100644
--- a/spec/views/account_types/show.html.haml_spec.rb
+++ b/spec/views/account_types/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "account_types/show" do
diff --git a/spec/views/accounts/edit.html.haml_spec.rb b/spec/views/accounts/edit.html.haml_spec.rb
index bff632495..4b278acc2 100644
--- a/spec/views/accounts/edit.html.haml_spec.rb
+++ b/spec/views/accounts/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "accounts/edit" do
diff --git a/spec/views/accounts/index.html.haml_spec.rb b/spec/views/accounts/index.html.haml_spec.rb
index cde04c48b..192c86dab 100644
--- a/spec/views/accounts/index.html.haml_spec.rb
+++ b/spec/views/accounts/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "accounts/index" do
diff --git a/spec/views/accounts/new.html.haml_spec.rb b/spec/views/accounts/new.html.haml_spec.rb
index 669017206..bc2b711fa 100644
--- a/spec/views/accounts/new.html.haml_spec.rb
+++ b/spec/views/accounts/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "accounts/new" do
diff --git a/spec/views/accounts/show.html.haml_spec.rb b/spec/views/accounts/show.html.haml_spec.rb
index e5932cae6..351a8fb24 100644
--- a/spec/views/accounts/show.html.haml_spec.rb
+++ b/spec/views/accounts/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "accounts/show" do
diff --git a/spec/views/admin/index_spec.rb b/spec/views/admin/index_spec.rb
index 981170249..32e77b9ee 100644
--- a/spec/views/admin/index_spec.rb
+++ b/spec/views/admin/index_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'admin/index.html.haml', type: "view" do
diff --git a/spec/views/admin/newsletter_spec.rb b/spec/views/admin/newsletter_spec.rb
index a98e8ef49..fb49b2e61 100644
--- a/spec/views/admin/newsletter_spec.rb
+++ b/spec/views/admin/newsletter_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'admin/newsletter.html.haml', type: "view" do
diff --git a/spec/views/admin/orders/index_spec.rb b/spec/views/admin/orders/index_spec.rb
index fa354a583..ea1331c94 100644
--- a/spec/views/admin/orders/index_spec.rb
+++ b/spec/views/admin/orders/index_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'admin/orders/index.html.haml', type: "view" do
diff --git a/spec/views/comments/edit.html.haml_spec.rb b/spec/views/comments/edit.html.haml_spec.rb
index 167168271..5446d2877 100644
--- a/spec/views/comments/edit.html.haml_spec.rb
+++ b/spec/views/comments/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "comments/edit" do
diff --git a/spec/views/comments/index.html.haml_spec.rb b/spec/views/comments/index.html.haml_spec.rb
index e0eb907cc..86c30c508 100644
--- a/spec/views/comments/index.html.haml_spec.rb
+++ b/spec/views/comments/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "comments/index" do
@@ -24,9 +20,9 @@ describe "comments/index" do
total_entries = 2
comments = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
- FactoryGirl.create(:comment),
- FactoryGirl.create(:comment, body: 'ROFL')
- ])
+ FactoryGirl.create(:comment),
+ FactoryGirl.create(:comment, body: 'ROFL')
+ ])
end
assign(:comments, comments)
render
diff --git a/spec/views/comments/index.rss.haml_spec.rb b/spec/views/comments/index.rss.haml_spec.rb
index f2fe2c4d9..68888611e 100644
--- a/spec/views/comments/index.rss.haml_spec.rb
+++ b/spec/views/comments/index.rss.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'comments/index.rss.haml' do
@@ -22,9 +18,9 @@ describe 'comments/index.rss.haml' do
@author = FactoryGirl.create(:member)
@post = FactoryGirl.create(:post)
assign(:comments, [
- FactoryGirl.create(:comment, author: @author, post: @post),
- FactoryGirl.create(:comment, author: @author, post: @post)
- ])
+ FactoryGirl.create(:comment, author: @author, post: @post),
+ FactoryGirl.create(:comment, author: @author, post: @post)
+ ])
render
end
@@ -44,5 +40,4 @@ describe 'comments/index.rss.haml' do
it 'shows content of comments' do
rendered.should have_content "OMG LOL"
end
-
end
diff --git a/spec/views/comments/new.html.haml_spec.rb b/spec/views/comments/new.html.haml_spec.rb
index a33eed8ae..2e55c843d 100644
--- a/spec/views/comments/new.html.haml_spec.rb
+++ b/spec/views/comments/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "comments/new" do
@@ -47,5 +43,4 @@ describe "comments/new" do
it 'shows markdown help' do
rendered.should have_content 'Markdown'
end
-
end
diff --git a/spec/views/comments/show.html.haml_spec.rb b/spec/views/comments/show.html.haml_spec.rb
index f69a635d3..4cc8a8a71 100644
--- a/spec/views/comments/show.html.haml_spec.rb
+++ b/spec/views/comments/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "comments/show" do
diff --git a/spec/views/crops/_grown_for.html.haml_spec.rb b/spec/views/crops/_grown_for.html.haml_spec.rb
index 81009b7e5..776d3bdf3 100644
--- a/spec/views/crops/_grown_for.html.haml_spec.rb
+++ b/spec/views/crops/_grown_for.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "crops/_grown_for" do
diff --git a/spec/views/crops/_planting_advice.html.haml_spec.rb b/spec/views/crops/_planting_advice.html.haml_spec.rb
index 2abed9015..62d85bcfa 100644
--- a/spec/views/crops/_planting_advice.html.haml_spec.rb
+++ b/spec/views/crops/_planting_advice.html.haml_spec.rb
@@ -10,15 +10,11 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "crops/_planting_advice" do
before(:each) do
- @owner = FactoryGirl.create(:member)
+ @owner = FactoryGirl.create(:member)
@crop = FactoryGirl.create(:crop)
@garden = FactoryGirl.create(:garden, owner: @owner)
@planting = FactoryGirl.create(:planting,
@@ -48,11 +44,9 @@ describe "crops/_planting_advice" do
rendered.should have_content "Plant in:"
rendered.should have_content "sun (2), shade (1)"
end
-
end
context "planted from" do
-
it "doesn't show planted_from if none are set" do
render partial: 'crops/planting_advice', locals: { crop: @crop }
rendered.should have_content "Plant from: not known."
@@ -74,5 +68,4 @@ describe "crops/_planting_advice" do
rendered.should have_content "seed (2), cutting (1)"
end
end
-
end
diff --git a/spec/views/crops/_popover.html.haml_spec.rb b/spec/views/crops/_popover.html.haml_spec.rb
index bad5008a1..af97d7645 100644
--- a/spec/views/crops/_popover.html.haml_spec.rb
+++ b/spec/views/crops/_popover.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "crops/_popover" do
@@ -32,5 +28,4 @@ describe "crops/_popover" do
it 'shows count of plantings' do
rendered.should have_content '1 time'
end
-
end
diff --git a/spec/views/crops/edit.html.haml_spec.rb b/spec/views/crops/edit.html.haml_spec.rb
index 464041a66..436114f78 100644
--- a/spec/views/crops/edit.html.haml_spec.rb
+++ b/spec/views/crops/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "crops/edit" do
@@ -32,5 +28,4 @@ describe "crops/edit" do
it "shows the creator" do
rendered.should have_content "Added by #{@crop.creator} less than a minute ago."
end
-
end
diff --git a/spec/views/crops/hierarchy.html.haml_spec.rb b/spec/views/crops/hierarchy.html.haml_spec.rb
index 076d13b64..077add247 100644
--- a/spec/views/crops/hierarchy.html.haml_spec.rb
+++ b/spec/views/crops/hierarchy.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "crops/hierarchy" do
diff --git a/spec/views/crops/index.html.haml_spec.rb b/spec/views/crops/index.html.haml_spec.rb
index 6db358f54..a11cbcb76 100644
--- a/spec/views/crops/index.html.haml_spec.rb
+++ b/spec/views/crops/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "crops/index" do
@@ -26,7 +22,7 @@ describe "crops/index" do
@maize = FactoryGirl.create(:maize)
assign(:crops, [@tomato, @maize])
paginated_crops = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
- pager.replace([ @tomato, @maize ])
+ pager.replace([@tomato, @maize])
end
assign(:paginated_crops, paginated_crops)
end
@@ -40,8 +36,8 @@ describe "crops/index" do
end
it "linkifies crop images" do
- render
- assert_select "img", src: :tomato
+ render
+ assert_select "img", src: :tomato
end
context "logged in and crop wrangler" do
diff --git a/spec/views/crops/index.rss.haml_spec.rb b/spec/views/crops/index.rss.haml_spec.rb
index d7b139b7f..5726c162c 100644
--- a/spec/views/crops/index.rss.haml_spec.rb
+++ b/spec/views/crops/index.rss.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'crops/index.rss.haml' do
@@ -34,5 +30,4 @@ describe 'crops/index.rss.haml' do
rendered.should have_content @tomato.name
rendered.should have_content @maize.name
end
-
end
diff --git a/spec/views/crops/new.html.haml_spec.rb b/spec/views/crops/new.html.haml_spec.rb
index 0b01ae76a..406b5e5c2 100644
--- a/spec/views/crops/new.html.haml_spec.rb
+++ b/spec/views/crops/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "crops/new" do
@@ -32,5 +28,4 @@ describe "crops/new" do
it "shows a link to crop wrangling guidelines" do
assert_select "a[href^='http://wiki.growstuff.org']", "crop wrangling guide"
end
-
end
diff --git a/spec/views/crops/wrangle.html.haml_spec.rb b/spec/views/crops/wrangle.html.haml_spec.rb
index a8e7612b6..b0ff06281 100644
--- a/spec/views/crops/wrangle.html.haml_spec.rb
+++ b/spec/views/crops/wrangle.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "crops/wrangle" do
@@ -26,7 +22,7 @@ describe "crops/wrangle" do
@tomato = FactoryGirl.create(:tomato)
@maize = FactoryGirl.create(:maize)
crops = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
- pager.replace([ @tomato, @maize ])
+ pager.replace([@tomato, @maize])
end
assign(:crops, crops)
assign(:crop_wranglers, Role.crop_wranglers)
@@ -48,5 +44,4 @@ describe "crops/wrangle" do
assert_select "a", text: @maize.name
assert_select "a", text: @tomato.name
end
-
end
diff --git a/spec/views/devise/confirmations/new_spec.rb b/spec/views/devise/confirmations/new_spec.rb
index 8d567d793..720822083 100644
--- a/spec/views/devise/confirmations/new_spec.rb
+++ b/spec/views/devise/confirmations/new_spec.rb
@@ -1,5 +1,4 @@
describe 'devise/confirmations/new.html.haml', type: "view" do
-
before(:each) do
@view.stub(:resource).and_return(Member.new)
@view.stub(:resource_name).and_return("member")
diff --git a/spec/views/devise/mailer/confirmation_instructions_spec.rb b/spec/views/devise/mailer/confirmation_instructions_spec.rb
index 0ed226dc2..f10eb6176 100644
--- a/spec/views/devise/mailer/confirmation_instructions_spec.rb
+++ b/spec/views/devise/mailer/confirmation_instructions_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'devise/mailer/confirmation_instructions.html.haml', type: "view" do
-
context "logged in" do
before(:each) do
@resource = FactoryGirl.create(:member)
diff --git a/spec/views/devise/mailer/reset_password_instructions_spec.rb b/spec/views/devise/mailer/reset_password_instructions_spec.rb
index 332f9a106..7d0cdfe6a 100644
--- a/spec/views/devise/mailer/reset_password_instructions_spec.rb
+++ b/spec/views/devise/mailer/reset_password_instructions_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'devise/mailer/reset_password_instructions.html.haml', type: "view" do
-
context "logged in" do
before(:each) do
@resource = mock_model(Member)
diff --git a/spec/views/devise/mailer/unlock_instructions_spec.rb b/spec/views/devise/mailer/unlock_instructions_spec.rb
index da74564c1..e0fb50e50 100644
--- a/spec/views/devise/mailer/unlock_instructions_spec.rb
+++ b/spec/views/devise/mailer/unlock_instructions_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'devise/mailer/unlock_instructions.html.haml', type: "view" do
context "logged in" do
diff --git a/spec/views/devise/registrations/edit_spec.rb b/spec/views/devise/registrations/edit_spec.rb
index 311b6bb15..2aef2fa70 100644
--- a/spec/views/devise/registrations/edit_spec.rb
+++ b/spec/views/devise/registrations/edit_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'devise/registrations/edit.html.haml', type: "view" do
-
context "logged in" do
before(:each) do
controller.stub(:current_user) { nil }
@@ -75,7 +70,6 @@ describe 'devise/registrations/edit.html.haml', type: "view" do
end
context 'other sites section' do
-
context 'not connected to twitter' do
it 'has a link to connect' do
render
@@ -115,9 +109,6 @@ describe 'devise/registrations/edit.html.haml', type: "view" do
assert_select "a", href: @flickr_auth, text: "Disconnect"
end
end
-
end
-
end
-
end
diff --git a/spec/views/devise/registrations/new_spec.rb b/spec/views/devise/registrations/new_spec.rb
index 994a702d1..be00abae9 100644
--- a/spec/views/devise/registrations/new_spec.rb
+++ b/spec/views/devise/registrations/new_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'devise/registrations/new.html.haml', type: "view" do
-
context "logged in" do
before(:each) do
@view.stub(:resource).and_return(Member.new)
@@ -28,7 +23,7 @@ describe 'devise/registrations/new.html.haml', type: "view" do
end
it 'should have some fields' do
- rendered.should have_content 'Email'
+ rendered.should have_content 'Email'
end
it 'has a checkbox for newsletter subscription' do
diff --git a/spec/views/devise/sessions/new_spec.rb b/spec/views/devise/sessions/new_spec.rb
index 3685b21a9..93b14b9c3 100644
--- a/spec/views/devise/sessions/new_spec.rb
+++ b/spec/views/devise/sessions/new_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'devise/sessions/new.html.haml', type: "view" do
-
context "logged in" do
before(:each) do
@view.stub(:resource).and_return(Member.new)
@@ -28,8 +23,8 @@ describe 'devise/sessions/new.html.haml', type: "view" do
end
it 'should have some fields' do
- rendered.should have_content 'Remember me'
- rendered.should have_content 'Password'
+ rendered.should have_content 'Remember me'
+ rendered.should have_content 'Password'
end
end
end
diff --git a/spec/views/devise/shared/_links_spec.rb b/spec/views/devise/shared/_links_spec.rb
index 7e71bbc12..c567339d6 100644
--- a/spec/views/devise/shared/_links_spec.rb
+++ b/spec/views/devise/shared/_links_spec.rb
@@ -1,5 +1,4 @@
describe 'devise/shared/_links.haml', type: "view" do
-
def devise_mapping(register, recover, confirm, lock, oauth)
dm = double("mappings")
dm.stub(registerable?: register)
@@ -13,14 +12,14 @@ describe 'devise/shared/_links.haml', type: "view" do
it 'should have a sign-in link if not in sessions' do
@view.stub(:controller_name).and_return("anything but sessions")
@view.stub(:resource_name).and_return("member")
- @view.stub(devise_mapping: devise_mapping(false, false, false, false, false))
+ @view.stub(devise_mapping: devise_mapping(false, false, false, false, false))
render
end
it "shouldn't have a sign-in link if in sessions" do
@view.stub(:controller_name).and_return("sessions")
@view.stub(:resource_name).and_return("member")
- @view.stub(devise_mapping: devise_mapping(false, false, false, false, false))
+ @view.stub(devise_mapping: devise_mapping(false, false, false, false, false))
render
end
end
diff --git a/spec/views/devise/unlocks/new_spec.rb b/spec/views/devise/unlocks/new_spec.rb
index 01140c9bb..c53968a8d 100644
--- a/spec/views/devise/unlocks/new_spec.rb
+++ b/spec/views/devise/unlocks/new_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'devise/unlocks/new.html.haml', type: "view" do
-
context "logged in" do
before(:each) do
@view.stub(:resource).and_return(Member.new)
@@ -28,7 +23,7 @@ describe 'devise/unlocks/new.html.haml', type: "view" do
end
it 'should have some fields' do
- rendered.should have_content 'Email'
+ rendered.should have_content 'Email'
end
end
end
diff --git a/spec/views/forums/edit.html.haml_spec.rb b/spec/views/forums/edit.html.haml_spec.rb
index c068ef295..002a52f3e 100644
--- a/spec/views/forums/edit.html.haml_spec.rb
+++ b/spec/views/forums/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "forums/edit" do
diff --git a/spec/views/forums/index.html.haml_spec.rb b/spec/views/forums/index.html.haml_spec.rb
index 470781a4f..701504d7f 100644
--- a/spec/views/forums/index.html.haml_spec.rb
+++ b/spec/views/forums/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "forums/index" do
@@ -22,7 +18,7 @@ describe "forums/index" do
controller.stub(:current_user) { @admin }
@forum1 = FactoryGirl.create(:forum)
@forum2 = FactoryGirl.create(:forum)
- assign(:forums, [ @forum1, @forum2 ])
+ assign(:forums, [@forum1, @forum2])
end
it "renders a list of forums" do
@@ -51,6 +47,5 @@ describe "forums/index" do
it "displays comment count" do
assert_select "td", text: "1"
end
-
end
end
diff --git a/spec/views/forums/new.html.haml_spec.rb b/spec/views/forums/new.html.haml_spec.rb
index b9a8abcb2..de0be5b3c 100644
--- a/spec/views/forums/new.html.haml_spec.rb
+++ b/spec/views/forums/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "forums/new" do
diff --git a/spec/views/forums/show.html.haml_spec.rb b/spec/views/forums/show.html.haml_spec.rb
index 3b2d41783..f2fa920a6 100644
--- a/spec/views/forums/show.html.haml_spec.rb
+++ b/spec/views/forums/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "forums/show" do
diff --git a/spec/views/gardens/edit.html.haml_spec.rb b/spec/views/gardens/edit.html.haml_spec.rb
index 340feaeef..f8b4b5e03 100644
--- a/spec/views/gardens/edit.html.haml_spec.rb
+++ b/spec/views/gardens/edit.html.haml_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "gardens/edit" do
-
context "logged in" do
before(:each) do
@owner = FactoryGirl.create(:member)
@@ -41,5 +36,4 @@ describe "gardens/edit" do
end
end
end
-
end
diff --git a/spec/views/gardens/new.html.haml_spec.rb b/spec/views/gardens/new.html.haml_spec.rb
index 58bd6a335..337b9066c 100644
--- a/spec/views/gardens/new.html.haml_spec.rb
+++ b/spec/views/gardens/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "gardens/new" do
diff --git a/spec/views/gardens/show.html.haml_spec.rb b/spec/views/gardens/show.html.haml_spec.rb
index b122abfd4..0e166e453 100644
--- a/spec/views/gardens/show.html.haml_spec.rb
+++ b/spec/views/gardens/show.html.haml_spec.rb
@@ -10,15 +10,11 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "gardens/show" do
before(:each) do
- @owner = FactoryGirl.create(:member)
+ @owner = FactoryGirl.create(:member)
controller.stub(:current_user) { @owner }
@garden = FactoryGirl.create(:garden, owner: @owner)
@planting = FactoryGirl.create(:planting, garden: @garden)
@@ -51,7 +47,6 @@ describe "gardens/show" do
end
context 'signed in' do
-
before :each do
sign_in @owner
render
@@ -69,5 +64,4 @@ describe "gardens/show" do
assert_select("a[href='#{new_planting_path}?garden_id=#{@garden.id}']")
end
end
-
end
diff --git a/spec/views/harvests/edit.html.haml_spec.rb b/spec/views/harvests/edit.html.haml_spec.rb
index 265925dd1..e0959b451 100644
--- a/spec/views/harvests/edit.html.haml_spec.rb
+++ b/spec/views/harvests/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "harvests/edit" do
diff --git a/spec/views/harvests/index.html.haml_spec.rb b/spec/views/harvests/index.html.haml_spec.rb
index 0e86f9782..32baadc1a 100644
--- a/spec/views/harvests/index.html.haml_spec.rb
+++ b/spec/views/harvests/index.html.haml_spec.rb
@@ -10,16 +10,12 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "harvests/index" do
before(:each) do
controller.stub(:current_user) { nil }
- @member = FactoryGirl.create(:member)
+ @member = FactoryGirl.create(:member)
@tomato = FactoryGirl.create(:tomato)
@maize = FactoryGirl.create(:maize)
@pp = FactoryGirl.create(:plant_part)
@@ -28,16 +24,16 @@ describe "harvests/index" do
total_entries = 2
harvests = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
- FactoryGirl.create(:harvest,
- crop: @tomato,
- owner: @member
- ),
- FactoryGirl.create(:harvest,
- crop: @maize,
- plant_part: @pp,
- owner: @member
- )
- ])
+ FactoryGirl.create(:harvest,
+ crop: @tomato,
+ owner: @member
+ ),
+ FactoryGirl.create(:harvest,
+ crop: @maize,
+ plant_part: @pp,
+ owner: @member
+ )
+ ])
end
assign(:harvests, harvests)
render
@@ -61,5 +57,4 @@ describe "harvests/index" do
render
view.content_for(:title).should have_content @tomato.name
end
-
end
diff --git a/spec/views/harvests/new.html.haml_spec.rb b/spec/views/harvests/new.html.haml_spec.rb
index 0d372d6ee..1b300f1e3 100644
--- a/spec/views/harvests/new.html.haml_spec.rb
+++ b/spec/views/harvests/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "harvests/new" do
@@ -27,7 +23,7 @@ describe "harvests/new" do
assert_select "input#crop", class: "ui-autocomplete-input"
assert_select "input#harvest_crop_id", name: "harvest[crop_id]"
assert_select "select#harvest_plant_part_id", name: "harvest[plant_part_id]"
-# some browsers interpret without a step as "integer"
+ # some browsers interpret without a step as "integer"
assert_select "input#harvest_quantity[step=any]", name: "harvest[quantity]"
assert_select "input#harvest_weight_quantity[step=any]", name: "harvest[quantity]"
assert_select "select#harvest_unit", name: "harvest[unit]"
diff --git a/spec/views/harvests/show.html.haml_spec.rb b/spec/views/harvests/show.html.haml_spec.rb
index 6ae30919b..b6a1ec7a0 100644
--- a/spec/views/harvests/show.html.haml_spec.rb
+++ b/spec/views/harvests/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "harvests/show" do
@@ -29,5 +25,4 @@ describe "harvests/show" do
rendered.should have_content @harvest.harvested_at.to_s
rendered.should have_content @harvest.plant_part.to_s
end
-
end
diff --git a/spec/views/home/_blurb.html.haml_spec.rb b/spec/views/home/_blurb.html.haml_spec.rb
index 75314118a..710fcd4d4 100644
--- a/spec/views/home/_blurb.html.haml_spec.rb
+++ b/spec/views/home/_blurb.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'home/_blurb.html.haml', type: "view" do
@@ -37,5 +33,4 @@ describe 'home/_blurb.html.haml', type: "view" do
assert_select "a", href: new_member_session_path
end
end
-
end
diff --git a/spec/views/home/_crops.html.haml_spec.rb b/spec/views/home/_crops.html.haml_spec.rb
index 5a0c06325..8f375f3e1 100644
--- a/spec/views/home/_crops.html.haml_spec.rb
+++ b/spec/views/home/_crops.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'home/_crops.html.haml', type: "view" do
diff --git a/spec/views/home/_members.html.haml_spec.rb b/spec/views/home/_members.html.haml_spec.rb
index 6cf6c0099..a4391da51 100644
--- a/spec/views/home/_members.html.haml_spec.rb
+++ b/spec/views/home/_members.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'home/_members.html.haml', type: "view" do
@@ -35,5 +31,4 @@ describe 'home/_members.html.haml', type: "view" do
rendered.should have_content @member.location
rendered.should have_content @planting.crop_name
end
-
end
diff --git a/spec/views/home/_seeds.html.haml_spec.rb b/spec/views/home/_seeds.html.haml_spec.rb
index ac47b1c1a..a904f47ff 100644
--- a/spec/views/home/_seeds.html.haml_spec.rb
+++ b/spec/views/home/_seeds.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'home/_seeds.html.haml', type: "view" do
diff --git a/spec/views/home/_stats.html.haml_spec.rb b/spec/views/home/_stats.html.haml_spec.rb
index 2bee43768..6bfc3e6fe 100644
--- a/spec/views/home/_stats.html.haml_spec.rb
+++ b/spec/views/home/_stats.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'home/_stats.html.haml', type: "view" do
diff --git a/spec/views/home/index_spec.rb b/spec/views/home/index_spec.rb
index c7f6f0927..b5a726e23 100644
--- a/spec/views/home/index_spec.rb
+++ b/spec/views/home/index_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'home/index.html.haml', type: "view" do
@@ -57,5 +53,4 @@ describe 'home/index.html.haml', type: "view" do
rendered.should have_content "Welcome to #{ENV['GROWSTUFF_SITE_NAME']}, #{@member.login_name}"
end
end
-
end
diff --git a/spec/views/layouts/_header_spec.rb b/spec/views/layouts/_header_spec.rb
index 8742796c1..2e6f8e36a 100644
--- a/spec/views/layouts/_header_spec.rb
+++ b/spec/views/layouts/_header_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'layouts/_header.html.haml', type: "view" do
@@ -64,11 +60,9 @@ describe 'layouts/_header.html.haml', type: "view" do
assert_select("form[action='#{crops_search_path}']")
assert_select("input#term")
end
-
end
context "logged in" do
-
before(:each) do
@member = FactoryGirl.create(:member)
sign_in @member
@@ -110,6 +104,5 @@ describe 'layouts/_header.html.haml', type: "view" do
rendered.should have_content 'Inbox (1)'
end
end
-
end
end
diff --git a/spec/views/layouts/_meta_spec.rb b/spec/views/layouts/_meta_spec.rb
index bd58962a3..805f0298d 100644
--- a/spec/views/layouts/_meta_spec.rb
+++ b/spec/views/layouts/_meta_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'layouts/_meta.html.haml', type: "view" do
@@ -39,5 +35,4 @@ describe 'layouts/_meta.html.haml', type: "view" do
it 'should have a title' do
assert_select "head>title"
end
-
end
diff --git a/spec/views/layouts/application_spec.rb b/spec/views/layouts/application_spec.rb
index a2a0c74f6..b773cce58 100644
--- a/spec/views/layouts/application_spec.rb
+++ b/spec/views/layouts/application_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'layouts/application.html.haml', type: "view" do
@@ -27,5 +23,4 @@ describe 'layouts/application.html.haml', type: "view" do
assert_select "script", text: 'alert("foo!")'
rendered.should_not have_content 'script'
end
-
end
diff --git a/spec/views/members/_location.html.haml_spec.rb b/spec/views/members/_location.html.haml_spec.rb
index 4a247d9eb..23beefc69 100644
--- a/spec/views/members/_location.html.haml_spec.rb
+++ b/spec/views/members/_location.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "members/_location" do
@@ -45,7 +41,5 @@ describe "members/_location" do
it "doesn't link anywhere" do
assert_select "a", false
end
-
end
-
end
diff --git a/spec/views/members/index.html.haml_spec.rb b/spec/views/members/index.html.haml_spec.rb
index ee1537b77..122b88b48 100644
--- a/spec/views/members/index.html.haml_spec.rb
+++ b/spec/views/members/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "members/index" do
@@ -24,7 +20,7 @@ describe "members/index" do
total_entries = 2
@member = FactoryGirl.create(:london_member)
members = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
- pager.replace([ @member, @member ])
+ pager.replace([@member, @member])
end
assign(:members, members)
render
@@ -37,5 +33,4 @@ describe "members/index" do
it 'contains member locations' do
rendered.should have_content @member.location
end
-
end
diff --git a/spec/views/members/show.rss.haml_spec.rb b/spec/views/members/show.rss.haml_spec.rb
index c54253bf9..5a3320a8b 100644
--- a/spec/views/members/show.rss.haml_spec.rb
+++ b/spec/views/members/show.rss.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'members/show.rss.haml', type: "view" do
@@ -34,13 +30,12 @@ describe 'members/show.rss.haml', type: "view" do
end
it 'renders post bodies to HTML and XML-escapes them' do
-# The variable "rendered" has been entity-replaced and tag-stripped
-# The literal string output contains "<strong>" etc.
+ # The variable "rendered" has been entity-replaced and tag-stripped
+ # The literal string output contains "<strong>" etc.
rendered.should have_content "strong"
end
it 'gives the author in the item title' do
rendered.should have_content "#{@post1.subject} by #{@post1.author}"
end
-
end
diff --git a/spec/views/notifications/index.html.haml_spec.rb b/spec/views/notifications/index.html.haml_spec.rb
index 55937df04..5e0f95beb 100644
--- a/spec/views/notifications/index.html.haml_spec.rb
+++ b/spec/views/notifications/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "notifications/index" do
@@ -25,12 +21,11 @@ describe "notifications/index" do
context "ordinary notifications" do
before(:each) do
@notification = FactoryGirl.create(:notification, sender: @member,
- recipient: @member)
- assign(:notifications, Kaminari.paginate_array([ @notification, @notification ]).page(1))
+ recipient: @member)
+ assign(:notifications, Kaminari.paginate_array([@notification, @notification]).page(1))
render
end
-
it "renders a list of notifications" do
assert_select "table"
assert_select "tr>td", text: @notification.sender.to_s, count: 2
@@ -45,7 +40,7 @@ describe "notifications/index" do
context "no subject" do
it "shows (no subject)" do
@notification = FactoryGirl.create(:notification,
- sender: @member, recipient: @member, subject: nil)
+ sender: @member, recipient: @member, subject: nil)
assign(:notifications, Kaminari.paginate_array([@notification]).page(1))
render
rendered.should have_content "(no subject)"
@@ -55,11 +50,10 @@ describe "notifications/index" do
context "whitespace-only subject" do
it "shows (no subject)" do
@notification = FactoryGirl.create(:notification,
- sender: @member, recipient: @member, subject: " ")
+ sender: @member, recipient: @member, subject: " ")
assign(:notifications, Kaminari.paginate_array([@notification]).page(1))
render
rendered.should have_content "(no subject)"
end
end
-
end
diff --git a/spec/views/notifications/new.html.haml_spec.rb b/spec/views/notifications/new.html.haml_spec.rb
index 92829806d..a5daa64f5 100644
--- a/spec/views/notifications/new.html.haml_spec.rb
+++ b/spec/views/notifications/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "notifications/new" do
@@ -22,7 +18,7 @@ describe "notifications/new" do
@sender = FactoryGirl.create(:member)
assign(:notification, FactoryGirl.create(:notification, recipient_id: @recipient.id, sender_id: @sender.id))
sign_in @sender
- controller.stub(:current_user) { @sender}
+ controller.stub(:current_user) { @sender }
end
it "renders new message form" do
@@ -63,5 +59,4 @@ describe "notifications/new" do
render
rendered.should have_content 'Markdown'
end
-
end
diff --git a/spec/views/notifications/show.html.haml_spec.rb b/spec/views/notifications/show.html.haml_spec.rb
index 9e10d0a85..4d5a71dfc 100644
--- a/spec/views/notifications/show.html.haml_spec.rb
+++ b/spec/views/notifications/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "notifications/show" do
@@ -36,7 +32,6 @@ describe "notifications/show" do
end
it "includes a reply button" do
- assert_select "a", {href: @reply_link}, "Reply"
+ assert_select "a", { href: @reply_link }, "Reply"
end
-
end
diff --git a/spec/views/notifier/notify.html.haml_spec.rb b/spec/views/notifier/notify.html.haml_spec.rb
index c0913d8e7..e3a7cbdb4 100644
--- a/spec/views/notifier/notify.html.haml_spec.rb
+++ b/spec/views/notifier/notify.html.haml_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'notifier/notify.html.haml', type: "view" do
-
before(:each) do
@notification = FactoryGirl.create(:notification)
@reply_link = "http://example.com"
diff --git a/spec/views/orders/index.html.haml_spec.rb b/spec/views/orders/index.html.haml_spec.rb
index 8b39c7fbe..38ab39362 100644
--- a/spec/views/orders/index.html.haml_spec.rb
+++ b/spec/views/orders/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "orders/index" do
@@ -22,7 +18,7 @@ describe "orders/index" do
sign_in @member
@order1 = FactoryGirl.create(:order, member: @member)
@order2 = FactoryGirl.create(:completed_order, member: @member)
- assign(:orders, [ @order1, @order2 ])
+ assign(:orders, [@order1, @order2])
end
it "shows your current account status" do
diff --git a/spec/views/orders/show.html.haml_spec.rb b/spec/views/orders/show.html.haml_spec.rb
index 8d8d9f5c4..b6c3da53b 100644
--- a/spec/views/orders/show.html.haml_spec.rb
+++ b/spec/views/orders/show.html.haml_spec.rb
@@ -10,14 +10,9 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "orders/show" do
-
before(:each) do
@member = FactoryGirl.create(:member)
sign_in @member
@@ -84,7 +79,5 @@ describe "orders/show" do
it "doesn't show delete order button" do
assert_select "a", text: "Delete this order", count: 0
end
-
end
-
end
diff --git a/spec/views/photos/edit.html.haml_spec.rb b/spec/views/photos/edit.html.haml_spec.rb
index c9b440a66..5ff07030b 100644
--- a/spec/views/photos/edit.html.haml_spec.rb
+++ b/spec/views/photos/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "photos/edit" do
@@ -25,5 +21,4 @@ describe "photos/edit" do
fullsize_url: "MyString"
))
end
-
end
diff --git a/spec/views/photos/index.html.haml_spec.rb b/spec/views/photos/index.html.haml_spec.rb
index 7b7479c97..a59e4eb2c 100644
--- a/spec/views/photos/index.html.haml_spec.rb
+++ b/spec/views/photos/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "photos/index" do
@@ -23,9 +19,9 @@ describe "photos/index" do
total_entries = 2
photos = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
- FactoryGirl.create(:photo),
- FactoryGirl.create(:photo)
- ])
+ FactoryGirl.create(:photo),
+ FactoryGirl.create(:photo)
+ ])
end
assign(:photos, photos)
end
diff --git a/spec/views/photos/new.html.haml_spec.rb b/spec/views/photos/new.html.haml_spec.rb
index b22240e4e..dab06e8b0 100644
--- a/spec/views/photos/new.html.haml_spec.rb
+++ b/spec/views/photos/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "photos/new" do
@@ -39,7 +35,7 @@ describe "photos/new" do
context "user has photosets" do
before(:each) do
- assign(:sets, {"foo" => "bar"}) # Hash of names => IDs
+ assign(:sets, { "foo" => "bar" }) # Hash of names => IDs
end
it "shows a dropdown with sets from Flickr" do
@@ -48,10 +44,9 @@ describe "photos/new" do
end
it "shows the current photoset" do
- assign(:current_set, "bar") # the ID of the set
+ assign(:current_set, "bar") # the ID of the set
render
assert_select "h2", "foo" # the name of the set
end
end
-
end
diff --git a/spec/views/photos/show.html.haml_spec.rb b/spec/views/photos/show.html.haml_spec.rb
index 2f995fd31..2a2e7afeb 100644
--- a/spec/views/photos/show.html.haml_spec.rb
+++ b/spec/views/photos/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "photos/show" do
@@ -38,7 +34,7 @@ describe "photos/show" do
it "links to the CC license" do
assert_select "a", href: @photo.license_url,
- text: @photo.license_name
+ text: @photo.license_name
end
it "shows a link to the original image" do
@@ -59,7 +55,5 @@ describe "photos/show" do
it "contains the phrase 'All rights reserved'" do
rendered.should have_content "All rights reserved"
end
-
end
-
end
diff --git a/spec/views/places/_map_attribution.html.haml_spec.rb b/spec/views/places/_map_attribution.html.haml_spec.rb
index 009c45290..efc101bc1 100644
--- a/spec/views/places/_map_attribution.html.haml_spec.rb
+++ b/spec/views/places/_map_attribution.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "places/_map_attribution.html.haml", type: :view do
@@ -23,12 +19,12 @@ describe "places/_map_attribution.html.haml", type: :view do
it "links to OpenStreetMap" do
assert_select "a", href: "http://openstreetmap.org",
- text: "OpenStreetMap"
+ text: "OpenStreetMap"
end
it "links to the ODbL" do
assert_select "a", href: "http://www.openstreetmap.org/copyright",
- text: "ODbL"
+ text: "ODbL"
end
it "links to CloudMade" do
diff --git a/spec/views/places/index.html.haml_spec.rb b/spec/views/places/index.html.haml_spec.rb
index 8efcca42e..44299c286 100644
--- a/spec/views/places/index.html.haml_spec.rb
+++ b/spec/views/places/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "places/index" do
diff --git a/spec/views/places/show.html.haml_spec.rb b/spec/views/places/show.html.haml_spec.rb
index 5a312f360..57f7e9742 100644
--- a/spec/views/places/show.html.haml_spec.rb
+++ b/spec/views/places/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "places/show" do
@@ -39,5 +35,4 @@ describe "places/show" do
rendered.should have_content m.login_name
end
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 c9a1533fa..2eeb4e535 100644
--- a/spec/views/plant_parts/edit.html.haml_spec.rb
+++ b/spec/views/plant_parts/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plant_parts/edit" do
diff --git a/spec/views/plant_parts/index.html.haml_spec.rb b/spec/views/plant_parts/index.html.haml_spec.rb
index 8b16b48ff..adb0f9a46 100644
--- a/spec/views/plant_parts/index.html.haml_spec.rb
+++ b/spec/views/plant_parts/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plant_parts/index" do
@@ -28,5 +24,4 @@ describe "plant_parts/index" do
rendered.should have_content @pp.name
assert_select "a", href: plant_part_path(@pp)
end
-
end
diff --git a/spec/views/plant_parts/new.html.haml_spec.rb b/spec/views/plant_parts/new.html.haml_spec.rb
index 9e977bd42..e25ba2da1 100644
--- a/spec/views/plant_parts/new.html.haml_spec.rb
+++ b/spec/views/plant_parts/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plant_parts/new" do
diff --git a/spec/views/plant_parts/show.html.haml_spec.rb b/spec/views/plant_parts/show.html.haml_spec.rb
index 66a6ddbb7..8b267c449 100644
--- a/spec/views/plant_parts/show.html.haml_spec.rb
+++ b/spec/views/plant_parts/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plant_parts/show" do
diff --git a/spec/views/plantings/_form.html.haml_spec.rb b/spec/views/plantings/_form.html.haml_spec.rb
index d2cdcf441..1ba3be93e 100644
--- a/spec/views/plantings/_form.html.haml_spec.rb
+++ b/spec/views/plantings/_form.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plantings/_form" do
@@ -36,5 +32,4 @@ describe "plantings/_form" do
it "has a free-form text field containing the planting date in ISO format" do
assert_select "input#planting_planted_at[type='text'][value='2013-03-01']"
end
-
end
diff --git a/spec/views/plantings/edit.html.haml_spec.rb b/spec/views/plantings/edit.html.haml_spec.rb
index 234d83646..1ea5fc586 100644
--- a/spec/views/plantings/edit.html.haml_spec.rb
+++ b/spec/views/plantings/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plantings/edit" do
@@ -35,7 +31,6 @@ describe "plantings/edit" do
@planting = assign(:planting,
FactoryGirl.create(:planting, garden: @garden, crop: @tomato)
)
-
end
context "logged in" do
@@ -66,6 +61,5 @@ describe "plantings/edit" do
assert_select "select#planting_garden_id",
html: /option selected value="#{@garden.id}"/
end
-
end
end
diff --git a/spec/views/plantings/index.html.haml_spec.rb b/spec/views/plantings/index.html.haml_spec.rb
index 0b584562f..54f2bb63a 100644
--- a/spec/views/plantings/index.html.haml_spec.rb
+++ b/spec/views/plantings/index.html.haml_spec.rb
@@ -10,16 +10,12 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plantings/index" do
before(:each) do
controller.stub(:current_user) { nil }
- @member = FactoryGirl.create(:member)
+ @member = FactoryGirl.create(:member)
@garden = FactoryGirl.create(:garden, owner: @member)
@tomato = FactoryGirl.create(:tomato)
@maize = FactoryGirl.create(:maize)
@@ -28,25 +24,25 @@ describe "plantings/index" do
total_entries = 3
plantings = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
- FactoryGirl.create(:planting,
- garden: @garden,
- crop: @tomato,
- owner: @member
- ),
- FactoryGirl.create(:planting,
- garden: @garden,
- crop: @maize,
- description: '',
- planted_at: Time.local(2013, 1, 13)
- ),
- FactoryGirl.create(:planting,
- garden: @garden,
- crop: @tomato,
- planted_at: Time.local(2013, 1, 13),
- finished_at: Time.local(2013, 1, 20),
- finished: true
- )
- ])
+ FactoryGirl.create(:planting,
+ garden: @garden,
+ crop: @tomato,
+ owner: @member
+ ),
+ FactoryGirl.create(:planting,
+ garden: @garden,
+ crop: @maize,
+ description: '',
+ planted_at: Time.local(2013, 1, 13)
+ ),
+ FactoryGirl.create(:planting,
+ garden: @garden,
+ crop: @tomato,
+ planted_at: Time.local(2013, 1, 13),
+ finished_at: Time.local(2013, 1, 20),
+ finished: true
+ )
+ ])
end
assign(:plantings, plantings)
render
diff --git a/spec/views/plantings/index.rss.haml_spec.rb b/spec/views/plantings/index.rss.haml_spec.rb
index eefb49c6a..58a4a2996 100644
--- a/spec/views/plantings/index.rss.haml_spec.rb
+++ b/spec/views/plantings/index.rss.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'plantings/index.rss.haml' do
@@ -54,7 +50,7 @@ describe 'plantings/index.rss.haml' do
context "one person's plantings" do
before :each do
@planting = FactoryGirl.create(:planting)
- assign(:plantings, [@planting ])
+ assign(:plantings, [@planting])
assign(:owner, @planting.owner)
render
end
diff --git a/spec/views/plantings/new.html.haml_spec.rb b/spec/views/plantings/new.html.haml_spec.rb
index 3521d34f6..2fadcf38b 100644
--- a/spec/views/plantings/new.html.haml_spec.rb
+++ b/spec/views/plantings/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plantings/new" do
@@ -31,7 +27,6 @@ describe "plantings/new" do
garden: @garden_a,
crop: @crop2
))
-
end
context "logged in" do
diff --git a/spec/views/plantings/show.html.haml_spec.rb b/spec/views/plantings/show.html.haml_spec.rb
index 48064e2fe..e89d6bb92 100644
--- a/spec/views/plantings/show.html.haml_spec.rb
+++ b/spec/views/plantings/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "plantings/show" do
@@ -22,7 +18,7 @@ describe "plantings/show" do
@crop = FactoryGirl.create(:tomato)
@planting = assign(:planting,
FactoryGirl.create(:planting, garden: @garden, crop: @crop,
- planted_from: 'cutting')
+ planted_from: 'cutting')
)
end
diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb
index 8c2c4863b..656a4194b 100644
--- a/spec/views/posts/_single.html.haml_spec.rb
+++ b/spec/views/posts/_single.html.haml_spec.rb
@@ -10,16 +10,11 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "posts/_single" do
-
def render_post()
- render partial: "single", locals: { post: @post }
+ render partial: "single", locals: { post: @post }
end
before(:each) do
@@ -37,7 +32,7 @@ describe "posts/_single" do
end
it "doesn't contain a link to new comment" do
- assert_select("a", {href: new_comment_path(post_id: @post.id)}, false)
+ assert_select("a", { href: new_comment_path(post_id: @post.id) }, false)
end
end
@@ -50,7 +45,7 @@ describe "posts/_single" do
end
it "contains link to new comment" do
- assert_select("a", {href: new_comment_path(post_id: @post.id)}, "Reply")
+ assert_select("a", { href: new_comment_path(post_id: @post.id) }, "Reply")
end
it "does not contain an edit link" do
@@ -121,13 +116,12 @@ describe "posts/_single" do
end
it "does not contain link to post" do
- assert_select "a[href='#{post_path @post}']", false
+ assert_select "a[href='#{post_path @post}']", false
end
it "does not contain link to new comment" do
assert_select "a[href='#{new_comment_path(post_id: @post.id)}']", false
end
-
end
context "when post has been edited" do
@@ -199,5 +193,4 @@ describe "posts/_single" do
rendered.should_not have_content "edited at #{@comment.updated_at}"
end
end
-
end
diff --git a/spec/views/posts/edit.html.haml_spec.rb b/spec/views/posts/edit.html.haml_spec.rb
index 9b4a14146..d3342f5b9 100644
--- a/spec/views/posts/edit.html.haml_spec.rb
+++ b/spec/views/posts/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "posts/edit" do
@@ -47,7 +43,7 @@ describe "posts/edit" do
context "forum specified" do
before(:each) do
@forum = assign(:forum, FactoryGirl.create(:forum))
- assign(:post, FactoryGirl.create( :post,
+ assign(:post, FactoryGirl.create(:post,
forum: @forum,
author: @author
))
@@ -62,6 +58,5 @@ describe "posts/edit" do
rendered.should have_content "This post will be posted in the forum #{@forum.name}"
end
end
-
end
end
diff --git a/spec/views/posts/index.html.haml_spec.rb b/spec/views/posts/index.html.haml_spec.rb
index 3d0f094d6..731be8ea8 100644
--- a/spec/views/posts/index.html.haml_spec.rb
+++ b/spec/views/posts/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "posts/index" do
@@ -25,9 +21,9 @@ describe "posts/index" do
total_entries = 2
posts = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([
- FactoryGirl.create(:post, author: @author),
- FactoryGirl.create(:post, author: @author)
- ])
+ FactoryGirl.create(:post, author: @author),
+ FactoryGirl.create(:post, author: @author)
+ ])
end
assign(:posts, posts)
render
diff --git a/spec/views/posts/index.rss.haml_spec.rb b/spec/views/posts/index.rss.haml_spec.rb
index 8a2b78329..a5ee08423 100644
--- a/spec/views/posts/index.rss.haml_spec.rb
+++ b/spec/views/posts/index.rss.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'posts/index.rss.haml', type: "view" do
@@ -37,5 +33,4 @@ describe 'posts/index.rss.haml', type: "view" do
it 'gives the author in the item title' do
rendered.should have_content "#{@post1.subject} by #{@post1.author}"
end
-
end
diff --git a/spec/views/posts/new.html.haml_spec.rb b/spec/views/posts/new.html.haml_spec.rb
index e4a23d704..53c01fa35 100644
--- a/spec/views/posts/new.html.haml_spec.rb
+++ b/spec/views/posts/new.html.haml_spec.rb
@@ -10,17 +10,13 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "posts/new" do
before(:each) do
@author = FactoryGirl.create(:member)
assign(:post, FactoryGirl.create(:post, author: @author))
-# assign(:forum, Forum.new)
+ # assign(:forum, Forum.new)
sign_in @author
controller.stub(:current_user) { @author }
end
@@ -74,5 +70,4 @@ describe "posts/new" do
render
rendered.should have_content 'Markdown'
end
-
end
diff --git a/spec/views/posts/show.html.haml_spec.rb b/spec/views/posts/show.html.haml_spec.rb
index 432879296..9564e7ee8 100644
--- a/spec/views/posts/show.html.haml_spec.rb
+++ b/spec/views/posts/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "posts/show" do
@@ -52,7 +48,7 @@ describe "posts/show" do
it 'has an anchor to the comments' do
@post = assign(:post,
- FactoryGirl.create(:post, author: @author))
+ FactoryGirl.create(:post, author: @author))
render
assert_select 'a[name=comments]'
end
@@ -60,7 +56,7 @@ describe "posts/show" do
context "when there is one comment" do
before(:each) do
@post = assign(:post,
- FactoryGirl.create(:html_post, author: @author))
+ FactoryGirl.create(:html_post, author: @author))
@comment = FactoryGirl.create(:comment, post: @post)
@comments = @post.comments
render
@@ -82,14 +78,14 @@ describe "posts/show" do
context "when there is more than one comment" do
before(:each) do
@post = assign(:post,
- FactoryGirl.create(:html_post, author: @author))
+ FactoryGirl.create(:html_post, author: @author))
@comment1 = FactoryGirl.create(:comment, post: @post, body: "F1rst!!!",
- created_at: Date.new(2010, 5, 17))
+ created_at: Date.new(2010, 5, 17))
@comment3 = FactoryGirl.create(:comment, post: @post, body: "Th1rd!!!",
- created_at: Date.new(2012, 5, 17))
+ created_at: Date.new(2012, 5, 17))
@comment4 = FactoryGirl.create(:comment, post: @post, body: "F0urth!!!")
@comment2 = FactoryGirl.create(:comment, post: @post, body: "S3c0nd!!1!",
- created_at: Date.new(2011, 5, 17))
+ created_at: Date.new(2011, 5, 17))
@comments = @post.comments
render
end
@@ -118,9 +114,7 @@ describe "posts/show" do
end
it 'shows a comment button' do
- assert_select "a", {href: new_comment_path(post_id: @post.id)}, "Comment"
+ assert_select "a", { href: new_comment_path(post_id: @post.id) }, "Comment"
end
-
end
-
end
diff --git a/spec/views/posts/show.rss.haml_spec.rb b/spec/views/posts/show.rss.haml_spec.rb
index b1f2977d2..7fd1d8891 100644
--- a/spec/views/posts/show.rss.haml_spec.rb
+++ b/spec/views/posts/show.rss.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'posts/show.rss.haml' do
@@ -43,5 +39,4 @@ describe 'posts/show.rss.haml' do
it 'shows content of comments' do
rendered.should have_content "OMG LOL"
end
-
end
diff --git a/spec/views/products/edit.html.haml_spec.rb b/spec/views/products/edit.html.haml_spec.rb
index 7822d1289..cb8269d9c 100644
--- a/spec/views/products/edit.html.haml_spec.rb
+++ b/spec/views/products/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "products/edit" do
diff --git a/spec/views/products/index.html.haml_spec.rb b/spec/views/products/index.html.haml_spec.rb
index 848bbab5b..f69492169 100644
--- a/spec/views/products/index.html.haml_spec.rb
+++ b/spec/views/products/index.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "products/index" do
diff --git a/spec/views/products/new.html.haml_spec.rb b/spec/views/products/new.html.haml_spec.rb
index a2f9d9dac..172cdf2ee 100644
--- a/spec/views/products/new.html.haml_spec.rb
+++ b/spec/views/products/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "products/new" do
diff --git a/spec/views/products/show.html.haml_spec.rb b/spec/views/products/show.html.haml_spec.rb
index 83d517750..2aeffa783 100644
--- a/spec/views/products/show.html.haml_spec.rb
+++ b/spec/views/products/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "products/show" do
diff --git a/spec/views/roles/edit.html.haml_spec.rb b/spec/views/roles/edit.html.haml_spec.rb
index 72584b4b0..44e32b306 100644
--- a/spec/views/roles/edit.html.haml_spec.rb
+++ b/spec/views/roles/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "roles/edit" do
diff --git a/spec/views/roles/index.html.haml_spec.rb b/spec/views/roles/index.html.haml_spec.rb
index be7fd4795..00aca2be7 100644
--- a/spec/views/roles/index.html.haml_spec.rb
+++ b/spec/views/roles/index.html.haml_spec.rb
@@ -10,25 +10,21 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "roles/index" do
before(:each) do
controller.stub(:current_user) { nil }
assign(:roles, [
- stub_model(Role,
- name: "Name",
- description: "MyText"
- ),
- stub_model(Role,
- name: "Name",
- description: "MyText"
- )
- ])
+ stub_model(Role,
+ name: "Name",
+ description: "MyText"
+ ),
+ stub_model(Role,
+ name: "Name",
+ description: "MyText"
+ )
+ ])
end
it "renders a list of roles" do
diff --git a/spec/views/roles/new.html.haml_spec.rb b/spec/views/roles/new.html.haml_spec.rb
index 341bd91f8..e884d6e64 100644
--- a/spec/views/roles/new.html.haml_spec.rb
+++ b/spec/views/roles/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "roles/new" do
diff --git a/spec/views/roles/show.html.haml_spec.rb b/spec/views/roles/show.html.haml_spec.rb
index ec2934088..cb208b487 100644
--- a/spec/views/roles/show.html.haml_spec.rb
+++ b/spec/views/roles/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "roles/show" do
diff --git a/spec/views/scientific_names/edit.html.haml_spec.rb b/spec/views/scientific_names/edit.html.haml_spec.rb
index db04906d1..446740f2d 100644
--- a/spec/views/scientific_names/edit.html.haml_spec.rb
+++ b/spec/views/scientific_names/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "scientific_names/edit" do
@@ -28,9 +24,9 @@ describe "scientific_names/edit" do
render
end
- it "shows the creator" do
- rendered.should have_content "Added by #{@scientific_name.creator} less than a minute ago."
- end
+ it "shows the creator" do
+ rendered.should have_content "Added by #{@scientific_name.creator} less than a minute ago."
+ end
it "renders the edit scientific_name form" do
assert_select "form", action: scientific_names_path(@scientific_name), method: "post" do
@@ -39,5 +35,4 @@ describe "scientific_names/edit" do
end
end
end
-
end
diff --git a/spec/views/scientific_names/index.html.haml_spec.rb b/spec/views/scientific_names/index.html.haml_spec.rb
index 64d5cb521..feb4d3535 100644
--- a/spec/views/scientific_names/index.html.haml_spec.rb
+++ b/spec/views/scientific_names/index.html.haml_spec.rb
@@ -10,19 +10,15 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "scientific_names/index" do
before(:each) do
controller.stub(:current_user) { nil }
assign(:scientific_names, [
- FactoryGirl.create(:zea_mays),
- FactoryGirl.create(:solanum_lycopersicum)
- ])
+ FactoryGirl.create(:zea_mays),
+ FactoryGirl.create(:solanum_lycopersicum)
+ ])
end
it "renders a list of scientific_names" do
diff --git a/spec/views/scientific_names/new.html.haml_spec.rb b/spec/views/scientific_names/new.html.haml_spec.rb
index a4383b6cc..772387dd7 100644
--- a/spec/views/scientific_names/new.html.haml_spec.rb
+++ b/spec/views/scientific_names/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "scientific_names/new" do
@@ -37,7 +33,5 @@ describe "scientific_names/new" do
assert_select "select#scientific_name_crop_id", name: "scientific_name[crop_id]"
end
end
-
end
-
end
diff --git a/spec/views/scientific_names/show.html.haml_spec.rb b/spec/views/scientific_names/show.html.haml_spec.rb
index 2f0228a3e..d044bfbcc 100644
--- a/spec/views/scientific_names/show.html.haml_spec.rb
+++ b/spec/views/scientific_names/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "scientific_names/show" do
@@ -31,7 +27,6 @@ describe "scientific_names/show" do
end
context 'signed in' do
-
before :each do
@wrangler = FactoryGirl.create(:crop_wrangling_member)
sign_in @wrangler
diff --git a/spec/views/seeds/edit.html.haml_spec.rb b/spec/views/seeds/edit.html.haml_spec.rb
index 995060c45..9ed744295 100644
--- a/spec/views/seeds/edit.html.haml_spec.rb
+++ b/spec/views/seeds/edit.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "seeds/edit" do
diff --git a/spec/views/seeds/index.rss.haml_spec.rb b/spec/views/seeds/index.rss.haml_spec.rb
index 72f56fa0a..a90394084 100644
--- a/spec/views/seeds/index.rss.haml_spec.rb
+++ b/spec/views/seeds/index.rss.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'seeds/index.rss.haml' do
@@ -25,7 +21,7 @@ describe 'seeds/index.rss.haml' do
before(:each) do
@seed = FactoryGirl.create(:seed)
@tradable = FactoryGirl.create(:tradable_seed)
- assign(:seeds, [ @seed, @tradable ])
+ assign(:seeds, [@seed, @tradable])
render
end
@@ -48,13 +44,12 @@ describe 'seeds/index.rss.haml' do
it 'mentions that one seed is tradable' do
rendered.should have_content "Will trade #{@tradable.tradable_to} from #{@tradable.owner.location}"
end
-
end
context "one member's seeds" do
before(:each) do
@seed = FactoryGirl.create(:seed)
- assign(:seeds, [ @seed ])
+ assign(:seeds, [@seed])
assign(:owner, @seed.owner)
render
end
diff --git a/spec/views/seeds/new.html.haml_spec.rb b/spec/views/seeds/new.html.haml_spec.rb
index 2d90ede1f..2cc82f641 100644
--- a/spec/views/seeds/new.html.haml_spec.rb
+++ b/spec/views/seeds/new.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "seeds/new" do
@@ -62,5 +58,4 @@ describe "seeds/new" do
assert_select "a", text: "Change your location."
end
end
-
end
diff --git a/spec/views/seeds/show.html.haml_spec.rb b/spec/views/seeds/show.html.haml_spec.rb
index 553a92fa2..c970a2518 100644
--- a/spec/views/seeds/show.html.haml_spec.rb
+++ b/spec/views/seeds/show.html.haml_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe "seeds/show" do
@@ -73,6 +69,5 @@ describe "seeds/show" do
render
rendered.should have_content "Request seeds"
end
-
end
end
diff --git a/spec/views/shop/index_spec.rb b/spec/views/shop/index_spec.rb
index 5c1f9caef..736168b63 100644
--- a/spec/views/shop/index_spec.rb
+++ b/spec/views/shop/index_spec.rb
@@ -10,10 +10,6 @@
## If you submit a pull request containing new view or controller tests, it will not be
## merged.
-
-
-
-
require 'rails_helper'
describe 'shop/index.html.haml', type: "view" do
@@ -83,7 +79,6 @@ describe 'shop/index.html.haml', type: "view" do
render
assert_select "form", false
end
-
end
context "signed out" do
@@ -96,5 +91,4 @@ describe 'shop/index.html.haml', type: "view" do
rendered.should have_content "sign in or sign up"
end
end
-
end