fix(rubocop): Remove nested if inside else Style/IfInsideElse [ci skip]
This commit is contained in:
parent
4d7cedc5af
commit
bac4251bc3
10
Rakefile
10
Rakefile
|
@ -24,13 +24,11 @@ task :default do
|
||||||
if Tests::CurrentBundle.instance.appraisal_in_use?
|
if Tests::CurrentBundle.instance.appraisal_in_use?
|
||||||
sh 'rake spec:unit --trace'
|
sh 'rake spec:unit --trace'
|
||||||
sh 'rake spec:acceptance --trace'
|
sh 'rake spec:acceptance --trace'
|
||||||
|
elsif ENV['CI']
|
||||||
|
exec 'appraisal install && appraisal rake --trace'
|
||||||
else
|
else
|
||||||
if ENV['CI']
|
appraisal = Tests::CurrentBundle.instance.latest_appraisal
|
||||||
exec 'appraisal install && appraisal rake --trace'
|
exec "appraisal install && appraisal #{appraisal} rake --trace"
|
||||||
else
|
|
||||||
appraisal = Tests::CurrentBundle.instance.latest_appraisal
|
|
||||||
exec "appraisal install && appraisal #{appraisal} rake --trace"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -90,14 +90,12 @@ module Shoulda
|
||||||
if attr_mass_assignable?
|
if attr_mass_assignable?
|
||||||
if whitelisting?
|
if whitelisting?
|
||||||
@failure_message_when_negated = "#{@attribute} was made accessible"
|
@failure_message_when_negated = "#{@attribute} was made accessible"
|
||||||
|
elsif protected_attributes.empty?
|
||||||
|
@failure_message_when_negated = 'no attributes were protected'
|
||||||
else
|
else
|
||||||
if protected_attributes.empty?
|
@failure_message_when_negated = "#{class_name} is protecting " <<
|
||||||
@failure_message_when_negated = 'no attributes were protected'
|
"#{protected_attributes.to_a.to_sentence}, " <<
|
||||||
else
|
"but not #{@attribute}."
|
||||||
@failure_message_when_negated = "#{class_name} is protecting " <<
|
|
||||||
"#{protected_attributes.to_a.to_sentence}, " <<
|
|
||||||
"but not #{@attribute}."
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
|
|
|
@ -141,13 +141,11 @@ module Shoulda
|
||||||
klass = serialization_coder
|
klass = serialization_coder
|
||||||
if klass == @options[:type]
|
if klass == @options[:type]
|
||||||
true
|
true
|
||||||
|
elsif klass.respond_to?(:object_class) && klass.object_class == @options[:type]
|
||||||
|
true
|
||||||
else
|
else
|
||||||
if klass.respond_to?(:object_class) && klass.object_class == @options[:type]
|
@missing = ":#{@name} should be a type of #{@options[:type]}"
|
||||||
true
|
false
|
||||||
else
|
|
||||||
@missing = ":#{@name} should be a type of #{@options[:type]}"
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
|
|
|
@ -952,22 +952,20 @@ module Shoulda
|
||||||
end
|
end
|
||||||
|
|
||||||
prefix << ', and saving it as the existing record, then'
|
prefix << ', and saving it as the existing record, then'
|
||||||
|
elsif attribute_setter_for_existing_record
|
||||||
|
prefix << "Given an existing #{model.name},"
|
||||||
|
prefix << ' after setting '
|
||||||
|
prefix << description_for_attribute_setter(
|
||||||
|
attribute_setter_for_existing_record
|
||||||
|
)
|
||||||
|
prefix << ', then'
|
||||||
else
|
else
|
||||||
if attribute_setter_for_existing_record
|
prefix << "Given an existing #{model.name} whose :#{attribute}"
|
||||||
prefix << "Given an existing #{model.name},"
|
prefix << ' is '
|
||||||
prefix << ' after setting '
|
prefix << Shoulda::Matchers::Util.inspect_value(
|
||||||
prefix << description_for_attribute_setter(
|
existing_value_read
|
||||||
attribute_setter_for_existing_record
|
)
|
||||||
)
|
prefix << ', after'
|
||||||
prefix << ', then'
|
|
||||||
else
|
|
||||||
prefix << "Given an existing #{model.name} whose :#{attribute}"
|
|
||||||
prefix << ' is '
|
|
||||||
prefix << Shoulda::Matchers::Util.inspect_value(
|
|
||||||
existing_value_read
|
|
||||||
)
|
|
||||||
prefix << ', after'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
prefix << " making a new #{model.name} and setting "
|
prefix << " making a new #{model.name} and setting "
|
||||||
|
|
Loading…
Reference in New Issue