diff options
-rw-r--r-- | app/controllers/application_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/roles_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/trackers_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/custom_fields_helper.rb | 2 | ||||
-rw-r--r-- | app/models/auth_source_ldap.rb | 2 | ||||
-rw-r--r-- | app/models/import.rb | 2 | ||||
-rw-r--r-- | app/models/mail_handler.rb | 2 | ||||
-rw-r--r-- | app/models/query.rb | 4 | ||||
-rw-r--r-- | app/models/setting.rb | 2 | ||||
-rw-r--r-- | app/models/wiki_page.rb | 2 | ||||
-rw-r--r-- | app/views/common/feed.atom.builder | 2 | ||||
-rw-r--r-- | app/views/journals/index.builder | 2 | ||||
-rw-r--r-- | lib/redmine/plugin.rb | 2 | ||||
-rw-r--r-- | test/unit/project_copy_test.rb | 2 | ||||
-rw-r--r-- | test/unit/project_test.rb | 4 | ||||
-rw-r--r-- | test/unit/user_test.rb | 6 |
16 files changed, 20 insertions, 20 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c39fe8ad1..e83e08989 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -251,7 +251,7 @@ class ApplicationController < ActionController::Base end if lang.nil? && !Setting.force_default_language_for_anonymous? && request.env['HTTP_ACCEPT_LANGUAGE'] accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first - if !accept_lang.blank? + if accept_lang.present? accept_lang = accept_lang.downcase lang = find_language(accept_lang) || find_language(accept_lang.split('-').first) end diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 70aa19ae6..35b753f31 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -63,7 +63,7 @@ class RolesController < ApplicationController @role.safe_attributes = params[:role] if request.post? && @role.save # workflow copy - if !params[:copy_workflow_from].blank? && (copy_from = Role.find_by_id(params[:copy_workflow_from])) + if params[:copy_workflow_from].present? && (copy_from = Role.find_by_id(params[:copy_workflow_from])) @role.copy_workflow_rules(copy_from) end flash[:notice] = l(:notice_successful_create) diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index 88381a1b8..64367f373 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -48,7 +48,7 @@ class TrackersController < ApplicationController @tracker.safe_attributes = params[:tracker] if @tracker.save # workflow copy - if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from])) + if params[:copy_workflow_from].present? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from])) @tracker.copy_workflow_rules(copy_from) end flash[:notice] = l(:notice_successful_create) diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index 13974daff..435634df8 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -155,7 +155,7 @@ module CustomFieldsHelper def custom_field_value_tag(value) attr_value = show_value(value) - if !attr_value.blank? && value.custom_field.full_text_formatting? + if attr_value.present? && value.custom_field.full_text_formatting? content_tag('div', attr_value, :class => 'wiki') else attr_value diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb index b9cf21ccc..a2d43b7f7 100644 --- a/app/models/auth_source_ldap.rb +++ b/app/models/auth_source_ldap.rb @@ -245,7 +245,7 @@ class AuthSourceLdap < AuthSource # Singleton class method is public class << self def get_attr(entry, attr_name) - if !attr_name.blank? + if attr_name.present? value = entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name] (+value.to_s).force_encoding('UTF-8') end diff --git a/app/models/import.rb b/app/models/import.rb index 5dcb05882..fe3f24fab 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -94,7 +94,7 @@ class Import < ActiveRecord::Base 'notifications' => '0' ) - if options.key?(:project_id) && !options[:project_id].blank? + if options.key?(:project_id) && options[:project_id].present? # Do not fail if project doesn't exist begin project = Project.find(options[:project_id]) diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 2fa4de00d..5925608bd 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -365,7 +365,7 @@ class MailHandler < ActionMailer::Base end if override && (v = extract_keyword!(cleaned_up_text_body, attr, options[:format])) v - elsif !handler_options[:issue][attr].blank? + elsif handler_options[:issue][attr].present? handler_options[:issue][attr] end end diff --git a/app/models/query.rb b/app/models/query.rb index 4a0aeb4fd..473ea4d86 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -505,7 +505,7 @@ class Query < ActiveRecord::Base add_filter_error(field, :blank) unless # filter requires one or more values - (values_for(field) and !values_for(field).first.blank?) or + (values_for(field) and values_for(field).first.present?) or # filter doesn't require any value ["o", "c", "!*", "*", "nd", "t", "ld", "nw", "w", "lw", "l2w", "nm", "m", "lm", "y", "*o", "!o"].include? operator_for(field) end if filters @@ -830,7 +830,7 @@ class Query < ActiveRecord::Base def column_names=(names) if names - names = names.select {|n| n.is_a?(Symbol) || !n.blank?} + names = names.select {|n| n.is_a?(Symbol) || n.present?} names = names.collect {|n| n.is_a?(Symbol) ? n : n.to_sym} if names.delete(:all_inline) names = available_inline_columns.map(&:name) | names diff --git a/app/models/setting.rb b/app/models/setting.rb index 155ed23b1..81f121db4 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -111,7 +111,7 @@ class Setting < ActiveRecord::Base v = YAML.safe_load(v, permitted_classes: Rails.configuration.active_record.yaml_column_permitted_classes) v = force_utf8_strings(v) end - v = v.to_sym if available_settings[name]['format'] == 'symbol' && !v.blank? + v = v.to_sym if available_settings[name]['format'] == 'symbol' && v.present? v end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 594c44bd6..0ee06673e 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -273,7 +273,7 @@ class WikiPage < ActiveRecord::Base protected def validate_parent_title - errors.add(:parent_title, :invalid) if !@parent_title.blank? && parent.nil? + errors.add(:parent_title, :invalid) if @parent_title.present? && parent.nil? errors.add(:parent_title, :circular_dependency) if parent && (parent == self || parent.ancestors.include?(self)) if parent_id_changed? && parent && (parent.wiki_id != wiki_id) errors.add(:parent_title, :not_same_project) diff --git a/app/views/common/feed.atom.builder b/app/views/common/feed.atom.builder index 13fda6b1b..e62b535d1 100644 --- a/app/views/common/feed.atom.builder +++ b/app/views/common/feed.atom.builder @@ -24,7 +24,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do author = item.event_author if item.respond_to?(:event_author) xml.author do xml.name(author) - xml.email(author.mail) if author.is_a?(User) && !author.mail.blank? && !author.pref.hide_mail + xml.email(author.mail) if author.is_a?(User) && author.mail.present? && !author.pref.hide_mail end if author xml.content "type" => "html" do xml.text! textilizable(item, :event_description, :only_path => false) diff --git a/app/views/journals/index.builder b/app/views/journals/index.builder index 26a067f6c..7682a3fa5 100644 --- a/app/views/journals/index.builder +++ b/app/views/journals/index.builder @@ -18,7 +18,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do xml.updated change.created_on.xmlschema xml.author do xml.name change.user.name - xml.email(change.user.mail) if change.user.is_a?(User) && !change.user.mail.blank? && !change.user.pref.hide_mail + xml.email(change.user.mail) if change.user.is_a?(User) && change.user.mail.present? && !change.user.pref.hide_mail end xml.content "type" => "html" do xml.text! '<ul>' diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index bf1f67aab..b7f243354 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -416,7 +416,7 @@ module Redmine # Returns +true+ if the plugin can be configured. def configurable? - settings && settings.is_a?(Hash) && !settings[:partial].blank? + settings && settings.is_a?(Hash) && settings[:partial].present? end # The directory containing this plugin's migrations (<tt>plugin/db/migrate</tt>) diff --git a/test/unit/project_copy_test.rb b/test/unit/project_copy_test.rb index 917805e51..76cbec891 100644 --- a/test/unit/project_copy_test.rb +++ b/test/unit/project_copy_test.rb @@ -76,7 +76,7 @@ class ProjectCopyTest < ActiveSupport::TestCase assert_equal @source_project.issues.size, @project.issues.size @project.issues.each do |issue| assert issue.valid? - assert ! issue.assigned_to.blank? + assert issue.assigned_to.present? assert_equal @project, issue.project end diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index 3e478e66e..43a3bf594 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -66,13 +66,13 @@ class ProjectTest < ActiveSupport::TestCase end with_settings :sequential_project_identifiers => '1' do - assert !Project.new.identifier.blank? + assert Project.new.identifier.present? assert Project.new(:identifier => '').identifier.blank? end with_settings :sequential_project_identifiers => '0' do assert Project.new.identifier.blank? - assert !Project.new(:identifier => 'test').blank? + assert Project.new(:identifier => 'test').present? end with_settings :default_projects_modules => ['issue_tracking', 'repository'] do diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index b6d9a34ef..577a7f972 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -1094,8 +1094,8 @@ class UserTest < ActiveSupport::TestCase def test_random_password u = User.new u.random_password - assert !u.password.blank? - assert !u.password_confirmation.blank? + assert u.password.present? + assert u.password_confirmation.present? end def test_random_password_include_required_characters @@ -1301,7 +1301,7 @@ class UserTest < ActiveSupport::TestCase user.reload # Salt added - assert !user.salt.blank? + assert user.salt.present? # Password still valid assert user.check_password?("unsalted") assert_equal user, User.try_to_login(user.login, "unsalted") |