Compare commits

...

16 Commits

Author SHA1 Message Date
Daniel O'Connor
9c4238e601 Merge branch 'dev' into feature-use-test-queue 2026-04-26 02:03:56 +09:30
Daniel O'Connor
bbe75df0ad Merge pull request #4550 from Growstuff/Style/FrozenStringLiteralComment
Rubocop: Style/FrozenStringLiteralComment
2026-04-24 08:41:23 +09:30
Daniel O'Connor
279cc88162 Update growstuff_markdown_spec.rb 2026-04-24 00:15:18 +09:30
Daniel O'Connor
fe4dd5c185 Merge pull request #4549 from Growstuff/Rails/WhereMissing
Rubocop: Rails/WhereMissing
2026-04-24 00:13:37 +09:30
Daniel O'Connor
75a2ec89e0 Merge branch 'dev' into feature-use-test-queue 2026-04-24 00:02:00 +09:30
Daniel O'Connor
d625eb2dbd Rubocop: Style/FrozenStringLiteralComment 2026-04-23 14:30:02 +00:00
Daniel O'Connor
2019d0e952 Rubocop: Rails/WhereMissing 2026-04-23 14:27:10 +00:00
Daniel O'Connor
e7659a75a4 Merge pull request #4548 from Growstuff/RSpecRails/HaveHttpStatus
Rubocop: RSpecRails/HaveHttpStatus
2026-04-23 23:52:40 +09:30
Daniel O'Connor
4a66bdc9fe Merge pull request #4546 from Growstuff/Rails/RedundantActiveRecordAllMethod
Rubocop: Rails/RedundantActiveRecordAllMethod
2026-04-23 23:46:39 +09:30
Daniel O'Connor
8de6b083f9 Rubocop: RSpecRails/HaveHttpStatus 2026-04-23 14:13:47 +00:00
Daniel O'Connor
accab7f84c Merge pull request #4545 from Growstuff/RSpecRails/InferredSpecType
Rubocop: RSpecRails/InferredSpecType
2026-04-23 23:29:17 +09:30
Daniel O'Connor
3f6dd59dfa Rubocop: Rails/RedundantActiveRecordAllMethod 2026-04-23 13:48:17 +00:00
Daniel O'Connor
0a71b44dea Merge pull request #4542 from Growstuff/RSpec/ContextMethod
Rubocop: RSpec/ContextMethod
2026-04-23 23:10:33 +09:30
Daniel O'Connor
ba75afb3f5 Rubocop: RSpecRails/InferredSpecType 2026-04-23 13:39:46 +00:00
Daniel O'Connor
6736ae3142 Rubocop: RSpec/ContextMethod 2026-04-23 13:20:47 +00:00
google-labs-jules[bot]
bd5769cf4f feat: Use test-queue to parallelize RSpec tests
This change introduces the `test-queue` gem to the project to enable parallel execution of the RSpec test suite. The CI configuration in `.github/workflows/ci.yml` has been updated to use a single `test-queue` command instead of multiple, sequential `rspec` commands. This will help to speed up the CI process by running tests concurrently.

The `--fail-fast` option has been removed from the RSpec command, as it is not recommended when running tests in parallel. This ensures that all tests are run, providing a complete picture of the test suite's status.
2025-11-29 03:40:46 +00:00
47 changed files with 74 additions and 84 deletions

View File

@@ -108,23 +108,5 @@ jobs:
run: bundle exec rails db:prepare
- name: Run rspec (lib)
run: bundle exec rspec spec/lib/ -fd --fail-fast
- name: Run rspec (services)
run: bundle exec rspec spec/services/ -fd --fail-fast
- name: Run rspec (models)
run: bundle exec rspec spec/models/ -fd --fail-fast
- name: Run rspec (controllers)
run: bundle exec rspec spec/controllers/ -fd --fail-fast
- name: Run rspec (views)
run: bundle exec rspec spec/views/ -fd --fail-fast
- name: Run rspec (routing)
run: bundle exec rspec spec/routing/ -fd --fail-fast
- name: Run rspec (request)
run: bundle exec rspec spec/requests/ -fd --fail-fast
- name: Run tests with test-queue
run: bundle exec test-queue rspec spec -fd

View File

