From 345d346224b3d94291ea4b7d61e8e628e33b5e53 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 18 Jan 2011 10:00:48 -0800 Subject: [PATCH] Initial fixture_builder --- spec/support/fixture_builder.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 spec/support/fixture_builder.rb diff --git a/spec/support/fixture_builder.rb b/spec/support/fixture_builder.rb new file mode 100644 index 000000000..c81d2f55b --- /dev/null +++ b/spec/support/fixture_builder.rb @@ -0,0 +1,15 @@ +# I usually put this file in spec/support/fixture_builder.rb +FixtureBuilder.configure do |fbuilder| + # rebuild fixtures automatically when these files change: + fbuilder.files_to_check += Dir["app/models/*.rb", "lib/**/*.rb", "spec/factories/*.rb", "spec/support/fixture_builder.rb"] + + # now declare objects + fbuilder.factory do + alice = Factory(:user_with_aspect, :username => "alice") + bob = Factory(:user_with_aspect, :username => "bob") + eve = Factory(:user_with_aspect, :username => "eve") + + connect_users(bob, bob.aspects.first, alice, alice.aspects.first) + connect_users(bob, bob.aspects.first, eve, eve.aspects.first) + end +end