diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb index f81aaef2cf..9f2561a067 100644 --- a/app/controllers/admin/organizations_controller.rb +++ b/app/controllers/admin/organizations_controller.rb @@ -86,7 +86,7 @@ def destroy def organization_params params.require(:organization) - .permit(:name, :short_name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_email_text, :account_request_id, :reminder_day, :deadline_day, + .permit(:name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_email_text, :account_request_id, :reminder_day, :deadline_day, users_attributes: %i(name email organization_admin), account_request_attributes: %i(ndbn_member_id id)) end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ef55bb6cfe..aa200634b0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,7 +30,7 @@ def current_organization elsif current_role.resource.is_a?(Organization) current_role.resource else - Organization.find_by(short_name: params[:organization_name]) + Organization.find_by(id: params[:organization_id]) end end helper_method :current_organization diff --git a/app/controllers/historical_trends/base_controller.rb b/app/controllers/historical_trends/base_controller.rb index d460ba686c..63b7a02d1f 100644 --- a/app/controllers/historical_trends/base_controller.rb +++ b/app/controllers/historical_trends/base_controller.rb @@ -1,5 +1,5 @@ class HistoricalTrends::BaseController < ApplicationController def cached_series(type) - Rails.cache.fetch("#{current_organization.short_name}-historical-#{type}-data") { HistoricalTrendService.new(current_organization.id, type).series } + Rails.cache.fetch("#{current_organization.id}-historical-#{type}-data") { HistoricalTrendService.new(current_organization.id, type).series } end end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 536f2d81e9..8be53b21c3 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -92,7 +92,7 @@ def organization_params request_type_formatter(params) params.require(:organization).permit( - :name, :short_name, :street, :city, :state, + :name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_storage_location, :default_email_text, :reminder_email_text, :invitation_text, :reminder_day, :deadline_day, diff --git a/app/jobs/historical_data_cache_job.rb b/app/jobs/historical_data_cache_job.rb index afe2d0ff99..841d47b47b 100644 --- a/app/jobs/historical_data_cache_job.rb +++ b/app/jobs/historical_data_cache_job.rb @@ -2,7 +2,7 @@ class HistoricalDataCacheJob < ApplicationJob def perform(org_id:, type:) organization = Organization.find_by(id: org_id) - Rails.cache.write("#{organization.short_name}-historical-#{type}-data", HistoricalTrendService.new(organization.id, type).series) + Rails.cache.write("#{organization.id}-historical-#{type}-data", HistoricalTrendService.new(organization.id, type).series) end def queue_name = "low_priority" diff --git a/app/models/organization.rb b/app/models/organization.rb index 7acc1d9fac..a6683f22cd 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -44,8 +44,10 @@ class Organization < ApplicationRecord include Deadlinable + # TODO: remove once migration "20250504183911_remove_short_name_from_organizations" has run in production + self.ignored_columns += ["short_name"] + validates :name, presence: true - validates :short_name, presence: true, format: /\A[a-z0-9_]+\z/i, uniqueness: true validates :url, format: { with: URI::DEFAULT_PARSER.make_regexp, message: "it should look like 'http://www.example.com'" }, allow_blank: true validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }, allow_blank: true validate :correct_logo_mime_type @@ -149,11 +151,6 @@ def assign_attributes_from_account_request(account_request) self end - # NOTE: when finding Organizations, use Organization.find_by(short_name: params[:organization_name]) - def to_param - short_name - end - def ordered_requests requests.order(status: :asc, updated_at: :desc) end diff --git a/app/services/distribution_service.rb b/app/services/distribution_service.rb index 2ee49456c9..9ed56e0734 100644 --- a/app/services/distribution_service.rb +++ b/app/services/distribution_service.rb @@ -10,10 +10,10 @@ def perform_distribution_service(&block) set_error(e) rescue Errors::InsufficientAllotment => e distribution.line_items.assign_insufficiency_errors(e.insufficient_items) - Rails.logger.error "[!] #{self.class.name} failed because of Insufficient Allotment #{distribution_organization.short_name}: #{distribution.errors.full_messages} [#{e.message}]" + Rails.logger.error "[!] #{self.class.name} failed because of Insufficient Allotment #{distribution_organization.name}: #{distribution.errors.full_messages} [#{e.message}]" set_error(e) rescue StandardError => e - Rails.logger.error "[!] #{self.class.name} failed for #{distribution_organization.short_name}: #{distribution.errors.full_messages} [#{e.inspect}]" + Rails.logger.error "[!] #{self.class.name} failed for #{distribution_organization.name}: #{distribution.errors.full_messages} [#{e.inspect}]" set_error(e) ensure return self diff --git a/app/views/admin/organizations/_list.html.erb b/app/views/admin/organizations/_list.html.erb index 6813b48aec..736285155c 100644 --- a/app/views/admin/organizations/_list.html.erb +++ b/app/views/admin/organizations/_list.html.erb @@ -12,7 +12,7 @@ <% @organizations.each do |organization| %> - + <%= organization.name %> <%= link_to organization.email, "mailto:#{organization.email}" %> <%= organization.created_at.strftime("%F") %> diff --git a/app/views/admin/organizations/_organization_row.html.erb b/app/views/admin/organizations/_organization_row.html.erb index c016e23385..2d40aea560 100644 --- a/app/views/admin/organizations/_organization_row.html.erb +++ b/app/views/admin/organizations/_organization_row.html.erb @@ -1,4 +1,4 @@ - + <%= organization_row.name %> <%= link_to organization_row.email, "mailto:#{organization_row.email}" %> <%= organization_row.created_at.strftime("%F") %> diff --git a/app/views/admin/organizations/edit.html.erb b/app/views/admin/organizations/edit.html.erb index 1d6efa10e3..14cdbcee9d 100644 --- a/app/views/admin/organizations/edit.html.erb +++ b/app/views/admin/organizations/edit.html.erb @@ -42,14 +42,6 @@ <%= f.input_field :name, class: "form-control" %> <% end %> - <%= f.input :short_name, required: true, autofocus: true, wrapper: :input_group do %> - - <%= f.input_field :short_name, class: "form-control" %> - <% end %> -
- APPROACH with EXTREME CAUTION! Editing the short name will break bookmarked links and calendar notices! If a - bank has asked you to do this, explain this to them first. -
<%= f.input :url, as: :url, placeholder: "http://www.example.com", wrapper: :input_group do %> <%= f.input_field :url, class: "form-control" %> diff --git a/app/views/admin/organizations/new.html.erb b/app/views/admin/organizations/new.html.erb index 62fd4906a8..948e8895fb 100644 --- a/app/views/admin/organizations/new.html.erb +++ b/app/views/admin/organizations/new.html.erb @@ -41,7 +41,6 @@ <%= f.hidden_field :account_request_id, value: @organization.account_request_id %> <%= f.input :name, required: true, autofocus: true %> - <%= f.input :short_name, required: true, autofocus: true %> <%= f.input :url, as: :url, placeholder: "http://www.example.com" %> <%= f.input :email %> <%= f.input :street %> diff --git a/app/views/organizations/_details.html.erb b/app/views/organizations/_details.html.erb index aafa8aa6f4..f9ae6247e6 100644 --- a/app/views/organizations/_details.html.erb +++ b/app/views/organizations/_details.html.erb @@ -14,12 +14,6 @@
Name

<%= current_organization&.name %>

-
-
Short name
-

- <%= @organization.short_name || "Not defined" %> -

-
NDBN membership ID

diff --git a/app/views/organizations/edit.html.erb b/app/views/organizations/edit.html.erb index 84c91c0634..b37c62c9c9 100644 --- a/app/views/organizations/edit.html.erb +++ b/app/views/organizations/edit.html.erb @@ -62,10 +62,6 @@ <%= f.input_field :name, class: "form-control" %> <% end %> - <%= f.input :short_name, required: true, autofocus: true, wrapper: :input_group do %> - - <%= f.input_field :short_name, disabled: true, class: "form-control" %> - <% end %> <%= f.input :ndbn_member, label: "NDBN membership ID", wrapper: :input_group do %>

<%# Removes "margin-bottom: 1rem" added by "form-group" class below %> <%= f.association :ndbn_member, label_method: :full_name, value_method: :id, label: false %> diff --git a/app/views/partners/_statuses.html.erb b/app/views/partners/_statuses.html.erb index 7f8166ed73..9b125a3646 100644 --- a/app/views/partners/_statuses.html.erb +++ b/app/views/partners/_statuses.html.erb @@ -11,7 +11,7 @@ partner_count = status_counts[status] || 0 %>
  • <%= fa_icon icon_mapping[status] || '', class: "bg-partner-#{status} " %> - <%= link_to_unless partner_count.zero?, "#{partner_count} #{status.humanize}", partners_path(organization_name:nil, filters: { by_status: status }), class: ("filtering" if status == current_filtered_status) %> + <%= link_to_unless partner_count.zero?, "#{partner_count} #{status.humanize}", partners_path(filters: { by_status: status }), class: ("filtering" if status == current_filtered_status) %>
  • <% end %>
  • diff --git a/app/views/users/_organization_user.html.erb b/app/views/users/_organization_user.html.erb index 5190838ff2..d125cb6e25 100644 --- a/app/views/users/_organization_user.html.erb +++ b/app/views/users/_organization_user.html.erb @@ -31,7 +31,7 @@ <% end %> <% if current_user.is_admin?(current_organization) && user.has_cached_role?(Role::ORG_ADMIN, current_organization) %> - <%= edit_button_to demote_to_user_organization_path(user_id: user.id, organization_name: current_organization.short_name), + <%= edit_button_to demote_to_user_organization_path(user_id: user.id, organization_id: current_organization.id), {text: 'Demote to User'}, {method: :post, rel: "nofollow", data: {confirm: 'This will demote the admin to user status. Are you sure that you want to submit this?', size: 'xs'}} unless user.id == current_user.id %> <% end %> diff --git a/db/seeds.rb b/db/seeds.rb index 90be3fd67d..08a50e99c6 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -36,8 +36,7 @@ def random_record_for_org(org, klass) # Organizations # ---------------------------------------------------------------------------- -pdx_org = Organization.find_or_create_by!(short_name: "diaper_bank") do |organization| - organization.name = "Pawnee Diaper Bank" +pdx_org = Organization.find_or_create_by!(name: "Pawnee Diaper Bank") do |organization| organization.street = "P.O. Box 22613" organization.city = "Pawnee" organization.state = "IN" @@ -46,8 +45,7 @@ def random_record_for_org(org, klass) end Organization.seed_items(pdx_org) -sf_org = Organization.find_or_create_by!(short_name: "sf_bank") do |organization| - organization.name = "SF Diaper Bank" +sf_org = Organization.find_or_create_by!(name: "SF Diaper Bank") do |organization| organization.street = "P.O. Box 12345" organization.city = "San Francisco" organization.state = "CA" @@ -56,8 +54,7 @@ def random_record_for_org(org, klass) end Organization.seed_items(sf_org) -sc_org = Organization.find_or_create_by!(short_name: "sc_bank") do |organization| - organization.name = "Second City Essentials Bank" +sc_org = Organization.find_or_create_by!(name: "Second City Essentials Bank") do |organization| organization.street = Faker::Address.street_address organization.city = Faker::Address.city organization.state = Faker::Address.state_abbr diff --git a/docs/user_guide/bank/getting_started_customization.md b/docs/user_guide/bank/getting_started_customization.md index 1e036b86f6..c3b21d9250 100644 --- a/docs/user_guide/bank/getting_started_customization.md +++ b/docs/user_guide/bank/getting_started_customization.md @@ -28,9 +28,6 @@ Here's all the fields, with a bit about the implications of each one: #### Name The name of your Essentials Bank. This appears in the headings on most screens, and will appear on printouts (such as the distribution printout many banks use as a packing slip), and most reports. -#### Short name -You don't change this -- we assigned it when we set it up -- it's here for reference for support calls if we need it. - #### NDBN membership ID This should be filled in already from your Account Request,but if it isn't, you can select it from the list. That list is updated on an irregular basis, so if you are an NDBN member, and you aren't on the list, let us know and we'll get a fresh list uploaded. This is included on the Annual Survey report. That's the only effect. diff --git a/docs/user_guide/bank/images/getting_started/customization/gs_customization_navigation_1.png b/docs/user_guide/bank/images/getting_started/customization/gs_customization_navigation_1.png index a95756ef2d..2c7a76f945 100644 Binary files a/docs/user_guide/bank/images/getting_started/customization/gs_customization_navigation_1.png and b/docs/user_guide/bank/images/getting_started/customization/gs_customization_navigation_1.png differ diff --git a/docs/user_guide/bank/images/getting_started/customization/gs_customization_top_of_edit.png b/docs/user_guide/bank/images/getting_started/customization/gs_customization_top_of_edit.png index 9feac3555f..7a33c815b2 100644 Binary files a/docs/user_guide/bank/images/getting_started/customization/gs_customization_top_of_edit.png and b/docs/user_guide/bank/images/getting_started/customization/gs_customization_top_of_edit.png differ diff --git a/lib/test_helpers/pdf_comparison_test_factory.rb b/lib/test_helpers/pdf_comparison_test_factory.rb index c442d2a991..aaf19970c7 100644 --- a/lib/test_helpers/pdf_comparison_test_factory.rb +++ b/lib/test_helpers/pdf_comparison_test_factory.rb @@ -13,7 +13,6 @@ def self.get_logo_file def self.create_organization_storage_items(logo = get_logo_file) org = Organization.create!( name: "Essentials Bank 1", - short_name: "db", street: "1500 Remount Road", city: "Front Royal", state: "VA", diff --git a/spec/controllers/distributions_controller_spec.rb b/spec/controllers/distributions_controller_spec.rb index 674e97acbd..c3f6ed7244 100644 --- a/spec/controllers/distributions_controller_spec.rb +++ b/spec/controllers/distributions_controller_spec.rb @@ -21,7 +21,6 @@ context "when distribution causes inventory to remain above minimum quantity for an organization" do let(:params) do { - organization_name: organization.id, distribution: { partner_id: partner.id, issued_at: Date.yesterday, @@ -45,7 +44,6 @@ context "when distribution causes inventory to fall below minimum quantity for a storage location" do let(:params) do { - organization_name: organization.id, distribution: { partner_id: partner.id, storage_location_id: second_storage_location.id, @@ -70,7 +68,6 @@ let(:storage_location) { create(:storage_location, :with_items, item: first_item, item_quantity: 20, organization: organization) } let(:params) do { - organization_name: organization.id, distribution: { partner_id: partner.id, storage_location_id: storage_location.id, @@ -96,7 +93,6 @@ let(:storage_location) { create(:storage_location, organization: organization) } let(:params) do { - organization_name: organization.id, distribution: { partner_id: partner.id, storage_location_id: storage_location.id, @@ -140,7 +136,6 @@ end let(:params) do { - organization_name: organization.id, distribution: { partner_id: partner.id, storage_location_id: storage_location.id, @@ -179,7 +174,6 @@ end let(:params) do { - organization_name: organization.id, distribution: { partner_id: partner.id, storage_location_id: storage_location.id, @@ -207,7 +201,6 @@ let(:storage_location) { create(:storage_location, :with_items, item: item, item_quantity: 2, organization: organization) } let(:params) do { - organization_name: organization.id, distribution: { partner_id: partner.id, storage_location_id: storage_location.id, @@ -230,7 +223,6 @@ context "when distribution reminder email is enabled" do let(:params) do { - organization_name: organization.id, distribution: { partner_id: partner.id, issued_at: Date.tomorrow, @@ -288,7 +280,6 @@ let(:distribution) { create(:distribution, storage_location: storage_location) } let(:params) do { - organization_name: organization.id, id: distribution.id, distribution: { storage_location_id: distribution.storage_location.id, @@ -326,7 +317,6 @@ let(:distribution) { create(:distribution, storage_location: storage_location, organization: organization) } let(:params) do { - organization_name: organization.id, id: distribution.id, distribution: { storage_location_id: distribution.storage_location.id, @@ -363,7 +353,6 @@ let(:distribution) { create(:distribution, :with_items, item: item1, storage_location: storage_location, organization: organization) } let(:params) do { - organization_name: organization.id, id: distribution.id, distribution: { storage_location_id: distribution.storage_location.id, @@ -410,7 +399,6 @@ let(:distribution) { create(:distribution, :with_items, item: item1, storage_location: storage_location, organization: organization, reminder_email_enabled: false, partner: partner) } let(:params) do { - organization_name: organization.id, id: distribution.id, distribution: { storage_location_id: distribution.storage_location.id, diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb index 32411eaede..d67082e648 100644 --- a/spec/controllers/help_controller_spec.rb +++ b/spec/controllers/help_controller_spec.rb @@ -2,17 +2,13 @@ let(:organization) { create(:organization) } let(:user) { create(:user, organization: organization) } - let(:default_params) do - { organization_name: organization.to_param } - end - context "While signed in as a normal user >" do before do sign_in(user) end describe "GET #show" do - subject { get :show, params: default_params } + subject { get :show } it "returns http success" do expect(subject).to be_successful end diff --git a/spec/factories/organizations.rb b/spec/factories/organizations.rb index 87f176dc30..f77da8d32c 100644 --- a/spec/factories/organizations.rb +++ b/spec/factories/organizations.rb @@ -44,7 +44,6 @@ end sequence(:name) { |n| "Essentials Bank #{n}" } # 037000863427 - sequence(:short_name) { |n| "db_#{n}" } # 037000863427 sequence(:email) { |n| "email#{n}@example.com" } # 037000863427 sequence(:url) { |n| "https://organization#{n}.org" } # 037000863427 street { "1500 Remount Road" } diff --git a/spec/jobs/historical_data_cache_job_spec.rb b/spec/jobs/historical_data_cache_job_spec.rb index a5d432d609..7ca669b4c9 100644 --- a/spec/jobs/historical_data_cache_job_spec.rb +++ b/spec/jobs/historical_data_cache_job_spec.rb @@ -17,7 +17,7 @@ perform_enqueued_jobs { job } - cached_data = Rails.cache.read("#{organization.short_name}-historical-#{type}-data") + cached_data = Rails.cache.read("#{organization.id}-historical-#{type}-data") expect(cached_data).to eq(expected_data) end end diff --git a/spec/models/organization_spec.rb b/spec/models/organization_spec.rb index ae3f5d7cc8..0627f20a21 100644 --- a/spec/models/organization_spec.rb +++ b/spec/models/organization_spec.rb @@ -63,11 +63,6 @@ )).to_not be_valid end - it "validates that short names are unique" do - expect(create(:organization, short_name: "foo_bar")).to be_valid - expect(build(:organization, short_name: "foo_bar")).to_not be_valid - end - it "validates that attachment file size is not higher than 1 MB" do fixture_path = Rails.root.join('spec', 'fixtures', 'files', 'logo.jpg') fixture_file = File.open(fixture_path) @@ -246,13 +241,6 @@ end end - describe "#short_name" do - it "can only contain valid characters" do - expect(build(:organization, short_name: "asdf")).to be_valid - expect(build(:organization, short_name: "Not Legal!")).to_not be_valid - end - end - describe "#ordered_requests" do let!(:new_active_request) { create(:request, comments: "first active") } let!(:old_active_request) { create(:request, comments: "second active") } diff --git a/spec/requests/admin/organizations_requests_spec.rb b/spec/requests/admin/organizations_requests_spec.rb index 7164a0b1d0..93253bc18e 100644 --- a/spec/requests/admin/organizations_requests_spec.rb +++ b/spec/requests/admin/organizations_requests_spec.rb @@ -1,8 +1,5 @@ RSpec.describe "Admin::Organizations", type: :request do let(:organization) { create(:organization) } - let(:default_params) do - { organization_name: organization.id } - end context "When logged in as a super admin" do before do @@ -110,7 +107,7 @@ describe "PATCH #update" do let(:organization) { create(:organization, name: "Original Name") } subject do - patch admin_organization_path(default_params.merge(id: organization.id, organization: { name: updated_name })) + patch admin_organization_path(id: organization.id, organization: { name: updated_name }) end context "with a valid update" do @@ -128,7 +125,7 @@ let(:successful) { 200 } subject do - patch admin_organization_path(default_params.merge(id: organization.id, organization: { name: updated_name })) + patch admin_organization_path(id: organization.id, organization: { name: updated_name }) end it "returns http success" do diff --git a/spec/requests/dashboard_requests_spec.rb b/spec/requests/dashboard_requests_spec.rb index 050aa06d34..76a9c0202a 100644 --- a/spec/requests/dashboard_requests_spec.rb +++ b/spec/requests/dashboard_requests_spec.rb @@ -26,14 +26,6 @@ expect(response.body).to include('switch_to_role') end end - - context "for another org" do - it "still displays the user's org" do - # another org - get dashboard_path(organization_name: create(:organization).to_param) - expect(response.body).to include(organization.name) - end - end end context "BroadcastAnnouncement card" do diff --git a/spec/requests/items_requests_spec.rb b/spec/requests/items_requests_spec.rb index 08379ae171..832ebcb836 100644 --- a/spec/requests/items_requests_spec.rb +++ b/spec/requests/items_requests_spec.rb @@ -1,5 +1,5 @@ RSpec.describe "Items", type: :request do - let(:organization) { create(:organization, short_name: "my_org") } + let(:organization) { create(:organization) } let(:user) { create(:user, organization: organization) } describe "while signed in" do diff --git a/spec/requests/organization_requests_spec.rb b/spec/requests/organization_requests_spec.rb index 85d51d1d58..b0e294d3b0 100644 --- a/spec/requests/organization_requests_spec.rb +++ b/spec/requests/organization_requests_spec.rb @@ -20,11 +20,11 @@ } it "runs correctly", :aggregate_failures do - # Explicitly specify the organization_name, as current_organization will not + # Explicitly specify the organization_id, as current_organization will not # be set for super admins post promote_to_org_admin_organization_path( user_id: user_to_promote.id, - organization_name: organization.short_name + organization_id: organization.id ) expect(user_to_promote.reload.has_role?(Role::ORG_ADMIN, organization)).to be_truthy # The user_update_redirect_path will vary based on whether the logged in @@ -46,11 +46,11 @@ } it "runs correctly", :aggregate_failures do - # Explicitly specify the organization_name, as current_organization will not + # Explicitly specify the organization_id, as current_organization will not # be set for super admins post demote_to_user_organization_path( user_id: user_to_demote.id, - organization_name: organization.short_name + organization_id: organization.id ) expect(user_to_demote.reload.has_role?(Role::ORG_ADMIN, organization)).to be_falsey # The user_update_redirect_path will vary based on whether the logged in @@ -72,11 +72,11 @@ } it "runs correctly", :aggregate_failures do - # Explicitly specify the organization_name, as current_organization will not + # Explicitly specify the organization_id, as current_organization will not # be set for super admins post remove_user_organization_path( user_id: user_to_remove.id, - organization_name: organization.short_name + organization_id: organization.id ) expect(user_to_remove.reload.has_role?(Role::ORG_USER, organization)).to be_falsey # The user_update_redirect_path will vary based on whether the logged in @@ -113,7 +113,6 @@ expect(html.text).to include("Address") expect(html.text).to include("Distribution email content") expect(html.text).to include("Users") - expect(html.text).to include("Short name") expect(html.text).to include("URL") expect(html.text).to include("Partner Profile sections") expect(html.text).to include("Custom Partner invitation message") @@ -192,7 +191,6 @@ expect(html.text).to include("Address") expect(html.text).to include("Distribution email content") expect(html.text).to include("Users") - expect(html.text).to include("Short name") expect(html.text).to include("URL") expect(html.text).to include("Partner Profile sections") expect(html.text).to include("Custom Partner invitation message") @@ -466,7 +464,7 @@ context "when attempting to access a different organization" do let(:other_organization) { create(:organization) } let(:other_organization_params) do - { organization_name: other_organization.to_param } + { organization_id: other_organization.id } end describe "GET #show" do @@ -538,9 +536,9 @@ let(:user) { create(:user, organization: create(:organization)) } it 'raises an error' do - # Explicitly specify the organization_name, as current_organization will not + # Explicitly specify the organization_id, as current_organization will not # be set for super admins - post remove_user_organization_path(user_id: user.id, organization_name: organization.short_name) + post remove_user_organization_path(user_id: user.id, organization_id: organization.id) expect(response).to have_http_status(:not_found) end diff --git a/spec/requests/reports/distributions_summary_requests_spec.rb b/spec/requests/reports/distributions_summary_requests_spec.rb index 63d6e6e25b..260aed326f 100644 --- a/spec/requests/reports/distributions_summary_requests_spec.rb +++ b/spec/requests/reports/distributions_summary_requests_spec.rb @@ -37,7 +37,7 @@ create :distribution, :with_items, item_quantity: 17, issued_at: 30.days.ago, organization: organization end - let(:formatted_date_range) { date_range.map { _1.to_fs(:date_picker) }.join(" - ") } + let(:formatted_date_range) { date_range.map { it.to_fs(:date_picker) }.join(" - ") } before do get reports_distributions_summary_path, params: {filters: {date_range: formatted_date_range}} diff --git a/spec/requests/reports/donations_summary_spec.rb b/spec/requests/reports/donations_summary_spec.rb index 89daa7e96f..75196ac6f8 100644 --- a/spec/requests/reports/donations_summary_spec.rb +++ b/spec/requests/reports/donations_summary_spec.rb @@ -24,7 +24,7 @@ it "has a link to create a new donation" do expect(response.body).to include("New Donation") - expect(response.body).to include("#{@url_prefix}/donations/new") + expect(response.body).to include("/donations/new") end context "with filters" do @@ -38,7 +38,7 @@ create :donation, :with_items, item_quantity: 17, issued_at: 30.days.ago, organization: organization end - let(:formatted_date_range) { date_range.map { _1.to_fs(:date_picker) }.join(" - ") } + let(:formatted_date_range) { date_range.map { it.to_fs(:date_picker) }.join(" - ") } before do get reports_donations_summary_path(user.organization), params: {filters: {date_range: formatted_date_range}} diff --git a/spec/requests/reports/manufacturer_donations_summary_spec.rb b/spec/requests/reports/manufacturer_donations_summary_spec.rb index 0b59455c9b..c54c416319 100644 --- a/spec/requests/reports/manufacturer_donations_summary_spec.rb +++ b/spec/requests/reports/manufacturer_donations_summary_spec.rb @@ -24,11 +24,11 @@ get reports_manufacturer_donations_summary_path expect(response.body).to include("New Donation") - expect(response.body).to include("#{@url_prefix}/donations/new") + expect(response.body).to include("/donations/new") end context "with manufacturer donations in the last year" do - let(:formatted_date_range) { date_range.map { _1.to_fs(:date_picker) }.join(" - ") } + let(:formatted_date_range) { date_range.map { it.to_fs(:date_picker) }.join(" - ") } let(:date_range) { [1.year.ago, 0.days.ago] } let!(:donations) do [ diff --git a/spec/requests/reports/product_drives_summary_spec.rb b/spec/requests/reports/product_drives_summary_spec.rb index d6007e8c75..72722729c9 100644 --- a/spec/requests/reports/product_drives_summary_spec.rb +++ b/spec/requests/reports/product_drives_summary_spec.rb @@ -35,7 +35,7 @@ create :product_drive_donation, :with_items, item_quantity: 117, money_raised: 1700, issued_at: 30.days.ago, organization: organization end - let(:formatted_date_range) { date_range.map { _1.to_fs(:date_picker) }.join(" - ") } + let(:formatted_date_range) { date_range.map { it.to_fs(:date_picker) }.join(" - ") } before do get reports_product_drives_summary_path(user.organization), params: {filters: {date_range: formatted_date_range}} diff --git a/spec/requests/reports/purchases_summary_requests_spec.rb b/spec/requests/reports/purchases_summary_requests_spec.rb index f845c4e831..0e0ff9d89f 100644 --- a/spec/requests/reports/purchases_summary_requests_spec.rb +++ b/spec/requests/reports/purchases_summary_requests_spec.rb @@ -29,7 +29,7 @@ create :purchase, :with_items, item_quantity: 17, issued_at: 30.days.ago, organization: organization end - let(:formatted_date_range) { date_range.map { _1.to_fs(:date_picker) }.join(" - ") } + let(:formatted_date_range) { date_range.map { it.to_fs(:date_picker) }.join(" - ") } before do get reports_purchases_summary_path, params: {filters: {date_range: formatted_date_range}} diff --git a/spec/requests/storage_locations_requests_spec.rb b/spec/requests/storage_locations_requests_spec.rb index 327bfec143..9040d2513e 100644 --- a/spec/requests/storage_locations_requests_spec.rb +++ b/spec/requests/storage_locations_requests_spec.rb @@ -288,7 +288,7 @@ file = fixture_file_upload("inventory.csv", "text/csv") params = { file: file, storage_location: storage_location_with_items.id } - post import_inventory_storage_locations_path(organization_name: organization.to_param), params: params + post import_inventory_storage_locations_path, params: params expect(response).to be_redirect expect(response).to have_error "Could not complete action: inventory already has items stored" diff --git a/spec/requests/users_requests_spec.rb b/spec/requests/users_requests_spec.rb index 4512af41d5..e083112f14 100644 --- a/spec/requests/users_requests_spec.rb +++ b/spec/requests/users_requests_spec.rb @@ -27,10 +27,10 @@ end end - describe "POST #send_partner_user_reset_password" do + describe "POST #partner_user_reset_password" do let(:partner) { create(:partner, organization: organization) } let!(:user) { create(:partner_user, partner: partner, email: "me@partner.com") } - let(:params) { { organization_name: organization.short_name, partner_id: partner.id, email: "me@partner.com" } } + let(:params) { { organization_id: organization.id, partner_id: partner.id, email: "me@partner.com" } } it "should send a password" do post partner_user_reset_password_users_path(params) diff --git a/spec/support/pagination_shared_example.rb b/spec/support/pagination_shared_example.rb index 9e2660a1a7..afef2f2a5e 100644 --- a/spec/support/pagination_shared_example.rb +++ b/spec/support/pagination_shared_example.rb @@ -1,14 +1,13 @@ shared_examples_for "pagination", type: :feature do let(:model_f) { described_class.to_s.underscore.to_sym } let(:plural_model_name) { described_class.to_s.underscore.pluralize } - let!(:url_prefix) { "/#{@organization.to_param}" } scenario "user can visit the paginated results for a given resource" do sign_in(@user) create_list(model_f, 200) - visit url_prefix + "/" + plural_model_name + visit plural_model_name within("tbody") do items = page.all("tr") diff --git a/spec/system/account_request_system_spec.rb b/spec/system/account_request_system_spec.rb index 37b1b34732..a7d04169b6 100644 --- a/spec/system/account_request_system_spec.rb +++ b/spec/system/account_request_system_spec.rb @@ -59,8 +59,6 @@ sign_in(super_admin) visit new_admin_organization_path(token: created_account_request.identity_token) - fill_in 'Short name', with: 'fakeshortname' - click_button 'Save' # Expect to see the a new organization with the name provided diff --git a/spec/system/admin/base_items_system_spec.rb b/spec/system/admin/base_items_system_spec.rb index 0c2d1116e8..536f6bd0d9 100644 --- a/spec/system/admin/base_items_system_spec.rb +++ b/spec/system/admin/base_items_system_spec.rb @@ -10,7 +10,6 @@ sign_in(super_admin) end - let!(:url_prefix) {} context "when creating a new base item" do before do visit new_admin_base_item_path @@ -71,7 +70,6 @@ sign_in(super_admin_no_org) end - let!(:url_prefix) {} context "when creating a new base item" do before do visit new_admin_base_item_path diff --git a/spec/system/admin/organizations_system_spec.rb b/spec/system/admin/organizations_system_spec.rb index a5272f51eb..11fcff0dfa 100644 --- a/spec/system/admin/organizations_system_spec.rb +++ b/spec/system/admin/organizations_system_spec.rb @@ -106,7 +106,6 @@ org_params = attributes_for(:organization) within "form#new_organization" do fill_in "organization_name", with: org_params[:name] - fill_in "organization_short_name", with: org_params[:short_name] fill_in "organization_url", with: org_params[:url] fill_in "organization_email", with: org_params[:email] fill_in "organization_street", with: "1500 Remount Road" @@ -122,7 +121,7 @@ expect(page).to have_content("All Human Essentials Organizations") - within("tr.#{org_params[:short_name]}") do + within(find("td", text: org_params[:name]).sibling(".text-right")) do first(:link, "View").click end @@ -140,7 +139,7 @@ it "can view organization details", :aggregate_failures do visit admin_organizations_path - within("tr.#{bar_org.short_name}") do + within(find("td", text: bar_org.name).sibling(".text-right")) do first(:link, "View").click end diff --git a/spec/system/annual_reports_system_spec.rb b/spec/system/annual_reports_system_spec.rb index 8dbc872a82..5b26888cb2 100644 --- a/spec/system/annual_reports_system_spec.rb +++ b/spec/system/annual_reports_system_spec.rb @@ -2,8 +2,6 @@ let(:organization) { create(:organization) } let(:organization_admin) { create(:organization_admin, organization: organization) } - let(:url_prefix) { "/#{organization.short_name}" } - context "while signed in as an organization admin" do subject { reports_annual_reports_path } let!(:purchase) { create(:purchase, :with_items, item_quantity: 10, issued_at: 1.year.ago, organization: organization) } diff --git a/spec/system/layout_system_spec.rb b/spec/system/layout_system_spec.rb index a913e1e2a8..c1e6bbf5a3 100644 --- a/spec/system/layout_system_spec.rb +++ b/spec/system/layout_system_spec.rb @@ -1,7 +1,6 @@ RSpec.describe "Layout", type: :system do let(:organization) { create(:organization) } let(:user) { create(:user, organization: organization) } - let!(:url_prefix) { "/#{organization.to_param}" } describe "Body CSS Data" do it "sets the ID to the controller and the class to the action" do