OSDN Git Service

fix js manifest
[pettanr/pettanr.git] / spec / factories / scroll.rb
index 3b8face..ba106f2 100644 (file)
@@ -4,13 +4,25 @@ FactoryGirl.define do
     i.title 'おめざめ2'\r
     i.description ''\r
     i.visible 1\r
-    association :author, factory: :author_yas\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
+    #association :author, factory: :author_yas\r
+    trait :with_scroll_panels do\r
+      after(:create) do |scroll, evaluator|\r
+        #panel_hello = create(:panel_hello, author: scroll.author)\r
+        create(:scroll_panel_plain, t: 0, scroll: scroll, panel: create(:panel_hello, author: scroll.author))\r
+        panel_my_name = create(:panel_hello, author: scroll.author)\r
+        create(:scroll_panel_plain, t: 1, scroll: scroll, panel: panel_my_name)\r
+        panel_penjiro = create(:panel_hello, author: scroll.author)\r
+        create(:scroll_panel_plain, t: 2, scroll: scroll, panel: panel_penjiro)\r
+        panel_enjoy = create(:panel_hello, author: scroll.author)\r
+        create(:scroll_panel_plain, t: 3, scroll: scroll, panel: panel_enjoy)\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 :scroll003, :class => Scroll do |i|\r
     i.title 'aaaaaaaa'\r