Fixed unit tests.

This commit is contained in:
Martin Edenhofer 2016-01-15 20:40:29 +01:00
parent 815666a994
commit 40f6314177
2 changed files with 7 additions and 7 deletions

View file

@ -442,7 +442,7 @@ returns
# do lookup with == to handle case insensitive databases # do lookup with == to handle case insensitive databases
records = where(login: data[:login]) records = where(login: data[:login])
records.each {|loop_record| 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) loop_record.update_attributes(data)
return loop_record return loop_record
end end
@ -455,7 +455,7 @@ returns
# do lookup with == to handle case insensitive databases # do lookup with == to handle case insensitive databases
records = where(email: data[:email]) records = where(email: data[:email])
records.each {|loop_record| 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) loop_record.update_attributes(data)
return loop_record return loop_record
end end
@ -468,7 +468,7 @@ returns
# do lookup with == to handle case insensitive databases # do lookup with == to handle case insensitive databases
records = where(locale: data[:locale]) records = where(locale: data[:locale])
records.each {|loop_record| 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) loop_record.update_attributes(data)
return loop_record return loop_record
end end

View file

@ -31,7 +31,7 @@ class String
=end =end
def to_filename def to_filename
camel_cased_word = to_s camel_cased_word = "#{self}" # rubocop:disable Style/UnneededInterpolation
camel_cased_word.gsub(/::/, '/') camel_cased_word.gsub(/::/, '/')
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
.gsub(/([a-z\d])([A-Z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2')
@ -48,7 +48,7 @@ class String
=end =end
def to_classname def to_classname
camel_cased_word = to_s camel_cased_word = "#{self}" # rubocop:disable Style/UnneededInterpolation
camel_cased_word.gsub!(/\.rb$/, '') camel_cased_word.gsub!(/\.rb$/, '')
camel_cased_word.split('/').map(&:camelize).join('::') camel_cased_word.split('/').map(&:camelize).join('::')
end end
@ -79,7 +79,7 @@ class String
=end =end
def html2text(string_only = false) def html2text(string_only = false)
string = to_s string = "#{self}" # rubocop:disable Style/UnneededInterpolation
# in case of invalid encodeing, strip invalid chars # in case of invalid encodeing, strip invalid chars
# see also test/fixtures/mail21.box # see also test/fixtures/mail21.box
@ -210,7 +210,7 @@ class String
=end =end
def text2html def text2html
text = CGI.escapeHTML( self ) text = CGI.escapeHTML(self)
text.gsub!(/\n/, '<br>') text.gsub!(/\n/, '<br>')
text.chomp text.chomp
end end