diff --git a/lib/factory_girl.rb b/lib/factory_girl.rb index 16e3223..5ce6919 100644 --- a/lib/factory_girl.rb +++ b/lib/factory_girl.rb @@ -1 +1,5 @@ require 'factory_girl/factory' + +def Factory (name, attrs = {}) + Factory.create(name, attrs) +end diff --git a/test/factory_test.rb b/test/factory_test.rb index cb5600c..1d27424 100644 --- a/test/factory_test.rb +++ b/test/factory_test.rb @@ -209,7 +209,7 @@ class FactoryTest < Test::Unit::TestCase end - context "Factory class method" do + context "Factory class" do setup do @name = :user @@ -240,6 +240,11 @@ class FactoryTest < Test::Unit::TestCase end + should "call the create method from the top-level Factory() method" do + @factory.expects(:create).with(@attrs) + Factory(@name, @attrs) + end + end end