OSDN Git Service

fix peta test
[pettanr/pettanr.git] / spec / factories / scroll.rb
index c68c80e..c80f5e0 100644 (file)
@@ -1,34 +1,39 @@
 # -*- encoding: utf-8 -*-\r
 FactoryGirl.define do\r
-  factory :scroll001, :class => Scroll do |i|\r
+  factory :scroll_hello, :class => Scroll do |i|\r
     i.title 'おめざめ2'\r
-    i.description ''\r
-    i.visible 1\r
-    i.author_id 1\r
-  end\r
-  factory :scroll002, :class => Scroll do |i|\r
-    i.title '意味ないし。'\r
-    i.description ''\r
-    i.visible 1\r
-    i.author_id 2\r
-  end\r
-  factory :scroll003, :class => Scroll do |i|\r
+    i.description 'とうとうあいつが目覚めたぞ。その勇姿をご覧あれ。'\r
+    i.visible 1\r
+    #association :author, factory: :author_yas\r
+    trait :with_scroll_panels do\r
+      after(:create) do |scroll, evaluator|\r
+        create(:scroll_panel_plain, t: 0, scroll: scroll, panel: create(:panel_hello, author: scroll.author))\r
+        create(:scroll_panel_plain, t: 1, scroll: scroll, panel: create(:panel_my_name, author: scroll.author))\r
+        create(:scroll_panel_plain, t: 2, scroll: scroll, panel: create(:panel_penjiro, author: scroll.author))\r
+        create(:scroll_panel_plain, t: 3, scroll: scroll, panel: create(:panel_enjoy, author: scroll.author))\r
+      end\r
+    end\r
+    factory :scroll_hello_with_scroll_panels, traits: [:with_scroll_panels]\r
+  end\r
+  factory :scroll_hidden, :class => Scroll do |i|\r
+    i.title '非公開のスクロール'\r
+    i.description '非公開の状態で作成したり、公開スクロールを非公開に変えるときに使う。'\r
+    i.visible 0\r
+  end\r
+  factory :scroll_itojun, :class => Scroll do |i|\r
     i.title 'aaaaaaaa'\r
     i.description ''\r
     i.visible 1\r
-    i.author_id 1\r
   end\r
-  factory :scroll004, :class => Scroll do |i|\r
+  factory :scroll_great, :class => Scroll do |i|\r
     i.title 'aaaaaaaa'\r
     i.description ''\r
     i.visible 1\r
-    i.author_id 1\r
   end\r
-  factory :scroll005, :class => Scroll do |i|\r
+  factory :scroll_diary, :class => Scroll do |i|\r
     i.title '投稿した直後'\r
     i.description ''\r
     i.visible 1\r
-    i.author_id 4\r
   end\r
   factory :scroll006, :class => Scroll do |i|\r
     i.title '投稿した直後'\r