Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9e0372
commit 1c7eab1
Showing
4 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module FactoryGirl | ||
if defined?(::BasicObject) | ||
class NullObject < ::BasicObject | ||
def method_missing(*args) | ||
nil | ||
end | ||
end | ||
else | ||
class NullObject | ||
instance_methods.each do |m| | ||
undef_method(m) if m.to_s !~ /(?:^__|^nil\?$|^send$|^object_id$)/ | ||
end | ||
|
||
def method_missing(*args) | ||
nil | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require "spec_helper" | ||
|
||
describe FactoryGirl::NullObject do | ||
its(:id) { should be_nil } | ||
its(:age) { should be_nil } | ||
its(:name) { should be_nil } | ||
its(:admin?) { should be_nil } | ||
end |