From 3d4f5c6917eda852520cfae4090880a4d577f7a5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 13 Nov 2017 21:47:17 +1300 Subject: [PATCH 01/58] upgrade leaflet-rails --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 824b6ca9f..7d3ce2a58 100644 --- a/Gemfile +++ b/Gemfile @@ -30,7 +30,7 @@ gem 'csv_shaper' # CSV export gem 'figaro' # for handling config via ENV variables gem 'gibbon', '~>1.2.0' # for Mailchimp newsletter subscriptions gem 'leaflet-markercluster-rails' -gem 'leaflet-rails', '~> 0.7.7' # Newer versions break tests - see https://travis-ci.org/CloCkWeRX/growstuff/builds/200984350 +gem 'leaflet-rails' gem 'pg' gem 'ruby-units' # for unit conversion gem 'unicorn' # http server diff --git a/Gemfile.lock b/Gemfile.lock index 5f8bcf612..e573d4114 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -296,7 +296,8 @@ GEM addressable (~> 2.3) leaflet-markercluster-rails (0.7.0) railties (>= 3.1) - leaflet-rails (0.7.7) + leaflet-rails (1.2.0) + rails (>= 4.2.0) letter_opener (1.4.1) launchy (~> 2.2) listen (3.1.5) @@ -592,7 +593,7 @@ DEPENDENCIES js-routes kaminari leaflet-markercluster-rails - leaflet-rails (~> 0.7.7) + leaflet-rails letter_opener memcachier newrelic_rpm @@ -625,9 +626,8 @@ DEPENDENCIES will_paginate xmlrpc - RUBY VERSION ruby 2.4.1p111 BUNDLED WITH - 1.15.4 + 1.16.0 From e489831241c92ed905123441a1406b7d13309a56 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 13 Nov 2017 22:11:01 +1300 Subject: [PATCH 02/58] Debugging phantom on travis --- .travis.yml | 1 + script/install_phantomjs | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef68fec4f..d3bd22cab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ env: before_install: - ./script/install_phantomjs; - export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH + - which phantomjs # Force Travis to use Elastic Search 2.4.0 - > if [ "${GROWSTUFF_ELASTICSEARCH}" = "true" ]; then diff --git a/script/install_phantomjs b/script/install_phantomjs index b6e8defb6..551a46bb6 100755 --- a/script/install_phantomjs +++ b/script/install_phantomjs @@ -1,10 +1,16 @@ #!/bin/bash +set -v + if [ "$(phantomjs --version)" != '2.1.1' ]; then PHANTOM_URL="https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2" rm -rf "$PWD/travis_phantomjs" mkdir -p "$PWD/travis_phantomjs" - wget "$PHANTOM_URL" -O "$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2" - tar -xvf "$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis_phantomjs" + cd "$PWD/travis_phantomjs" + wget "$PHANTOM_URL" + ls -l + tar -vjxf phantomjs-2.1.1-linux-x86_64.tar.bz2 + find fi +which phantomjs phantomjs --version \ No newline at end of file From d8bf8ae4dfd107d499773ce69f8d59af4b7c8e08 Mon Sep 17 00:00:00 2001 From: milesgould Date: Fri, 17 Nov 2017 10:34:32 +0000 Subject: [PATCH 03/58] De-deprecate controller and view specs We deprecated controller and view specs on the grounds that they were brittle, and were a poorer measure of user experience than feature specs. However, feature specs have their own problems: they're much slower to run, and flakier (see #901). We also ran into a few cases where feature specs erroneously passed because they were checking for the presence of a string that occurred in the error page! Hence, we're cautiously un-deprecating controller and view specs. Fixes #1132 --- spec/controllers/account_types_controller_spec.rb | 12 ------------ spec/controllers/accounts_controller_spec.rb | 12 ------------ spec/controllers/admin/orders_controller_spec.rb | 12 ------------ spec/controllers/admin_controller_spec.rb | 12 ------------ spec/controllers/authentications_controller_spec.rb | 12 ------------ spec/controllers/comments_controller_spec.rb | 12 ------------ spec/controllers/crops_controller_spec.rb | 12 ------------ spec/controllers/forums_controller_spec.rb | 12 ------------ spec/controllers/gardens_controller_spec.rb | 12 ------------ spec/controllers/harvests_controller_spec.rb | 12 ------------ spec/controllers/home_controller_spec.rb | 12 ------------ spec/controllers/member_controller_spec.rb | 12 ------------ spec/controllers/notifications_controller_spec.rb | 12 ------------ spec/controllers/order_items_controller_spec.rb | 12 ------------ spec/controllers/orders_controller_spec.rb | 12 ------------ spec/controllers/photos_controller_spec.rb | 11 ----------- spec/controllers/places_controller_spec.rb | 12 ------------ spec/controllers/plant_parts_controller_spec.rb | 12 ------------ spec/controllers/plantings_controller_spec.rb | 12 ------------ spec/controllers/posts_controller_spec.rb | 12 ------------ spec/controllers/products_controller_spec.rb | 12 ------------ spec/controllers/registrations_controller_spec.rb | 12 ------------ spec/controllers/roles_controller_spec.rb | 12 ------------ spec/controllers/scientific_names_controller_spec.rb | 12 ------------ spec/controllers/seeds_controller_spec.rb | 12 ------------ spec/controllers/shop_controller_spec.rb | 12 ------------ spec/views/account_types/edit.html.haml_spec.rb | 12 ------------ spec/views/account_types/index.html.haml_spec.rb | 12 ------------ spec/views/account_types/new.html.haml_spec.rb | 12 ------------ spec/views/account_types/show.html.haml_spec.rb | 12 ------------ spec/views/accounts/edit.html.haml_spec.rb | 12 ------------ spec/views/accounts/index.html.haml_spec.rb | 12 ------------ spec/views/accounts/new.html.haml_spec.rb | 12 ------------ spec/views/accounts/show.html.haml_spec.rb | 12 ------------ spec/views/admin/index_spec.rb | 12 ------------ spec/views/admin/newsletter_spec.rb | 12 ------------ spec/views/admin/orders/index_spec.rb | 12 ------------ spec/views/comments/edit.html.haml_spec.rb | 12 ------------ spec/views/comments/index.html.haml_spec.rb | 12 ------------ spec/views/comments/index.rss.haml_spec.rb | 12 ------------ spec/views/comments/new.html.haml_spec.rb | 12 ------------ spec/views/comments/show.html.haml_spec.rb | 12 ------------ spec/views/crops/_grown_for.html.haml_spec.rb | 12 ------------ spec/views/crops/_planting_advice.html.haml_spec.rb | 12 ------------ spec/views/crops/_popover.html.haml_spec.rb | 12 ------------ spec/views/crops/edit.html.haml_spec.rb | 12 ------------ spec/views/crops/hierarchy.html.haml_spec.rb | 12 ------------ spec/views/crops/index.html.haml_spec.rb | 12 ------------ spec/views/crops/index.rss.haml_spec.rb | 12 ------------ spec/views/crops/new.html.haml_spec.rb | 12 ------------ spec/views/crops/wrangle.html.haml_spec.rb | 12 ------------ .../devise/mailer/confirmation_instructions_spec.rb | 12 ------------ .../mailer/reset_password_instructions_spec.rb | 12 ------------ spec/views/devise/mailer/unlock_instructions_spec.rb | 12 ------------ spec/views/devise/registrations/edit_spec.rb | 12 ------------ spec/views/devise/registrations/new_spec.rb | 12 ------------ spec/views/devise/sessions/new_spec.rb | 12 ------------ spec/views/devise/unlocks/new_spec.rb | 12 ------------ spec/views/forums/edit.html.haml_spec.rb | 12 ------------ spec/views/forums/index.html.haml_spec.rb | 12 ------------ spec/views/forums/new.html.haml_spec.rb | 12 ------------ spec/views/forums/show.html.haml_spec.rb | 12 ------------ spec/views/gardens/edit.html.haml_spec.rb | 12 ------------ spec/views/gardens/new.html.haml_spec.rb | 12 ------------ spec/views/gardens/show.html.haml_spec.rb | 12 ------------ spec/views/harvests/edit.html.haml_spec.rb | 12 ------------ spec/views/harvests/index.html.haml_spec.rb | 12 ------------ spec/views/harvests/new.html.haml_spec.rb | 12 ------------ spec/views/harvests/show.html.haml_spec.rb | 12 ------------ spec/views/home/_blurb.html.haml_spec.rb | 12 ------------ spec/views/home/_crops.html.haml_spec.rb | 12 ------------ spec/views/home/_members.html.haml_spec.rb | 12 ------------ spec/views/home/_seeds.html.haml_spec.rb | 12 ------------ spec/views/home/_stats.html.haml_spec.rb | 12 ------------ spec/views/home/index_spec.rb | 12 ------------ spec/views/layouts/_header_spec.rb | 12 ------------ spec/views/layouts/_meta_spec.rb | 12 ------------ spec/views/layouts/application_spec.rb | 12 ------------ spec/views/notifications/index.html.haml_spec.rb | 12 ------------ spec/views/notifications/new.html.haml_spec.rb | 12 ------------ spec/views/notifications/show.html.haml_spec.rb | 12 ------------ spec/views/notifier/notify.html.haml_spec.rb | 12 ------------ spec/views/orders/index.html.haml_spec.rb | 12 ------------ spec/views/orders/show.html.haml_spec.rb | 12 ------------ spec/views/photos/edit.html.haml_spec.rb | 12 ------------ spec/views/photos/index.html.haml_spec.rb | 12 ------------ spec/views/photos/new.html.haml_spec.rb | 12 ------------ spec/views/photos/show.html.haml_spec.rb | 12 ------------ spec/views/places/_map_attribution.html.haml_spec.rb | 12 ------------ spec/views/places/index.html.haml_spec.rb | 12 ------------ spec/views/places/show.html.haml_spec.rb | 12 ------------ spec/views/plant_parts/edit.html.haml_spec.rb | 12 ------------ spec/views/plant_parts/index.html.haml_spec.rb | 12 ------------ spec/views/plant_parts/new.html.haml_spec.rb | 12 ------------ spec/views/plant_parts/show.html.haml_spec.rb | 12 ------------ spec/views/plantings/_form.html.haml_spec.rb | 12 ------------ spec/views/plantings/edit.html.haml_spec.rb | 12 ------------ spec/views/plantings/index.html.haml_spec.rb | 12 ------------ spec/views/plantings/index.rss.haml_spec.rb | 12 ------------ spec/views/plantings/new.html.haml_spec.rb | 12 ------------ spec/views/plantings/show.html.haml_spec.rb | 12 ------------ spec/views/posts/_single.html.haml_spec.rb | 12 ------------ spec/views/posts/edit.html.haml_spec.rb | 12 ------------ spec/views/posts/index.html.haml_spec.rb | 12 ------------ spec/views/posts/index.rss.haml_spec.rb | 12 ------------ spec/views/posts/new.html.haml_spec.rb | 12 ------------ spec/views/posts/show.rss.haml_spec.rb | 12 ------------ spec/views/products/edit.html.haml_spec.rb | 12 ------------ spec/views/products/index.html.haml_spec.rb | 12 ------------ spec/views/products/new.html.haml_spec.rb | 12 ------------ spec/views/products/show.html.haml_spec.rb | 12 ------------ spec/views/roles/edit.html.haml_spec.rb | 12 ------------ spec/views/roles/index.html.haml_spec.rb | 12 ------------ spec/views/roles/new.html.haml_spec.rb | 12 ------------ spec/views/roles/show.html.haml_spec.rb | 12 ------------ spec/views/scientific_names/edit.html.haml_spec.rb | 12 ------------ spec/views/scientific_names/index.html.haml_spec.rb | 12 ------------ spec/views/scientific_names/new.html.haml_spec.rb | 12 ------------ spec/views/scientific_names/show.html.haml_spec.rb | 12 ------------ spec/views/seeds/edit.html.haml_spec.rb | 12 ------------ spec/views/seeds/index.rss.haml_spec.rb | 12 ------------ spec/views/seeds/new.html.haml_spec.rb | 12 ------------ spec/views/seeds/show.html.haml_spec.rb | 12 ------------ spec/views/shop/index_spec.rb | 12 ------------ 124 files changed, 1487 deletions(-) diff --git a/spec/controllers/account_types_controller_spec.rb b/spec/controllers/account_types_controller_spec.rb index 633311b6e..3a7559f63 100644 --- a/spec/controllers/account_types_controller_spec.rb +++ b/spec/controllers/account_types_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe AccountTypesController do diff --git a/spec/controllers/accounts_controller_spec.rb b/spec/controllers/accounts_controller_spec.rb index d159f4114..2b4222f1d 100644 --- a/spec/controllers/accounts_controller_spec.rb +++ b/spec/controllers/accounts_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe AccountsController do diff --git a/spec/controllers/admin/orders_controller_spec.rb b/spec/controllers/admin/orders_controller_spec.rb index a81875427..fb475b34c 100644 --- a/spec/controllers/admin/orders_controller_spec.rb +++ b/spec/controllers/admin/orders_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe Admin::OrdersController do diff --git a/spec/controllers/admin_controller_spec.rb b/spec/controllers/admin_controller_spec.rb index 6e97245d1..9f134bbab 100644 --- a/spec/controllers/admin_controller_spec.rb +++ b/spec/controllers/admin_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe AdminController do diff --git a/spec/controllers/authentications_controller_spec.rb b/spec/controllers/authentications_controller_spec.rb index fe7eaa61f..8b61bbddc 100644 --- a/spec/controllers/authentications_controller_spec.rb +++ b/spec/controllers/authentications_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe AuthenticationsController do diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index e65a24544..23210a875 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe CommentsController do diff --git a/spec/controllers/crops_controller_spec.rb b/spec/controllers/crops_controller_spec.rb index 9a0a1dcdc..1f9e06d43 100644 --- a/spec/controllers/crops_controller_spec.rb +++ b/spec/controllers/crops_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe CropsController do diff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rb index f320204e2..5c59473cb 100644 --- a/spec/controllers/forums_controller_spec.rb +++ b/spec/controllers/forums_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe ForumsController do diff --git a/spec/controllers/gardens_controller_spec.rb b/spec/controllers/gardens_controller_spec.rb index 5fef6e210..b0ccae0b8 100644 --- a/spec/controllers/gardens_controller_spec.rb +++ b/spec/controllers/gardens_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' RSpec.describe GardensController, type: :controller do diff --git a/spec/controllers/harvests_controller_spec.rb b/spec/controllers/harvests_controller_spec.rb index c0dea9f2e..8a2edb56b 100644 --- a/spec/controllers/harvests_controller_spec.rb +++ b/spec/controllers/harvests_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe HarvestsController do diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index eb71e1f4a..cb12b2bb4 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe HomeController do diff --git a/spec/controllers/member_controller_spec.rb b/spec/controllers/member_controller_spec.rb index 866507f5f..b04bcd799 100644 --- a/spec/controllers/member_controller_spec.rb +++ b/spec/controllers/member_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe MembersController do diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index 0619a6707..fd6f40aa1 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe NotificationsController do diff --git a/spec/controllers/order_items_controller_spec.rb b/spec/controllers/order_items_controller_spec.rb index 0c1b50706..1da3c3b8d 100644 --- a/spec/controllers/order_items_controller_spec.rb +++ b/spec/controllers/order_items_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe OrderItemsController do diff --git a/spec/controllers/orders_controller_spec.rb b/spec/controllers/orders_controller_spec.rb index d02fc6e27..3c6631d8c 100644 --- a/spec/controllers/orders_controller_spec.rb +++ b/spec/controllers/orders_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe OrdersController do diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index 7c935422c..8f4fab28e 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -1,15 +1,4 @@ # frozen_string_literal: true -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. require 'rails_helper' diff --git a/spec/controllers/places_controller_spec.rb b/spec/controllers/places_controller_spec.rb index 79c1dc623..8b6cb0a31 100644 --- a/spec/controllers/places_controller_spec.rb +++ b/spec/controllers/places_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe PlacesController do diff --git a/spec/controllers/plant_parts_controller_spec.rb b/spec/controllers/plant_parts_controller_spec.rb index 239422efa..c6e11f315 100644 --- a/spec/controllers/plant_parts_controller_spec.rb +++ b/spec/controllers/plant_parts_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe PlantPartsController do diff --git a/spec/controllers/plantings_controller_spec.rb b/spec/controllers/plantings_controller_spec.rb index e9ce41369..1bacacc8c 100644 --- a/spec/controllers/plantings_controller_spec.rb +++ b/spec/controllers/plantings_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe PlantingsController do diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index 4cd61d242..cbfe8b46c 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe PostsController do diff --git a/spec/controllers/products_controller_spec.rb b/spec/controllers/products_controller_spec.rb index 63c17aa66..173ef9ba4 100644 --- a/spec/controllers/products_controller_spec.rb +++ b/spec/controllers/products_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe ProductsController do diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index c69144fd6..015bbb705 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe RegistrationsController do diff --git a/spec/controllers/roles_controller_spec.rb b/spec/controllers/roles_controller_spec.rb index 5c2271bce..9bf0ea1b5 100644 --- a/spec/controllers/roles_controller_spec.rb +++ b/spec/controllers/roles_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe RolesController do diff --git a/spec/controllers/scientific_names_controller_spec.rb b/spec/controllers/scientific_names_controller_spec.rb index 64b1e97fe..412f53224 100644 --- a/spec/controllers/scientific_names_controller_spec.rb +++ b/spec/controllers/scientific_names_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe ScientificNamesController do diff --git a/spec/controllers/seeds_controller_spec.rb b/spec/controllers/seeds_controller_spec.rb index 9ae6af1e2..c2fd699eb 100644 --- a/spec/controllers/seeds_controller_spec.rb +++ b/spec/controllers/seeds_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe SeedsController do diff --git a/spec/controllers/shop_controller_spec.rb b/spec/controllers/shop_controller_spec.rb index 4a438ea76..6298b7e76 100644 --- a/spec/controllers/shop_controller_spec.rb +++ b/spec/controllers/shop_controller_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe ShopController do diff --git a/spec/views/account_types/edit.html.haml_spec.rb b/spec/views/account_types/edit.html.haml_spec.rb index 09bcc35ce..1bd22be03 100644 --- a/spec/views/account_types/edit.html.haml_spec.rb +++ b/spec/views/account_types/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 b5aa55b17..56020fc35 100644 --- a/spec/views/account_types/index.html.haml_spec.rb +++ b/spec/views/account_types/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 3efc39b05..027a1b7c1 100644 --- a/spec/views/account_types/new.html.haml_spec.rb +++ b/spec/views/account_types/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 828639f00..a31d4bc33 100644 --- a/spec/views/account_types/show.html.haml_spec.rb +++ b/spec/views/account_types/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 96b29ef75..bc5c3b5a3 100644 --- a/spec/views/accounts/edit.html.haml_spec.rb +++ b/spec/views/accounts/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 5d23d9d76..4ec76151e 100644 --- a/spec/views/accounts/index.html.haml_spec.rb +++ b/spec/views/accounts/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 6ba4da067..77f6ff20f 100644 --- a/spec/views/accounts/new.html.haml_spec.rb +++ b/spec/views/accounts/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 71be40505..d96fbbd96 100644 --- a/spec/views/accounts/show.html.haml_spec.rb +++ b/spec/views/accounts/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 1c5f9bd20..beb0eacbd 100644 --- a/spec/views/admin/index_spec.rb +++ b/spec/views/admin/index_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 901e3a12a..384833034 100644 --- a/spec/views/admin/newsletter_spec.rb +++ b/spec/views/admin/newsletter_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 c819f0268..8d80dc3ef 100644 --- a/spec/views/admin/orders/index_spec.rb +++ b/spec/views/admin/orders/index_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 e562ca027..2ef7d480f 100644 --- a/spec/views/comments/edit.html.haml_spec.rb +++ b/spec/views/comments/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 1bf0e734f..91ed15a88 100644 --- a/spec/views/comments/index.html.haml_spec.rb +++ b/spec/views/comments/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "comments/index" do diff --git a/spec/views/comments/index.rss.haml_spec.rb b/spec/views/comments/index.rss.haml_spec.rb index c3b6fdd32..672658bac 100644 --- a/spec/views/comments/index.rss.haml_spec.rb +++ b/spec/views/comments/index.rss.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/comments/new.html.haml_spec.rb b/spec/views/comments/new.html.haml_spec.rb index 074b5bfe5..e0533ea5b 100644 --- a/spec/views/comments/new.html.haml_spec.rb +++ b/spec/views/comments/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "comments/new" do diff --git a/spec/views/comments/show.html.haml_spec.rb b/spec/views/comments/show.html.haml_spec.rb index baf02cbbb..6315b4f69 100644 --- a/spec/views/comments/show.html.haml_spec.rb +++ b/spec/views/comments/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 183445346..c378c296c 100644 --- a/spec/views/crops/_grown_for.html.haml_spec.rb +++ b/spec/views/crops/_grown_for.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 2e6bf9e93..c7a4719b5 100644 --- a/spec/views/crops/_planting_advice.html.haml_spec.rb +++ b/spec/views/crops/_planting_advice.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/crops/_popover.html.haml_spec.rb b/spec/views/crops/_popover.html.haml_spec.rb index 35d508fd8..dde4a893f 100644 --- a/spec/views/crops/_popover.html.haml_spec.rb +++ b/spec/views/crops/_popover.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "crops/_popover" do diff --git a/spec/views/crops/edit.html.haml_spec.rb b/spec/views/crops/edit.html.haml_spec.rb index 03f333bf2..eed85528d 100644 --- a/spec/views/crops/edit.html.haml_spec.rb +++ b/spec/views/crops/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "crops/edit" do diff --git a/spec/views/crops/hierarchy.html.haml_spec.rb b/spec/views/crops/hierarchy.html.haml_spec.rb index c711b2174..833bb2b98 100644 --- a/spec/views/crops/hierarchy.html.haml_spec.rb +++ b/spec/views/crops/hierarchy.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 421e33e00..9f2985035 100644 --- a/spec/views/crops/index.html.haml_spec.rb +++ b/spec/views/crops/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "crops/index" do diff --git a/spec/views/crops/index.rss.haml_spec.rb b/spec/views/crops/index.rss.haml_spec.rb index 623fb296e..72a8bbdff 100644 --- a/spec/views/crops/index.rss.haml_spec.rb +++ b/spec/views/crops/index.rss.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/crops/new.html.haml_spec.rb b/spec/views/crops/new.html.haml_spec.rb index a1208352a..5ce7eefdc 100644 --- a/spec/views/crops/new.html.haml_spec.rb +++ b/spec/views/crops/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "crops/new" do diff --git a/spec/views/crops/wrangle.html.haml_spec.rb b/spec/views/crops/wrangle.html.haml_spec.rb index 6550026f6..085060570 100644 --- a/spec/views/crops/wrangle.html.haml_spec.rb +++ b/spec/views/crops/wrangle.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "crops/wrangle" do diff --git a/spec/views/devise/mailer/confirmation_instructions_spec.rb b/spec/views/devise/mailer/confirmation_instructions_spec.rb index 01e0d7230..d2cce98c4 100644 --- a/spec/views/devise/mailer/confirmation_instructions_spec.rb +++ b/spec/views/devise/mailer/confirmation_instructions_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/devise/mailer/reset_password_instructions_spec.rb b/spec/views/devise/mailer/reset_password_instructions_spec.rb index 7d0cdfe6a..fc2ad1bbe 100644 --- a/spec/views/devise/mailer/reset_password_instructions_spec.rb +++ b/spec/views/devise/mailer/reset_password_instructions_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/devise/mailer/unlock_instructions_spec.rb b/spec/views/devise/mailer/unlock_instructions_spec.rb index 693fe97b0..633545cf3 100644 --- a/spec/views/devise/mailer/unlock_instructions_spec.rb +++ b/spec/views/devise/mailer/unlock_instructions_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 7c69a8d3e..3d9dae906 100644 --- a/spec/views/devise/registrations/edit_spec.rb +++ b/spec/views/devise/registrations/edit_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/devise/registrations/new_spec.rb b/spec/views/devise/registrations/new_spec.rb index be00abae9..48805b806 100644 --- a/spec/views/devise/registrations/new_spec.rb +++ b/spec/views/devise/registrations/new_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/devise/sessions/new_spec.rb b/spec/views/devise/sessions/new_spec.rb index 93b14b9c3..dfe91af2a 100644 --- a/spec/views/devise/sessions/new_spec.rb +++ b/spec/views/devise/sessions/new_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/devise/unlocks/new_spec.rb b/spec/views/devise/unlocks/new_spec.rb index c53968a8d..60d056d72 100644 --- a/spec/views/devise/unlocks/new_spec.rb +++ b/spec/views/devise/unlocks/new_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/forums/edit.html.haml_spec.rb b/spec/views/forums/edit.html.haml_spec.rb index d7d426a8e..44151170a 100644 --- a/spec/views/forums/edit.html.haml_spec.rb +++ b/spec/views/forums/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 cf8377858..02b265e85 100644 --- a/spec/views/forums/index.html.haml_spec.rb +++ b/spec/views/forums/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "forums/index" do diff --git a/spec/views/forums/new.html.haml_spec.rb b/spec/views/forums/new.html.haml_spec.rb index 8c95c7c1f..72cd7ae45 100644 --- a/spec/views/forums/new.html.haml_spec.rb +++ b/spec/views/forums/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 5b6bae8fa..08892df58 100644 --- a/spec/views/forums/show.html.haml_spec.rb +++ b/spec/views/forums/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 1928f6d8b..1326f1544 100644 --- a/spec/views/gardens/edit.html.haml_spec.rb +++ b/spec/views/gardens/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "gardens/edit" do diff --git a/spec/views/gardens/new.html.haml_spec.rb b/spec/views/gardens/new.html.haml_spec.rb index 97eab872e..7346997dc 100644 --- a/spec/views/gardens/new.html.haml_spec.rb +++ b/spec/views/gardens/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 b22ee0452..015333ae0 100644 --- a/spec/views/gardens/show.html.haml_spec.rb +++ b/spec/views/gardens/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "gardens/show" do diff --git a/spec/views/harvests/edit.html.haml_spec.rb b/spec/views/harvests/edit.html.haml_spec.rb index a475a6300..1193b4284 100644 --- a/spec/views/harvests/edit.html.haml_spec.rb +++ b/spec/views/harvests/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 db9ce915f..fe205cda6 100644 --- a/spec/views/harvests/index.html.haml_spec.rb +++ b/spec/views/harvests/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "harvests/index" do diff --git a/spec/views/harvests/new.html.haml_spec.rb b/spec/views/harvests/new.html.haml_spec.rb index 4b792a4c6..d79055a38 100644 --- a/spec/views/harvests/new.html.haml_spec.rb +++ b/spec/views/harvests/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "harvests/new" do diff --git a/spec/views/harvests/show.html.haml_spec.rb b/spec/views/harvests/show.html.haml_spec.rb index b13d53ed6..5e2f167af 100644 --- a/spec/views/harvests/show.html.haml_spec.rb +++ b/spec/views/harvests/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "harvests/show" do diff --git a/spec/views/home/_blurb.html.haml_spec.rb b/spec/views/home/_blurb.html.haml_spec.rb index 710fcd4d4..47244a445 100644 --- a/spec/views/home/_blurb.html.haml_spec.rb +++ b/spec/views/home/_blurb.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/home/_crops.html.haml_spec.rb b/spec/views/home/_crops.html.haml_spec.rb index ecbb74227..cc91976b8 100644 --- a/spec/views/home/_crops.html.haml_spec.rb +++ b/spec/views/home/_crops.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 f131d5b67..76aa434b6 100644 --- a/spec/views/home/_members.html.haml_spec.rb +++ b/spec/views/home/_members.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/home/_seeds.html.haml_spec.rb b/spec/views/home/_seeds.html.haml_spec.rb index 4a128f1f6..7b8d6156c 100644 --- a/spec/views/home/_seeds.html.haml_spec.rb +++ b/spec/views/home/_seeds.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 6bfc3e6fe..a9979190c 100644 --- a/spec/views/home/_stats.html.haml_spec.rb +++ b/spec/views/home/_stats.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 190ee7b9f..5e11882fd 100644 --- a/spec/views/home/index_spec.rb +++ b/spec/views/home/index_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/layouts/_header_spec.rb b/spec/views/layouts/_header_spec.rb index badecf8f7..5060fc30d 100644 --- a/spec/views/layouts/_header_spec.rb +++ b/spec/views/layouts/_header_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/layouts/_meta_spec.rb b/spec/views/layouts/_meta_spec.rb index 805f0298d..151c6fe19 100644 --- a/spec/views/layouts/_meta_spec.rb +++ b/spec/views/layouts/_meta_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/layouts/application_spec.rb b/spec/views/layouts/application_spec.rb index b773cce58..f094ae2c2 100644 --- a/spec/views/layouts/application_spec.rb +++ b/spec/views/layouts/application_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/notifications/index.html.haml_spec.rb b/spec/views/notifications/index.html.haml_spec.rb index ee52b7319..2c8195069 100644 --- a/spec/views/notifications/index.html.haml_spec.rb +++ b/spec/views/notifications/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "notifications/index" do diff --git a/spec/views/notifications/new.html.haml_spec.rb b/spec/views/notifications/new.html.haml_spec.rb index 2830966e1..a7f030f47 100644 --- a/spec/views/notifications/new.html.haml_spec.rb +++ b/spec/views/notifications/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "notifications/new" do diff --git a/spec/views/notifications/show.html.haml_spec.rb b/spec/views/notifications/show.html.haml_spec.rb index 7cf7838c9..14db0448c 100644 --- a/spec/views/notifications/show.html.haml_spec.rb +++ b/spec/views/notifications/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "notifications/show" do diff --git a/spec/views/notifier/notify.html.haml_spec.rb b/spec/views/notifier/notify.html.haml_spec.rb index 66e81b158..913ea10d2 100644 --- a/spec/views/notifier/notify.html.haml_spec.rb +++ b/spec/views/notifier/notify.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/orders/index.html.haml_spec.rb b/spec/views/orders/index.html.haml_spec.rb index 6053de32f..c95f204e2 100644 --- a/spec/views/orders/index.html.haml_spec.rb +++ b/spec/views/orders/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "orders/index" do diff --git a/spec/views/orders/show.html.haml_spec.rb b/spec/views/orders/show.html.haml_spec.rb index 32289bfc9..a9f662de9 100644 --- a/spec/views/orders/show.html.haml_spec.rb +++ b/spec/views/orders/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "orders/show" do diff --git a/spec/views/photos/edit.html.haml_spec.rb b/spec/views/photos/edit.html.haml_spec.rb index f1f2eacc5..a52b51a79 100644 --- a/spec/views/photos/edit.html.haml_spec.rb +++ b/spec/views/photos/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "photos/edit" do diff --git a/spec/views/photos/index.html.haml_spec.rb b/spec/views/photos/index.html.haml_spec.rb index 4e1674765..b603de1e6 100644 --- a/spec/views/photos/index.html.haml_spec.rb +++ b/spec/views/photos/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "photos/index" do diff --git a/spec/views/photos/new.html.haml_spec.rb b/spec/views/photos/new.html.haml_spec.rb index 2dcb51bfc..e4f24f9e4 100644 --- a/spec/views/photos/new.html.haml_spec.rb +++ b/spec/views/photos/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "photos/new" do diff --git a/spec/views/photos/show.html.haml_spec.rb b/spec/views/photos/show.html.haml_spec.rb index 5ca8c31e1..cecb0008b 100644 --- a/spec/views/photos/show.html.haml_spec.rb +++ b/spec/views/photos/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "photos/show" do diff --git a/spec/views/places/_map_attribution.html.haml_spec.rb b/spec/views/places/_map_attribution.html.haml_spec.rb index efc101bc1..7082290c8 100644 --- a/spec/views/places/_map_attribution.html.haml_spec.rb +++ b/spec/views/places/_map_attribution.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/places/index.html.haml_spec.rb b/spec/views/places/index.html.haml_spec.rb index 44299c286..f3a3661ae 100644 --- a/spec/views/places/index.html.haml_spec.rb +++ b/spec/views/places/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 c5e4cca10..635d06ab9 100644 --- a/spec/views/places/show.html.haml_spec.rb +++ b/spec/views/places/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "places/show" do diff --git a/spec/views/plant_parts/edit.html.haml_spec.rb b/spec/views/plant_parts/edit.html.haml_spec.rb index e871b49d3..683dd6ab0 100644 --- a/spec/views/plant_parts/edit.html.haml_spec.rb +++ b/spec/views/plant_parts/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 73dec883e..65ecf2d63 100644 --- a/spec/views/plant_parts/index.html.haml_spec.rb +++ b/spec/views/plant_parts/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/plant_parts/new.html.haml_spec.rb b/spec/views/plant_parts/new.html.haml_spec.rb index 31218ee71..b1b3f12ae 100644 --- a/spec/views/plant_parts/new.html.haml_spec.rb +++ b/spec/views/plant_parts/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 bffd0f394..b367a723b 100644 --- a/spec/views/plant_parts/show.html.haml_spec.rb +++ b/spec/views/plant_parts/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 926150f73..692b53173 100644 --- a/spec/views/plantings/_form.html.haml_spec.rb +++ b/spec/views/plantings/_form.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "plantings/_form" do diff --git a/spec/views/plantings/edit.html.haml_spec.rb b/spec/views/plantings/edit.html.haml_spec.rb index fc7ff7f30..b83af0028 100644 --- a/spec/views/plantings/edit.html.haml_spec.rb +++ b/spec/views/plantings/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "plantings/edit" do diff --git a/spec/views/plantings/index.html.haml_spec.rb b/spec/views/plantings/index.html.haml_spec.rb index 10de32f81..f682d62e9 100644 --- a/spec/views/plantings/index.html.haml_spec.rb +++ b/spec/views/plantings/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "plantings/index" do diff --git a/spec/views/plantings/index.rss.haml_spec.rb b/spec/views/plantings/index.rss.haml_spec.rb index 1d15ad5cc..c4a394561 100644 --- a/spec/views/plantings/index.rss.haml_spec.rb +++ b/spec/views/plantings/index.rss.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/plantings/new.html.haml_spec.rb b/spec/views/plantings/new.html.haml_spec.rb index db1da2826..6667a05ee 100644 --- a/spec/views/plantings/new.html.haml_spec.rb +++ b/spec/views/plantings/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "plantings/new" do diff --git a/spec/views/plantings/show.html.haml_spec.rb b/spec/views/plantings/show.html.haml_spec.rb index b68ceb6c1..c20f7e909 100644 --- a/spec/views/plantings/show.html.haml_spec.rb +++ b/spec/views/plantings/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "plantings/show" do diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index 833970b29..a153995c5 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "posts/_single" do diff --git a/spec/views/posts/edit.html.haml_spec.rb b/spec/views/posts/edit.html.haml_spec.rb index 8bee4298b..48d64a267 100644 --- a/spec/views/posts/edit.html.haml_spec.rb +++ b/spec/views/posts/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "posts/edit" do diff --git a/spec/views/posts/index.html.haml_spec.rb b/spec/views/posts/index.html.haml_spec.rb index 17aab3d47..eeebac8b6 100644 --- a/spec/views/posts/index.html.haml_spec.rb +++ b/spec/views/posts/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "posts/index" do diff --git a/spec/views/posts/index.rss.haml_spec.rb b/spec/views/posts/index.rss.haml_spec.rb index a47b80b48..3d4ec11f2 100644 --- a/spec/views/posts/index.rss.haml_spec.rb +++ b/spec/views/posts/index.rss.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/posts/new.html.haml_spec.rb b/spec/views/posts/new.html.haml_spec.rb index 0c788716e..fa344e55b 100644 --- a/spec/views/posts/new.html.haml_spec.rb +++ b/spec/views/posts/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "posts/new" do diff --git a/spec/views/posts/show.rss.haml_spec.rb b/spec/views/posts/show.rss.haml_spec.rb index 97625fa2c..c22c4196f 100644 --- a/spec/views/posts/show.rss.haml_spec.rb +++ b/spec/views/posts/show.rss.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/products/edit.html.haml_spec.rb b/spec/views/products/edit.html.haml_spec.rb index e0d8ebbda..3d60c9e95 100644 --- a/spec/views/products/edit.html.haml_spec.rb +++ b/spec/views/products/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 cbde70cf1..90e08e2a3 100644 --- a/spec/views/products/index.html.haml_spec.rb +++ b/spec/views/products/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 d75741775..336c6bac1 100644 --- a/spec/views/products/new.html.haml_spec.rb +++ b/spec/views/products/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 ee529cc71..315d9caae 100644 --- a/spec/views/products/show.html.haml_spec.rb +++ b/spec/views/products/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 9135b8639..a86f67ceb 100644 --- a/spec/views/roles/edit.html.haml_spec.rb +++ b/spec/views/roles/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 54fe35337..e4b28e9ba 100644 --- a/spec/views/roles/index.html.haml_spec.rb +++ b/spec/views/roles/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "roles/index" do diff --git a/spec/views/roles/new.html.haml_spec.rb b/spec/views/roles/new.html.haml_spec.rb index a56fce052..1cdce8c41 100644 --- a/spec/views/roles/new.html.haml_spec.rb +++ b/spec/views/roles/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 03df232ec..56f1cc4fb 100644 --- a/spec/views/roles/show.html.haml_spec.rb +++ b/spec/views/roles/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 abd9b4c62..ecaa2056f 100644 --- a/spec/views/scientific_names/edit.html.haml_spec.rb +++ b/spec/views/scientific_names/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/scientific_names/index.html.haml_spec.rb b/spec/views/scientific_names/index.html.haml_spec.rb index 248ca5be9..4d63ac9e1 100644 --- a/spec/views/scientific_names/index.html.haml_spec.rb +++ b/spec/views/scientific_names/index.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/scientific_names/new.html.haml_spec.rb b/spec/views/scientific_names/new.html.haml_spec.rb index f820007a7..0cf5a4205 100644 --- a/spec/views/scientific_names/new.html.haml_spec.rb +++ b/spec/views/scientific_names/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/scientific_names/show.html.haml_spec.rb b/spec/views/scientific_names/show.html.haml_spec.rb index a12082fa4..b728df2b3 100644 --- a/spec/views/scientific_names/show.html.haml_spec.rb +++ b/spec/views/scientific_names/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/seeds/edit.html.haml_spec.rb b/spec/views/seeds/edit.html.haml_spec.rb index 6822bf961..f450d7065 100644 --- a/spec/views/seeds/edit.html.haml_spec.rb +++ b/spec/views/seeds/edit.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 7e2b3df88..4df8e526c 100644 --- a/spec/views/seeds/index.rss.haml_spec.rb +++ b/spec/views/seeds/index.rss.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 diff --git a/spec/views/seeds/new.html.haml_spec.rb b/spec/views/seeds/new.html.haml_spec.rb index a05da5b23..5c5cf3ae4 100644 --- a/spec/views/seeds/new.html.haml_spec.rb +++ b/spec/views/seeds/new.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "seeds/new" do diff --git a/spec/views/seeds/show.html.haml_spec.rb b/spec/views/seeds/show.html.haml_spec.rb index 654d27b0f..975f2baa1 100644 --- a/spec/views/seeds/show.html.haml_spec.rb +++ b/spec/views/seeds/show.html.haml_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## If you submit a pull request containing new view or controller tests, it will not be -## merged. - require 'rails_helper' describe "seeds/show" do diff --git a/spec/views/shop/index_spec.rb b/spec/views/shop/index_spec.rb index e809782bc..3bd0061d7 100644 --- a/spec/views/shop/index_spec.rb +++ b/spec/views/shop/index_spec.rb @@ -1,15 +1,3 @@ -## DEPRECATION NOTICE: Do not add new tests to this file! -## -## View and controller tests are deprecated in the Growstuff project. -## We no longer write new view and controller tests, but instead write -## feature tests (in spec/features) using Capybara (https://github.com/jnicklas/capybara). -## These test the full stack, behaving as a browser, and require less complicated setup -## to run. Please feel free to delete old view/controller tests as they are reimplemented -## in feature tests. -## -## 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 From 949c7c31d823a3efe1a9cf0a10effd3da1f30528 Mon Sep 17 00:00:00 2001 From: deppbot Date: Sat, 18 Nov 2017 08:10:02 +0800 Subject: [PATCH 04/58] Bundle Update on 2017-11-18 --- Gemfile.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5e1f4564c..6cdced74a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -423,7 +423,7 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (2.1.0) raindrops (0.19.0) - rake (12.2.1) + rake (12.3.0) rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) @@ -630,6 +630,7 @@ DEPENDENCIES will_paginate xmlrpc + RUBY VERSION ruby 2.4.1p111 From fd9fc38def0b79abf9a197fad9af789ed8162bac Mon Sep 17 00:00:00 2001 From: Logan Gingerich Date: Mon, 6 Nov 2017 07:40:15 -0700 Subject: [PATCH 05/58] fixes #1433 Says what item you're adding a photo to on photos#new --- app/controllers/photos_controller.rb | 3 ++- app/views/photos/new.html.haml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 0dd3a275d..e0de2ff65 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -19,8 +19,9 @@ class PhotosController < ApplicationController def new @type = params[:type] @id = params[:id] - @photo = Photo.new + planting = Planting.find @id + @crop_name = Crop.find(planting.crop_id).name.capitalize retrieve_from_flickr respond_with @photo end diff --git a/app/views/photos/new.html.haml b/app/views/photos/new.html.haml index 4bb2013f2..6ff5df91a 100644 --- a/app/views/photos/new.html.haml +++ b/app/views/photos/new.html.haml @@ -1,5 +1,9 @@ - content_for :title, "New Photo" +%h3 + Choose photo for + = @crop_name + - if @flickr_auth %p Connected to Flickr as From 73524b8883744937944f70672dd81eeb49ab0f48 Mon Sep 17 00:00:00 2001 From: Logan Gingerich Date: Mon, 6 Nov 2017 13:10:12 -0700 Subject: [PATCH 06/58] Now displays correctly for planting, harvest or garden --- app/controllers/photos_controller.rb | 5 +++-- app/views/photos/new.html.haml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index e0de2ff65..b18811090 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -19,9 +19,10 @@ class PhotosController < ApplicationController def new @type = params[:type] @id = params[:id] + @photo = Photo.new - planting = Planting.find @id - @crop_name = Crop.find(planting.crop_id).name.capitalize + item_class = Growstuff::Constants::PhotoModels.get_item(params[:type]) + @item = item_class.find_by!(id: params[:id], owner_id: current_member.id) retrieve_from_flickr respond_with @photo end diff --git a/app/views/photos/new.html.haml b/app/views/photos/new.html.haml index 6ff5df91a..31023b694 100644 --- a/app/views/photos/new.html.haml +++ b/app/views/photos/new.html.haml @@ -2,7 +2,7 @@ %h3 Choose photo for - = @crop_name + = @item - if @flickr_auth %p From 6304f230a5c46b880fb695ff77c075d9c969e666 Mon Sep 17 00:00:00 2001 From: Logan Gingerich Date: Thu, 9 Nov 2017 10:27:57 -0700 Subject: [PATCH 07/58] Refactored and specs updated --- app/controllers/photos_controller.rb | 15 +++++++++------ spec/controllers/photos_controller_spec.rb | 20 ++++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index b18811090..0e1a11410 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -21,8 +21,7 @@ class PhotosController < ApplicationController @id = params[:id] @photo = Photo.new - item_class = Growstuff::Constants::PhotoModels.get_item(params[:type]) - @item = item_class.find_by!(id: params[:id], owner_id: current_member.id) + find_item_name retrieve_from_flickr respond_with @photo end @@ -76,15 +75,19 @@ class PhotosController < ApplicationController raise "No item id provided" unless item_id? collection = Growstuff::Constants::PhotoModels.get_relation(@photo, params[:type]) - item_class = Growstuff::Constants::PhotoModels.get_item(params[:type]) - item = item_class.find_by!(id: params[:id], owner_id: current_member.id) - raise "Could not find this item owned by you" unless item + find_item_name + raise "Could not find this item owned by you" unless @item - collection << item unless collection.include?(item) + collection << @item unless collection.include?(@item) rescue => e flash[:alert] = e.message end + def find_item_name + item_class = Growstuff::Constants::PhotoModels.get_item(params[:type]) + @item = item_class.find_by!(id: params[:id], owner_id: current_member.id) + end + def retrieve_from_flickr @flickr_auth = current_member.auth('flickr') @current_set = params[:set] diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index 8f4fab28e..bc9d1dbad 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -29,37 +29,41 @@ describe PhotosController do @member.stub(:flickr_photos) { [[], 0] } @member.stub(:flickr_sets) { { "foo" => "bar" } } controller.stub(:current_member) { @member } + @tomato = FactoryBot.create(:tomato) + @planting1 = FactoryBot.create(:planting, crop: @tomato, owner: @member) + @garden1 = FactoryBot.create(:garden, owner: @member) + @harvest1 = FactoryBot.create(:harvest, owner: @member) end it "assigns the flickr auth as @flickr_auth" do @auth = FactoryBot.create(:flickr_authentication, member: @member) - get :new, {} + get :new, type: "planting", id: @planting1.id assigns(:flickr_auth).should be_an_instance_of(Authentication) end it "assigns a planting id" do - get :new, type: "planting", id: 5 - assigns(:id).should eq "5" + get :new, type: "planting", id: @planting1.id + assigns(:id).should eq @planting1.id.to_s assigns(:type).should eq "planting" expect(flash[:alert]).not_to be_present end it "assigns a harvest id" do - get :new, type: "harvest", id: 5 - assigns(:id).should eq "5" + get :new, type: "harvest", id: @harvest1.id + assigns(:id).should eq @harvest1.id.to_s assigns(:type).should eq "harvest" expect(flash[:alert]).not_to be_present end it "assigns a garden id" do - get :new, type: "garden", id: 5 - assigns(:id).should eq "5" + get :new, type: "garden", id: @garden1.id + assigns(:id).should eq @garden1.id.to_s assigns(:type).should eq "garden" expect(flash[:alert]).not_to be_present end it "assigns the current set as @current_set" do - get :new, set: 'foo' + get :new, type: "planting", id: @planting1.id, set: 'foo' assigns(:current_set).should eq "foo" expect(flash[:alert]).not_to be_present end From 3969f410f15bef569cf0603833ad7d1a62d4f5c5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 18 Nov 2017 15:44:45 +1300 Subject: [PATCH 08/58] Tidy up photos logic, and test of signin/out on photos#new --- app/controllers/photos_controller.rb | 45 +++++++------ spec/controllers/photos_controller_spec.rb | 76 ++++++++++------------ spec/features/signout_spec.rb | 20 ++++-- 3 files changed, 74 insertions(+), 67 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 0e1a11410..4dfc3c602 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -17,11 +17,12 @@ class PhotosController < ApplicationController end def new - @type = params[:type] @id = params[:id] + @type = params[:type] + redirect_to photos_path if @type.nil? @photo = Photo.new - find_item_name + @item = item_to_link_to retrieve_from_flickr respond_with @photo end @@ -31,9 +32,14 @@ class PhotosController < ApplicationController end def create - find_or_create_photo_from_flickr_photo - add_photo_to_collection - @photo.save if @photo.present? + @photo = find_or_create_photo_from_flickr_photo + @item = item_to_link_to + raise "Could not find this item owned by you" unless @item + collection << @item unless collection.include?(@item) + @photo.save! if @photo.present? + rescue => e + flash[:alert] = e.message + ensure respond_with @photo end @@ -50,6 +56,10 @@ class PhotosController < ApplicationController private def item_id? + item_id.present? + end + + def item_id params.key? :id end @@ -63,29 +73,22 @@ class PhotosController < ApplicationController end def find_or_create_photo_from_flickr_photo - @photo = Photo.find_by(flickr_photo_id: flickr_photo_id_param) - @photo = Photo.new(photo_params) unless @photo - @photo.owner_id = current_member.id - @photo.set_flickr_metadata - @photo + photo = Photo.find_by(flickr_photo_id: flickr_photo_id_param) + photo = Photo.new(photo_params) unless photo + photo.owner_id = current_member.id + photo.set_flickr_metadata + photo end - def add_photo_to_collection + def collection raise "Missing or invalid type provided" unless Growstuff::Constants::PhotoModels.types.include?(params[:type]) raise "No item id provided" unless item_id? - collection = Growstuff::Constants::PhotoModels.get_relation(@photo, params[:type]) - - find_item_name - raise "Could not find this item owned by you" unless @item - - collection << @item unless collection.include?(@item) - rescue => e - flash[:alert] = e.message + Growstuff::Constants::PhotoModels.get_relation(@photo, params[:type]) end - def find_item_name + def item_to_link_to item_class = Growstuff::Constants::PhotoModels.get_item(params[:type]) - @item = item_class.find_by!(id: params[:id], owner_id: current_member.id) + item_class.find_by!(id: params[:id], owner_id: current_member.id) end def retrieve_from_flickr diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index bc9d1dbad..8788ee09f 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -23,49 +23,41 @@ describe PhotosController do end describe "GET new" do + let(:tomato) { FactoryBot.create(:tomato) } + let(:planting) { FactoryBot.create(:planting, crop: tomato, owner: member) } + let(:garden) { FactoryBot.create(:garden, owner: member) } + let(:harvest) { FactoryBot.create(:harvest, owner: member) } + let(:member) { FactoryBot.create(:member) } + let!(:auth) { FactoryBot.create(:flickr_authentication, member: member) } + before(:each) do - @member = FactoryBot.create(:member) - sign_in @member - @member.stub(:flickr_photos) { [[], 0] } - @member.stub(:flickr_sets) { { "foo" => "bar" } } - controller.stub(:current_member) { @member } - @tomato = FactoryBot.create(:tomato) - @planting1 = FactoryBot.create(:planting, crop: @tomato, owner: @member) - @garden1 = FactoryBot.create(:garden, owner: @member) - @harvest1 = FactoryBot.create(:harvest, owner: @member) + sign_in member + member.stub(:flickr_photos) { [[], 0] } + member.stub(:flickr_sets) { { "foo" => "bar" } } + controller.stub(:current_member) { member } end - it "assigns the flickr auth as @flickr_auth" do - @auth = FactoryBot.create(:flickr_authentication, member: @member) - get :new, type: "planting", id: @planting1.id - assigns(:flickr_auth).should be_an_instance_of(Authentication) + describe "planting photos" do + before(:each) { get :new, type: "planting", id: planting.id } + it { assigns(:flickr_auth).should be_an_instance_of(Authentication) } + it { assigns(:id).should eq planting.id.to_s } + it { assigns(:type).should eq "planting" } + it { expect(flash[:alert]).not_to be_present } + it { expect(flash[:alert]).not_to be_present } end - it "assigns a planting id" do - get :new, type: "planting", id: @planting1.id - assigns(:id).should eq @planting1.id.to_s - assigns(:type).should eq "planting" - expect(flash[:alert]).not_to be_present + describe "harvest photos" do + before { get :new, type: "harvest", id: harvest.id } + it { assigns(:id).should eq harvest.id.to_s } + it { assigns(:type).should eq "harvest" } + it { expect(flash[:alert]).not_to be_present } end - it "assigns a harvest id" do - get :new, type: "harvest", id: @harvest1.id - assigns(:id).should eq @harvest1.id.to_s - assigns(:type).should eq "harvest" - expect(flash[:alert]).not_to be_present - end - - it "assigns a garden id" do - get :new, type: "garden", id: @garden1.id - assigns(:id).should eq @garden1.id.to_s - assigns(:type).should eq "garden" - expect(flash[:alert]).not_to be_present - end - - it "assigns the current set as @current_set" do - get :new, type: "planting", id: @planting1.id, set: 'foo' - assigns(:current_set).should eq "foo" - expect(flash[:alert]).not_to be_present + describe "garden photos" do + before { get :new, type: "garden", id: garden.id } + it { assigns(:id).should eq garden.id.to_s } + it { assigns(:type).should eq "garden" } + it { expect(flash[:alert]).not_to be_present } end end @@ -92,11 +84,13 @@ describe PhotosController do Photo.last.plantings.first.should eq planting end - it "doesn't attach a photo to a planting twice" do - post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "planting", id: planting.id - post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "planting", id: planting.id - expect(flash[:alert]).not_to be_present - Photo.last.plantings.size.should eq 1 + describe "doesn't attach a photo to a planting twice" do + before do + post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "planting", id: planting.id + post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "planting", id: planting.id + end + it { expect(flash[:alert]).not_to be_present } + it { expect(Photo.last.plantings.size).to eq 1 } end it "attaches the photo to a harvest" do diff --git a/spec/features/signout_spec.rb b/spec/features/signout_spec.rb index 433286078..575f11678 100644 --- a/spec/features/signout_spec.rb +++ b/spec/features/signout_spec.rb @@ -13,17 +13,27 @@ feature "signout" do expect(current_path).to eq crops_path end - scenario "after signout, redirect to signin page if page needs authentication" do - models = %w[plantings harvests posts photos gardens seeds] - models.each do |model| - visit "/#{model}/new" + shared_examples "sign-in redirects" do |path| + scenario "after signout, redirect to signin page if page needs authentication" do + visit path expect(current_path).to eq new_member_session_path fill_in 'Login', with: member.login_name fill_in 'Password', with: member.password click_button 'Sign in' - expect(current_path).to eq "/#{model}/new" + expect(current_path).to eq path click_link 'Sign out' expect(current_path).to eq new_member_session_path end end + + let(:path) {} + describe 'most models' do + let(:garden) { FactoryBot.create :garden, owner: member } + include_examples "sign-in redirects", "/plantings/new" + include_examples "sign-in redirects", "/harvests/new" + include_examples "sign-in redirects", "/posts/new" + include_examples "sign-in redirects", "/gardens/new" + include_examples "sign-in redirects", "/seeds/new" + include_examples "sign-in redirects", "/photos/new?type=garden&id=1" + end end From c8974a869fe4629af94fdb04c4163365e01b48b8 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 18 Nov 2017 16:50:56 +1300 Subject: [PATCH 09/58] Use the ||= operator --- app/controllers/photos_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 4dfc3c602..3703557d2 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -74,7 +74,7 @@ class PhotosController < ApplicationController def find_or_create_photo_from_flickr_photo photo = Photo.find_by(flickr_photo_id: flickr_photo_id_param) - photo = Photo.new(photo_params) unless photo + photo ||= Photo.new(photo_params) photo.owner_id = current_member.id photo.set_flickr_metadata photo From faed8b019e96ae06fa7c7223cdfdd6560f9da84f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 18 Nov 2017 16:51:25 +1300 Subject: [PATCH 10/58] Removed rescue in a controller --- app/controllers/photos_controller.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 3703557d2..5c8dedfd1 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -37,9 +37,6 @@ class PhotosController < ApplicationController raise "Could not find this item owned by you" unless @item collection << @item unless collection.include?(@item) @photo.save! if @photo.present? - rescue => e - flash[:alert] = e.message - ensure respond_with @photo end From 7906d50d131be011a25021d79746bd5710a1a333 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 18 Nov 2017 17:14:29 +1300 Subject: [PATCH 11/58] Shaved some yaks to remove a rescue from a controller --- app/controllers/photos_controller.rb | 57 +++++++++++++--------- spec/controllers/photos_controller_spec.rb | 29 +++++------ 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 5c8dedfd1..2c707f726 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -17,10 +17,6 @@ class PhotosController < ApplicationController end def new - @id = params[:id] - @type = params[:type] - redirect_to photos_path if @type.nil? - @photo = Photo.new @item = item_to_link_to retrieve_from_flickr @@ -32,11 +28,13 @@ class PhotosController < ApplicationController end def create - @photo = find_or_create_photo_from_flickr_photo - @item = item_to_link_to - raise "Could not find this item owned by you" unless @item - collection << @item unless collection.include?(@item) - @photo.save! if @photo.present? + ActiveRecord::Base.transaction do + @photo = find_or_create_photo_from_flickr_photo + @item = item_to_link_to + raise "Could not find this #{type} owned by you" unless @item + collection << @item unless collection.include?(@item) + @photo.save! if @photo.present? + end respond_with @photo end @@ -52,12 +50,14 @@ class PhotosController < ApplicationController private - def item_id? - item_id.present? + # + # Params + def item_id + params[:id] end - def item_id - params.key? :id + def item_type + params[:type] end def flickr_photo_id_param @@ -69,6 +69,26 @@ class PhotosController < ApplicationController :license_url, :thumbnail_url, :fullsize_url, :link_url) end + # Item with photos attached + # + def item_to_link_to + raise "No item id provided" if item_id.nil? + raise "No item type provided" if item_type.nil? + raise "Missing or invalid type provided" unless photos_supported_on_type?(item_type) + item_class = Growstuff::Constants::PhotoModels.get_item(item_type) + item_class.find_by!(id: params[:id], owner_id: current_member.id) + end + + def collection + Growstuff::Constants::PhotoModels.get_relation(@photo, item_type) + end + + def photos_supported_on_type?(_type) + Growstuff::Constants::PhotoModels.types.include?(item_type) + end + + # + # Flickr retrieval def find_or_create_photo_from_flickr_photo photo = Photo.find_by(flickr_photo_id: flickr_photo_id_param) photo ||= Photo.new(photo_params) @@ -77,17 +97,6 @@ class PhotosController < ApplicationController photo end - def collection - raise "Missing or invalid type provided" unless Growstuff::Constants::PhotoModels.types.include?(params[:type]) - raise "No item id provided" unless item_id? - Growstuff::Constants::PhotoModels.get_relation(@photo, params[:type]) - end - - def item_to_link_to - item_class = Growstuff::Constants::PhotoModels.get_item(params[:type]) - item_class.find_by!(id: params[:id], owner_id: current_member.id) - end - def retrieve_from_flickr @flickr_auth = current_member.auth('flickr') @current_set = params[:set] diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index 8788ee09f..3c4f9dacb 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -40,23 +40,20 @@ describe PhotosController do describe "planting photos" do before(:each) { get :new, type: "planting", id: planting.id } it { assigns(:flickr_auth).should be_an_instance_of(Authentication) } - it { assigns(:id).should eq planting.id.to_s } - it { assigns(:type).should eq "planting" } + it { assigns(:item).should eq planting } it { expect(flash[:alert]).not_to be_present } it { expect(flash[:alert]).not_to be_present } end describe "harvest photos" do before { get :new, type: "harvest", id: harvest.id } - it { assigns(:id).should eq harvest.id.to_s } - it { assigns(:type).should eq "harvest" } + it { assigns(:item).should eq harvest } it { expect(flash[:alert]).not_to be_present } end describe "garden photos" do before { get :new, type: "garden", id: garden.id } - it { assigns(:id).should eq garden.id.to_s } - it { assigns(:type).should eq "garden" } + it { assigns(:item).should eq garden } it { expect(flash[:alert]).not_to be_present } end end @@ -108,18 +105,20 @@ describe PhotosController do it "doesn't attach photo to a comment" do comment = FactoryBot.create(:comment) - post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "comment", id: comment.id - expect(flash[:alert]).to be_present + expect do + post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "comment", id: comment.id + end.to raise_error end end describe "for the second time" do + let(:planting) { FactoryBot.create :planting, owner: member } it "does not add a photo twice" do expect do - post :create, photo: { flickr_photo_id: 1 } + post :create, photo: { flickr_photo_id: 1 }, id: planting.id, type: 'planting' end.to change(Photo, :count).by(1) expect do - post :create, photo: { flickr_photo_id: 1 } + post :create, photo: { flickr_photo_id: 1 }, id: planting.id, type: 'planting' end.to change(Photo, :count).by(0) end end @@ -146,16 +145,18 @@ describe PhotosController do it "does not create the planting/photo link" do # members will be auto-created, and different another_planting = FactoryBot.create(:planting) - post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "planting", id: another_planting.id - expect(flash[:alert]).to be_present + expect do + post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "planting", id: another_planting.id + end.to raise_error(ActiveRecord::RecordNotFound) Photo.last.plantings.first.should_not eq another_planting end it "does not create the harvest/photo link" do # members will be auto-created, and different another_harvest = FactoryBot.create(:harvest) - post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "harvest", id: another_harvest.id - expect(flash[:alert]).to be_present + expect do + post :create, photo: { flickr_photo_id: photo.flickr_photo_id }, type: "harvest", id: another_harvest.id + end.to raise_error(ActiveRecord::RecordNotFound) Photo.last.harvests.first.should_not eq another_harvest end end From c20d9b78c5f143904d3d29642b12496f5e58ec6a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 18 Nov 2017 21:52:29 +1300 Subject: [PATCH 12/58] Reduced the tests of signout on photos/new --- spec/features/signout_spec.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/spec/features/signout_spec.rb b/spec/features/signout_spec.rb index 575f11678..107795cc1 100644 --- a/spec/features/signout_spec.rb +++ b/spec/features/signout_spec.rb @@ -17,23 +17,34 @@ feature "signout" do scenario "after signout, redirect to signin page if page needs authentication" do visit path expect(current_path).to eq new_member_session_path + expect(page).to have_http_status(200) fill_in 'Login', with: member.login_name fill_in 'Password', with: member.password click_button 'Sign in' - expect(current_path).to eq path + expect(page).to have_http_status(200) + # path has params removed after signin + expect(current_path).to eq path.split('?')[0] click_link 'Sign out' + expect(page).to have_http_status(200) expect(current_path).to eq new_member_session_path end end let(:path) {} - describe 'most models' do - let(:garden) { FactoryBot.create :garden, owner: member } + describe 'after signout, redirect to signin page if page needs authentication' do include_examples "sign-in redirects", "/plantings/new" include_examples "sign-in redirects", "/harvests/new" include_examples "sign-in redirects", "/posts/new" include_examples "sign-in redirects", "/gardens/new" include_examples "sign-in redirects", "/seeds/new" - include_examples "sign-in redirects", "/photos/new?type=garden&id=1" + end + + scenario 'photos' do + garden = FactoryBot.create :garden, owner: member + visit "/photos/new?id=#{garden.id}&type=garden" + expect(current_path).to eq new_member_session_path + expect(page).to have_http_status(200) + # photos/new needs id&type params, + # but these are stripped after signing in end end From 3e149a5d1d182caff8216375631148e5aa7087c4 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 18 Nov 2017 22:12:03 +1300 Subject: [PATCH 13/58] Feature spec for showing item details on photo adding page --- app/views/gardens/show.html.haml | 4 +- spec/features/photos/new_photo_spec.rb | 51 ++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 spec/features/photos/new_photo_spec.rb diff --git a/app/views/gardens/show.html.haml b/app/views/gardens/show.html.haml index 70f062468..ef5b41cfb 100644 --- a/app/views/gardens/show.html.haml +++ b/app/views/gardens/show.html.haml @@ -91,8 +91,8 @@ %p = link_to new_photo_path(type: "garden", id: @garden.id), class: 'btn btn-primary' do - %span.glyphicon.glyphicon-camera{ title: "Add Photo" } - Add Photo + %span.glyphicon.glyphicon-camera{ title: "Add photo" } + Add photo - if @garden.photos.size.positive? %h3= localize_plural(@garden.photos, Photo) .row diff --git a/spec/features/photos/new_photo_spec.rb b/spec/features/photos/new_photo_spec.rb new file mode 100644 index 000000000..0f0c8af2c --- /dev/null +++ b/spec/features/photos/new_photo_spec.rb @@ -0,0 +1,51 @@ +require 'rails_helper' + +feature "new photo page" do + let(:photo) { FactoryBot.create :photo } + + context "signed in member" do + let(:member) { FactoryBot.create :member } + + background { login_as member } + + context "viewing a planting" do + let(:planting) { FactoryBot.create :planting, owner: member } + + scenario "add photo" do + visit planting_path(planting) + click_link "Add photo" + expect(page).to have_text planting.crop.name + end + end + + context "viewing a harvest" do + let(:harvest) { FactoryBot.create :harvest, owner: member } + + scenario "add photo" do + visit harvest_path(harvest) + click_link "Add photo" + expect(page).to have_text harvest.crop.name + end + end + + context "viewing a garden" do + let(:garden) { FactoryBot.create :garden, owner: member } + + scenario "add photo" do + visit garden_path(garden) + click_link "Add photo" + expect(page).to have_text garden.name + end + end + + pending "viewing a seed" do + let(:seed) { FactoryBot.create :seed, owner: member } + + scenario "add photo" do + visit seed_path(seed) + click_link "Add photo" + expect(page).to have_text seed.to_s + end + end + end +end From dafaffcd7391cf96908d4ba8dce318b7d3d9fc48 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 18 Nov 2017 22:14:43 +1300 Subject: [PATCH 14/58] Path remains same after sign out for our test cases --- spec/features/signout_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/features/signout_spec.rb b/spec/features/signout_spec.rb index 107795cc1..a6402df2c 100644 --- a/spec/features/signout_spec.rb +++ b/spec/features/signout_spec.rb @@ -22,8 +22,7 @@ feature "signout" do fill_in 'Password', with: member.password click_button 'Sign in' expect(page).to have_http_status(200) - # path has params removed after signin - expect(current_path).to eq path.split('?')[0] + expect(current_path).to eq path click_link 'Sign out' expect(page).to have_http_status(200) expect(current_path).to eq new_member_session_path From 7574eb554ef1cbc1146a51d23d09ef49d7537cf0 Mon Sep 17 00:00:00 2001 From: Logan Gingerich Date: Wed, 15 Nov 2017 09:24:14 -0700 Subject: [PATCH 15/58] Adds a more prominent add photo button to garden and planting show views --- app/views/gardens/show.html.haml | 6 ++++++ app/views/plantings/show.html.haml | 3 +++ 2 files changed, 9 insertions(+) diff --git a/app/views/gardens/show.html.haml b/app/views/gardens/show.html.haml index ef5b41cfb..cdfedeb13 100644 --- a/app/views/gardens/show.html.haml +++ b/app/views/gardens/show.html.haml @@ -12,6 +12,12 @@ .row .col-md-9 %p.btn-group= render 'gardens/actions', garden: @garden + - if can?(:edit, @garden) && can?(:create, Photo) + %p + = link_to new_photo_path(type: "garden", id: @garden.id), + class: 'btn btn-primary' do + %span.glyphicon.glyphicon-camera{ title: "Add Photo" } + Add Photo - unless @garden.active .alert.alert-warning diff --git a/app/views/plantings/show.html.haml b/app/views/plantings/show.html.haml index 099571218..b0208f34a 100644 --- a/app/views/plantings/show.html.haml +++ b/app/views/plantings/show.html.haml @@ -67,6 +67,9 @@ %p= render 'plantings/progress', planting: @planting, show_explanation: true = render 'plantings/actions', planting: @planting + - if !@planting.photos.empty? || (can?(:edit, @planting) && can?(:create, Photo)) + - if can?(:create, Photo) && can?(:edit, @planting) + = link_to "Add photo", new_photo_path(type: "planting", id: @planting.id), class: 'btn btn-primary btn-xs' .col-md-6 = render partial: "crops/index_card", locals: { crop: @planting.crop } From 1fa71c1546ba9416b79a9bdfb61e6e318fd39d7f Mon Sep 17 00:00:00 2001 From: Logan Gingerich Date: Thu, 16 Nov 2017 09:36:22 -0700 Subject: [PATCH 16/58] Moved add photo button from garden show view to garden actions --- app/views/gardens/_actions.html.haml | 5 +++++ app/views/gardens/show.html.haml | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/views/gardens/_actions.html.haml b/app/views/gardens/_actions.html.haml index 4d262f97c..5aec0ba35 100644 --- a/app/views/gardens/_actions.html.haml +++ b/app/views/gardens/_actions.html.haml @@ -21,3 +21,8 @@ class: 'btn btn-default', id: 'delete_garden_link' do %span.glyphicon.glyphicon-trash{ title: "Delete" } Delete + - if can?(:edit, @garden) && can?(:create, Photo) + = link_to new_photo_path(type: "garden", id: @garden.id), + class: 'btn btn-primary' do + %span.glyphicon.glyphicon-camera{ title: "Add Photo" } + Add Photo diff --git a/app/views/gardens/show.html.haml b/app/views/gardens/show.html.haml index cdfedeb13..ef5b41cfb 100644 --- a/app/views/gardens/show.html.haml +++ b/app/views/gardens/show.html.haml @@ -12,12 +12,6 @@ .row .col-md-9 %p.btn-group= render 'gardens/actions', garden: @garden - - if can?(:edit, @garden) && can?(:create, Photo) - %p - = link_to new_photo_path(type: "garden", id: @garden.id), - class: 'btn btn-primary' do - %span.glyphicon.glyphicon-camera{ title: "Add Photo" } - Add Photo - unless @garden.active .alert.alert-warning From 610a5b7a48c30dd540f1237ab67ed337e30dc75d Mon Sep 17 00:00:00 2001 From: Logan Gingerich Date: Sat, 18 Nov 2017 09:30:43 -0700 Subject: [PATCH 17/58] deleted line 70 on plantings view to clean up logic --- app/views/plantings/show.html.haml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/plantings/show.html.haml b/app/views/plantings/show.html.haml index b0208f34a..ebddd779e 100644 --- a/app/views/plantings/show.html.haml +++ b/app/views/plantings/show.html.haml @@ -67,9 +67,8 @@ %p= render 'plantings/progress', planting: @planting, show_explanation: true = render 'plantings/actions', planting: @planting - - if !@planting.photos.empty? || (can?(:edit, @planting) && can?(:create, Photo)) - - if can?(:create, Photo) && can?(:edit, @planting) - = link_to "Add photo", new_photo_path(type: "planting", id: @planting.id), class: 'btn btn-primary btn-xs' + - if can?(:create, Photo) && can?(:edit, @planting) + = link_to "Add photo", new_photo_path(type: "planting", id: @planting.id), class: 'btn btn-primary btn-xs' .col-md-6 = render partial: "crops/index_card", locals: { crop: @planting.crop } From ede51873691176893cc03a63e0f2437115606e21 Mon Sep 17 00:00:00 2001 From: Logan Gingerich Date: Sat, 18 Nov 2017 09:57:23 -0700 Subject: [PATCH 18/58] Whitespace fix, spec fix, and spec addition --- app/views/gardens/_actions.html.haml | 2 +- spec/features/photos/new_photo_spec.rb | 2 +- spec/views/gardens/show.html.haml_spec.rb | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/gardens/_actions.html.haml b/app/views/gardens/_actions.html.haml index 5aec0ba35..a6f85a2e4 100644 --- a/app/views/gardens/_actions.html.haml +++ b/app/views/gardens/_actions.html.haml @@ -23,6 +23,6 @@ Delete - if can?(:edit, @garden) && can?(:create, Photo) = link_to new_photo_path(type: "garden", id: @garden.id), - class: 'btn btn-primary' do + class: 'btn btn-primary' do %span.glyphicon.glyphicon-camera{ title: "Add Photo" } Add Photo diff --git a/spec/features/photos/new_photo_spec.rb b/spec/features/photos/new_photo_spec.rb index 0f0c8af2c..1c13b2793 100644 --- a/spec/features/photos/new_photo_spec.rb +++ b/spec/features/photos/new_photo_spec.rb @@ -13,7 +13,7 @@ feature "new photo page" do scenario "add photo" do visit planting_path(planting) - click_link "Add photo" + click_link('Add photo', match: :first) expect(page).to have_text planting.crop.name end end diff --git a/spec/views/gardens/show.html.haml_spec.rb b/spec/views/gardens/show.html.haml_spec.rb index 015333ae0..7130e2e4f 100644 --- a/spec/views/gardens/show.html.haml_spec.rb +++ b/spec/views/gardens/show.html.haml_spec.rb @@ -50,6 +50,10 @@ describe "gardens/show" do rendered.should have_content "Plant something" end + it "shows an 'add photo' button" do + rendered.should have_content "Add photo" + end + it "links to the right crop in the planting link" do assert_select("a[href='#{new_planting_path}?garden_id=#{@garden.id}']") end From bd063be3a9bd891f98c43aa0058fff4d193888e1 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 19 Nov 2017 16:31:17 +1300 Subject: [PATCH 19/58] Fix gardens actions, and add specs A bug slipped into all garden display pages - and there were no tests that caught it. This adds feature specs for gardens#index, which would have detected the un-initialised variable in haml --- app/views/gardens/_actions.html.haml | 4 +- spec/features/gardens/gardens_index_spec.rb | 70 +++++++++++++++++++++ 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 spec/features/gardens/gardens_index_spec.rb diff --git a/app/views/gardens/_actions.html.haml b/app/views/gardens/_actions.html.haml index a6f85a2e4..ecf434911 100644 --- a/app/views/gardens/_actions.html.haml +++ b/app/views/gardens/_actions.html.haml @@ -21,8 +21,8 @@ class: 'btn btn-default', id: 'delete_garden_link' do %span.glyphicon.glyphicon-trash{ title: "Delete" } Delete - - if can?(:edit, @garden) && can?(:create, Photo) - = link_to new_photo_path(type: "garden", id: @garden.id), + - if can?(:edit, garden) && can?(:create, Photo) + = link_to new_photo_path(type: "garden", id: garden.id), class: 'btn btn-primary' do %span.glyphicon.glyphicon-camera{ title: "Add Photo" } Add Photo diff --git a/spec/features/gardens/gardens_index_spec.rb b/spec/features/gardens/gardens_index_spec.rb new file mode 100644 index 000000000..39161d5c8 --- /dev/null +++ b/spec/features/gardens/gardens_index_spec.rb @@ -0,0 +1,70 @@ +require 'rails_helper' +require 'custom_matchers' + +feature "Gardens#index", :js do + context "Logged in as member" do + let(:member) { FactoryBot.create :member } + + background { login_as member } + + context "with 10 gardens" do + before do + FactoryBot.create_list :garden, 10, owner: member + visit gardens_path(member: member) + end + + it "displays each of the gardens" do + member.gardens.each do |garden| + expect(page).to have_text garden.name + end + end + it "links to each garden" do + member.gardens.each do |garden| + expect(page).to have_link(garden.name, href: garden_path(garden)) + end + end + end + + context "with inactive gardens" do + let!(:active_garden) { FactoryBot.create :garden, name: "My active garden", owner: member } + let!(:inactive_garden) { FactoryBot.create :inactive_garden, name: "retired garden", owner: member } + + before { visit gardens_path(member: member) } + + it "show active garden" do + expect(page).to have_text active_garden.name + end + it "should not show inactive garden" do + expect(page).not_to have_text inactive_garden.name + end + it "links to active garden" do + expect(page).to have_link(active_garden.name, href: garden_path(active_garden)) + end + it "does not link to inactive gardens" do + expect(page).not_to have_link(inactive_garden.name, href: garden_path(inactive_garden)) + end + end + + context 'with plantings' do + let(:maize) { FactoryBot.create(:maize) } + let(:tomato) { FactoryBot.create(:tomato) } + + let!(:planting) do + FactoryBot.create :planting, owner: member, crop: maize, garden: member.gardens.first + end + let!(:finished_planting) do + FactoryBot.create :finished_planting, owner: member, crop: tomato, garden: member.gardens.first + end + + before do + visit gardens_path(member: member) + end + it "shows planting in garden" do + expect(page).to have_link(planting.crop.name, href: planting_path(planting)) + end + it "does not show finished planting" do + expect(page).not_to have_text(finished_planting.crop.name) + end + end + end +end From d3df1e8f33ab03d53222ec8097ed3ab4ade98f46 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 19 Nov 2017 16:53:10 +1300 Subject: [PATCH 20/58] Move planting's add photo button to _actions.haml --- app/views/plantings/_actions.html.haml | 25 ++++++++++++++++++------- app/views/plantings/show.html.haml | 2 -- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/views/plantings/_actions.html.haml b/app/views/plantings/_actions.html.haml index 74ebbd504..d72f6243b 100644 --- a/app/views/plantings/_actions.html.haml +++ b/app/views/plantings/_actions.html.haml @@ -1,16 +1,27 @@ - if can?(:edit, planting) || can?(:destroy, planting) - if can? :edit, planting = link_to edit_planting_path(planting), class: 'btn btn-default btn-xs' do - %span.glyphicon.glyphicon-pencil{ title: "Edit garden" } + %span.glyphicon.glyphicon-pencil{ title: "Edit" } Edit - if can? :destroy, planting = link_to planting, method: :delete, - data: { confirm: 'Are you sure?' }, - class: 'btn btn-default btn-xs' do + data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs' do %span.glyphicon.glyphicon-trash{ title: "Delete" } Delete + - unless planting.finished - = link_to "Mark as finished", planting_path(planting, planting: { finished: 1 }), - method: :put, class: 'btn btn-default btn-xs append-date' - - if can? :create, Harvest - = link_to 'Harvest', new_planting_harvest_path(planting), class: 'btn btn-default btn-xs' + = link_to planting_path(planting, planting: { finished: 1 }), + method: :put, class: 'btn btn-default btn-xs append-date' do + + %span.glyphicon.glyphicon-ok{ title: "Finished" } + Mark as finished + + - if can?(:create, Harvest) + = link_to new_planting_harvest_path(planting), class: 'btn btn-default btn-xs' do + %span.glyphicon.glyphicon-leaf{ title: "Harvest" } + Harvest + + - if can?(:edit, planting) && can?(:create, Photo) + = link_to new_photo_path(id: planting.id, type: 'planting'), class: 'btn btn-default btn-xs' do + %span.glyphicon.glyphicon-camera{ title: "Add photo" } + Add photo diff --git a/app/views/plantings/show.html.haml b/app/views/plantings/show.html.haml index ebddd779e..099571218 100644 --- a/app/views/plantings/show.html.haml +++ b/app/views/plantings/show.html.haml @@ -67,8 +67,6 @@ %p= render 'plantings/progress', planting: @planting, show_explanation: true = render 'plantings/actions', planting: @planting - - if can?(:create, Photo) && can?(:edit, @planting) - = link_to "Add photo", new_photo_path(type: "planting", id: @planting.id), class: 'btn btn-primary btn-xs' .col-md-6 = render partial: "crops/index_card", locals: { crop: @planting.crop } From a91b8605c4fca550a8fc6dfb3c80bd60c108af13 Mon Sep 17 00:00:00 2001 From: deppbot Date: Tue, 21 Nov 2017 12:11:33 +0800 Subject: [PATCH 21/58] Bundle Update on 2017-11-21 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6cdced74a..ed43b2add 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,7 +85,7 @@ GEM uniform_notifier (~> 1.10.0) byebug (9.1.0) cancancan (2.1.1) - capybara (2.16.0) + capybara (2.16.1) addressable mini_mime (>= 0.1.3) nokogiri (>= 1.3.3) @@ -447,7 +447,7 @@ GEM rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.7.0) - rspec-rails (3.7.1) + rspec-rails (3.7.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) From 229396d9e7186dcec91b2bd412e82075895da6e6 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 21 Nov 2017 10:09:53 +1300 Subject: [PATCH 22/58] Add id and type back to photos#new --- app/controllers/photos_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 2c707f726..80d481f60 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -19,6 +19,8 @@ class PhotosController < ApplicationController def new @photo = Photo.new @item = item_to_link_to + @type = item_type + @id = item_id retrieve_from_flickr respond_with @photo end From 08a73ce5032be6d1f0429f735e5256fdc92b8fe2 Mon Sep 17 00:00:00 2001 From: deppbot Date: Fri, 24 Nov 2017 16:10:50 +0800 Subject: [PATCH 23/58] Bundle Update on 2017-11-24 --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ed43b2add..724ae39f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,7 +84,7 @@ GEM activesupport (>= 3.0.0) uniform_notifier (~> 1.10.0) byebug (9.1.0) - cancancan (2.1.1) + cancancan (2.1.2) capybara (2.16.1) addressable mini_mime (>= 0.1.3) @@ -241,7 +241,7 @@ GEM excon moneta multi_json (>= 1.9.2) - highline (1.7.8) + highline (1.7.10) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) @@ -273,7 +273,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (5.0.5) railties (>= 3.2.16) - js-routes (1.4.1) + js-routes (1.4.2) railties (>= 3.2) sprockets-rails json (2.1.0) From c154a9b845fe876dd902e77d082859608ea1c2f5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 25 Nov 2017 19:34:05 +1300 Subject: [PATCH 24/58] Upgraded leaflet maskercluster --- Gemfile | 5 ++++- Gemfile.lock | 8 +++++--- app/assets/stylesheets/application.sass | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index e711de8ca..af2f2ebc8 100644 --- a/Gemfile +++ b/Gemfile @@ -32,8 +32,11 @@ gem 'cancancan' # for checking member privileges gem 'csv_shaper' # CSV export gem 'figaro' # for handling config via ENV variables gem 'gibbon', '~>1.2.0' # for Mailchimp newsletter subscriptions -gem 'leaflet-markercluster-rails' + +# Maps gem 'leaflet-rails' +gem 'rails-assets-leaflet.markercluster', source: 'https://rails-assets.org' + gem 'pg' gem 'ruby-units' # for unit conversion gem 'unicorn' # http server diff --git a/Gemfile.lock b/Gemfile.lock index ac07b2c14..b79e44706 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,6 @@ GEM remote: https://rubygems.org/ + remote: https://rails-assets.org/ specs: actionmailer (4.2.10) actionpack (= 4.2.10) @@ -298,8 +299,6 @@ GEM kramdown (1.15.0) launchy (2.4.3) addressable (~> 2.3) - leaflet-markercluster-rails (0.7.0) - railties (>= 3.1) leaflet-rails (1.2.0) rails (>= 4.2.0) letter_opener (1.4.1) @@ -401,6 +400,9 @@ GEM bundler (>= 1.3.0, < 2.0) railties (= 4.2.10) sprockets-rails + rails-assets-leaflet (1.2.0) + rails-assets-leaflet.markercluster (1.2.0) + rails-assets-leaflet (>= 1.0.3) rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) rails-dom-testing (1.0.8) @@ -597,7 +599,6 @@ DEPENDENCIES js-routes jsonapi-resources kaminari - leaflet-markercluster-rails leaflet-rails letter_opener memcachier @@ -612,6 +613,7 @@ DEPENDENCIES pry quiet_assets rails (~> 4.2.8) + rails-assets-leaflet.markercluster! rails_12factor rainbow (< 2.2.0) rake (>= 10.0.0) diff --git a/app/assets/stylesheets/application.sass b/app/assets/stylesheets/application.sass index a386feb29..ae07e7516 100644 --- a/app/assets/stylesheets/application.sass +++ b/app/assets/stylesheets/application.sass @@ -2,7 +2,6 @@ @import 'bootstrap-datepicker' @import 'leaflet' @import 'leaflet.markercluster' -@import 'leaflet.markercluster.default' @import 'custom_bootstrap/custom_bootstrap' @import 'overrides' @import 'graphs' From 49aa6bb846632e8d28eeb801d499e0f5a0eba987 Mon Sep 17 00:00:00 2001 From: Shiny Date: Sat, 25 Nov 2017 19:41:03 +1300 Subject: [PATCH 25/58] Update .travis.yml --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d3bd22cab..ef68fec4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ env: before_install: - ./script/install_phantomjs; - export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH - - which phantomjs # Force Travis to use Elastic Search 2.4.0 - > if [ "${GROWSTUFF_ELASTICSEARCH}" = "true" ]; then From dae3ea2789deee6de80d60bdad1e4388dce3376a Mon Sep 17 00:00:00 2001 From: Shiny Date: Sat, 25 Nov 2017 19:41:41 +1300 Subject: [PATCH 26/58] removed some debug --- script/install_phantomjs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/script/install_phantomjs b/script/install_phantomjs index 551a46bb6..b633ea9cd 100755 --- a/script/install_phantomjs +++ b/script/install_phantomjs @@ -7,10 +7,8 @@ if [ "$(phantomjs --version)" != '2.1.1' ]; then mkdir -p "$PWD/travis_phantomjs" cd "$PWD/travis_phantomjs" wget "$PHANTOM_URL" - ls -l tar -vjxf phantomjs-2.1.1-linux-x86_64.tar.bz2 - find fi which phantomjs -phantomjs --version \ No newline at end of file +phantomjs --version From 811011419e46e0d46072e77d83528dc1f134b87e Mon Sep 17 00:00:00 2001 From: Shiny Date: Sun, 26 Nov 2017 09:39:43 +1300 Subject: [PATCH 27/58] Exit if we can't cd --- script/install_phantomjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/install_phantomjs b/script/install_phantomjs index b633ea9cd..c31b5408b 100755 --- a/script/install_phantomjs +++ b/script/install_phantomjs @@ -5,7 +5,7 @@ if [ "$(phantomjs --version)" != '2.1.1' ]; then PHANTOM_URL="https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2" rm -rf "$PWD/travis_phantomjs" mkdir -p "$PWD/travis_phantomjs" - cd "$PWD/travis_phantomjs" + cd "$PWD/travis_phantomjs" || exit 1 wget "$PHANTOM_URL" tar -vjxf phantomjs-2.1.1-linux-x86_64.tar.bz2 fi From 8a679670e43bfaa4ec14bf0ca8896c49556679eb Mon Sep 17 00:00:00 2001 From: deppbot Date: Wed, 29 Nov 2017 00:12:48 +0800 Subject: [PATCH 28/58] Bundle Update on 2017-11-29 --- Gemfile.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b79e44706..017c433c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -296,7 +296,7 @@ GEM kaminari-core (= 1.1.1) kaminari-core (1.1.1) kgio (2.11.0) - kramdown (1.15.0) + kramdown (1.16.1) launchy (2.4.3) addressable (~> 2.3) leaflet-rails (1.2.0) @@ -633,6 +633,7 @@ DEPENDENCIES will_paginate xmlrpc + RUBY VERSION ruby 2.4.1p111 From 7719d1f896e5c9d1db56c1a55b386829984dbd75 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 13:35:10 +1300 Subject: [PATCH 29/58] Remote default ordering scopes, and clean up models --- app/models/comment.rb | 1 - app/models/crop.rb | 1 - app/models/garden.rb | 2 +- app/models/harvest.rb | 2 +- app/models/member.rb | 53 +++++++++------------- app/models/notification.rb | 1 - app/models/order.rb | 11 +++-- app/models/photo.rb | 2 +- app/models/planting.rb | 2 +- app/models/post.rb | 67 +++++++++++++++------------ app/models/product.rb | 13 +++--- app/models/seed.rb | 93 +++++++++++++------------------------- 12 files changed, 107 insertions(+), 141 deletions(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index f91c9cb42..7098e0b46 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -2,7 +2,6 @@ class Comment < ActiveRecord::Base belongs_to :author, class_name: 'Member' belongs_to :post - default_scope { order("created_at DESC") } scope :post_order, -> { reorder("created_at ASC") } # for display on post page after_create do diff --git a/app/models/crop.rb b/app/models/crop.rb index 96ba2bc01..ceb275b8b 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -24,7 +24,6 @@ class Crop < ActiveRecord::Base ## ## Scopes - default_scope { order("lower(crops.name) asc") } scope :recent, -> { approved.reorder("created_at desc") } scope :toplevel, -> { approved.where(parent_id: nil) } scope :popular, -> { approved.reorder("plantings_count desc, lower(name) asc") } diff --git a/app/models/garden.rb b/app/models/garden.rb index 571eca7ba..bde976de0 100644 --- a/app/models/garden.rb +++ b/app/models/garden.rb @@ -14,7 +14,7 @@ class Garden < ActiveRecord::Base after_validation :empty_unwanted_geocodes after_save :mark_inactive_garden_plantings_as_finished - default_scope { joins(:owner).order("lower(name) asc") } + default_scope { joins(:owner) } # Ensures owner exists scope :active, -> { where(active: true) } scope :inactive, -> { where(active: false) } diff --git a/app/models/harvest.rb b/app/models/harvest.rb index c2ad7eab1..1e4ceb2dc 100644 --- a/app/models/harvest.rb +++ b/app/models/harvest.rb @@ -39,7 +39,7 @@ class Harvest < ActiveRecord::Base ## ## Scopes - default_scope { joins(:owner) } + default_scope { joins(:owner) } # Ensures owner exists ## ## Validations diff --git a/app/models/member.rb b/app/models/member.rb index 5108cf711..f17e9b36e 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -6,48 +6,40 @@ class Member < ActiveRecord::Base friendly_id :login_name, use: %i(slugged finders) + # + # Relationshops has_many :posts, foreign_key: 'author_id' has_many :comments, foreign_key: 'author_id' has_many :forums, foreign_key: 'owner_id' has_many :gardens, foreign_key: 'owner_id' has_many :plantings, foreign_key: 'owner_id' - has_many :seeds, foreign_key: 'owner_id' has_many :harvests, foreign_key: 'owner_id' - has_and_belongs_to_many :roles # rubocop:disable Rails/HasAndBelongsToMany - has_many :notifications, foreign_key: 'recipient_id' has_many :sent_notifications, foreign_key: 'sender_id' - has_many :authentications - has_many :orders has_one :account has_one :account_type, through: :account - has_many :photos - has_many :requested_crops, class_name: Crop, foreign_key: 'requester_id' has_many :likes, dependent: :destroy + has_many :follows, class_name: "Follow", foreign_key: "follower_id" + has_many :followed, through: :follows + has_many :inverse_follows, class_name: "Follow", foreign_key: "followed_id" + has_many :followers, through: :inverse_follows, source: :follower - default_scope { order("lower(login_name) asc") } - + # + # Scopes scope :confirmed, -> { where.not(confirmed_at: nil) } scope :located, -> { where.not(location: '').where.not(latitude: nil).where.not(longitude: nil) } scope :recently_signed_in, -> { reorder(updated_at: :desc) } scope :recently_joined, -> { reorder(confirmed_at: :desc) } scope :wants_newsletter, -> { where(newsletter: true) } scope :interesting, -> { confirmed.located.recently_signed_in.has_plantings } - scope :has_plantings, -> { joins(:plantings).group("members.id") } - has_many :follows, class_name: "Follow", foreign_key: "follower_id" - has_many :followed, through: :follows - - has_many :inverse_follows, class_name: "Follow", foreign_key: "followed_id" - has_many :followers, through: :inverse_follows, source: :follower - # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable @@ -57,45 +49,42 @@ class Member < ActiveRecord::Base # set up geocoding geocoded_by :location - after_validation :geocode - after_validation :empty_unwanted_geocodes # Virtual attribute for authenticating by either username or email # This is in addition to a real persisted field like 'username' attr_accessor :login + # + # Validations # Requires acceptance of the Terms of Service - validates :tos_agreement, acceptance: { allow_nil: true, - accept: true } - + validates :tos_agreement, acceptance: { allow_nil: true, accept: true } validates :login_name, length: { - minimum: 2, - maximum: 25, - message: "should be between 2 and 25 characters long" + minimum: 2, maximum: 25, message: "should be between 2 and 25 characters long" }, exclusion: { - in: %w(growstuff admin moderator staff nearby), - message: "name is reserved" + in: %w(growstuff admin moderator staff nearby), message: "name is reserved" }, format: { - with: /\A\w+\z/, - message: "may only include letters, numbers, or underscores" + with: /\A\w+\z/, message: "may only include letters, numbers, or underscores" }, uniqueness: { case_sensitive: false } - # Give each new member a default garden - after_create { |member| Garden.create(name: "Garden", owner_id: member.id) } + # + # Triggers + after_validation :geocode + after_validation :empty_unwanted_geocodes + after_save :update_newsletter_subscription + # Give each new member a default garden # 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 FactoryBot associations + after_create { |member| Garden.create(name: "Garden", owner_id: member.id) } after_create { |member| Account.find_or_create_by(member_id: member.id) } - after_save :update_newsletter_subscription - # allow login via either login_name or email address def self.find_first_by_auth_conditions(warden_conditions) conditions = warden_conditions.dup diff --git a/app/models/notification.rb b/app/models/notification.rb index a7320692e..1b09b1e5e 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -5,7 +5,6 @@ class Notification < ActiveRecord::Base validates :subject, length: { maximum: 255 } - default_scope { order('created_at DESC') } scope :unread, -> { where(read: false) } scope :by_recipient, ->(recipient) { where(recipient_id: recipient) } diff --git a/app/models/order.rb b/app/models/order.rb index 3993ce620..53a309c35 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -1,17 +1,22 @@ class Order < ActiveRecord::Base + # + # Relationships belongs_to :member, with_deleted: true - has_many :order_items, dependent: :destroy - default_scope { order('created_at DESC') } - + # + # Validations validates :referral_code, format: { with: /\A[a-zA-Z0-9 ]*\z/, message: "may only include letters and numbers" } + # + # Teiggers before_save :standardize_referral_code + # + # Scopes scope :by_member, ->(member) { where(member: member) } # total price of an order diff --git a/app/models/photo.rb b/app/models/photo.rb index 402eebd7e..244687fb5 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -8,7 +8,7 @@ class Photo < ActiveRecord::Base before_destroy { all_associations.clear } - default_scope { joins(:owner).order(created_at: :desc) } + default_scope { joins(:owner) } # Ensures the owner still exists def associations? plantings.any? || harvests.any? || gardens.any? || seeds.any? diff --git a/app/models/planting.rb b/app/models/planting.rb index ec0355a52..c4503bfb4 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -22,7 +22,7 @@ class Planting < ActiveRecord::Base ## ## Scopes - default_scope { joins(:owner).order(created_at: :desc) } + default_scope { joins(:owner) } # Ensures the owner still exists scope :finished, -> { where(finished: true) } scope :current, -> { where(finished: false) } scope :interesting, -> { has_photos.one_per_owner } diff --git a/app/models/post.rb b/app/models/post.rb index df7303c9e..6014e8f64 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -2,45 +2,27 @@ class Post < ActiveRecord::Base extend FriendlyId include Likeable friendly_id :author_date_subject, use: %i(slugged finders) + + # + # Relationships belongs_to :author, class_name: 'Member' belongs_to :forum has_many :comments, dependent: :destroy has_and_belongs_to_many :crops # rubocop:disable Rails/HasAndBelongsToMany - 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 = author.id - body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_REGEX) do |_m| - # find member case-insensitively and add to list of recipients - member = Member.case_insensitive_login_name(Regexp.last_match(1)).first - recipients << member if member && !recipients.include?(member) - end - body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_AT_REGEX) do |_m| - # find member case-insensitively and add to list of recipients - member = Member.case_insensitive_login_name(Regexp.last_match(1)[1..-1]).first - recipients << member if member && !recipients.include?(member) - end - # don't send notifications to yourself - recipients.map(&:id).each do |recipient| - next unless recipient != sender - Notification.create( - recipient_id: recipient, - sender_id: sender, - subject: "#{author} mentioned you in their post #{subject}", - body: body - ) - end - end + # + # Triggers + before_destroy { |post| post.crops.clear } + after_save :update_crops_posts_association + after_create :send_notification - default_scope { joins(:author).order(created_at: :desc) } + default_scope { joins(:author) } # Ensures the owner still exists - validates :subject, - presence: true, - length: { maximum: 255 } + # + # Validations + validates :subject, presence: true, length: { maximum: 255 } def author_date_subject # slugs are created before created_at is set @@ -78,4 +60,29 @@ class Post < ActiveRecord::Base crops << crop if crop && !crops.include?(crop) end end + + def send_notification + recipients = [] + sender = author.id + body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_REGEX) do |_m| + # find member case-insensitively and add to list of recipients + member = Member.case_insensitive_login_name(Regexp.last_match(1)).first + recipients << member if member && !recipients.include?(member) + end + body.scan(Haml::Filters::GrowstuffMarkdown::MEMBER_AT_REGEX) do |_m| + # find member case-insensitively and add to list of recipients + member = Member.case_insensitive_login_name(Regexp.last_match(1)[1..-1]).first + recipients << member if member && !recipients.include?(member) + end + # don't send notifications to yourself + recipients.map(&:id).each do |recipient_id| + next unless recipient_id != sender + Notification.create( + recipient_id: recipient_id, + sender_id: sender, + subject: "#{author} mentioned you in their post #{subject}", + body: body + ) + end + end end diff --git a/app/models/product.rb b/app/models/product.rb index 646edd1a6..01b5a8902 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -1,13 +1,12 @@ class Product < ActiveRecord::Base - has_and_belongs_to_many :orders # rubocop:disable Rails/HasAndBelongsToMany + # + # Relationships belongs_to :account_type + has_and_belongs_to_many :orders # rubocop:disable Rails/HasAndBelongsToMany - validates :paid_months, - numericality: { - only_integer: true, - greater_than_or_equal_to: 0 - }, - allow_nil: true + # + # Validations + validates :paid_months, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } validates :min_price, presence: true def to_s diff --git a/app/models/seed.rb b/app/models/seed.rb index 9b2fc510b..219e29b79 100644 --- a/app/models/seed.rb +++ b/app/models/seed.rb @@ -3,81 +3,50 @@ class Seed < ActiveRecord::Base include PhotoCapable friendly_id :seed_slug, use: [:slugged, :finders] + TRADABLE_TO_VALUES = %w(nowhere locally nationally internationally).freeze + ORGANIC_VALUES = ['certified organic', 'non-certified organic', 'conventional/non-organic', 'unknown'].freeze + GMO_VALUES = ['certified GMO-free', 'non-certified GMO-free', 'GMO', 'unknown'].freeze + HEIRLOOM_VALUES = %w(heirloom hybrid unknown).freeze + + # + # Relationships belongs_to :crop belongs_to :owner, class_name: 'Member', foreign_key: 'owner_id', counter_cache: true - default_scope { joins(:owner).order(created_at: :desc) } - + # + # Validations validates :crop, approved: true delegate :name, to: :crop delegate :default_photo, to: :crop - validates :crop, presence: { message: "must be present and exist in our database" } - validates :quantity, - numericality: { - only_integer: true, - greater_than_or_equal_to: 0 - }, - allow_nil: true - validates :days_until_maturity_min, - numericality: { - only_integer: true, - greater_than_or_equal_to: 0 - }, - allow_nil: true - validates :days_until_maturity_max, - numericality: { - only_integer: true, - greater_than_or_equal_to: 0 - }, - allow_nil: true + validates :quantity, allow_nil: true, + numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :days_until_maturity_min, allow_nil: true, + numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :days_until_maturity_max, allow_nil: true, + numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :tradable_to, allow_nil: false, allow_blank: false, + inclusion: { in: TRADABLE_TO_VALUES, message: "You may only trade seed nowhere, "\ + "locally, nationally, or internationally" } + validates :organic, allow_nil: false, allow_blank: false, + inclusion: { in: ORGANIC_VALUES, message: "You must say whether the seeds "\ + "are organic or not, or that you don't know" } + validates :gmo, allow_nil: false, allow_blank: false, + inclusion: { in: GMO_VALUES, message: "You must say whether the seeds are "\ + "genetically modified or not, or that you don't know" } + validates :heirloom, allow_nil: false, allow_blank: false, + inclusion: { in: HEIRLOOM_VALUES, message: "You must say whether the seeds"\ + "are heirloom, hybrid, or unknown" } + # + # Scopes + default_scope { joins(:owner) } # Ensure owner exists scope :tradable, -> { where.not(tradable_to: 'nowhere') } scope :interesting, -> { tradable.has_location } scope :has_location, -> { joins(:owner).where.not("members.location": nil) } - TRADABLE_TO_VALUES = %w(nowhere locally nationally internationally).freeze - 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 - - ORGANIC_VALUES = [ - 'certified organic', - 'non-certified organic', - 'conventional/non-organic', - 'unknown' - ].freeze - 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 - - GMO_VALUES = [ - 'certified GMO-free', - 'non-certified GMO-free', - 'GMO', - 'unknown' - ].freeze - 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 - - HEIRLOOM_VALUES = %w(heirloom hybrid unknown).freeze - validates :heirloom, inclusion: { in: HEIRLOOM_VALUES, - message: "You must say whether the seeds are heirloom, hybrid, or unknown" }, - allow_nil: false, - allow_blank: false def tradable? - if tradable_to == 'nowhere' - false - else - true - end + tradable_to == 'nowhere' end def seed_slug From 0446c0a4055c2f1801ada9ba495756b8949dad6b Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 13:36:23 +1300 Subject: [PATCH 30/58] Add ordering back into controller #index --- app/controllers/account_types_controller.rb | 2 +- app/controllers/accounts_controller.rb | 2 +- app/controllers/alternate_names_controller.rb | 2 +- app/controllers/comments_controller.rb | 2 +- app/controllers/crops_controller.rb | 2 +- app/controllers/forums_controller.rb | 2 +- app/controllers/gardens_controller.rb | 2 +- app/controllers/notifications_controller.rb | 2 +- app/controllers/photos_controller.rb | 4 +++- app/controllers/plant_parts_controller.rb | 2 +- app/controllers/plantings_controller.rb | 2 +- app/controllers/posts_controller.rb | 2 +- app/controllers/products_controller.rb | 2 +- app/controllers/roles_controller.rb | 2 +- app/controllers/scientific_names_controller.rb | 2 +- app/controllers/seeds_controller.rb | 2 +- 16 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/controllers/account_types_controller.rb b/app/controllers/account_types_controller.rb index 15d75016a..f86892346 100644 --- a/app/controllers/account_types_controller.rb +++ b/app/controllers/account_types_controller.rb @@ -5,7 +5,7 @@ class AccountTypesController < ApplicationController # GET /account_types def index - @account_types = AccountType.all + @account_types = AccountType.all.order(:name) respond_with(@account_types) end diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 86c465809..040092aba 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -5,7 +5,7 @@ class AccountsController < ApplicationController # GET /accounts def index - @accounts = Account.all + @accounts = Account.all.order(created_at: :desc) respond_with(@accounts) end diff --git a/app/controllers/alternate_names_controller.rb b/app/controllers/alternate_names_controller.rb index 097c172c4..b673a63d7 100644 --- a/app/controllers/alternate_names_controller.rb +++ b/app/controllers/alternate_names_controller.rb @@ -7,7 +7,7 @@ class AlternateNamesController < ApplicationController # GET /alternate_names # GET /alternate_names.json def index - @alternate_names = AlternateName.all + @alternate_names = AlternateName.all.order(:name) respond_with(@alternate_names) end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index e0f983425..d99c9c1eb 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -6,7 +6,7 @@ class CommentsController < ApplicationController responders :flash def index - @comments = Comment.paginate(page: params[:page]) + @comments = Comment.order("comments.created_at": :desc).paginate(page: params[:page]) respond_with(@comments) end diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index 1deb716c7..2a16206bb 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -185,7 +185,7 @@ class CropsController < ApplicationController def crops q = Crop.approved.includes(:scientific_names, plantings: :photos) q = q.popular unless @sort == 'alpha' - q.includes(:photos).paginate(page: params[:page]) + q.order("LOWER(crops.name)").includes(:photos).paginate(page: params[:page]) end def requested_crops diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 78daf807d..949de10b0 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -5,7 +5,7 @@ class ForumsController < ApplicationController # GET /forums # GET /forums.json def index - @forums = Forum.all + @forums = Forum.all.order(:name) respond_with(@forums) end diff --git a/app/controllers/gardens_controller.rb b/app/controllers/gardens_controller.rb index 32b392093..6b345dc70 100644 --- a/app/controllers/gardens_controller.rb +++ b/app/controllers/gardens_controller.rb @@ -68,6 +68,6 @@ class GardensController < ApplicationController def gardens g = @owner ? @owner.gardens : Garden.all g = g.active unless @show_all - g.joins(:owner).order(:updated_at).paginate(page: params[:page]) + g.joins(:owner).order(:name).paginate(page: params[:page]) end end diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index f69130f07..7c3c1f322 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -6,7 +6,7 @@ class NotificationsController < ApplicationController # GET /notifications def index - @notifications = Notification.by_recipient(current_member).page(params[:page]) + @notifications = Notification.by_recipient(current_member).order(:created_at).page(params[:page]) end # GET /notifications/1 diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 80d481f60..a36064684 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -12,7 +12,9 @@ class PhotosController < ApplicationController else @photos = Photo.all end - @photos = @photos.includes(:owner).order(:created_at).paginate(page: params[:page]) + @photos = @photos.order("photos.created_at": :desc) + .includes(:owner) + .paginate(page: params[:page]) respond_with(@photos) end diff --git a/app/controllers/plant_parts_controller.rb b/app/controllers/plant_parts_controller.rb index e7c3a38e5..2841e54e7 100644 --- a/app/controllers/plant_parts_controller.rb +++ b/app/controllers/plant_parts_controller.rb @@ -4,7 +4,7 @@ class PlantPartsController < ApplicationController responders :flash def index - @plant_parts = PlantPart.all + @plant_parts = PlantPart.all.order("plant_parts.name") respond_with(@plant_parts) end diff --git a/app/controllers/plantings_controller.rb b/app/controllers/plantings_controller.rb index d6e937a98..fff2b9558 100644 --- a/app/controllers/plantings_controller.rb +++ b/app/controllers/plantings_controller.rb @@ -96,8 +96,8 @@ class PlantingsController < ApplicationController end p = p.current unless @show_all p.joins(:owner, :crop, :garden) + .order("plantings.created_at": :desc) .includes(:crop, :owner, :garden) - .order(:created_at) .paginate(page: params[:page]) end end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index dbda9be38..b72d22fae 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -66,6 +66,6 @@ class PostsController < ApplicationController @author.posts else Post - end.includes(:author, comments: :author).paginate(page: params[:page]) + end.order("posts.created_at": :desc).includes(:author, comments: :author).paginate(page: params[:page]) end end diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index fbd57e6b4..8e0a1fb08 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -5,7 +5,7 @@ class ProductsController < ApplicationController responders :flash def index - @products = Product.all + @products = Product.all.order(:name) respond_with @products end diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 30a88bee6..6b43cf9da 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -5,7 +5,7 @@ class RolesController < ApplicationController responders :flash def index - @roles = Role.all + @roles = Role.all.order(:name) respond_with @roles end diff --git a/app/controllers/scientific_names_controller.rb b/app/controllers/scientific_names_controller.rb index 5768943b8..954a94dbc 100644 --- a/app/controllers/scientific_names_controller.rb +++ b/app/controllers/scientific_names_controller.rb @@ -7,7 +7,7 @@ class ScientificNamesController < ApplicationController # GET /scientific_names # GET /scientific_names.json def index - @scientific_names = ScientificName.all + @scientific_names = ScientificName.all.order(:name) respond_with(@scientific_names) end diff --git a/app/controllers/seeds_controller.rb b/app/controllers/seeds_controller.rb index 0c64e5984..283f65744 100644 --- a/app/controllers/seeds_controller.rb +++ b/app/controllers/seeds_controller.rb @@ -75,7 +75,7 @@ class SeedsController < ApplicationController crop.seeds else Seed - end.includes(:owner, :crop).paginate(page: params[:page]) + end.order("seeds.created_at": :desc).includes(:owner, :crop).paginate(page: params[:page]) end def csv_filename From 9aff65e956c74dbe2b72162f80355c0758deb036 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 13:54:00 +1300 Subject: [PATCH 31/58] Added ordering to finding first photo --- app/models/harvest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/harvest.rb b/app/models/harvest.rb index 1e4ceb2dc..77db04014 100644 --- a/app/models/harvest.rb +++ b/app/models/harvest.rb @@ -124,7 +124,7 @@ class Harvest < ActiveRecord::Base end def default_photo - photos.first || crop.default_photo + photos.order(created_at: :desc).first || crop.default_photo end def crop_must_match_planting From 023c870d4990b4426ad1255028d4aa7b72599825 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 13:55:40 +1300 Subject: [PATCH 32/58] Fix up crop.recent --- app/models/crop.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/crop.rb b/app/models/crop.rb index ceb275b8b..4d21c4894 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -24,7 +24,7 @@ class Crop < ActiveRecord::Base ## ## Scopes - scope :recent, -> { approved.reorder("created_at desc") } + scope :recent, -> { approved.order(created_at: :desc) } scope :toplevel, -> { approved.where(parent_id: nil) } scope :popular, -> { approved.reorder("plantings_count desc, lower(name) asc") } # ok on sqlite and psql, but not on mysql From 4bed6da4224114768c0bf7ecce5a21deacf4ab5e Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 13:56:11 +1300 Subject: [PATCH 33/58] Crop validation methods can be private --- app/models/harvest.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/harvest.rb b/app/models/harvest.rb index 77db04014..6bb9aa048 100644 --- a/app/models/harvest.rb +++ b/app/models/harvest.rb @@ -127,6 +127,8 @@ class Harvest < ActiveRecord::Base photos.order(created_at: :desc).first || crop.default_photo end + private + def crop_must_match_planting return if planting.blank? # only check if we are linked to a planting errors.add(:planting, "must be the same crop") unless crop == planting.crop From d77d1d9a77177682b2205dc3f1b4e7b30024fc7e Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 13:57:57 +1300 Subject: [PATCH 34/58] spec for notifications needs to be agnostic about the order --- spec/models/notification_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index be5fd019d..4f04573d5 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -20,7 +20,8 @@ describe Notification do @n2 = FactoryBot.create(:notification, read: true) Notification.unread.should eq [notification] @n3 = FactoryBot.create(:notification, read: false) - Notification.unread.should eq [@n3, notification] + Notification.unread.should include @n3 + Notification.unread.should include notification end it "counts unread" do From 962b3b574da34760673f99c89c831daabe96d360 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 14:01:40 +1300 Subject: [PATCH 35/58] Fixed up planting spec to not care about ordering --- spec/models/planting_spec.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/models/planting_spec.rb b/spec/models/planting_spec.rb index ec9eb0746..48a035bb4 100644 --- a/spec/models/planting_spec.rb +++ b/spec/models/planting_spec.rb @@ -155,12 +155,6 @@ describe Planting do planting.location.should eq "#{garden_owner.login_name}'s #{garden.name}" end - it "sorts plantings in descending order of creation" do - @planting1 = FactoryBot.create(:planting) - @planting2 = FactoryBot.create(:planting) - Planting.first.should eq @planting2 - end - it "should have a slug" do planting.slug.should match(/^member\d+-springfield-community-garden-tomato$/) end @@ -321,12 +315,14 @@ describe Planting do p.save end - Planting.interesting.should eq [ + [ @planting4, @planting3, @planting2, @planting1 - ] + ].each do |p| + Planting.interesting.should include p + end end context "default arguments" do From 6aa689b0d826ef572119d99e9a275ae205b6a754 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 14:02:22 +1300 Subject: [PATCH 36/58] Removed some model ordering specs --- spec/models/comment_spec.rb | 4 ---- spec/models/crop_spec.rb | 4 ---- spec/models/forum_spec.rb | 6 ------ spec/models/member_spec.rb | 10 ---------- spec/models/order_spec.rb | 5 ----- spec/models/post_spec.rb | 12 ------------ 6 files changed, 41 deletions(-) diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index 70d0a8386..b98c52062 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -49,10 +49,6 @@ describe Comment do @c2 = FactoryBot.create(:comment, post: @p, author: @m) end - it 'is in DESC order by default' do - Comment.all.should eq [@c2, @c1] - end - it 'has a scope for ASC order for displaying on post page' do Comment.post_order.should eq [@c1, @c2] end diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index 860e2e935..5d9b671c0 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -39,10 +39,6 @@ describe Crop do @lowercase = FactoryBot.create(:lowercasecrop, created_at: 2.days.ago) end - it "should be sorted case-insensitively" do - Crop.first.should == @lowercase - end - it 'recent scope sorts by creation date' do Crop.recent.first.should == @uppercase end diff --git a/spec/models/forum_spec.rb b/spec/models/forum_spec.rb index 5fab0bfed..310c36842 100644 --- a/spec/models/forum_spec.rb +++ b/spec/models/forum_spec.rb @@ -20,10 +20,4 @@ describe Forum do @post2 = FactoryBot.create(:forum_post, forum: forum) forum.posts.size.should == 2 end - - it "orders posts in reverse chron order" do - @post1 = FactoryBot.create(:forum_post, forum: forum, created_at: 2.days.ago) - @post2 = FactoryBot.create(:forum_post, forum: forum, created_at: 1.day.ago) - forum.posts.first.should eq @post2 - end end diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index 4a42a8409..7dd56f1cb 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -140,16 +140,6 @@ describe 'member' do end end - context 'ordering' do - before do - FactoryBot.create(:member, login_name: "Zoe") - FactoryBot.create(:member, login_name: "Anna") - end - it "should be sorted by name" do - expect(Member.first.login_name).to eq("Anna") - end - end - context 'invalid login names' do it "doesn't allow short names" do member = FactoryBot.build(:invalid_member_shortname) diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb index 2d43473e5..9abb381ba 100644 --- a/spec/models/order_spec.rb +++ b/spec/models/order_spec.rb @@ -25,11 +25,6 @@ describe Order do @order.order_items.first.should eq @order_item end - it 'sorts by created_at DESC' do - @order2 = FactoryBot.create(:order) - Order.all.should eq [@order2, @order] - end - it 'updates the account details' do @member = FactoryBot.create(:member) @order = FactoryBot.create(:order, member: @member) diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 479a04bff..566f451cb 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -4,18 +4,6 @@ describe Post do let(:member) { FactoryBot.create(:member) } it_behaves_like "it is likeable" - it "should be sorted in reverse order" do - FactoryBot.create(:post, - subject: 'first entry', - author: member, - created_at: 2.days.ago) - FactoryBot.create(:post, - subject: 'second entry', - author: member, - created_at: 1.day.ago) - Post.first.subject.should == "second entry" - end - it "should have a slug" do post = FactoryBot.create(:post, author: member) time = post.created_at From 7357524271264a0e078f2b4ec899fcac6d9f5780 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 15:25:30 +1300 Subject: [PATCH 37/58] Garden's default photo should be the most recent photo --- app/models/garden.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/garden.rb b/app/models/garden.rb index bde976de0..1df5397b3 100644 --- a/app/models/garden.rb +++ b/app/models/garden.rb @@ -88,6 +88,6 @@ class Garden < ActiveRecord::Base end def default_photo - photos.first + photos.order(created_at: :desc).first end end From 9f8a32e9f88b3016e6a7c43d7f4c7964bbf8bc71 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 15:50:00 +1300 Subject: [PATCH 38/58] Feature plantings need to be ordered --- app/models/garden.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/garden.rb b/app/models/garden.rb index 1df5397b3..0c3378b00 100644 --- a/app/models/garden.rb +++ b/app/models/garden.rb @@ -62,7 +62,7 @@ class Garden < ActiveRecord::Base unique_plantings = [] seen_crops = [] - plantings.includes(:garden, :crop, :owner, :harvests).each do |p| + plantings.order(created_at: :desc).includes(:garden, :crop, :owner, :harvests).each do |p| unless seen_crops.include?(p.crop) unique_plantings.push(p) seen_crops.push(p.crop) From 0205b345d0bd8a325c33a23ab385d1ab09da4cf8 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 15:50:55 +1300 Subject: [PATCH 39/58] A planting's photo is their most recent photo --- app/models/planting.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/planting.rb b/app/models/planting.rb index c4503bfb4..85e5277c0 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -72,7 +72,7 @@ class Planting < ActiveRecord::Base end def default_photo - photos.first + photos.order(created_at: :desc).first end def planted? From 00e6aeed5ca527fc731498fa014a356330efd011 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 15:52:28 +1300 Subject: [PATCH 40/58] seed.tradable was back to front logic. fixed --- app/models/seed.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/seed.rb b/app/models/seed.rb index 219e29b79..4213a7886 100644 --- a/app/models/seed.rb +++ b/app/models/seed.rb @@ -46,7 +46,7 @@ class Seed < ActiveRecord::Base scope :has_location, -> { joins(:owner).where.not("members.location": nil) } def tradable? - tradable_to == 'nowhere' + tradable_to != 'nowhere' end def seed_slug From 33816d4312dca97d0bc8a1ebd0a261a8e328bad1 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 20:39:49 +1300 Subject: [PATCH 41/58] Use faker gem, in account types - and add controller specs --- Gemfile | 1 + Gemfile.lock | 4 ++- app/models/account_type.rb | 6 ++++ .../account_types_controller_spec.rb | 28 ++++++++++++++++--- spec/factories/account_types.rb | 8 +++++- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index af2f2ebc8..36a8608c0 100644 --- a/Gemfile +++ b/Gemfile @@ -134,6 +134,7 @@ group :development, :test do gem 'coveralls', require: false # coverage analysis gem 'database_cleaner' gem 'factory_bot_rails' # for creating test data + gem 'faker' gem 'haml-i18n-extractor' gem 'haml-rails' # HTML templating language gem 'haml_lint' # Checks haml files for goodness diff --git a/Gemfile.lock b/Gemfile.lock index 017c433c1..74118c7e9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -181,6 +181,8 @@ GEM factory_bot_rails (4.8.2) factory_bot (~> 4.8.2) railties (>= 3.0.0) + faker (1.8.4) + i18n (~> 0.5) faraday (0.12.2) multipart-post (>= 1.2, < 3) ffi (1.9.18) @@ -578,6 +580,7 @@ DEPENDENCIES elasticsearch-model elasticsearch-rails factory_bot_rails + faker figaro flickraw font-awesome-sass @@ -633,7 +636,6 @@ DEPENDENCIES will_paginate xmlrpc - RUBY VERSION ruby 2.4.1p111 diff --git a/app/models/account_type.rb b/app/models/account_type.rb index d6be51a94..06416751a 100644 --- a/app/models/account_type.rb +++ b/app/models/account_type.rb @@ -1,6 +1,12 @@ class AccountType < ActiveRecord::Base + # + # Relationships has_many :products + # + # Validations + validates :name, presence: true, uniqueness: true + def to_s name end diff --git a/spec/controllers/account_types_controller_spec.rb b/spec/controllers/account_types_controller_spec.rb index 3a7559f63..37dbfa706 100644 --- a/spec/controllers/account_types_controller_spec.rb +++ b/spec/controllers/account_types_controller_spec.rb @@ -1,10 +1,30 @@ require 'rails_helper' describe AccountTypesController do - # This automatically creates a "Free" account type - login_member(:admin_member) + subject { response } - def valid_attributes - { "name" => "MyString" } + context 'anon' do + describe '#index' do + before { get :index } + it { is_expected.not_to be_success } + end + end + context 'member' do + login_member(:member) + describe '#index' do + before { get :index } + it { is_expected.not_to be_success } + end + end + context 'admin' do + login_member(:admin_member) + describe '#index' do + let!(:aaa) { FactoryBot.create :account_type, name: 'aaa' } + let!(:zzz) { FactoryBot.create :account_type, name: 'zzz' } + before { get :index } + it { is_expected.to be_success } + it { expect(assigns[:account_types].first).to eql(aaa) } + it { expect(assigns[:account_types].last).to eql(zzz) } + end end end diff --git a/spec/factories/account_types.rb b/spec/factories/account_types.rb index a983e24e4..66717492f 100644 --- a/spec/factories/account_types.rb +++ b/spec/factories/account_types.rb @@ -2,10 +2,16 @@ FactoryBot.define do factory :account_type do - name "Free" + name { Faker::Name.unique.name } is_paid false is_permanent_paid false + factory :free_account_type do + name "Free" + is_paid false + is_permanent_paid false + end + factory :paid_account_type do name "Paid" is_paid true From d5fece87d0c54eff4c82cc02c887fb5946046e1b Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 26 Nov 2017 20:58:40 +1300 Subject: [PATCH 42/58] Tests for comments#index (and bugfix) --- app/controllers/comments_controller.rb | 2 +- spec/controllers/comments_controller_spec.rb | 30 +++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index d99c9c1eb..f85302d74 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -6,7 +6,7 @@ class CommentsController < ApplicationController responders :flash def index - @comments = Comment.order("comments.created_at": :desc).paginate(page: params[:page]) + @comments = Comment.order(created_at: :desc).paginate(page: params[:page]) respond_with(@comments) end diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index 23210a875..0e986cc93 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -1,10 +1,11 @@ require 'rails_helper' describe CommentsController do + subject { response } + let(:member) { FactoryBot.create(:member) } before(:each) do - @member = FactoryBot.create(:member) - sign_in @member - controller.stub(:current_member) { @member } + sign_in member + controller.stub(:current_member) { member } end def valid_attributes @@ -13,11 +14,14 @@ describe CommentsController do end describe "GET RSS feed" do - it "returns an RSS feed" do - get :index, format: "rss" - response.should be_success - response.should render_template("comments/index") - response.content_type.should eq("application/rss+xml") + let!(:first_comment) { FactoryBot.create :comment, created_at: 10.days.ago } + let!(:last_comment) { FactoryBot.create :comment, created_at: 4.minutes.ago } + describe "returns an RSS feed" do + before { get :index, format: "rss" } + it { is_expected.to be_success } + it { is_expected.to render_template("comments/index") } + it { expect(response.content_type).to eq("application/rss+xml") } + it { expect(assigns(:comments)).to eq([last_comment, first_comment]) } end end @@ -48,10 +52,10 @@ describe CommentsController do before { get :edit, id: comment.to_param } describe "my comment" do - let!(:comment) { FactoryBot.create :comment, author: @member, post: post } + let!(:comment) { FactoryBot.create :comment, author: member, post: post } let!(:old_comment) { FactoryBot.create(:comment, post: post, created_at: Time.zone.yesterday) } it "assigns previous comments as @comments" do - assigns(:comments).should eq([comment, old_comment]) + expect(assigns(:comments)).to eq([comment, old_comment]) end end @@ -65,7 +69,7 @@ describe CommentsController do before { put :update, id: comment.to_param, comment: valid_attributes } describe "my comment" do - let(:comment) { FactoryBot.create :comment, author: @member } + let(:comment) { FactoryBot.create :comment, author: member } it "redirects to the comment's post" do expect(response).to redirect_to(comment.post) end @@ -78,7 +82,7 @@ describe CommentsController do let(:post) { FactoryBot.create :post, subject: 'our post' } let(:other_post) { FactoryBot.create :post, subject: 'the other post' } let(:valid_attributes) { { post_id: other_post.id, body: "kōrero" } } - let(:comment) { FactoryBot.create :comment, author: @member, post: post } + let(:comment) { FactoryBot.create :comment, author: member, post: post } it "does not change post_id" do comment.reload expect(comment.post_id).to eq(post.id) @@ -90,7 +94,7 @@ describe CommentsController do before { delete :destroy, id: comment.to_param } describe "my comment" do - let(:comment) { FactoryBot.create :comment, author: @member } + let(:comment) { FactoryBot.create :comment, author: member } it "redirects to the post the comment was on" do expect(response).to redirect_to(comment.post) end From 9c993e9f4766a69161c6e1dc8c7d6287d51fdbe3 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 18:59:40 +1300 Subject: [PATCH 43/58] Plantings controller ordering and specs --- app/controllers/plantings_controller.rb | 2 +- spec/controllers/plantings_controller_spec.rb | 108 +++++++++--------- 2 files changed, 54 insertions(+), 56 deletions(-) diff --git a/app/controllers/plantings_controller.rb b/app/controllers/plantings_controller.rb index fff2b9558..334118dc5 100644 --- a/app/controllers/plantings_controller.rb +++ b/app/controllers/plantings_controller.rb @@ -96,7 +96,7 @@ class PlantingsController < ApplicationController end p = p.current unless @show_all p.joins(:owner, :crop, :garden) - .order("plantings.created_at": :desc) + .order(created_at: :desc) .includes(:crop, :owner, :garden) .paginate(page: params[:page]) end diff --git a/spec/controllers/plantings_controller_spec.rb b/spec/controllers/plantings_controller_spec.rb index 1bacacc8c..dd1340d44 100644 --- a/spec/controllers/plantings_controller_spec.rb +++ b/spec/controllers/plantings_controller_spec.rb @@ -11,85 +11,83 @@ describe PlantingsController do end describe "GET index" do - before do - @member1 = FactoryBot.create(:member) - @member2 = FactoryBot.create(:member) - @tomato = FactoryBot.create(:tomato) - @maize = FactoryBot.create(:maize) - @planting1 = FactoryBot.create(:planting, crop: @tomato, owner: @member1) - @planting2 = FactoryBot.create(:planting, crop: @maize, owner: @member2) + let!(:member1) { FactoryBot.create(:member) } + let!(:member2) { FactoryBot.create(:member) } + let!(:tomato) { FactoryBot.create(:tomato) } + let!(:maize) { FactoryBot.create(:maize) } + let!(:planting1) { FactoryBot.create :planting, crop: tomato, owner: member1, created_at: 1.day.ago } + let!(:planting2) { FactoryBot.create :planting, crop: maize, owner: member2, created_at: 5.days.ago } + + describe "assigns all plantings as @plantings" do + before { get :index, {} } + it { expect(assigns(:plantings)).to match [planting1, planting2] } end - it "assigns all plantings as @plantings" do - get :index, {} - assigns(:plantings).should =~ [@planting1, @planting2] + describe "picks up owner from params and shows owner's plantings only" do + before { get :index, owner: member1.slug } + it { expect(assigns(:owner)).to eq member1 } + it { expect(assigns(:plantings)).to eq [planting1] } end - it "picks up owner from params and shows owner's plantings only" do - 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 - assigns(:crop).should eq @maize - assigns(:plantings).should eq [@planting2] + describe "picks up crop from params and shows the plantings for the crop only" do + before { get :index, crop: maize.name } + it { expect(assigns(:crop)).to eq maize } + it { expect(assigns(:plantings)).to eq [planting2] } end end describe "GET new" do - it "picks up crop from params" do - crop = FactoryBot.create(:crop) - get :new, crop_id: crop.id - assigns(:crop).should eq(crop) + describe "picks up crop from params" do + let(:crop) { FactoryBot.create(:crop) } + before { get :new, crop_id: crop.id } + it { expect(assigns(:crop)).to eq(crop) } end - it "doesn't die if no crop specified" do - get :new, {} - assigns(:crop).should be_a_new(Crop) + describe "doesn't die if no crop specified" do + before { get :new, {} } + it { expect(assigns(:crop)).to be_a_new(Crop) } end - it "picks up member's garden from params" do - garden = FactoryBot.create(:garden, owner: member) - get :new, garden_id: garden.id - assigns(:garden).should eq(garden) + describe "picks up member's garden from params" do + let(:garden) { FactoryBot.create(:garden, owner: member) } + before { get :new, garden_id: garden.id } + it { expect(assigns(:garden)).to eq(garden) } end - it "Doesn't display another member's garden on planting form" do - member = FactoryBot.create(:member) # over-riding member from login_member() - garden = FactoryBot.create(:garden, owner: member) - get :new, garden_id: garden.id - assigns(:garden).should_not eq(garden) + describe "Doesn't display another member's garden on planting form" do + let(:another_member) { FactoryBot.create(:member) } # over-riding member from login_member() + let(:garden) { FactoryBot.create(:garden, owner: another_member) } + before { get :new, garden_id: garden.id } + it { expect(assigns(:garden)).not_to eq(garden) } end - it "Doesn't display un-approved crops on planting form" do - crop = FactoryBot.create(:crop, approval_status: 'pending') - FactoryBot.create(:garden, owner: member) - get :new, crop_id: crop.id - assigns(:crop).should_not eq(crop) + describe "Doesn't display un-approved crops on planting form" do + let(:crop) { FactoryBot.create(:crop, approval_status: 'pending') } + let!(:garden) { FactoryBot.create(:garden, owner: member) } + before { get :new, crop_id: crop.id } + it { expect(assigns(:crop)).not_to eq(crop) } end - it "Doesn't display rejected crops on planting form" do - crop = FactoryBot.create(:crop, approval_status: 'rejected', reason_for_rejection: 'nope') - FactoryBot.create(:garden, owner: member) - get :new, crop_id: crop.id - assigns(:crop).should_not eq(crop) + describe "Doesn't display rejected crops on planting form" do + let(:crop) { FactoryBot.create(:crop, approval_status: 'rejected', reason_for_rejection: 'nope') } + let!(:garden) { FactoryBot.create(:garden, owner: member) } + before { get :new, crop_id: crop.id } + it { expect(assigns(:crop)).not_to eq(crop) } end - it "doesn't die if no garden specified" do - get :new, {} - assigns(:garden).should be_a_new(Garden) + describe "doesn't die if no garden specified" do + before { get :new, {} } + it { expect(assigns(:garden)).to be_a_new(Garden) } end - it "sets the date of the planting to today" do - get :new, {} - assigns(:planting).planted_at.should == Time.zone.today + describe "sets the date of the planting to today" do + before { get :new, {} } + it { expect(assigns(:planting).planted_at).to eq Time.zone.today } end - it "sets the owner automatically" do - post :create, planting: valid_attributes - assigns(:planting).owner.should eq subject.current_member + describe "sets the owner automatically" do + before { post :create, planting: valid_attributes } + it { expect(assigns(:planting).owner).to eq subject.current_member } end end end From d0b8ae3411668befe8b2ac5ef9cba247db48f08e Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 19:04:35 +1300 Subject: [PATCH 44/58] Delete follows records when a member is deleted --- app/models/member.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/member.rb b/app/models/member.rb index f17e9b36e..9828a005c 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -25,9 +25,9 @@ class Member < ActiveRecord::Base has_many :photos has_many :requested_crops, class_name: Crop, foreign_key: 'requester_id' has_many :likes, dependent: :destroy - has_many :follows, class_name: "Follow", foreign_key: "follower_id" + has_many :follows, class_name: "Follow", foreign_key: "follower_id", dependent: :destroy + has_many :inverse_follows, class_name: "Follow", foreign_key: "followed_id", dependent: :destroy has_many :followed, through: :follows - has_many :inverse_follows, class_name: "Follow", foreign_key: "followed_id" has_many :followers, through: :inverse_follows, source: :follower # From b813669d71d93692503bc8957858af655fcf0c60 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 19:12:46 +1300 Subject: [PATCH 45/58] Updated shop controller specs --- spec/controllers/shop_controller_spec.rb | 46 ++++++++++++------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/spec/controllers/shop_controller_spec.rb b/spec/controllers/shop_controller_spec.rb index 6298b7e76..c25039d2d 100644 --- a/spec/controllers/shop_controller_spec.rb +++ b/spec/controllers/shop_controller_spec.rb @@ -1,33 +1,35 @@ require 'rails_helper' describe ShopController do - before :each do - @product1 = FactoryBot.create(:product) - @product2 = FactoryBot.create(:product) - end + let!(:product1) { FactoryBot.create(:product, name: 'aaa') } + let!(:product2) { FactoryBot.create(:product, name: 'zzz') } describe "GET index" do - it "assigns all products as @products" do - get :index, {} - assigns(:products).should eq([@product1, @product2]) - end + describe 'not logged in' do + before { get :index, {} } - it "assigns a new @order_item to build forms" do - get :index, {} - assigns(:order_item).should be_an_instance_of OrderItem - end + describe "assigns all products as @products ordered by name" do + it { expect(assigns(:products)).to eq([product1, product2]) } + end - it "assigns @order as nil if the user doesn't have one" do - get :index, {} - assigns(:order).should be_nil - end + describe "assigns a new @order_item to build forms" do + it { expect(assigns(:order_item)).to be_an_instance_of OrderItem } + end - it "assigns @order as current_order if there is one" do - @member = FactoryBot.create(:member) - sign_in @member - @order = FactoryBot.create(:order, member: @member) - get :index, {} - assigns(:order).should eq @order + describe "assigns @order as nil if the user doesn't have one" do + it { expect(assigns(:order)).to be_nil } + end + end + describe 'logged in' do + describe "assigns @order as current_order if there is one" do + let(:member) { FactoryBot.create(:member) } + let!(:order) { FactoryBot.create(:order, member: member) } + before do + sign_in member + get :index, {} + end + it { expect(assigns(:order)).to eq order } + end end end end From 594e466fd4523ba353b5093548e9b0ee5e92357d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 19:57:46 +1300 Subject: [PATCH 46/58] Fixed photos ordering --- app/controllers/photos_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index a36064684..1f091b19b 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -12,7 +12,7 @@ class PhotosController < ApplicationController else @photos = Photo.all end - @photos = @photos.order("photos.created_at": :desc) + @photos = @photos.order(created_at: :desc) .includes(:owner) .paginate(page: params[:page]) respond_with(@photos) From 48f8085e2d592b5c9a61ef30476c5b026b660e5d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 19:58:31 +1300 Subject: [PATCH 47/58] Fix seeds order --- app/controllers/seeds_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/seeds_controller.rb b/app/controllers/seeds_controller.rb index 283f65744..f21b1b61a 100644 --- a/app/controllers/seeds_controller.rb +++ b/app/controllers/seeds_controller.rb @@ -75,7 +75,7 @@ class SeedsController < ApplicationController crop.seeds else Seed - end.order("seeds.created_at": :desc).includes(:owner, :crop).paginate(page: params[:page]) + end.order(created_at: :desc).includes(:owner, :crop).paginate(page: params[:page]) end def csv_filename From e3886ce5b5f4abbc041f81e180694247b1aaa193 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 20:10:01 +1300 Subject: [PATCH 48/58] Fixed up unescaped model attribute --- app/views/plant_parts/index.html.haml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/plant_parts/index.html.haml b/app/views/plant_parts/index.html.haml index c4a8e9b82..34846e9c3 100644 --- a/app/views/plant_parts/index.html.haml +++ b/app/views/plant_parts/index.html.haml @@ -9,7 +9,8 @@ - if plant_part.crops.empty? No crops are harvested for this plant part (yet). - else - != plant_part.crops.map { |c| link_to(c, c) }.join(", ") + - plant_part.crops.limit(100).each do |crop| + = link_to(crop, crop_path(crop)) %p = link_to "More detail", plant_part @@ -18,6 +19,3 @@ = link_to 'Edit', edit_plant_part_path(plant_part), class: 'btn btn-default btn-xs' - if can? :destroy, plant_part = link_to 'Delete', plant_part, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs' - - - From 3058160a59904da493238e2491f255f18983343c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 20:12:28 +1300 Subject: [PATCH 49/58] Removed an orderng spec for gardens --- spec/models/garden_spec.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/spec/models/garden_spec.rb b/spec/models/garden_spec.rb index cbb097d91..f8e5a3311 100644 --- a/spec/models/garden_spec.rb +++ b/spec/models/garden_spec.rb @@ -93,14 +93,6 @@ describe Garden do end end - context 'ordering' do - it "should be sorted alphabetically" do - FactoryBot.create(:garden_z) - a = FactoryBot.create(:garden_a) - Garden.first.should == a - end - end - it "destroys plantings when deleted" do garden = FactoryBot.create(:garden, owner: owner) @planting1 = FactoryBot.create(:planting, garden: garden, owner: garden.owner) From 9e000233329d3420d1859f6f8c9ea07aaa22b53d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 20:53:05 +1300 Subject: [PATCH 50/58] Fixed post ordering --- app/controllers/posts_controller.rb | 2 +- app/models/post.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index b72d22fae..287ef6f2a 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -66,6 +66,6 @@ class PostsController < ApplicationController @author.posts else Post - end.order("posts.created_at": :desc).includes(:author, comments: :author).paginate(page: params[:page]) + end.order(created_at: :desc).includes(:author, comments: :author).paginate(page: params[:page]) end end diff --git a/app/models/post.rb b/app/models/post.rb index 6014e8f64..76dfcd5d8 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -38,7 +38,7 @@ class Post < ActiveRecord::Base # i.e. the time of the most recent comment, or of the post itself if # there are no comments. def recent_activity - comments.present? ? comments.reorder('created_at DESC').first.created_at : created_at + comments.present? ? comments.order(created_at: :desc).first.created_at : created_at end # return posts sorted by recent activity From 3a3f4eefbf939382d3bb04d49913ecacf141c41a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 20:56:29 +1300 Subject: [PATCH 51/58] Added sort to members controller --- app/controllers/members_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index c7460dafc..1353a8720 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -96,8 +96,10 @@ class MembersController < ApplicationController end def members - q = Member.confirmed - q = q.recently_joined if @sort == 'recently_joined' - q.paginate(page: params[:page]) + if @sort == 'recently_joined' + Member.recently_joined + else + Member.order(:login_name) + end.confirmed.paginate(page: params[:page]) end end From d7ec4eacee45d1bd99a3f0f1041919f2a7d594e6 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 21:36:14 +1300 Subject: [PATCH 52/58] Fix sort on plant parts --- app/controllers/plant_parts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/plant_parts_controller.rb b/app/controllers/plant_parts_controller.rb index 2841e54e7..1e594fd72 100644 --- a/app/controllers/plant_parts_controller.rb +++ b/app/controllers/plant_parts_controller.rb @@ -4,7 +4,7 @@ class PlantPartsController < ApplicationController responders :flash def index - @plant_parts = PlantPart.all.order("plant_parts.name") + @plant_parts = PlantPart.all.order(:name) respond_with(@plant_parts) end From 8d0bec34a67e328bdc667a227f90d834d5e2b5fc Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 27 Nov 2017 21:38:09 +1300 Subject: [PATCH 53/58] Crops controller spec, use let, other cleanup --- spec/controllers/crops_controller_spec.rb | 38 ++++++++++++----------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/spec/controllers/crops_controller_spec.rb b/spec/controllers/crops_controller_spec.rb index 1f9e06d43..5b682f6c2 100644 --- a/spec/controllers/crops_controller_spec.rb +++ b/spec/controllers/crops_controller_spec.rb @@ -11,37 +11,39 @@ describe CropsController do } end + subject { response } + describe "GET crop wrangler homepage" do - it 'fetches the crop wrangler homepage' do - get :wrangle - response.should be_success - response.should render_template("crops/wrangle") - expect(assigns[:crop_wranglers]).to eq(Role.crop_wranglers) + describe 'fetches the crop wrangler homepage' do + before { get :wrangle } + it { is_expected.to be_success } + it { is_expected.to render_template("crops/wrangle") } + it { expect(assigns[:crop_wranglers]).to eq(Role.crop_wranglers) } end end describe "GET crop hierarchy " do - it 'fetches the crop hierarchy page' do - get :hierarchy - response.should be_success - response.should render_template("crops/hierarchy") + describe 'fetches the crop hierarchy page' do + before { get :hierarchy } + it { is_expected.to be_success } + it { is_expected.to render_template("crops/hierarchy") } end end describe "GET crop search" do - it 'fetches the crop search page' do - get :search - response.should be_success - response.should render_template("crops/search") + describe 'fetches the crop search page' do + before { get :search } + it { is_expected.to be_success } + it { is_expected.to render_template("crops/search") } end end describe "GET RSS feed" do - it "returns an RSS feed" do - get :index, format: "rss" - response.should be_success - response.should render_template("crops/index") - response.content_type.should eq("application/rss+xml") + describe "returns an RSS feed" do + before { get :index, format: "rss" } + it { is_expected.to be_success } + it { is_expected.to render_template("crops/index") } + it { expect(response.content_type).to eq("application/rss+xml") } end end end From 09f82d599560e5792bc542af71762572a2dd5db3 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 28 Nov 2017 09:30:14 +1300 Subject: [PATCH 54/58] Tidy up home/crops partial view --- spec/views/home/_crops.html.haml_spec.rb | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/spec/views/home/_crops.html.haml_spec.rb b/spec/views/home/_crops.html.haml_spec.rb index cc91976b8..254fcb2f6 100644 --- a/spec/views/home/_crops.html.haml_spec.rb +++ b/spec/views/home/_crops.html.haml_spec.rb @@ -1,27 +1,18 @@ require 'rails_helper' describe 'home/_crops.html.haml', type: "view" do - before(:each) do - # we need to set up an "interesting" crop - @crop = FactoryBot.create(:crop) - (1..3).each do - @planting = FactoryBot.create(:planting, crop: @crop) - end - @photo = FactoryBot.create(:photo) - (1..3).each do - @crop.plantings.first.photos << @photo - end - render - end - + let!(:crop) { FactoryBot.create(:crop, plantings: FactoryBot.create_list(:planting, 3)) } + let!(:photo) { FactoryBot.create(:photo, plantings: [crop.plantings.first]) } + let(:planting) { crop.plantings.first } + before(:each) { render } it 'shows crops section' do assert_select 'h2', text: 'Some of our crops' - assert_select "a[href='#{crop_path(@crop)}']" + assert_select "a[href='#{crop_path(crop)}']" end it 'shows plantings section' do assert_select 'h2', text: 'Recently planted' - rendered.should have_content @planting.location + rendered.should have_content planting.location end it 'shows recently added crops' do From a62b668781aa6bcaf239e957aa26d5b66c3bfc7f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 28 Nov 2017 09:37:44 +1300 Subject: [PATCH 55/58] Fix up duplicate order item in controller spec, and DRY --- app/controllers/order_items_controller.rb | 23 ++++-- .../order_items_controller_spec.rb | 81 +++++++++---------- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/app/controllers/order_items_controller.rb b/app/controllers/order_items_controller.rb index 0eb381a89..326cff21f 100644 --- a/app/controllers/order_items_controller.rb +++ b/app/controllers/order_items_controller.rb @@ -1,28 +1,35 @@ class OrderItemsController < ApplicationController before_action :authenticate_member! load_and_authorize_resource + respond_to :html + responders :flash # POST /order_items def create if params[:order_item][:price] params[:order_item][:price] = params[:order_item][:price].to_f * 100 # convert to cents end + @order_item = OrderItem.new(order_item_params) @order_item.order = current_member.current_order || Order.create(member_id: current_member.id) - respond_to do |format| - if @order_item.save - format.html { redirect_to @order_item.order, notice: 'Added item to your order.' } - else - errors = @order_item.errors.empty? ? - "There was a problem with your order." : @order_item.errors.full_messages.to_sentence - format.html { redirect_to shop_path, alert: errors } - end + if @order_item.save + redirect_to @order_item.order, notice: 'Added item to your order.' + else + redirect_to shop_path, alert: errors end end private + def errors + if @order_item.errors.empty? + "There was a problem with your order." + else + @order_item.errors.full_messages.to_sentence + end + end + def order_item_params params.require(:order_item).permit(:order_id, :price, :product_id, :quantity) end diff --git a/spec/controllers/order_items_controller_spec.rb b/spec/controllers/order_items_controller_spec.rb index 1da3c3b8d..4de8eb98d 100644 --- a/spec/controllers/order_items_controller_spec.rb +++ b/spec/controllers/order_items_controller_spec.rb @@ -3,53 +3,48 @@ require 'rails_helper' describe OrderItemsController do login_member(:admin_member) - before(:each) do - @member = FactoryBot.create(:member) - sign_in @member - @product = FactoryBot.create(:product) - @order = FactoryBot.create(:order, member: @member) - @order_item = FactoryBot.create(:order_item, - order: @order, - product: @product, - price: @product.min_price) + let(:member) { FactoryBot.create(:member) } + let(:product) { FactoryBot.create(:product) } + let(:order) { FactoryBot.create(:order, member: member) } + let(:order_item) do + FactoryBot.create(:order_item, + order: order, + product: product, + price: product.min_price) end - describe "POST create" do - it "redirects to order" do - @order = FactoryBot.create(:order, member: @member) - post :create, order_item: { - order_id: @order.id, - product_id: @product.id, - price: @product.min_price - } - response.should redirect_to(OrderItem.last.order) - end + context 'signed in' do + before { sign_in member } - it 'creates an order for you' do - @member = FactoryBot.create(:member) - sign_in @member - @product = FactoryBot.create(:product) - expect { - 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 + describe "POST create" do + describe "redirects to order" do + before do + post :create, order_item: { order_id: order.id, product_id: product.id, price: product.min_price } + end + it { expect(response).to redirect_to(OrderItem.last.order) } + it { expect(OrderItem.last.order).to be_an_instance_of Order } + end - describe "with non-int price" do - it "converts 3.33 to 333 cents" do - @order = FactoryBot.create(:order, member: @member) - @product = FactoryBot.create(:product, min_price: 1) - expect { - 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 + describe 'creates an order for you' do + it do + expect do + post :create, order_item: { + product_id: product.id, + price: product.min_price + } + end.to change(Order, :count).by(1) + end + end + + describe "with non-int price" do + it "converts 3.33 to 333 cents" do + order = FactoryBot.create(:order, member: member) + product = FactoryBot.create(:product, min_price: 1) + expect do + post :create, order_item: { order_id: order.id, product_id: product.id, price: 3.33 } + end.to change(OrderItem, :count).by(1) + OrderItem.last.price.should eq 333 + end end end end From c8a200bf19b93a50833183e2f39b42e7eb3ffd96 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 28 Nov 2017 20:19:43 +1300 Subject: [PATCH 56/58] Changed selector in view spec it was having trouble finding the link --- spec/features/gardens_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/gardens_spec.rb b/spec/features/gardens_spec.rb index e9a20d060..3d00d4a5f 100644 --- a/spec/features/gardens_spec.rb +++ b/spec/features/gardens_spec.rb @@ -58,7 +58,7 @@ feature "Planting a crop", js: true do end scenario "button on index to edit garden" do - first(".garden-info").click_link("Edit") + first(".garden-info").click_link("edit_garden_link") expect(page).to have_content 'Edit garden' end end From 6ed7376c58b6861fce1c737fadd2a645515b2246 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 29 Nov 2017 10:41:55 +1300 Subject: [PATCH 57/58] Name garden in spec to ensure it's ordered first --- spec/features/gardens_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/features/gardens_spec.rb b/spec/features/gardens_spec.rb index 3d00d4a5f..a299a0197 100644 --- a/spec/features/gardens_spec.rb +++ b/spec/features/gardens_spec.rb @@ -1,7 +1,8 @@ require 'rails_helper' feature "Planting a crop", js: true do - let!(:garden) { create :garden } + # name is aaa to ensure it is ordered first + let!(:garden) { create :garden, name: 'aaa' } let!(:planting) { create :planting, garden: garden, owner: garden.owner, planted_at: Date.parse("2013-3-10") } let!(:tomato) { create :tomato } let!(:finished_planting) { create :finished_planting, owner: garden.owner, garden: garden, crop: tomato } From f08d02f4c5267e307ad635b9eb9b1ffcd7bd2dca Mon Sep 17 00:00:00 2001 From: deppbot Date: Sat, 2 Dec 2017 04:09:51 +0800 Subject: [PATCH 58/58] Bundle Update on 2017-12-02 --- Gemfile.lock | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 74118c7e9..71addf491 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -194,7 +194,7 @@ GEM formatador (0.2.5) friendly_id (5.2.3) activerecord (>= 4.0.0) - geocoder (1.4.4) + geocoder (1.4.5) gibbon (1.2.1) httparty multi_json (>= 1.9.0) @@ -298,7 +298,7 @@ GEM kaminari-core (= 1.1.1) kaminari-core (1.1.1) kgio (2.11.0) - kramdown (1.16.1) + kramdown (1.16.2) launchy (2.4.3) addressable (~> 2.3) leaflet-rails (1.2.0) @@ -484,7 +484,7 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - selenium-webdriver (3.7.0) + selenium-webdriver (3.8.0) childprocess (~> 0.5) rubyzip (~> 1.0) sexp_processor (4.10.0) @@ -499,8 +499,8 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sparkpost_rails (1.4.0) - rails (>= 4.0, < 5.1) + sparkpost_rails (1.5.0) + rails (>= 4.0, < 5.2) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -519,7 +519,7 @@ GEM thread_safe (0.3.6) tilt (2.0.8) timecop (0.9.1) - tins (1.15.1) + tins (1.16.0) trollop (1.16.2) tzinfo (1.2.4) thread_safe (~> 0.1) @@ -636,6 +636,7 @@ DEPENDENCIES will_paginate xmlrpc + RUBY VERSION ruby 2.4.1p111