From 40f631417776017086fc3173d0be7203c335f924 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 15 Jan 2016 20:40:29 +0100 Subject: [PATCH] Fixed unit tests. --- app/models/application_model.rb | 6 +++--- lib/core_ext/string.rb | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/application_model.rb b/app/models/application_model.rb index 0218203ec..548c234de 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -442,7 +442,7 @@ returns # do lookup with == to handle case insensitive databases records = where(login: data[:login]) records.each {|loop_record| - if loop_record.login.casecmp data[:login] == 0 + if loop_record.login.casecmp(data[:login]) == 0 loop_record.update_attributes(data) return loop_record end @@ -455,7 +455,7 @@ returns # do lookup with == to handle case insensitive databases records = where(email: data[:email]) records.each {|loop_record| - if loop_record.email.casecmp data[:email] == 0 + if loop_record.email.casecmp(data[:email]) == 0 loop_record.update_attributes(data) return loop_record end @@ -468,7 +468,7 @@ returns # do lookup with == to handle case insensitive databases records = where(locale: data[:locale]) records.each {|loop_record| - if loop_record.locale.casecmp data[:locale] == 0 + if loop_record.locale.casecmp(data[:locale]) == 0 loop_record.update_attributes(data) return loop_record end diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb index 68f611e86..01e3e4f22 100644 --- a/lib/core_ext/string.rb +++ b/lib/core_ext/string.rb @@ -31,7 +31,7 @@ class String =end def to_filename - camel_cased_word = to_s + camel_cased_word = "#{self}" # rubocop:disable Style/UnneededInterpolation camel_cased_word.gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') @@ -48,7 +48,7 @@ class String =end def to_classname - camel_cased_word = to_s + camel_cased_word = "#{self}" # rubocop:disable Style/UnneededInterpolation camel_cased_word.gsub!(/\.rb$/, '') camel_cased_word.split('/').map(&:camelize).join('::') end @@ -79,7 +79,7 @@ class String =end def html2text(string_only = false) - string = to_s + string = "#{self}" # rubocop:disable Style/UnneededInterpolation # in case of invalid encodeing, strip invalid chars # see also test/fixtures/mail21.box @@ -210,7 +210,7 @@ class String =end def text2html - text = CGI.escapeHTML( self ) + text = CGI.escapeHTML(self) text.gsub!(/\n/, '
') text.chomp end