Replace empty? with blank? [SCI-5579]

This commit is contained in:
Oleksii Kriuchykhin 2021-07-23 11:56:28 +02:00
parent d4f974ac64
commit c26dcf4b23
67 changed files with 86 additions and 95 deletions

View file

@ -12,7 +12,7 @@ module Dashboard
my_module = CreateMyModuleService.new(current_user, current_team,
project: @project || create_project_params,
experiment: @experiment || create_experiment_params).call
if my_module.errors.empty?
if my_module.errors.blank?
render json: { my_module_path: protocols_my_module_path(my_module) }
else
render json: { errors: my_module.errors, error_object: my_module.class.name }, status: :unprocessable_entity

View file

@ -13,7 +13,7 @@ class MyModuleCommentsController < ApplicationController
def index
comments = @my_module.last_comments(@last_comment_id, @per_page)
unless comments.empty?
unless comments.blank?
more_url = url_for(my_module_my_module_comments_url(@my_module, format: :json, from: comments.first.id))
end
comment_index_helper(comments, more_url, @last_comment_id.positive? ? nil : '/my_module_comments/index.html.erb')

View file

@ -13,7 +13,7 @@ class ProjectCommentsController < ApplicationController
def index
comments = @project.last_comments(@last_comment_id, @per_page)
more_url = project_project_comments_url(@project, format: :json, from: comments.first.id) unless comments.empty?
more_url = project_project_comments_url(@project, format: :json, from: comments.first.id) unless comments.blank?
comment_index_helper(comments, more_url, @last_comment_id.positive? ? nil : '/project_comments/index.html.erb')
end

View file

@ -570,7 +570,7 @@ class ProtocolsController < ApplicationController
end
p_name =
if @protocol_json['name'].present? && !@protocol_json['name'].empty?
if @protocol_json['name'].present?
escape_input(@protocol_json['name'])
else
t('protocols.index.no_protocol_name')
@ -772,7 +772,7 @@ class ProtocolsController < ApplicationController
unless protocol_name.nil?
escaped_name = protocol_name.gsub(/[^0-9a-zA-Z\-.,_]/i, '_')
.downcase[0..Constants::NAME_MAX_LENGTH]
file_name = escaped_name + '.eln' unless escaped_name.empty?
file_name = escaped_name + '.eln' unless escaped_name.blank?
end
elsif @protocols.length > 1
file_name = 'protocols.eln'

View file

@ -277,7 +277,7 @@ class RepositoriesController < ApplicationController
else
@import_data = parsed_file.data
if @import_data.header.empty? || @import_data.columns.empty?
if @import_data.header.blank? || @import_data.columns.blank?
return repository_response(t('repositories.parse_sheet.errors.empty_file'))
end

View file

