mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
Mimic BasicObject without using BasicObject
This commit is contained in:
parent
b734b589f8
commit
d9e0372345
1 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
require "active_support/basic_object"
|
||||
|
||||
module FactoryGirl
|
||||
class AttributeAssigner
|
||||
def initialize(build_class, evaluator, attribute_list)
|
||||
|
@ -33,7 +35,11 @@ module FactoryGirl
|
|||
end
|
||||
|
||||
def null_object
|
||||
Class.new(BasicObject) do
|
||||
Class.new do
|
||||
instance_methods.each do |m|
|
||||
undef_method(m) if m.to_s !~ /(?:^__|^nil\?$|^send$|^object_id$)/
|
||||
end
|
||||
|
||||
def method_missing(*args)
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue