mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
Run automatic cop fixes
This runs all of the automatic cops that came in since rubocop 0.68. None of these changes were manual.
This commit is contained in:
parent
41468b09f3
commit
0e7c6e60f1
11 changed files with 29 additions and 27 deletions
|
@ -16,6 +16,7 @@ module FactoryBot
|
|||
else instance_exec(&block)
|
||||
end
|
||||
raise SequenceAbuseError if FactoryBot::Sequence === value
|
||||
|
||||
value
|
||||
}
|
||||
end
|
||||
|
|
|
@ -72,8 +72,8 @@ module FactoryBot
|
|||
result = []
|
||||
begin
|
||||
FactoryBot.public_send(factory_strategy, factory.name)
|
||||
rescue StandardError => error
|
||||
result |= [FactoryError.new(error, factory)]
|
||||
rescue StandardError => e
|
||||
result |= [FactoryError.new(e, factory)]
|
||||
end
|
||||
result
|
||||
end
|
||||
|
@ -83,9 +83,9 @@ module FactoryBot
|
|||
factory.definition.defined_traits.map(&:name).each do |trait_name|
|
||||
begin
|
||||
FactoryBot.public_send(factory_strategy, factory.name, trait_name)
|
||||
rescue StandardError => error
|
||||
rescue StandardError => e
|
||||
result |=
|
||||
[FactoryTraitError.new(error, factory, trait_name)]
|
||||
[FactoryTraitError.new(e, factory, trait_name)]
|
||||
end
|
||||
end
|
||||
result
|
||||
|
|
|
@ -21,8 +21,8 @@ module FactoryBot
|
|||
|
||||
def find(name)
|
||||
@items.fetch(name)
|
||||
rescue KeyError => key_error
|
||||
raise key_error_with_custom_message(key_error)
|
||||
rescue KeyError => e
|
||||
raise key_error_with_custom_message(e)
|
||||
end
|
||||
|
||||
alias :[] :find
|
||||
|
|
|
@ -8,6 +8,7 @@ describe "attribute overrides" do
|
|||
|
||||
def secure=(value)
|
||||
return unless user&.admin?
|
||||
|
||||
write_attribute(:secure, value)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,9 +25,9 @@ module DefineConstantMacros
|
|||
connection.create_table(table_name, &block)
|
||||
created_tables << table_name
|
||||
connection
|
||||
rescue Exception => exception # rubocop:disable Lint/RescueException
|
||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||
connection.execute("DROP TABLE IF EXISTS #{table_name}")
|
||||
raise exception
|
||||
raise e
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue