Copy the main tenant administrator login credentials into the new tenant

Co-Authored-By: Senén Rodero <senenrodero@gmail.com>
This commit is contained in:
taitus
2022-12-15 14:35:07 +01:00
committed by Senén Rodero Rodríguez
parent 171cf4e634
commit 951eec7d08
7 changed files with 51 additions and 1 deletions

View File

@@ -40,6 +40,33 @@ describe "Tenants", :admin, :seed_tenants do
expect(page).to have_current_path root_path
expect(page).to have_link "Sign in"
end
scenario "Updates new tenant default user with the main tenant administrator login credentials" do
user = create(:user, email: "super@consul.dev", password: "secret_password")
create(:administrator, user: user)
login_as(user)
visit new_admin_tenant_path
expect(page).to have_content "When you create a tenant, your current user"
fill_in "Name", with: "Earthlings"
fill_in "Subdomain", with: "earth"
click_button "Create tenant"
expect(page).to have_content "Tenant created successfully"
expect(ActionMailer::Base.deliveries.count).to eq(0)
click_link "earth.lvh.me"
click_link "Sign in"
fill_in "Email or username", with: "super@consul.dev"
fill_in "Password", with: "secret_password"
click_button "Enter"
expect(page).to have_content "You have been signed in successfully."
expect(current_host).to eq "http://earth.lvh.me"
end
end
scenario "Update" do