Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/bundler/rails-7.1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dorner authored May 17, 2024
2 parents 6f2b4a0 + 3d4b658 commit 0cb3471
Show file tree
Hide file tree
Showing 263 changed files with 434 additions and 495 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ group :development, :test do
gem 'rubocop-performance'
gem "rubocop-rails", "~> 2.25.0"
# Default rules for Rubocop.
gem "standard", "~> 1.35"
gem "standard", "~> 1.36"
# Erb linter.
gem "erb_lint"
end
Expand Down
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rubocop (1.62.1)
rubocop (1.63.5)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -636,12 +636,12 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
standard (1.35.1)
standard (1.36.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.62.0)
rubocop (~> 1.63.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.3)
standard-performance (~> 1.4)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
Expand Down Expand Up @@ -778,7 +778,7 @@ DEPENDENCIES
simple_form
simplecov
sprockets (~> 4.2.1)
standard (~> 1.35)
standard (~> 1.36)
stimulus-rails
strong_migrations (= 1.8.0)
terser
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/admins_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=begin
require "rails_helper"
RSpec.describe AdminsController, type: :controller, skip_seed: true do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe AdminsController, type: :controller do
let(:organization) { create(:organization) }
let(:organization_admin) { create(:organization_admin, organization: organization) }
let(:default_params) do
Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/application_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RSpec.describe ApplicationController, skip_seed: true do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe ApplicationController do
let(:organization) { create(:organization) }

describe "current_organization" do
before(:each) do
Expand All @@ -15,8 +15,8 @@
end

context "As an org user" do
let(:org) { create(:organization, skip_items: true) }
let(:org2) { create(:organization, skip_items: true) }
let(:org) { create(:organization) }
let(:org2) { create(:organization) }
let(:user) { create(:user, organization: org) }
before(:each) do
user.add_role(Role::ORG_USER, org2) # add a second role
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/distributions_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RSpec.describe DistributionsController, type: :controller, skip_seed: true do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe DistributionsController, type: :controller do
let(:organization) { create(:organization) }
let(:user) { create(:user, organization: organization) }
let(:partner) { create(:partner, organization: organization) }

Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/donation_sites_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RSpec.describe DonationSitesController, type: :controller, skip_seed: true do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe DonationSitesController, type: :controller do
let(:organization) { create(:organization) }
let(:user) { create(:user, organization: organization) }

context "While signed in" do
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/donations_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RSpec.describe DonationsController, type: :controller, skip_seed: true do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe DonationsController, type: :controller do
let(:organization) { create(:organization) }
let(:user) { create(:user, organization: organization) }
let(:organization_admin) { create(:organization_admin, organization: organization) }

Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/help_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'rails_helper'

RSpec.describe HelpController, type: :controller, skip_seed: true do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe HelpController, type: :controller do
let(:organization) { create(:organization) }
let(:user) { create(:user, organization: organization) }

let(:default_params) do
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/items_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RSpec.describe ItemsController, type: :controller, skip_seed: true do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe ItemsController, type: :controller do
let(:organization) { create(:organization) }
let(:user) { create(:user, organization: organization) }

context "While signed in" do
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/transfers_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RSpec.describe TransfersController, type: :controller, skip_seed: true do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe TransfersController, type: :controller do
let(:organization) { create(:organization) }
let(:user) { create(:user, organization: organization) }

