about summary refs log tree commit diff
path: root/app/validators
diff options
context:
space:
mode:
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/blacklisted_email_validator.rb2
-rw-r--r--app/validators/html_validator.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/validators/blacklisted_email_validator.rb b/app/validators/blacklisted_email_validator.rb
index 16e3abf12..20a1587cc 100644
--- a/app/validators/blacklisted_email_validator.rb
+++ b/app/validators/blacklisted_email_validator.rb
@@ -22,7 +22,7 @@ class BlacklistedEmailValidator < ActiveModel::Validator
     domains = Rails.configuration.x.email_domains_blacklist.gsub('.', '\.')
     regexp  = Regexp.new("@(.+\\.)?(#{domains})", true)
 
-    @email =~ regexp
+    regexp.match?(@email)
   end
 
   def not_on_whitelist?
diff --git a/app/validators/html_validator.rb b/app/validators/html_validator.rb
index 1c9cd303c..b85b9769f 100644
--- a/app/validators/html_validator.rb
+++ b/app/validators/html_validator.rb
@@ -15,6 +15,6 @@ class HtmlValidator < ActiveModel::EachValidator
 
   def html_errors(str)
     fragment = Nokogiri::HTML.fragment(options[:wrap_with] ? "<#{options[:wrap_with]}>#{str}</#{options[:wrap_with]}>" : str)
-    fragment.errors.select { |error| ERROR_RE =~ error.message }
+    fragment.errors.select { |error| ERROR_RE.match?(error.message) }
   end
 end