From 7903bdfed26f085f6d07d104ac458bc4319b1e32 Mon Sep 17 00:00:00 2001 From: Jamie Winsor Date: Sun, 4 Sep 2011 03:20:51 -0700 Subject: refactor factories and add #show tests for posts controller Do not want to cache classes, but do want to reload models after factory girl: http://groups.google.com/group/factory_girl/browse_thread/thread/daa24556d90c31fc http://stackoverflow.com/questions/5145165/associationtypemismatch-and-factorygirl rails_autolink was removed from Rails 3.1 and abstracted to an external gem fix display author name and post time on comment show fix namespace for thanking and moderated flash notices --- spec/factories/blog_comments.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 spec/factories/blog_comments.rb (limited to 'spec/factories/blog_comments.rb') diff --git a/spec/factories/blog_comments.rb b/spec/factories/blog_comments.rb new file mode 100644 index 0000000..9818c07 --- /dev/null +++ b/spec/factories/blog_comments.rb @@ -0,0 +1,19 @@ +FactoryGirl.define do + factory :blog_comment, :class => Refinery::BlogComment do + name "Joe Commenter" + sequence(:email) { |n| "person#{n}@example.com" } + body "Which one is the best for picking up new shoes?" + association :post, :factory => :blog_post + + trait :approved do + state 'approved' + end + + trait :rejected do + state 'rejected' + end + + factory :approved_comment, :traits => [:approved] + factory :rejected_comment, :traits => [:rejected] + end +end -- cgit v1.2.3