forked from thoughtbot/factory_bot
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
41bc3ac
commit aee300a
Showing
4 changed files
with
42 additions
and
12 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 | ||
class NullFactory | ||
attr_reader :definition | ||
|
||
def initialize | ||
@definition = Definition.new | ||
end | ||
|
||
delegate :defined_traits, :callbacks, :to => :definition | ||
|
||
def compile; end | ||
def default_strategy; end | ||
def class_name; end | ||
|
||
def attributes | ||
AttributeList.new | ||
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,11 @@ | ||
require "spec_helper" | ||
|
||
describe FactoryGirl::NullFactory do | ||
it { should delegate(:defined_traits).to(:definition) } | ||
it { should delegate(:callbacks).to(:definition) } | ||
|
||
its(:compile) { should be_nil } | ||
its(:default_strategy) { should be_nil } | ||
its(:class_name) { should be_nil } | ||
its(:attributes) { should be_an_instance_of(FactoryGirl::AttributeList) } | ||
end |