@ -87,7 +87,7 @@ class RepositoryColumnsController < ApplicationController
end
def available_asset_type_columns
if @asset_columns.empty?
if @asset_columns.blank?
render json: {
no_items: t(
'projects.reports.new.save_PDF_to_inventory_modal.no_columns'

View file

@ -145,7 +145,7 @@ class RepositoryRowsController < ApplicationController
end
def available_rows
if @repository.repository_rows.active.empty?
if @repository.repository_rows.active.blank?
no_items_string =
"#{t('projects.reports.new.save_PDF_to_inventory_modal.no_items')} " \
"#{link_to(t('projects.reports.new.save_PDF_to_inventory_modal.here'),

View file

@ -14,7 +14,7 @@ class ResultCommentsController < ApplicationController
def index
comments = @result.last_comments(@last_comment_id, @per_page)
more_url = result_result_comments_path(@result, format: :json, from: comments.first.id) unless comments.empty?
more_url = result_result_comments_path(@result, format: :json, from: comments.first.id) unless comments.blank?
comment_index_helper(comments, more_url)
end

View file

@ -76,7 +76,7 @@ class SearchController < ApplicationController
@search_query += "#{splited_query[i]} "
end
end
if @search_query.empty?
if @search_query.blank?
flash[:error] = t('general.query.wrong_query',
min_length: Constants::NAME_MIN_LENGTH,
max_length: Constants::TEXT_MAX_LENGTH)

View file

@ -14,7 +14,7 @@ class StepCommentsController < ApplicationController
def index
comments = @step.last_comments(@last_comment_id, @per_page)
more_url = step_step_comments_path(@step, format: :json, from: comments.first.id) unless comments.empty?
more_url = step_step_comments_path(@step, format: :json, from: comments.first.id) unless comments.blank?
comment_index_helper(comments, more_url)
end

View file

@ -84,7 +84,7 @@ class StepsController < ApplicationController
end
respond_to do |format|
if @step.errors.empty?
if @step.errors.blank?
format.json do
render json: {
html: render_to_string(
@ -392,7 +392,7 @@ class StepsController < ApplicationController
update_params = {}
delete_step_tables(params)
extract_destroy_params(params, update_params)
@step.update(update_params) unless update_params.empty?
@step.update(update_params) unless update_params.blank?
end
# Delete the step table

View file

@ -22,7 +22,7 @@ module Users
@team.name = params[:team][:name]
super do |user|
if user.errors.empty?
if user.errors.blank?
@team.created_by = user
@team.save

View file

@ -19,7 +19,7 @@ module Users
auth = request.env['omniauth.auth']
provider_id = auth.dig(:extra, :raw_info, :id_token_claims, :aud)
provider_conf = Rails.configuration.x.azure_ad_apps[provider_id]
raise StandardError, 'No matching Azure AD provider config found' if provider_conf.empty?
raise StandardError, 'No matching Azure AD provider config found' if provider_conf.blank?
auth.provider = provider_conf[:provider]
@ -161,7 +161,7 @@ module Users
def generate_initials(full_name)
initials = full_name.titleize.scan(/[A-Z]+/).join
initials = initials.strip.empty? ? 'PLCH' : initials[0..3]
initials = initials.strip.blank? ? 'PLCH' : initials[0..3]
initials
end
end

View file

@ -19,7 +19,7 @@ class Users::PasswordsController < Devise::PasswordsController
self.resource = resource_class.reset_password_by_token(resource_params)
yield resource if block_given?
if resource.errors.empty?
if resource.errors.blank?
resource.unlock_access! if unlockable?(resource)
if !resource.two_factor_auth_enabled?
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active

View file

@ -216,7 +216,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
def sign_up_params
tmp = params.require(:user).permit(:full_name, :initials, :email, :password, :password_confirmation)
initials = tmp[:full_name].titleize.scan(/[A-Z]+/).join()
initials = if initials.strip.empty?
initials = if initials.strip.blank?
'PLCH'
else
initials[0..Constants::USER_INITIALS_MAX_LENGTH]

View file

@ -142,7 +142,7 @@ class LoadFromRepositoryProtocolsDatatable < CustomDatatable
end
def keywords_html(record)
if !record.protocol_keywords_str || record.protocol_keywords_str.empty?
if record.protocol_keywords_str.blank?
"<i>#{I18n.t("protocols.no_keywords")}</i>"
else
kws = record.protocol_keywords_str.split(", ")

View file

@ -183,7 +183,7 @@ class ProtocolsDatatable < CustomDatatable
end
def keywords_html(record)
if !record.protocol_keywords_str || record.protocol_keywords_str.empty?
if !record.protocol_keywords_str || record.protocol_keywords_str.blank?
"<i>#{I18n.t("protocols.no_keywords")}</i>"
else
kws = record.protocol_keywords_str.split(", ")

View file

@ -22,7 +22,7 @@ module SearchableByNameModel
end
def self.filter_by_teams(teams = [])
return self if teams.empty?
return self if teams.blank?
if column_names.include? 'team_id'
where(team_id: teams)

View file

@ -26,7 +26,7 @@ module SearchableModel
if options[:whole_word].to_s == 'true' ||
options[:whole_phrase].to_s == 'true' ||
options[:at_search].to_s == 'true'
unless attrs.empty?
unless attrs.blank?
like = options[:match_case].to_s == 'true' ? '~' : '~*'
like = 'SIMILAR TO' if options[:at_search].to_s == 'true'
@ -65,7 +65,7 @@ module SearchableModel
like = options[:match_case].to_s == 'true' ? 'LIKE' : 'ILIKE'
if query.count(' ') > 0
unless attrs.empty?
unless attrs.blank?
a_query = query.split.map { |a| "%#{sanitize_sql_like(a)}%" }
where_str =
(attrs.map.with_index do |a, i|
@ -87,7 +87,7 @@ module SearchableModel
return where(where_str, vals)
end
else
unless attrs.empty?
unless attrs.blank?
where_str =
(attrs.map.with_index do |a, i|
if %w(repository_rows.id repository_number_values.data).include?(a)

View file

@ -240,7 +240,7 @@ class Experiment < ApplicationRecord
projects = projects_with_role_above_user(current_user)
projects = projects.each_with_object([]) do |p, arr|
arr << p if (project.users - p.users).empty?
arr << p if (project.users - p.users).blank?
arr
end
projects - [project]

View file

@ -286,7 +286,7 @@ class MyModule < ApplicationRecord
def downstream_modules
final = []
modules = [self]
until modules.empty?
until modules.blank?
my_module = modules.shift
final << my_module unless final.include?(my_module)
modules.push(*my_module.my_modules)
@ -298,7 +298,7 @@ class MyModule < ApplicationRecord
def upstream_modules
final = []
modules = [self]
until modules.empty?
until modules.blank?
my_module = modules.shift
final << my_module unless final.include?(my_module)
modules.push(*my_module.my_module_antecessors)
@ -395,7 +395,7 @@ class MyModule < ApplicationRecord
positions = experiment.my_modules.active.collect { |m| [m.x, m.y] }
.select { |x, _| x >= 0 && x < WIDTH }
.sort_by { |_, y| y }
return { x: 0, y: 0 } if positions.empty? || positions.first[1] >= HEIGHT
return { x: 0, y: 0 } if positions.blank? || positions.first[1] >= HEIGHT
# It looks we'll have to find a gap between the modules if it exists (at
# least 2*HEIGHT wide

View file

@ -33,11 +33,11 @@ class MyModuleStatus < ApplicationRecord
def self.sort_by_position(order = :asc)
ordered_statuses, statuses = all.to_a.partition { |i| i.previous_status_id.nil? }
return [] if ordered_statuses.empty?
return [] if ordered_statuses.blank?
until statuses.empty?
until statuses.blank?
next_element, statuses = statuses.partition { |i| ordered_statuses.last.id == i.previous_status_id }
if next_element.empty?
if next_element.blank?
break
else
ordered_statuses.concat(next_element)

View file

@ -224,7 +224,7 @@ class Project < ApplicationRecord
ids = active_experiments.map do |exp|
exp.my_modules.pluck(:id) if exp.my_modules
end
ids.delete_if { |i| i.flatten.empty? }
ids.delete_if { |i| i.flatten.blank? }
ids.join(', ')
end

View file

@ -131,7 +131,7 @@ class TinyMceAsset < ApplicationRecord
order(:id).each do |tiny_mce_asset|
asset_guid = get_guid(tiny_mce_asset.id)
extension = tiny_mce_asset.image.blob.filename.extension
asset_file_name = if extension.empty?
asset_file_name = if extension.blank?
"rte-#{asset_guid}"
else
"rte-#{asset_guid}.#{tiny_mce_asset.image.blob.filename.extension}"

View file

@ -8,7 +8,7 @@ module Api
has_many :repository_cells, key: :inventory_cells,
serializer: InventoryCellSerializer,
class_name: 'RepositoryCell',
unless: -> { object.repository_cells.empty? }
unless: -> { object.repository_cells.blank? }
belongs_to :repository, key: :inventory,
serializer: InventorySerializer,
class_name: 'Repository',

View file

@ -13,7 +13,7 @@ module Api
key: :keywords,
serializer: ProtocolKeywordSerializer,
class_name: 'ProtocolKeyword',
unless: -> { object.protocol_keywords.empty? }
unless: -> { object.protocol_keywords.blank? }
has_many :steps, serializer: StepSerializer, if: -> { object.steps.any? }
belongs_to :parent, serializer: ProtocolSerializer, if: -> { object.parent.present? }

View file

@ -8,7 +8,7 @@ module Api
has_many :my_modules, key: :tasks,
serializer: TaskSerializer,
class_name: 'MyModule',
unless: -> { object.my_modules.empty? }
unless: -> { object.my_modules.blank? }
end
end
end

View file

@ -13,7 +13,7 @@ class CreateExperimentService
unless @params[:project].class == Project
@params[:project] = CreateProjectService.new(@user, @team, @params[:project]).call
end
unless @params[:project]&.errors&.empty?
unless @params[:project]&.errors&.blank?
new_experiment = @params[:project]
raise ActiveRecord::Rollback
end

View file

@ -15,7 +15,7 @@ class CreateMyModuleService
@params[:experiment][:project] = @params[:project]
@params[:experiment] = CreateExperimentService.new(@user, @team, @params[:experiment]).call
end
unless @params[:experiment]&.errors&.empty?
unless @params[:experiment]&.errors&.blank?
new_my_module = @params[:experiment]
raise ActiveRecord::Rollback
end

View file

@ -82,7 +82,7 @@ class MarvinJsService
end
def prepare_name(sketch_name)
if !sketch_name.empty?
if !sketch_name.blank?
sketch_name
else
I18n.t('marvinjs.new_sketch')

View file

@ -53,7 +53,7 @@ module Reports
next unless elem
if %w(image newline table ol ul).include? elem[:type]
unless temp_p.empty?
unless temp_p.blank?
elements.push(type: 'p', children: temp_p)
temp_p = []
end

View file

@ -25,7 +25,7 @@ module RepositoryRows
params[:repository_cells]&.each do |column_id, value|
column = @repository.repository_columns.find_by(id: column_id)
next if !column || value.empty?
next if !column || value.blank?
RepositoryCell.create_with_value!(@repository_row, column, value, @user)
end

View file

@ -45,7 +45,7 @@ module SmartAnnotations
match = el.match(USER_REGEX)
user = User.find_by_id(match[2].base62_decode)
next unless user
next if UserTeam.where(user: user, team: team).empty?
next if UserTeam.where(user: user, team: team).blank?
user.full_name
end
end

View file

@ -63,7 +63,7 @@ module RepositoryImportParser
@rows.each do |row|
# Skip empty rows
next if row.empty?
next if row.blank?
unless @header_skipped
@header_skipped = true

View file

@ -49,7 +49,7 @@ module UsersGenerator
end
# Assign user team as user current team
nu.current_team_id = nu.teams.first.id unless nu.teams.empty?
nu.current_team_id = nu.teams.first.id unless nu.teams.blank?
nu.save!
nu.reload

View file

@ -4,7 +4,7 @@
<div class="container" id="global-activity-page">
<div>
<ul id="list-activities" class="no-style content-activities">
<% if @vars[:activities].empty? %>
<% if @vars[:activities].blank? %>
<li><em><%= t'activities.index.no_activities' %></em></li>
<% else %>
<% @vars[:activities].each do |activity| %>

View file

@ -66,7 +66,7 @@
<%= render "shared/left_menu_bar" if user_signed_in? %>
<div id="content-wrapper">
<% if user_signed_in? && current_user.teams.empty? && !(activities_are_selected? || settings_are_selected?) %>
<% if user_signed_in? && current_user.teams.blank? && !(activities_are_selected? || settings_are_selected?) %>
<!-- If member of no teams -->
<div id="no-teams-jumbotron" class="jumbotron">
<h2><%=t 'general.no_teams.title' %></h2>

View file

@ -1,5 +1,5 @@
<div class="row">
<div class="expand-all-steps" style="display: <%= 'none' if @protocol.steps.empty? %>">
<div class="expand-all-steps" style="display: <%= 'none' if @protocol.steps.blank? %>">
<a class="btn btn-light" data-action="collapse-steps">
<span class="fas fa-caret-up"></span>
<span><%= t("protocols.steps.collapse_label") %></a></span>

View file

@ -255,7 +255,7 @@
</ul>
</div>
<% if not @search_category.empty? %>
<% if not @search_category.blank? %>
<div class="col-xs-12 col-sm-9" id="search-content">
<div class="container-fluid" id="search-container">

View file

@ -4,7 +4,7 @@
<%= render partial: "search/results/partials/my_module_text.html.erb", locals: { my_module: mod, query: search_query } %>
</h5>
<% if mod.description.present? && !mod.description.empty? %>
<% if mod.description.present? %>
<p>
<span>
<%=t "search.index.description" %>

View file

@ -1,6 +1,6 @@
<% results.each do |protocol| %>
<% has_description = protocol.description.present? && !protocol.description.empty? %>
<% has_authors = protocol.authors.present? && !protocol.authors.empty? %>
<% has_description = protocol.description.present? %>
<% has_authors = protocol.authors.present? %>
<% has_keywords = protocol.in_repository? && protocol.protocol_keywords.count > 0 %>
<h5>
@ -122,5 +122,3 @@
<hr>
<% end %>

View file

@ -14,7 +14,7 @@
<%= render partial: "search/results/partials/result_text.html.erb", locals: { result: result, query: search_query, target: nil } %>
</h5>
<% if result.is_text && result.result_text.text.present? && !result.result_text.text.empty? %>
<% if result.is_text && result.result_text.text.present? %>
<blockquote class="search-asset-text-data">
<p>
<%= highlight custom_auto_link(result.result_text.tinymce_render(:text),

View file

@ -4,7 +4,7 @@
<%= render partial: "search/results/partials/step_text.html.erb", locals: { step: step, query: search_query, target: nil } %>
</h5>
<% if step.description.present? && !step.description.empty? %>
<% if step.description.present? %>
<p>
<span>
<%=t "search.index.description" %>

View file

@ -1,5 +1,5 @@
<% query ||= nil %>
<% text = query.present? ? highlight(protocol.name, query.strip.split(/\s+/)) : (protocol.name.empty? ? t("search.index.no_name") : protocol.name) %>
<% text = query.present? ? highlight(protocol.name, query.strip.split(/\s+/)) : (protocol.name.blank? ? t("search.index.no_name") : protocol.name) %>
<% if protocol.in_repository_public? %>
<span class="label label-info">

View file

@ -1,7 +1,7 @@
<div id="left-menu-bar" class="menu-bar">
<div class="scroll-wrapper">
<ul class="nav">
<% if current_user.teams.empty? %>
<% if current_user.teams.blank? %>
<li class="disabled">
<span>
<span class="fas fa-thumbtack"></span>

View file

@ -9,7 +9,7 @@
</li>
<% else %>
<li class="sidebar-leaf">
<% unless record[:children].empty? %>
<% unless record[:children].blank? %>
<i class="fas fa-caret-right toggle-branch collapsed"></i>
<% end %>
<%= link_to project_folder_path(record[:folder]),

View file

@ -18,7 +18,7 @@
<% if limit_reached %>
<div class="more-results"><%= t('atwho.more_results') %></div>
<% end %>
<% if experiments.empty? %>
<% if experiments.blank? %>
<%= render partial: 'shared/smart_annotation/no_results.html.erb', locals: { object_type: 'experiments' } %>
<% end %>
</div>

View file

@ -20,7 +20,7 @@
<% if limit_reached %>
<div class="more-results"><%= t('atwho.more_results') %></div>
<% end %>
<% if my_modules.empty? %>
<% if my_modules.blank? %>
<%= render partial: 'shared/smart_annotation/no_results.html.erb', locals: { object_type: 'my_modules' } %>
<% end %>
</div>

View file

@ -9,7 +9,7 @@
<% if limit_reached %>
<div class="more-results"><%= t('atwho.more_results') %></div>
<% end %>
<% if projects.empty? %>
<% if projects.blank? %>
<%= render partial: 'shared/smart_annotation/no_results.html.erb', locals: { object_type: 'projects' } %>
<% end %>
</div>

View file

@ -9,7 +9,7 @@
<% if limit_reached %>
<div class="more-results"><%= t('atwho.more_results') %></div>
<% end %>
<% if repository_rows.empty? %>
<% if repository_rows.blank? %>
<%= render partial: 'shared/smart_annotation/no_results.html.erb', locals: { object_type: 'repository_rows' } %>
<% end %>
</div>

View file

@ -16,7 +16,7 @@
<% if limit_reached %>
<div class="more-results"><%= t('atwho.more_results') %></div>
<% end %>
<% if users.empty? %>
<% if users.blank? %>
<%= render partial: 'shared/smart_annotation/no_results.html.erb', locals: { object_type: 'users' } %>
<% end %>
</div>

View file

@ -140,7 +140,7 @@
<hr>
<% step.checklists.asc.each do |checklist| %>
<strong><%= custom_auto_link(checklist.name, team: current_team) %></strong>
<% if checklist.checklist_items.empty? %>
<% if checklist.checklist_items.blank? %>
</br>
<%= t("protocols.steps.empty_checklist") %>
</br>

View file

@ -20,7 +20,7 @@
</div>
<% if not resource.errors.empty? %>
<% if resource.errors.present? %>
<script>
(function () {
var formErrors = {};

View file

@ -52,7 +52,7 @@
<% end %>
</div>
<% if resource and not resource.errors.empty? %>
<% if resource && resource.errors.present? %>
<script>
(function () {
var formErrors = {};
@ -69,7 +69,7 @@
</script>
<% end %>
<% if @team and not @team.errors.empty? %>
<% if @team && @team.errors.present? %>
<script>
(function () {
var formErrors = {};

View file

@ -5,10 +5,10 @@
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<% if not resource.errors.empty? %>
<div class="alert alert-danger" id="alert-flash">
<%= devise_error_messages! %>
</div>
<% if resource.errors.present? %>
<div class="alert alert-danger" id="alert-flash">
<%= devise_error_messages! %>
</div>
<% end %>
<%= f.hidden_field :reset_password_token %>

View file

@ -7,10 +7,10 @@
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<% if not resource.errors.empty? %>
<div class="alert alert-danger" id="alert-flash">
<%= devise_error_messages! %>
</div>
<% if resource.errors.present? %>
<div class="alert alert-danger" id="alert-flash">
<%= devise_error_messages! %>
</div>
<% end %>
<div class="form-group sci-input-container">

View file

@ -11,7 +11,7 @@
</div>
<div class="row settings-row">
<div class="col-md-12">
<% if not resource.errors.empty? %>
<% if resource.errors.present? %>
<div class="alert alert-danger">
<%= devise_error_messages! %>
</div>

View file

@ -61,7 +61,7 @@
</div>
</div>
<% if resource and not resource.errors.empty? %>
<% if resource && resource.errors.present? %>
<script>
(function () {
var formErrors = {};
@ -77,7 +77,7 @@
</script>
<% end %>
<% if @team and not @team.errors.empty? %>
<% if @team && @team.errors.present? %>
<script>
(function () {
var formErrors = {};

View file

@ -22,7 +22,7 @@
<%= render 'users/shared/links' %>
</div>
<% if @team and not @team.errors.empty? %>
<% if @team && @team.errors.present? %>
<script>
(function () {
var formErrors = {};

View file

@ -1,5 +0,0 @@
<% if team.description.present? and not team.description.empty? %>
<%= team.description %>
<% else %>
<em><%= t('users.settings.teams.edit.header_no_description') %></em>
<% end %>

View file

@ -5,7 +5,7 @@
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<% if not resource.errors.empty? %>
<% if not resource.errors.blank? %>
<div class="alert alert-danger">
<%= devise_error_messages! %>
</div>

View file

@ -1,7 +1,7 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun = rerun.strip.gsub /\s/, ' '
rerun_opts = rerun.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
rerun_opts = rerun.blank? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags 'not @wip'"
%>
default: <%= std_opts %> features

View file

@ -4,7 +4,7 @@ require 'omniauth/strategies/custom_azure_active_directory'
SETUP_PROC = lambda do |env|
providers = Rails.configuration.x.azure_ad_apps.select { |_, v| v[:enable_sign_in] == true }
raise StandardError, 'No Azure AD config available for sign in' if providers.empty?
raise StandardError, 'No Azure AD config available for sign in' if providers.blank?
req = Rack::Request.new(env)

View file

@ -11,7 +11,7 @@ if defined?(Rails::Server).present? && ENV['WOPI_ENABLED'] == 'true'
missing_vars << var_name if ENV[var_name].blank?
end
unless missing_vars.empty?
unless missing_vars.blank?
puts "WARNING: Due to WOPI_ENABLED == 'true', " \
"following env. variables MUST also be specified: " \
"#{missing_vars.join(', ')}; " \

View file

@ -5,7 +5,7 @@ namespace :db do
desc "Load users into database from the provided YAML file"
task :load_users, [ :file_path, :create_teams ] => :environment do |task, args|
if args.blank? or args.empty? or args[:file_path].blank?
if args.blank? || args[:file_path].blank?
puts "No file provided"
return
end
@ -81,7 +81,7 @@ namespace :db do
puts 'Type in user\'s password (e.g. \'password\'), or ' \
'leave blank to let Rails generate password'
password = $stdin.gets.to_s.strip
if password.empty?
if password.blank?
password = generate_user_password
end
puts 'Do you want Rails to create default user\'s team? (T/F)'
@ -89,7 +89,7 @@ namespace :db do
puts 'Type names of any additional teams you want the user ' \
'to be admin of (delimited with \',\'), or leave blank'
team_names = $stdin.gets.to_s.strip
if team_names.empty?
if team_names.blank?
team_names = []
else
team_names = team_names.split(',').collect(&:strip)

View file

@ -4,9 +4,7 @@ namespace :sign_up_constraint do
task :email_domain, [:domain] => :environment do |_, args|
include DatabaseHelper
if args.blank? ||
args.empty? ||
args[:domain].blank?
if args.blank? || args[:domain].blank?
puts 'Please add the email domain'
return
end

View file

@ -385,7 +385,7 @@ describe TeamImporter do
end
#
# User assigns to the the module
expect(db_module.user_my_modules.first.user_id).to eq USER_ID unless my_module['user_my_modules'].empty?
expect(db_module.user_my_modules.first.user_id).to eq USER_ID unless my_module['user_my_modules'].blank?
end
end
end