Permalink
Browse files

Added default strategy parameter

  • Loading branch information...
eugenebolshakov authored and jferris committed Jan 8, 2009
1 parent f7a3ca5 commit fb5a506558b52be9b6fdb4f463402ac1c3a3cf79
Showing with 11 additions and 2 deletions.
  1. +1 −1 lib/factory_girl/factory.rb
  2. +9 −0 test/factory_test.rb
  3. +1 −1 test/integration_test.rb
@@ -174,7 +174,7 @@ def sequence (name, &block)
s = Sequence.new(&block)
add_attribute(name) { s.next }
end
# Generates and returns a Hash of attributes from this factory. Attributes
# can be individually overridden by passing in a Hash of attribute => value
# pairs.
View
@@ -366,6 +366,15 @@ class FactoryTest < Test::Unit::TestCase
returns('result')
assert_equal 'result', Factory.stub(@name, :attr => 'value')
end
should "use default strategy option as Factory.default_strategy" do
@factory.stubs(:default_strategy).returns(:create)
@factory.
expects(:run).
with(Factory::Proxy::Create, :attr => 'value').
returns('result')
assert_equal 'result', Factory.default_strategy(@name, :attr => 'value')
end
should "use the default strategy for the global Factory method" do
@factory.stubs(:default_strategy).returns(:create)
View
@@ -131,7 +131,7 @@ def teardown
end
end
context "an instance generated by a factory with a custom class name" do
setup do

0 comments on commit fb5a506

Please sign in to comment.