From ee45b518ced9abff73c831166bb1fb4d917a9df4 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sun, 7 Jan 2024 21:05:59 +1030 Subject: [PATCH] Rubocop fixes (Stacked PR) (#3454) * Fix todo * Rubcop * Rubocop * Rubocop * Rename harvests_routing_spec.rb to harvests_controller_routing_spec.rb Making codeclimate happier * Rename for CodeFactor: updates_routing_spec.rb to posts_controller_updates_routing_spec.rb For codefactor * Rename for CodeFactor: follows_routing_spec.rb to follows_controller_routing_spec.rb * Rename for CodeFactor: forums_routing_spec.rb to forums_controller_routing_spec.rb * Rename spec/routing/roles_routing_spec.rb to spec/routing/admin/roles_controller_routing_spec.rb * Rename authentications_routing_spec.rb to authentications_controller_routing_spec.rb * Rename for CodeFactor: plantings_routing_spec.rb to plantings_controller_routing_spec.rb * Rename for CodeFactor: scientific_names_routing_spec.rb to scientific_names_controller_routing_spec.rb * Rename for CodeFactor: seeds_routing_spec.rb to seeds_controller_routing_spec.rb * Rename for CodeFactor: comments_routing_spec.rb to comments_controller_routing_spec.rb * Rename for CodeFactor: garden_types_routing_spec.rb to garden_types_controller_routing_spec.rb * Rename for CodeFactor: admin_routing_spec.rb to admin_controller_routing_spec.rb * Rename for CodeFactor: gardens_routing_spec.rb to gardens_controller_routing_spec.rb * Rename for CodeFactor: photos_routing_spec.rb to photos_controller_routing_spec.rb * Rename for CodeFactor: plant_parts_routing_spec.rb to plant_parts_controller_routing_spec.rb * Rename for CodeFactor: crops_routing_spec.rb to crops_controller_routing_spec.rb * [CodeFactor] Apply fixes * Rename * Code factor bot --------- Co-authored-by: Cesy Co-authored-by: codefactor-io --- .rubocop_todo.yml | 31 ------------------- CONTRIBUTORS.md | 1 + app/controllers/crops_controller.rb | 2 +- .../omniauth_callbacks_controller.rb | 2 +- spec/factories/scientific_name.rb | 2 +- spec/features/admin/admin_spec.rb | 2 +- spec/features/admin/forums_spec.rb | 2 +- spec/features/crops/alternate_name_spec.rb | 2 +- spec/features/crops/creating_a_crop_spec.rb | 4 ++- spec/features/crops/crop_detail_page_spec.rb | 2 +- spec/features/crops/crop_wranglers_spec.rb | 2 +- spec/features/crops/scientific_name_spec.rb | 2 +- spec/features/footer_spec.rb | 2 +- spec/features/gardens/gardens_spec.rb | 2 +- spec/features/likeable_spec.rb | 3 +- spec/features/locale_spec.rb | 2 +- spec/features/members/profile_spec.rb | 2 +- spec/features/percy/percy_spec.rb | 2 +- spec/features/seeds/adding_seeds_spec.rb | 2 +- spec/features/seeds/misc_seeds_spec.rb | 2 +- spec/features/signin_spec.rb | 2 +- spec/features/signup_spec.rb | 2 +- spec/features/timeline/index_spec.rb | 2 +- spec/models/crop_spec.rb | 1 + spec/models/photo_spec.rb | 4 +-- spec/rails_helper.rb | 2 +- .../roles_controller_routing_spec.rb} | 0 ...ec.rb => admin_controller_routing_spec.rb} | 0 ...uthentications_controller_routing_spec.rb} | 0 ...rb => comments_controller_routing_spec.rb} | 0 ...ec.rb => crops_controller_routing_spec.rb} | 0 ....rb => follows_controller_routing_spec.rb} | 0 ...c.rb => forums_controller_routing_spec.rb} | 0 ...> garden_types_controller_routing_spec.rb} | 0 ....rb => gardens_controller_routing_spec.rb} | 0 ...rb => harvests_controller_routing_spec.rb} | 0 ....rb => members_controller_routing_spec.rb} | 0 ...c.rb => photos_controller_routing_spec.rb} | 0 ...=> plant_parts_controller_routing_spec.rb} | 0 ...b => plantings_controller_routing_spec.rb} | 0 ... posts_controller_updates_routing_spec.rb} | 0 ...ientific_names_controller_routing_spec.rb} | 0 ...ec.rb => seeds_controller_routing_spec.rb} | 0 spec/spec_helper.rb | 2 +- spec/support/feature_helpers.rb | 2 ++ spec/views/home/_seeds.html.haml_spec.rb | 2 +- 46 files changed, 33 insertions(+), 57 deletions(-) rename spec/routing/{roles_routing_spec.rb => admin/roles_controller_routing_spec.rb} (100%) rename spec/routing/{admin_routing_spec.rb => admin_controller_routing_spec.rb} (100%) rename spec/routing/{authentications_routing_spec.rb => authentications_controller_routing_spec.rb} (100%) rename spec/routing/{comments_routing_spec.rb => comments_controller_routing_spec.rb} (100%) rename spec/routing/{crops_routing_spec.rb => crops_controller_routing_spec.rb} (100%) rename spec/routing/{follows_routing_spec.rb => follows_controller_routing_spec.rb} (100%) rename spec/routing/{forums_routing_spec.rb => forums_controller_routing_spec.rb} (100%) rename spec/routing/{garden_types_routing_spec.rb => garden_types_controller_routing_spec.rb} (100%) rename spec/routing/{gardens_routing_spec.rb => gardens_controller_routing_spec.rb} (100%) rename spec/routing/{harvests_routing_spec.rb => harvests_controller_routing_spec.rb} (100%) rename spec/routing/{member_routing_spec.rb => members_controller_routing_spec.rb} (100%) rename spec/routing/{photos_routing_spec.rb => photos_controller_routing_spec.rb} (100%) rename spec/routing/{plant_parts_routing_spec.rb => plant_parts_controller_routing_spec.rb} (100%) rename spec/routing/{plantings_routing_spec.rb => plantings_controller_routing_spec.rb} (100%) rename spec/routing/{updates_routing_spec.rb => posts_controller_updates_routing_spec.rb} (100%) rename spec/routing/{scientific_names_routing_spec.rb => scientific_names_controller_routing_spec.rb} (100%) rename spec/routing/{seeds_routing_spec.rb => seeds_controller_routing_spec.rb} (100%) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 122335cbf..4fa490610 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -48,12 +48,6 @@ FactoryBot/CreateList: - 'spec/views/places/show.html.haml_spec.rb' - 'spec/views/posts/index.html.haml_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -FactoryBot/RedundantFactoryOption: - Exclude: - - 'spec/factories/scientific_name.rb' - # Offense count: 1135 # This cop supports unsafe autocorrection (--autocorrect-all). FactoryBot/SyntaxMethods: @@ -101,15 +95,6 @@ Layout/LineEndStringConcatenationIndentation: Layout/LineLength: Max: 304 -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceBeforeBlockBraces: - Exclude: - - 'spec/models/photo_spec.rb' - # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). Lint/AmbiguousOperatorPrecedence: @@ -242,15 +227,6 @@ RSpec/EmptyExampleGroup: - 'spec/views/photos/edit.html.haml_spec.rb' - 'spec/views/posts/_single.html.haml_spec.rb' -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -RSpec/EmptyLineAfterExampleGroup: - Exclude: - - 'spec/features/crops/creating_a_crop_spec.rb' - - 'spec/features/likeable_spec.rb' - - 'spec/models/crop_spec.rb' - - 'spec/support/feature_helpers.rb' - # Offense count: 134 # Configuration parameters: CountAsOne. RSpec/ExampleLength: @@ -323,13 +299,6 @@ RSpec/MessageChain: RSpec/MessageSpies: EnforcedStyle: receive -# Offense count: 22 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: hash, symbol -RSpec/MetadataStyle: - Enabled: false - # Offense count: 1 RSpec/MultipleDescribes: Exclude: diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5362e2f72..b0f3e35db 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -97,5 +97,6 @@ submit the change with your pull request. ## Bots ### Security and Dependency Updates +- `codefactor-io[bot]` - DeppBot / [deppbot](https://github.com/deppbot) - `dependabot[bot]` [dependabot](https://github.com/dependabot-bot) / [dependabot-preview](https://github.com/apps/dependabot-preview) diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index b927f53ee..535a6d03f 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -163,7 +163,7 @@ class CropsController < ApplicationController return if params[param_name].blank? destroy_names(name_type) - params[param_name].each do |_i, value| + params[param_name].each_value do |value| create_name!(name_type, value) unless value.empty? end end diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index f01ad3d71..e19114b88 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -41,7 +41,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def after_sign_in_path_for(resource) if resource.tos_agreement - super resource + super(resource) else finish_signup_path(resource) end diff --git a/spec/factories/scientific_name.rb b/spec/factories/scientific_name.rb index ec43799ce..a8363397b 100644 --- a/spec/factories/scientific_name.rb +++ b/spec/factories/scientific_name.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :scientific_name do - association :crop, factory: :crop + association :crop name { "Beanus Magicus" } creator diff --git a/spec/features/admin/admin_spec.rb b/spec/features/admin/admin_spec.rb index a4f97ac22..e4cd871d1 100644 --- a/spec/features/admin/admin_spec.rb +++ b/spec/features/admin/admin_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "forums", js: true do +describe "forums", :js do context 'signed in admin' do include_context 'signed in admin' it "navigating to forum admin with js" do diff --git a/spec/features/admin/forums_spec.rb b/spec/features/admin/forums_spec.rb index fb90a9d5b..5c0847cdb 100644 --- a/spec/features/admin/forums_spec.rb +++ b/spec/features/admin/forums_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "forums", js: true do +describe "forums", :js do include_context 'signed in admin' let(:forum) { create(:forum) } diff --git a/spec/features/crops/alternate_name_spec.rb b/spec/features/crops/alternate_name_spec.rb index 8d9882daf..380a7f71d 100644 --- a/spec/features/crops/alternate_name_spec.rb +++ b/spec/features/crops/alternate_name_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "Alternate names", js: true do +describe "Alternate names", :js do let!(:alternate_eggplant) { create(:alternate_eggplant) } let(:crop) { alternate_eggplant.crop } diff --git a/spec/features/crops/creating_a_crop_spec.rb b/spec/features/crops/creating_a_crop_spec.rb index b4bb23e1b..afaaad7e2 100644 --- a/spec/features/crops/creating_a_crop_spec.rb +++ b/spec/features/crops/creating_a_crop_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "Crop", js: true do +describe "Crop", :js do shared_context 'fill in form' do before do visit new_crop_path @@ -22,6 +22,7 @@ describe "Crop", js: true do end end end + shared_examples 'request crop' do describe "requesting a crop with multiple scientific and alternate name" do include_examples 'fill in form' @@ -38,6 +39,7 @@ describe "Crop", js: true do it { expect(page).to have_content "Matsurika" } end end + shared_examples 'create crop' do describe "creating a crop with multiple scientific and alternate name" do include_examples 'fill in form' diff --git a/spec/features/crops/crop_detail_page_spec.rb b/spec/features/crops/crop_detail_page_spec.rb index 41e9126d5..b441bd7fe 100644 --- a/spec/features/crops/crop_detail_page_spec.rb +++ b/spec/features/crops/crop_detail_page_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "crop detail page", js: true do +describe "crop detail page", :js do subject do # Update the medians after all the # data has been loaded diff --git a/spec/features/crops/crop_wranglers_spec.rb b/spec/features/crops/crop_wranglers_spec.rb index 31949fcd8..7307d6e6a 100644 --- a/spec/features/crops/crop_wranglers_spec.rb +++ b/spec/features/crops/crop_wranglers_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "crop wranglers", js: true do +describe "crop wranglers", :js do context "signed in wrangler" do include_context 'signed in crop wrangler' let!(:crop_wranglers) { create_list(:crop_wrangling_member, 3) } diff --git a/spec/features/crops/scientific_name_spec.rb b/spec/features/crops/scientific_name_spec.rb index ccf2b2bbe..ac437bc05 100644 --- a/spec/features/crops/scientific_name_spec.rb +++ b/spec/features/crops/scientific_name_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "Scientific names", js: true do +describe "Scientific names", :js do let!(:zea_mays) { create(:zea_mays) } let(:crop) { zea_mays.crop } diff --git a/spec/features/footer_spec.rb b/spec/features/footer_spec.rb index 6e5713f62..147c68a6b 100644 --- a/spec/features/footer_spec.rb +++ b/spec/features/footer_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "footer", js: true do +describe "footer", :js do before { visit root_path } it "footer is on home page" do diff --git a/spec/features/gardens/gardens_spec.rb b/spec/features/gardens/gardens_spec.rb index 8d3170b73..15c73fd62 100644 --- a/spec/features/gardens/gardens_spec.rb +++ b/spec/features/gardens/gardens_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "Planting a crop", js: true do +describe "Planting a crop", :js do context 'signed in' do include_context 'signed in member' # name is aaa to ensure it is ordered first diff --git a/spec/features/likeable_spec.rb b/spec/features/likeable_spec.rb index da082ee29..adf4397fe 100644 --- a/spec/features/likeable_spec.rb +++ b/spec/features/likeable_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Likeable', :js, search: true do +describe 'Likeable', :js, :search do let(:another_member) { FactoryBot.create(:london_member) } let!(:post) { FactoryBot.create(:post, :reindex, author: member) } let!(:photo) { FactoryBot.create(:photo, :reindex, owner: member) } @@ -51,6 +51,7 @@ describe 'Likeable', :js, search: true do logout(another_member) end end + describe 'photos#index' do let(:path) { photos_path } diff --git a/spec/features/locale_spec.rb b/spec/features/locale_spec.rb index 093aad6c1..db3683710 100644 --- a/spec/features/locale_spec.rb +++ b/spec/features/locale_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "Changing locales", js: true do +describe "Changing locales", :js do after { I18n.locale = :en } let(:member) { FactoryBot.create(:member) } diff --git a/spec/features/members/profile_spec.rb b/spec/features/members/profile_spec.rb index c5978b890..5e206d3d7 100644 --- a/spec/features/members/profile_spec.rb +++ b/spec/features/members/profile_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "member profile", js: true do +describe "member profile", :js do let(:member) { create(:member) } let(:other_member) { create(:member) } let(:admin_member) { create(:admin_member) } diff --git a/spec/features/percy/percy_spec.rb b/spec/features/percy/percy_spec.rb index 23cf28afc..066c48102 100644 --- a/spec/features/percy/percy_spec.rb +++ b/spec/features/percy/percy_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Test with visual testing', js: true, type: :feature do +describe 'Test with visual testing', :js, type: :feature do # Use the same random seed every time so our random data is the same # on every run, so doesn't trigger percy to see changes before { Faker::Config.random = Random.new(42) } diff --git a/spec/features/seeds/adding_seeds_spec.rb b/spec/features/seeds/adding_seeds_spec.rb index f3ea7bf0e..c1ee4d9e2 100644 --- a/spec/features/seeds/adding_seeds_spec.rb +++ b/spec/features/seeds/adding_seeds_spec.rb @@ -29,7 +29,7 @@ describe "Seeds", :js, :search do it { expect(page).to have_selector '.form-group.required', text: 'Will trade' } end - describe "Adding a new seed", js: true do + describe "Adding a new seed", :js do before do fill_autocomplete "crop", with: "mai" select_from_autocomplete "maize" diff --git a/spec/features/seeds/misc_seeds_spec.rb b/spec/features/seeds/misc_seeds_spec.rb index bbe357d25..24a8b3a78 100644 --- a/spec/features/seeds/misc_seeds_spec.rb +++ b/spec/features/seeds/misc_seeds_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "seeds", js: true do +describe "seeds", :js do context "signed in user" do include_context 'signed in member' xit "button on index to edit seed" do diff --git a/spec/features/signin_spec.rb b/spec/features/signin_spec.rb index aa9082bd3..e0680b191 100644 --- a/spec/features/signin_spec.rb +++ b/spec/features/signin_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "signin", js: true do +describe "signin", :js do let(:member) { FactoryBot.create(:member) } let(:recipient) { FactoryBot.create(:member) } let(:wrangler) { FactoryBot.create(:crop_wrangling_member) } diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb index 5dabbb02d..7745370bc 100644 --- a/spec/features/signup_spec.rb +++ b/spec/features/signup_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "signup", js: true do +describe "signup", :js do it "sign up for new account from top menubar" do visit crops_path # something other than front page, which has multiple signup links click_link 'Sign up' diff --git a/spec/features/timeline/index_spec.rb b/spec/features/timeline/index_spec.rb index 53d02879b..b7db4d4d5 100644 --- a/spec/features/timeline/index_spec.rb +++ b/spec/features/timeline/index_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe "timeline", js: true do +describe "timeline", :js do let(:member) { FactoryBot.create(:member) } let(:friend1) { FactoryBot.create(:member) } let(:friend2) { FactoryBot.create(:member) } diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index 423c86ade..9dd9bc3b2 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -143,6 +143,7 @@ describe Crop do shared_examples 'has default photo' do it { expect(described_class.has_photos).to include(crop) } end + let!(:crop) { FactoryBot.create(:tomato) } context 'with a planting photo' do diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 1c3adc07f..ffa37c595 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -115,7 +115,7 @@ describe Photo do planting.photos << photo harvest.destroy # photo is now used by harvest but not planting photo.destroy_if_unused - expect{ photo.reload }.not_to raise_error + expect { photo.reload }.not_to raise_error end it 'they are used by harvests but not plantings' do @@ -237,7 +237,7 @@ describe Photo do end end - describe 'Elastic search indexing', search: true do + describe 'Elastic search indexing', :search do let!(:planting) { FactoryBot.create(:planting, :reindex, owner: photo.owner) } let!(:crop) { FactoryBot.create(:crop, :reindex) } diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 37bf1aee3..24c9f8cf7 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -99,7 +99,7 @@ RSpec.configure do |config| config.include FactoryBot::Syntax::Methods # Prevent Poltergeist from fetching external URLs during feature tests - config.before(:each, js: true) do + config.before(:each, :js) do if page.driver.browser.respond_to?(:url_blacklist) page.driver.browser.url_blacklist = [ 'gravatar.com', diff --git a/spec/routing/roles_routing_spec.rb b/spec/routing/admin/roles_controller_routing_spec.rb similarity index 100% rename from spec/routing/roles_routing_spec.rb rename to spec/routing/admin/roles_controller_routing_spec.rb diff --git a/spec/routing/admin_routing_spec.rb b/spec/routing/admin_controller_routing_spec.rb similarity index 100% rename from spec/routing/admin_routing_spec.rb rename to spec/routing/admin_controller_routing_spec.rb diff --git a/spec/routing/authentications_routing_spec.rb b/spec/routing/authentications_controller_routing_spec.rb similarity index 100% rename from spec/routing/authentications_routing_spec.rb rename to spec/routing/authentications_controller_routing_spec.rb diff --git a/spec/routing/comments_routing_spec.rb b/spec/routing/comments_controller_routing_spec.rb similarity index 100% rename from spec/routing/comments_routing_spec.rb rename to spec/routing/comments_controller_routing_spec.rb diff --git a/spec/routing/crops_routing_spec.rb b/spec/routing/crops_controller_routing_spec.rb similarity index 100% rename from spec/routing/crops_routing_spec.rb rename to spec/routing/crops_controller_routing_spec.rb diff --git a/spec/routing/follows_routing_spec.rb b/spec/routing/follows_controller_routing_spec.rb similarity index 100% rename from spec/routing/follows_routing_spec.rb rename to spec/routing/follows_controller_routing_spec.rb diff --git a/spec/routing/forums_routing_spec.rb b/spec/routing/forums_controller_routing_spec.rb similarity index 100% rename from spec/routing/forums_routing_spec.rb rename to spec/routing/forums_controller_routing_spec.rb diff --git a/spec/routing/garden_types_routing_spec.rb b/spec/routing/garden_types_controller_routing_spec.rb similarity index 100% rename from spec/routing/garden_types_routing_spec.rb rename to spec/routing/garden_types_controller_routing_spec.rb diff --git a/spec/routing/gardens_routing_spec.rb b/spec/routing/gardens_controller_routing_spec.rb similarity index 100% rename from spec/routing/gardens_routing_spec.rb rename to spec/routing/gardens_controller_routing_spec.rb diff --git a/spec/routing/harvests_routing_spec.rb b/spec/routing/harvests_controller_routing_spec.rb similarity index 100% rename from spec/routing/harvests_routing_spec.rb rename to spec/routing/harvests_controller_routing_spec.rb diff --git a/spec/routing/member_routing_spec.rb b/spec/routing/members_controller_routing_spec.rb similarity index 100% rename from spec/routing/member_routing_spec.rb rename to spec/routing/members_controller_routing_spec.rb diff --git a/spec/routing/photos_routing_spec.rb b/spec/routing/photos_controller_routing_spec.rb similarity index 100% rename from spec/routing/photos_routing_spec.rb rename to spec/routing/photos_controller_routing_spec.rb diff --git a/spec/routing/plant_parts_routing_spec.rb b/spec/routing/plant_parts_controller_routing_spec.rb similarity index 100% rename from spec/routing/plant_parts_routing_spec.rb rename to spec/routing/plant_parts_controller_routing_spec.rb diff --git a/spec/routing/plantings_routing_spec.rb b/spec/routing/plantings_controller_routing_spec.rb similarity index 100% rename from spec/routing/plantings_routing_spec.rb rename to spec/routing/plantings_controller_routing_spec.rb diff --git a/spec/routing/updates_routing_spec.rb b/spec/routing/posts_controller_updates_routing_spec.rb similarity index 100% rename from spec/routing/updates_routing_spec.rb rename to spec/routing/posts_controller_updates_routing_spec.rb diff --git a/spec/routing/scientific_names_routing_spec.rb b/spec/routing/scientific_names_controller_routing_spec.rb similarity index 100% rename from spec/routing/scientific_names_routing_spec.rb rename to spec/routing/scientific_names_controller_routing_spec.rb diff --git a/spec/routing/seeds_routing_spec.rb b/spec/routing/seeds_controller_routing_spec.rb similarity index 100% rename from spec/routing/seeds_routing_spec.rb rename to spec/routing/seeds_controller_routing_spec.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 02a2f3e02..d514c4788 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -53,7 +53,7 @@ RSpec.configure do |config| Searchkick.disable_callbacks end - config.around(:each, search: true) do |example| + config.around(:each, :search) do |example| Searchkick.callbacks(true) do index_everything example.run diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index e13837157..8040cdd3a 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -16,10 +16,12 @@ module FeatureHelpers let(:member) { FactoryBot.create(:member) } include_examples 'sign in' end + shared_context 'signed in crop wrangler' do let(:member) { FactoryBot.create(:crop_wrangling_member) } include_examples 'sign in' end + shared_context 'signed in admin' do let(:member) { FactoryBot.create(:admin_member) } include_examples 'sign in' diff --git a/spec/views/home/_seeds.html.haml_spec.rb b/spec/views/home/_seeds.html.haml_spec.rb index 142b8f1e1..183f829dd 100644 --- a/spec/views/home/_seeds.html.haml_spec.rb +++ b/spec/views/home/_seeds.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'home/_seeds.html.haml', search: true, type: "view" do +describe 'home/_seeds.html.haml', :search, type: "view" do let!(:seed) { FactoryBot.create(:tradable_seed, owner:) } let(:owner) { FactoryBot.create(:london_member) }