context "While signed in" do
Expand Down
2 changes: 1 addition & 1 deletion spec/events/inventory_aggregate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RSpec.describe InventoryAggregate, skip_seed: true do
RSpec.describe InventoryAggregate do
let(:organization) { FactoryBot.create(:organization, :with_items) }
let(:storage_location1) { FactoryBot.create(:storage_location, organization: organization) }
let(:storage_location2) { FactoryBot.create(:storage_location, organization: organization) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/adjustments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

FactoryBot.define do
factory :adjustment do
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
storage_location
comment { "A comment" }
user { organization.users.try(:first) || create(:user, organization_id: organization.id) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/audits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FactoryBot.define do
factory :audit do
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
user { nil }
storage_location { nil }
adjustment { nil }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/barcode_items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
end

factory :barcode_item, class: "BarcodeItem" do
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
sequence(:value) { (SecureRandom.random_number * (10**12)).to_i } # 037000863427
quantity { 50 }
barcodeable { nil }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/distributions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
factory :distribution do
storage_location
partner
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
issued_at { nil }
delivery_method { :pick_up }
state { :scheduled }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/donation_site.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :donation_site do
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
name { Faker::Company.name }
address { "1500 Remount Road, Front Royal, VA 22630" }
active { true }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/donations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
source { Donation::SOURCES[:misc] }
comment { "It's a fine day for diapers." }
storage_location
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
issued_at { nil }

factory :manufacturer_donation do
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
FactoryBot.define do
factory :item do
sequence(:name) { |n| "#{n}T Diapers" }
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
partner_key { BaseItem.first&.partner_key || create(:base_item).partner_key }
kit { nil }

Expand Down
2 changes: 1 addition & 1 deletion spec/factories/manufacturers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

FactoryBot.define do
factory :manufacturer do
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
sequence(:name) { |n| "Manufacturer #{n}" }
end
end
8 changes: 2 additions & 6 deletions spec/factories/organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,9 @@

trait :with_items do
after(:create) do |instance, evaluator|
seed_base_items if BaseItem.count.zero?
Organization.seed_items(instance)
seed_base_items if BaseItem.count.zero? # seeds 45 base items if none exist
Organization.seed_items(instance) # creates 1 item for each base item
end
end

after(:create) do |instance, evaluator|
Organization.seed_items(instance) unless evaluator.skip_items
end
end
end
2 changes: 1 addition & 1 deletion spec/factories/partner_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
FactoryBot.define do
factory :partner_group do
sequence(:name) { |n| "Group #{n}" }
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
reminder_day { 14 }
deadline_day { 28 }

Expand Down
2 changes: 1 addition & 1 deletion spec/factories/partners.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
sequence(:email) { |n| "leslie#{n}@gmail.com" }
notes { "Lorem ipsum" }
send_reminders { true }
organization_id { Organization.try(:first).try(:id) || create(:organization, skip_items: true).id }
organization_id { Organization.try(:first).try(:id) || create(:organization).id }

trait :approved do
status { :approved }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/product_drive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
start_date { Time.current }
end_date { Time.current }
virtual { [true, false].sample }
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
end
end
2 changes: 1 addition & 1 deletion spec/factories/product_drive_participants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

FactoryBot.define do
factory :product_drive_participant do
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
contact_name { "Don Draper" }
business_name { "Awesome Business" }
sequence(:email) { |n| "don#{n}@scdp.com" }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/purchases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
comment { "It's a fine day for diapers." }
purchased_from { "Google" }
storage_location
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
issued_at { nil }
amount_spent_in_cents { 10_00 }
vendor { Vendor.try(:first) || create(:vendor) }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/storage_locations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
factory :storage_location do
name { "Smithsonian Conservation Center" }
address { "1500 Remount Road, Front Royal, VA 22630" }
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
square_footage { 100 }
warehouse_type { StorageLocation::WAREHOUSE_TYPES.sample }
transient do
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/transfers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
transient do
storage_location { nil }
end
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
from { nil }
to { nil }
comment { "A comment" }
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
password { "password!" }
password_confirmation { "password!" }
transient do
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
end

after(:create) do |user, evaluator|
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/vendor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

FactoryBot.define do
factory :vendor do
organization { Organization.try(:first) || create(:organization, skip_items: true) }
organization { Organization.try(:first) || create(:organization) }
contact_name { "Don Draper" }
business_name { "Awesome Business" }
sequence(:email) { |n| "don#{n}@scdp.com" }
Expand Down
6 changes: 3 additions & 3 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"

RSpec.describe ApplicationHelper, type: :helper, seed_db: false do
let(:organization) { create(:organization, skip_items: true) }
RSpec.describe ApplicationHelper, type: :helper do
let(:organization) { create(:organization) }
let(:user) { create(:user, organization: organization) }

describe "default_title_content" do
Expand Down Expand Up @@ -43,7 +43,7 @@ def current_organization; end

describe "can_administrate?" do
let(:org_1) { organization }
let(:org_2) { create(:organization, skip_items: true) }
let(:org_2) { create(:organization) }

helper do
def current_organization; end
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/dashboard_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RSpec.describe DashboardHelper, type: :helper, seed_db: false do
RSpec.describe DashboardHelper, type: :helper do
describe "#recently_added_user_display_text" do
context "when the user has a name" do
it "returns the user's display name" do
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/historical_trends_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rspec"

RSpec.describe HistoricalTrendsHelper, seed_db: false do
RSpec.describe HistoricalTrendsHelper do
describe "#last_12_months" do
it "returns the last 12 months starting from July when the current month is June" do
allow_any_instance_of(Time).to receive(:month).and_return(6)
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/product_drive_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe ProductDriveHelper, type: :helper, seed_db: false do
RSpec.describe ProductDriveHelper, type: :helper do
describe '#is_virtual' do
context 'when the product drive was held virtually' do
let(:product_drive) { build(:product_drive, virtual: true) }
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/purchases_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe PurchasesHelper, type: :helper, seed_db: false do
RSpec.describe PurchasesHelper, type: :helper do
describe "#new_purchase_default_location" do
helper do
def current_organization
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/ui_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe UiHelper, type: :helper, seed_db: false do
RSpec.describe UiHelper, type: :helper do
describe 'optional_data_text' do
subject { helper.optional_data_text(field) }

Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/historical_data_cache_job_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

RSpec.describe HistoricalDataCacheJob, type: :job, skip_seed: true do
RSpec.describe HistoricalDataCacheJob, type: :job do
include ActiveJob::TestHelper

let(:organization) { create(:organization) }
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/notify_partner_job_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RSpec.describe NotifyPartnerJob, job: true, skip_seed: true do
RSpec.describe NotifyPartnerJob, job: true do
describe "#perform" do
let(:request) { create(:request) }
let(:mailer) { double(:mailer) }
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/partner_mailer_job_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RSpec.describe PartnerMailerJob, type: :job, skip_seed: true do
RSpec.describe PartnerMailerJob, type: :job do
describe "conditionally sending the emails" do
let(:organization) { create :organization }
let(:mailer_subject) { 'PartnerMailerJob subject' }
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/reminder_deadline_job_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe ReminderDeadlineJob, type: :job, skip_seed: true do
RSpec.describe ReminderDeadlineJob, type: :job do
describe '#perform' do
subject { -> { described_class.perform_now } }
let(:partner) { create(:partner) }
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/dispersed_past_dates_generator_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load "lib/dispersed_past_dates_generator.rb"

RSpec.describe DispersedPastDatesGenerator, skip_seed: true do
RSpec.describe DispersedPastDatesGenerator do
describe "constants" do
it "has 4 day ranges for generation of past dates" do
expect(described_class::DAYS_RANGES).to eq([0..6, 7..30, 31..300, 350..700])
Expand Down
2 changes: 1 addition & 1 deletion spec/mailers/account_request_mailer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RSpec.describe AccountRequestMailer, type: :mailer, skip_seed: true do
RSpec.describe AccountRequestMailer, type: :mailer do
describe '#confirmation' do
let(:mail) { AccountRequestMailer.confirmation(account_request_id: account_request_id) }
let(:account_request_id) { account_request.id }
Expand Down
Loading

0 comments on commit 0cb3471

Please sign in to comment.