forked from ginty/cranky
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to assign attributes via a block
- Loading branch information
Ginty
committed
May 27, 2010
1 parent
d0b4c44
commit efc07f4
Showing
3 changed files
with
24 additions
and
4 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 |
---|---|---|
|
@@ -79,6 +79,13 @@ | |
Factory.build(:user).argument_received.should == nil | ||
Factory.build(:user, :argument_supplied => true).argument_received.should == true | ||
end | ||
|
||
it "should allow blocks to be passed into the define method" do | ||
Factory.build(:user, :name => "jenny", :email => lambda{ |u| "#{u.name}@home.com" }).email.should == "[email protected]" | ||
Factory.build(:user, :name => lambda{"jimmy" + " cranky"}).name.should == "jimmy cranky" | ||
Factory.build(:user, :name => "jenny", :email => Proc.new{ |u| "#{u.name}@home.com" }).email.should == "[email protected]" | ||
Factory.build(:user, :name => Proc.new{"jimmy" + " cranky"}).name.should == "jimmy cranky" | ||
end | ||
|
||
end | ||
|