@@ -242,12 +242,6 @@ RSpec/BeforeAfterAll:
Exclude:
- 'spec/tasks/import_spec.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
RSpec/ContextMethod:
Exclude:
- 'spec/requests/api/v1/activities_request_spec.rb'
# Offense count: 299
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
@@ -478,23 +472,6 @@ RSpec/VerifiedDoubles:
- 'spec/controllers/gardens_controller_spec.rb'
- 'spec/views/devise/shared/_links_spec.rb'
# Offense count: 7
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ResponseMethods.
# ResponseMethods: response, last_response
RSpecRails/HaveHttpStatus:
Exclude:
- 'spec/controllers/api/v1/plantings_controller_spec.rb'
- 'spec/controllers/harvests_controller_spec.rb'
- 'spec/controllers/likes_controller_spec.rb'
- 'spec/requests/harvests_spec.rb'
# Offense count: 17
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Inferences.
RSpecRails/InferredSpecType:
Enabled: false
# Offense count: 30
# Configuration parameters: Database.
# SupportedDatabases: mysql, postgresql
@@ -614,7 +591,6 @@ Rails/RedundantActiveRecordAllMethod:
- 'app/controllers/scientific_names_controller.rb'
- 'spec/features/members/deletion_spec.rb'
- 'spec/features/percy/percy_spec.rb'
- 'spec/models/harvest_spec.rb'
# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
@@ -696,12 +672,6 @@ Rails/WhereEquals:
- 'app/models/harvest.rb'
- 'app/models/planting.rb'
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Rails/WhereMissing:
Exclude:
- 'app/controllers/crops_controller.rb'
# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/WhereRange:
@@ -758,13 +728,6 @@ Style/FloatDivision:
Exclude:
- 'app/models/concerns/predict_planting.rb'
# Offense count: 22
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:

View File

@@ -196,6 +196,7 @@ group :test do
gem 'rails-controller-testing'
gem "rspec-rebound"
gem 'selenium-webdriver'
gem 'test-queue'
gem 'timecop'
gem 'vcr'
end

View File

@@ -719,6 +719,7 @@ GEM
unicode-display_width (>= 1.1.1, < 4)
terser (1.2.7)
execjs (>= 0.3.0, < 3)
test-queue (0.11.1)
thor (1.5.0)
thread_safe (0.3.6)
tilt (2.7.0)
@@ -873,6 +874,7 @@ DEPENDENCIES
sitemap_generator
sprockets (< 4)
terser
test-queue
timecop
unicorn
validate_url

View File

@@ -160,7 +160,7 @@ class CropsController < ApplicationController
when 'youtube'
Crop.approved.where(en_youtube_url: [nil, '']).order(plantings_count: :desc)
when 'alternate_names'
Crop.approved.left_joins(:alternate_names).where(alternate_names: { id: nil }).order(plantings_count: :desc)
Crop.approved.where.missing(:alternate_names).order(plantings_count: :desc)
when 'wikidata'
crops_with_wikidata = Crop.joins(:scientific_names).where.not(scientific_names: { wikidata_id: nil }).distinct
Crop.approved.where.not(id: crops_with_wikidata).order(plantings_count: :desc)

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.0 upgrade.

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# This migration comes from active_storage (originally 20180723000244)
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
def up

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddFieldsToCrops < ActiveRecord::Migration[5.2]
def change
add_column :crops, :row_spacing, :integer

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class PopulateCropFieldsFromOpenfarmData < ActiveRecord::Migration[5.2]
def up
Crop.find_each do |crop|

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddSocialMediaToMembers < ActiveRecord::Migration[6.0]
def change
add_column :members, :website_url, :string

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class RenameOtherHandleToOtherUrlInMembers < ActiveRecord::Migration[6.0]
def change
rename_column :members, :other_handle, :other_url

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateGardenCollaborators < ActiveRecord::Migration[7.2]
def change
create_table :garden_collaborators do |t|

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateAustralianFoodClassificationData < ActiveRecord::Migration[5.2]
def change
create_table :australian_food_classification_data do |t|

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class MakeNotificationsPolymorphic < ActiveRecord::Migration[6.1]
def change
add_column :notifications, :notifiable_type, :string

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class ChangeCommentsPolymorphic < ActiveRecord::Migration[7.2]
def change
add_column :comments, :commentable_type, :string

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddSourceToSeeds < ActiveRecord::Migration[7.2]
def change
add_column :seeds, :source, :string

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddIndexesCrops < ActiveRecord::Migration[7.2]
def change
add_index :alternate_names, :crop_id

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddOverallRatingPlantings < ActiveRecord::Migration[7.2]
def change
add_column :plantings, :overall_rating, :integer

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddEnYoutubeUrlToCrops < ActiveRecord::Migration[7.2]
def change
add_column :crops, :en_youtube_url, :string

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# This migration creates the `versions` table for the Version class.
# All other migrations PT provides are optional.
class CreateVersions < ActiveRecord::Migration[7.2]

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
# This migration adds the optional `object_changes` column, in which PaperTrail
# will store the `changes` diff for each update event. See the readme for
# details.

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddPublicFoodKeyToCrops < ActiveRecord::Migration[5.2]
def change
add_column :crops, :public_food_key, :string

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'csv'
namespace :import do

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe Api::V1::PlantingsController, type: :controller do
RSpec.describe Api::V1::PlantingsController do
subject { JSON.parse response.body }
let!(:member) { create(:member) }
@@ -42,7 +42,7 @@ RSpec.describe Api::V1::PlantingsController, type: :controller do
it { expect(matching_planting).to include('id' => my_planting.id.to_s) }
it { expect(matching_planting['attributes']).to eq expected_attributes }
it { expect(response.status).to eq 200 }
it { expect(response).to have_http_status :ok }
end
context 'with photo' do
@@ -81,7 +81,7 @@ RSpec.describe Api::V1::PlantingsController, type: :controller do
it { expect(matching_planting).to include('id' => my_planting.id.to_s) }
it { expect(matching_planting['attributes']).to eq expected_attributes }
it { expect(response.status).to eq 200 }
it { expect(response).to have_http_status :ok }
end
end
end

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe GardenTypesController, type: :controller do
RSpec.describe GardenTypesController do
include Devise::Test::ControllerHelpers
let(:valid_params) { { name: 'My second GardenType' } }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe GardensController, type: :controller do
RSpec.describe GardensController do
include Devise::Test::ControllerHelpers
let(:valid_params) { { name: 'My second Garden' } }

