Skip to content

Instantly share code, notes, and snippets.

@jferris
Created November 5, 2010 18:27
Show Gist options
  • Save jferris/664564 to your computer and use it in GitHub Desktop.
Save jferris/664564 to your computer and use it in GitHub Desktop.
factory_girl_rspec_integration.rb
describe Message do
create :account, :name => "My Account" do
create :user
create :project
with :project, :user => :author do
create :message
end
end
# examples
end
describe Message do
let!(:account) { Factory(:account, :name => "My Account") }
let!(:user) { Factory(:user, :account => account) }
let!(:project) { Factory(:project, :account => account) }
let!(:message) { Factory(:message, :account => account,
:project => project,
:author => user) }
# examples
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment