Tests need to set up the script_name properly
which requires tweaking fixtures for the memberships and the account
This commit is contained in:
@@ -22,7 +22,7 @@ class Account < ApplicationRecord
|
||||
end
|
||||
|
||||
def slug
|
||||
"/#{tenant}"
|
||||
"/#{external_account_id}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -16,7 +16,7 @@ module AccountSlug
|
||||
# $1, $2, $' == script_name, slug, path_info
|
||||
if request.script_name && request.script_name =~ PATH_INFO_MATCH
|
||||
# Likely due to restarting the action cable connection after upgrade
|
||||
AccountSlug.decode($2)
|
||||
env["fizzy.external_account_id"] = AccountSlug.decode($2)
|
||||
elsif request.path_info =~ PATH_INFO_MATCH
|
||||
# Yanks the prefix off PATH_INFO and move it to SCRIPT_NAME
|
||||
request.engine_script_name = request.script_name = $1
|
||||
|
||||
Vendored
+1
@@ -1,2 +1,3 @@
|
||||
37s:
|
||||
name: 37signals
|
||||
external_account_id: <%= ActiveRecord::FixtureSet.identify("37signals") %>
|
||||
|
||||
Vendored
+3
-3
@@ -1,12 +1,12 @@
|
||||
# TODO:PLANB: not sure what to set membership tenant to right now
|
||||
david_in_37signals:
|
||||
identity: david
|
||||
tenant: 1 # <%# Rails.application.config.active_record_tenanted.default_tenant %>
|
||||
tenant: <%= ActiveRecord::FixtureSet.identify("37signals") %> # matches the external_account_id
|
||||
|
||||
jz_in_37signals:
|
||||
identity: jz
|
||||
tenant: 2 # <%# Rails.application.config.active_record_tenanted.default_tenant %>
|
||||
tenant: <%= ActiveRecord::FixtureSet.identify("37signals") %> # matches the external_account_id
|
||||
|
||||
kevin_in_37signals:
|
||||
identity: kevin
|
||||
tenant: 3 # <%# Rails.application.config.active_record_tenanted.default_tenant %>
|
||||
tenant: <%= ActiveRecord::FixtureSet.identify("37signals") %> # matches the external_account_id
|
||||
|
||||
+10
-11
@@ -47,18 +47,17 @@ module ActiveSupport
|
||||
end
|
||||
end
|
||||
|
||||
# # TODO:PLANB: not sure if we need these anymore
|
||||
# class ActionDispatch::IntegrationTest
|
||||
# setup do
|
||||
# integration_session.default_url_options[:script_name] = "/#{Current.account.slug}"
|
||||
# end
|
||||
# end
|
||||
class ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
integration_session.default_url_options[:script_name] = "/#{ActiveRecord::FixtureSet.identify("37signals")}"
|
||||
end
|
||||
end
|
||||
|
||||
# class ActionDispatch::SystemTestCase
|
||||
# setup do
|
||||
# self.default_url_options[:script_name] = "/#{ApplicationRecord.current_tenant}"
|
||||
# end
|
||||
# end
|
||||
class ActionDispatch::SystemTestCase
|
||||
setup do
|
||||
self.default_url_options[:script_name] = "/#{ActiveRecord::FixtureSet.identify("37signals")}"
|
||||
end
|
||||
end
|
||||
|
||||
unless Rails.application.config.x.oss_config
|
||||
load File.expand_path("../gems/fizzy-saas/test/test_helper.rb", __dir__)
|
||||
|
||||
Reference in New Issue
Block a user