Routine Rubocop fixes (#12016)

This commit is contained in:
Michael Kohl 2020-12-23 22:26:12 +07:00 committed by GitHub
parent 63cf95d811
commit 1cb990e87f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 9 deletions

View file

@ -654,7 +654,7 @@ class User < ApplicationRecord
return unless persisted?
index_to_elasticsearch_inline
rescue => e
rescue StandardError => e
Honeybadger.notify(e, context: { user_id: id })
end

View file

@ -14,7 +14,7 @@ module SiteConfigs
onboarding_taskcard_image
].freeze
VALID_URL = %r{\A(http|https)://([/|.|\w|\s|-])*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?\z}.freeze
VALID_URL = %r{\A(http|https)://([/|.\w\s-])*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?\z}.freeze
VALID_DOMAIN = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/.freeze

View file

@ -65,32 +65,33 @@ RSpec.describe "Api::V0::Admin::Configs", type: :request do
it "enables proper domains to allow list" do
proper_list = "dev.to, forem.com, forem.dev"
put api_admin_config_path, params: { site_config: { allowed_registration_email_domains: proper_list } }.to_json,
headers: headers
headers: headers
expect(SiteConfig.allowed_registration_email_domains).to eq(%w[dev.to forem.com forem.dev])
end
it "does not allow improper domain list" do
improper_list = "dev.to, foremcom, forem.dev"
put api_admin_config_path, params: { site_config: { allowed_registration_email_domains: improper_list } }.to_json,
headers: headers
put api_admin_config_path,
params: { site_config: { allowed_registration_email_domains: improper_list } }.to_json,
headers: headers
expect(SiteConfig.allowed_registration_email_domains).not_to eq(%w[dev.to foremcom forem.dev])
end
it "removes space suggested_tags" do
put api_admin_config_path, params: { site_config: { suggested_tags: "hey, haha,hoho, bobo fofo" } }.to_json,
headers: headers
headers: headers
expect(SiteConfig.suggested_tags).to eq(%w[hey haha hoho bobofofo])
end
it "downcases suggested_tags" do
put api_admin_config_path, params: { site_config: { suggested_tags: "hey, haha,hoHo, Bobo Fofo" } }.to_json,
headers: headers
headers: headers
expect(SiteConfig.suggested_tags).to eq(%w[hey haha hoho bobofofo])
end
it "Renders siteconfig result" do
put api_admin_config_path, params: { site_config: { community_name: "new" } }.to_json,
headers: headers
headers: headers
expect(response.parsed_body["community_name"]).to eq SiteConfig.community_name
end

View file

@ -65,7 +65,7 @@ RSpec.describe Broadcasts::WelcomeNotification::Generator, type: :service do
not_github = [
facebook_connect_broadcast,
twitter_connect_broadcast,
apple_connect_broadcast
apple_connect_broadcast,
].include?(user.notifications.last.notifiable)
expect(not_github).to be(true)