mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
a56b68bc9c
* Alphabetize gem listing in various Gemfiles [Rubocop Bundler/OrderedGems] * Fix alignment of if/else/end statement [Rubocop Layout/ElseAlignment] * Method definitions should have a empty line between them [Rubocop Layout/EmptyLineBetweenDefs] * Modules, Classes, and blocks should have an empty line around them [Rubocop] Cops: Layout/EmptyLinesAroundBlockBody Layout/EmptyLinesAroundModuleBody Layout/EmptyLinesAroundClassBody Layout/EmptyLinesAroundAccessModifier * Keep a blank line before and after access modifiers [Rubocop Layout/EmptyLinesAroundAccessModifier] * Remove misc extra whitespace [Rubocop Layout/ExtraSpacing] * Indent the first line of the right-hand-side of a multi-line assignment [Rubocop Layout/IndentAssignment] * Remove extraneous whitespace [Rubocop] Cops: Layout/IndentationWidth Layout/LeadingCommentSpace Layout/SpaceAroundEqualsInParameterDefault Layout/SpaceInsideArrayLiteralBrackets Layout/SpaceInsideBlockBraces Layout/SpaceInsideParens Layout/TrailingBlankLines * Revert rubocop changes to gemfiles; exclude files from rubocop checks The files in gemfiles/ are generated by Appraisal, so we shouldn't edit them. Instead, let's tell RuboCop to exclude this directory.
24 lines
490 B
Ruby
24 lines
490 B
Ruby
module FactoryBot
|
|
# @api private
|
|
class NullObject < ::BasicObject
|
|
def initialize(methods_to_respond_to)
|
|
@methods_to_respond_to = methods_to_respond_to.map(&:to_s)
|
|
end
|
|
|
|
def method_missing(name, *args, &block)
|
|
if respond_to?(name)
|
|
nil
|
|
else
|
|
super
|
|
end
|
|
end
|
|
|
|
def respond_to?(method, include_private = false)
|
|
@methods_to_respond_to.include? method.to_s
|
|
end
|
|
|
|
def respond_to_missing?(*args)
|
|
false
|
|
end
|
|
end
|
|
end
|