mirror of
https://github.com/Growstuff/growstuff.git
synced 2025-12-23 17:47:49 -05:00
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 <cesy.avon@gmail.com> Co-authored-by: codefactor-io <support@codefactor.io>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
FactoryBot.define do
|
||||
factory :scientific_name do
|
||||
association :crop, factory: :crop
|
||||
association :crop
|
||||
name { "Beanus Magicus" }
|
||||
creator
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
|
||||
@@ -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 }
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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 }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user