Created
April 27, 2012 18:05
-
-
Save dinedal/2511397 to your computer and use it in GitHub Desktop.
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
# Simple examples are wussy, here's a complicated one | |
# User belongs_to Circle, Tags has_many User, Tags has_many Circle | |
Factory :user do | |
has_a :circle | |
has_many :tag | |
end | |
Factory :circle do | |
has_many :user | |
has_many :tag | |
end | |
Factory :tag do | |
has_a :user | |
has_a :circle | |
end | |
describe User do | |
context "with a tag" do | |
subject{Make(:user)} # user is now this user | |
let(:tag){Make(:tag)} # tag is newly created with a :user of user, and a circle of Make(:circle) | |
end | |
context "in a circle" do | |
subject{Make(:user)} # user is now this user | |
let(:other_user){Make(:user)} | |
let(:circle){Make(:circle)} # circle is newly created with a :circle with two users user and other_user | |
context "with a tag" do | |
let(:tag){Make(:tag)} # tag is newly created with a :user of user and a :circle of circle | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment