fix(rubocop): Remove nested if inside else Style/IfInsideElse [ci skip]

This commit is contained in:
Kapil Sachdev 2020-09-04 20:30:58 +05:30 committed by Elliot Winkler
parent 4d7cedc5af
commit bac4251bc3
4 changed files with 26 additions and 34 deletions

View File

@ -24,15 +24,13 @@ task :default do
if Tests::CurrentBundle.instance.appraisal_in_use?
sh 'rake spec:unit --trace'
sh 'rake spec:acceptance --trace'
else
if ENV['CI']
elsif ENV['CI']
exec 'appraisal install && appraisal rake --trace'
else
appraisal = Tests::CurrentBundle.instance.latest_appraisal
exec "appraisal install && appraisal #{appraisal} rake --trace"
end
end
end
namespace :appraisal do
task :list do

View File

@ -90,15 +90,13 @@ module Shoulda
if attr_mass_assignable?
if whitelisting?
@failure_message_when_negated = "#{@attribute} was made accessible"
else
if protected_attributes.empty?
elsif protected_attributes.empty?
@failure_message_when_negated = 'no attributes were protected'
else
@failure_message_when_negated = "#{class_name} is protecting " <<
"#{protected_attributes.to_a.to_sentence}, " <<
"but not #{@attribute}."
end
end
true
else
if whitelisting?

View File

@ -141,14 +141,12 @@ module Shoulda
klass = serialization_coder
if klass == @options[:type]
true
else
if klass.respond_to?(:object_class) && klass.object_class == @options[:type]
elsif klass.respond_to?(:object_class) && klass.object_class == @options[:type]
true
else
@missing = ":#{@name} should be a type of #{@options[:type]}"
false
end
end
else
true
end

View File

@ -952,8 +952,7 @@ module Shoulda
end
prefix << ', and saving it as the existing record, then'
else
if attribute_setter_for_existing_record
elsif attribute_setter_for_existing_record
prefix << "Given an existing #{model.name},"
prefix << ' after setting '
prefix << description_for_attribute_setter(
@ -968,7 +967,6 @@ module Shoulda
)
prefix << ', after'
end
end
prefix << " making a new #{model.name} and setting "