View File

@@ -51,7 +51,7 @@ describe HarvestsController, :search do
describe "generates a csv" do
before { get :index, format: "csv" }
it { expect(response.status).to eq 200 }
it { expect(response).to have_http_status :ok }
end
end

View File

@@ -19,7 +19,7 @@ describe LikesController do
it { JSON.parse(response.body)["description"] == "1 like" }
describe "Liking someone else's post" do
it { expect(response.code).to eq('201') }
it { expect(response).to have_http_status(:created) }
end
end
@@ -29,14 +29,14 @@ describe LikesController do
it { expect(response.content_type).to eq "application/json; charset=utf-8" }
describe "un-liking something i liked before" do
it { expect(response.code).to eq('200') }
it { expect(response).to have_http_status(:ok) }
it { JSON.parse(response.body)["description"] == "0 likes" }
end
describe "Deleting someone else's like" do
let(:like) { create(:like) }
it { expect(response.code).to eq('403') }
it { expect(response).to have_http_status(:forbidden) }
it { JSON.parse(response.body)["error"] == "Unable to like" }
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
FactoryBot.define do
factory :garden_collaborator do
garden

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'Creating a recurring activity' do

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
describe 'Test with visual testing', :js, type: :feature do
describe 'Test with visual testing', :js 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) }

View File

@@ -12,7 +12,7 @@ require 'rails_helper'
# end
# end
# end
RSpec.describe ButtonsHelper, type: :helper do
RSpec.describe ButtonsHelper do
before { allow(self).to receive(:can?).and_return(true) }
let(:garden) { create(:garden) }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe EventHelper, type: :helper do
RSpec.describe EventHelper do
subject { resolve_model(event) }
let(:planting) { create(:planting) }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe CropCompanion, type: :model do
RSpec.describe CropCompanion do
it 'has a crop' do
cc = described_class.new
cc.crop_a = create :tomato

View File

@@ -144,7 +144,7 @@ describe Harvest do
it 'lists most recent harvests first' do
@h1 = create(:harvest, created_at: 1.day.ago)
@h2 = create(:harvest, created_at: 1.hour.ago)
expect(described_class.all.order(created_at: :desc)).to eq [@h2, @h1]
expect(described_class.order(created_at: :desc)).to eq [@h2, @h1]
end
end

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Activities', type: :request do
RSpec.describe 'Activities' do
subject { JSON.parse response.body }
let(:member) { create(:member) }
@@ -60,7 +60,7 @@ RSpec.describe 'Activities', type: :request do
end
end
context '#update' do
describe '#update' do
let(:params) do
{
'data' => {

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Crops', type: :request do
RSpec.describe 'Crops' do
subject { JSON.parse response.body }
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Gardens', type: :request do
RSpec.describe 'Gardens' do
subject { JSON.parse response.body }
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Harvests', type: :request do
RSpec.describe 'Harvests' do
subject { JSON.parse response.body }
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Members', type: :request do
RSpec.describe 'Members' do
subject { JSON.parse response.body }
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Photos', type: :request do
RSpec.describe 'Photos' do
subject { JSON.parse response.body }
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Plantings', type: :request do
RSpec.describe 'Plantings' do
subject { JSON.parse response.body }
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe 'Seeds', type: :request do
RSpec.describe 'Seeds' do
subject { JSON.parse response.body }
let(:headers) { { 'Accept' => 'application/vnd.api+json' } }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe "GardenTypes", type: :request do
RSpec.describe "GardenTypes" do
describe "GET /garden_types" do
it "works! (now write some real specs)" do
get garden_types_path

View File

@@ -6,7 +6,7 @@ describe "Harvests" do
describe "GET /harvests" do
it "works! (now write some real specs)" do
get harvests_path
expect(response.status).to be 200
expect(response).to have_http_status :ok
end
end
end

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper'
require 'rake'

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
describe "places/_map_attribution.html.haml", type: :view do
describe "places/_map_attribution.html.haml" do
before do
render
end