- <%= link_to t(:learn_more), "#{Wabosign::PRODUCT_URL}/docs/embedding", target: "_blank", data: { turbo: false }, class: "btn btn-ghost text-gray-100 flex", rel: "noopener" %>
- ">
+ <%= link_to t(:learn_more), "#{Wabosign::PRODUCT_URL}/docs/embedding", target: '_blank', data: { turbo: false }, class: 'btn btn-ghost text-gray-100 flex', rel: 'noopener' %>
+
@@ -78,7 +78,7 @@
-
<script src="<%= embed_script_url(filename: "form.js") %>"></script>
+ <script src="<%= embed_script_url(filename: 'form.js') %>"></script>
<docuseal-form data-src="<%= start_form_url(slug: template.slug) %>"></docuseal-form>
@@ -88,7 +88,7 @@
- <%= link_to t(:learn_more), "#{Wabosign::PRODUCT_URL}/docs/embedding", target: "_blank", data: { turbo: false }, class: "btn btn-ghost text-gray-100 flex", rel: "noopener" %>
+ <%= link_to t(:learn_more), "#{Wabosign::PRODUCT_URL}/docs/embedding", target: '_blank', data: { turbo: false }, class: 'btn btn-ghost text-gray-100 flex', rel: 'noopener' %>
- <%= link_to t(:learn_more), "#{Wabosign::PRODUCT_URL}/docs/embedding", target: "_blank", data: { turbo: false }, class: "btn btn-ghost text-gray-100 flex", rel: "noopener" %>
+ <%= link_to t(:learn_more), "#{Wabosign::PRODUCT_URL}/docs/embedding", target: '_blank', data: { turbo: false }, class: 'btn btn-ghost text-gray-100 flex', rel: 'noopener' %>
- <%= link_to t(:learn_more), "#{Wabosign::PRODUCT_URL}/docs/embedding", target: "_blank", data: { turbo: false }, class: "btn btn-ghost text-gray-100 flex", rel: "noopener" %>
+ <%= link_to t(:learn_more), "#{Wabosign::PRODUCT_URL}/docs/embedding", target: '_blank', data: { turbo: false }, class: 'btn btn-ghost text-gray-100 flex', rel: 'noopener' %>
e
- abort e.to_s.strip
+ abort e.to_s.strip # rubocop:disable Rails/Exit
end
RSpec.configure do |config|
diff --git a/spec/requests/account_logo_controller_spec.rb b/spec/requests/account_logo_controller_spec.rb
index 4a91e3b9..c5b004d1 100644
--- a/spec/requests/account_logo_controller_spec.rb
+++ b/spec/requests/account_logo_controller_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe 'Account logo', type: :request do
describe 'POST /settings/account_logo' do
it 'accepts a PNG upload and attaches it to the current account' do
- png_bytes = File.binread(Rails.root.join('public/favicon-32x32.png'))
+ png_bytes = Rails.public_path.join('favicon-32x32.png').binread
expect do
post settings_account_logo_path, params: { logo: upload(content_type: 'image/png', bytes: png_bytes) }
@@ -31,7 +31,8 @@ RSpec.describe 'Account logo', type: :request do
it 'rejects an unsupported content type' do
pdf_bytes = '%PDF-1.4 dummy'
- post settings_account_logo_path, params: { logo: upload(content_type: 'application/pdf', bytes: pdf_bytes, filename: 'logo.pdf') }
+ post settings_account_logo_path,
+ params: { logo: upload(content_type: 'application/pdf', bytes: pdf_bytes, filename: 'logo.pdf') }
expect(account.reload.logo.attached?).to be(false)
expect(flash[:alert]).to include('PNG, JPEG, or SVG')
@@ -49,7 +50,8 @@ RSpec.describe 'Account logo', type: :request do
it 'sanitises malicious SVG content before storing' do
malicious = ''
- post settings_account_logo_path, params: { logo: upload(content_type: 'image/svg+xml', bytes: malicious, filename: 'logo.svg') }
+ post settings_account_logo_path,
+ params: { logo: upload(content_type: 'image/svg+xml', bytes: malicious, filename: 'logo.svg') }
expect(account.reload.logo.attached?).to be(true)
stored = account.logo.download
@@ -62,7 +64,7 @@ RSpec.describe 'Account logo', type: :request do
describe 'DELETE /settings/account_logo' do
it 'purges the attachment' do
- png_bytes = File.binread(Rails.root.join('public/favicon-32x32.png'))
+ png_bytes = Rails.public_path.join('favicon-32x32.png').binread
account.logo.attach(io: StringIO.new(png_bytes), filename: 'logo.png', content_type: 'image/png')
expect(account.reload.logo.attached?).to be(true)
diff --git a/spec/requests/role_authorization_spec.rb b/spec/requests/role_authorization_spec.rb
index 50b52523..6917d76e 100644
--- a/spec/requests/role_authorization_spec.rb
+++ b/spec/requests/role_authorization_spec.rb
@@ -37,10 +37,10 @@ RSpec.describe 'Role-based authorization', type: :request do
end
describe 'admin-only settings' do
- include_examples 'an admin-only settings route', :settings_users_path
- include_examples 'an admin-only settings route', :settings_sso_index_path
- include_examples 'an admin-only settings route', :settings_webhooks_path
- include_examples 'an admin-only settings route', :settings_esign_path
+ it_behaves_like 'an admin-only settings route', :settings_users_path
+ it_behaves_like 'an admin-only settings route', :settings_sso_index_path
+ it_behaves_like 'an admin-only settings route', :settings_webhooks_path
+ it_behaves_like 'an admin-only settings route', :settings_esign_path
# Personalization's GET reads `AccountConfig`, which Editor/Viewer can do
# (so UI chrome renders correctly). Writes are gated by :create AccountConfig,
diff --git a/spec/requests/users/omniauth_callbacks_spec.rb b/spec/requests/users/omniauth_callbacks_spec.rb
index 714424c1..6129c949 100644
--- a/spec/requests/users/omniauth_callbacks_spec.rb
+++ b/spec/requests/users/omniauth_callbacks_spec.rb
@@ -4,11 +4,12 @@ require 'rails_helper'
RSpec.describe 'Google OAuth2 callback', type: :request do
let!(:account) { create(:account) }
- # ApplicationController redirects to /setup when no users exist; create a
- # placeholder admin so that branch doesn't fire during these specs.
- let!(:placeholder_admin) { create(:user, account: account, email: 'admin@wabo.cc') }
before do
+ # ApplicationController redirects to /setup when no users exist; create a
+ # placeholder admin so that branch doesn't fire during these specs.
+ create(:user, account: account, email: 'admin@wabo.cc')
+
OmniAuth.config.test_mode = true
OmniAuth.config.logger = Rails.logger
@@ -26,12 +27,12 @@ RSpec.describe 'Google OAuth2 callback', type: :request do
OmniAuth.config.mock_auth[:google_oauth2] = nil
end
- def stub_google_auth(email:, uid: '1234567890', hd: 'wabo.cc', first_name: 'Test', last_name: 'User')
+ def stub_google_auth(email:, uid: '1234567890', hosted_domain: 'wabo.cc', first_name: 'Test', last_name: 'User')
OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new(
provider: 'google_oauth2',
uid: uid,
info: { email: email, first_name: first_name, last_name: last_name },
- extra: { raw_info: OmniAuth::AuthHash.new(hd: hd) }
+ extra: { raw_info: OmniAuth::AuthHash.new(hd: hosted_domain) }
)
end
@@ -70,7 +71,7 @@ RSpec.describe 'Google OAuth2 callback', type: :request do
describe 'disallowed Workspace domain' do
it 'redirects back to sign-in with a flash' do
- stub_google_auth(email: 'outsider@evil.com', hd: 'evil.com')
+ stub_google_auth(email: 'outsider@evil.com', hosted_domain: 'evil.com')
expect do
post user_google_oauth2_omniauth_callback_path
@@ -100,7 +101,7 @@ RSpec.describe 'Google OAuth2 callback', type: :request do
end
describe '2FA bypass' do
- let!(:user) do
+ before do
create(:user, account: account, email: '2fa@wabo.cc').tap do |u|
u.update_columns(otp_required_for_login: true, otp_secret: User.generate_otp_secret)
end
diff --git a/spec/system/dashboard_spec.rb b/spec/system/dashboard_spec.rb
index beca9606..a9b1c12b 100644
--- a/spec/system/dashboard_spec.rb
+++ b/spec/system/dashboard_spec.rb
@@ -19,7 +19,9 @@ RSpec.describe 'Dashboard Page' do
context 'when there are templates' do
let!(:authors) { create_list(:user, 5, account:) }
let!(:templates) { authors.map { |author| create(:template, account:, author:) } }
- let!(:other_template) { create(:template, account: create(:user).account) }
+ let!(:other_template) do
+ create(:template, name: "OTHER-ACCOUNT-#{SecureRandom.hex(8)}", account: create(:user).account)
+ end
before do
visit root_path