During signup, name beta accounts distinctly

because Launchpad will present both in the UI, but will not be able to
redirect to a beta fizzy account from production launchpad (or vice versa).
This commit is contained in:
Mike Dalessio
2025-06-18 14:39:54 -04:00
parent ee60e8dd01
commit 237830d91c
2 changed files with 18 additions and 1 deletions
+7 -1
View File
@@ -116,7 +116,7 @@ class Signup
{
skip_remote: true, # Fizzy creates its own local account
product_name: "fizzy",
name: company_name.presence || signal_identity.name,
name: queenbee_account_name,
owner_identity_id: signal_identity.id,
trial: false,
subscription: subscription_attributes,
@@ -131,4 +131,10 @@ class Signup
def request_attributes
{ remote_address: Current.ip_address, user_agent: Current.user_agent, referrer: Current.referrer }
end
def queenbee_account_name
name = company_name.presence || signal_identity.name
name += " (Beta)" if Rails.env.beta?
name
end
end
+11
View File
@@ -25,6 +25,7 @@ class SignupTest < ActiveSupport::TestCase
assert @signup.signal_account
assert @signup.signal_account.persisted?
assert_equal @signup.signal_identity, @signup.signal_account.owner.identity
assert_equal @signup.company_name, @signup.signal_account.name
assert @signup.account
assert @signup.account.persisted?
@@ -36,6 +37,16 @@ class SignupTest < ActiveSupport::TestCase
assert_includes ApplicationRecord.tenants, @signup.signal_account.subdomain
end
test "the new account is named with company name if present" do
assert_equal @signup.company_name, @signup.send(:queenbee_account_name)
end
test "in beta, the new account is named distinctly" do
Rails.stubs(:env).returns(stub(beta?: true))
assert_equal "#{@signup.company_name} (Beta)", @signup.send(:queenbee_account_name)
end
test "#process creates all the necessary objects for an existing identity" do
signal_identity = SignalId::Identity.find_by_email_address("david@37signals.com")