mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
Implemented the top-level Factory method
This commit is contained in:
parent
218ed9a055
commit
4985bea035
2 changed files with 10 additions and 1 deletions
|
@ -1 +1,5 @@
|
||||||
require 'factory_girl/factory'
|
require 'factory_girl/factory'
|
||||||
|
|
||||||
|
def Factory (name, attrs = {})
|
||||||
|
Factory.create(name, attrs)
|
||||||
|
end
|
||||||
|
|
|
@ -209,7 +209,7 @@ class FactoryTest < Test::Unit::TestCase
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "Factory class method" do
|
context "Factory class" do
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
@name = :user
|
@name = :user
|
||||||
|
@ -240,6 +240,11 @@ class FactoryTest < Test::Unit::TestCase
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "call the create method from the top-level Factory() method" do
|
||||||
|
@factory.expects(:create).with(@attrs)
|
||||||
|
Factory(@name, @attrs)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue