* Split Settings::Authentication from SiteConfig * Move specs * Sort fields * Update settings usages * Update recaptcha usages * Add data update script * Update spec * Rename SiteConfigParams concern * Fixes, new route, new controller * Controller and service refactoring * More controller and service updates * Spec updates * More spec fixes * Move file * Fix FeedbackMessagesController * Update admin/configs_spec * Fix remaining specs in admin/configs_spec * Fix configs API * Formatting * Clean up old service object * Various fixes * Update DUS * Add model argument to admin_config_label * Fix key name * Fix specs * Add distinct request caches for settings classes * Fix e2e tests * Fix remaining system spec * Make DUS idempotent * Move routes block * Cleanup * Switch to ActiveSupport::CurrentAttributes * Pinned rails-settings-cached * Update e2e test * Update lib/data_update_scripts/20210316091354_move_authentication_settings.rb Co-authored-by: rhymes <rhymes@hey.com> * Add guard to DUS * Temporarily re-add two SiteConfig fields * Fix config show view Co-authored-by: rhymes <rhymes@hey.com>
29 lines
1.1 KiB
Ruby
29 lines
1.1 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe ReCaptcha::CheckRegistrationEnabled, type: :request do
|
|
describe "ReCaptcha for registration" do
|
|
context "when recaptcha is enabled" do
|
|
before do
|
|
allow(Settings::Authentication)
|
|
.to receive(:require_captcha_for_email_password_registration).and_return(true)
|
|
end
|
|
|
|
it "is enabled if both site & secret keys present" do
|
|
allow(Settings::Authentication).to receive(:recaptcha_secret_key).and_return("someSecretKey")
|
|
allow(Settings::Authentication).to receive(:recaptcha_site_key).and_return("someSiteKey")
|
|
expect(described_class.call).to be(true)
|
|
end
|
|
|
|
it "is disabled if site or secret key missing" do
|
|
allow(Settings::Authentication).to receive(:recaptcha_site_key).and_return("")
|
|
expect(described_class.call).to be(false)
|
|
end
|
|
end
|
|
|
|
it "is disabled if recaptcha disabled for email signup" do
|
|
allow(Settings::Authentication)
|
|
.to receive(:require_captcha_for_email_password_registration).and_return(false)
|
|
expect(described_class.call).to be(false)
|
|
end
|
|
end
|
|
end
|