OSDN Git Service

fix peta spec
[pettanr/pettanr.git] / spec / factories / scroll.rb
1 # -*- encoding: utf-8 -*-\r
2 FactoryGirl.define do\r
3   factory :scroll_hello, :class => Scroll do |i|\r
4     i.title 'おめざめ2'\r
5     i.description 'とうとうあいつが目覚めたぞ。その勇姿をご覧あれ。'\r
6     i.visible 1\r
7     #association :author, factory: :author_yas\r
8     trait :with_scroll_panels do\r
9       after(:create) do |scroll, evaluator|\r
10         create(:scroll_panel_plain, t: 0, scroll: scroll, panel: create(:panel_hello, author: scroll.author))\r
11         create(:scroll_panel_plain, t: 1, scroll: scroll, panel: create(:panel_my_name, author: scroll.author))\r
12         create(:scroll_panel_plain, t: 2, scroll: scroll, panel: create(:panel_penjiro, author: scroll.author))\r
13         create(:scroll_panel_plain, t: 3, scroll: scroll, panel: create(:panel_enjoy, author: scroll.author))\r
14       end\r
15     end\r
16     factory :scroll_hello_with_scroll_panels, traits: [:with_scroll_panels]\r
17   end\r
18   factory :scroll_hidden, :class => Scroll do |i|\r
19     i.title '非公開のスクロール'\r
20     i.description '非公開の状態で作成したり、公開スクロールを非公開に変えるときに使う。'\r
21     i.visible 0\r
22   end\r
23   factory :scroll_itojun, :class => Scroll do |i|\r
24     i.title 'aaaaaaaa'\r
25     i.description ''\r
26     i.visible 1\r
27   end\r
28   factory :scroll_great, :class => Scroll do |i|\r
29     i.title 'aaaaaaaa'\r
30     i.description ''\r
31     i.visible 1\r
32     trait :with_scroll_panels do\r
33       after(:create) do |scroll, evaluator|\r
34         create(:scroll_panel_plain, t: 0, scroll: scroll, panel: create(:panel_great, author: scroll.author))\r
35         create(:scroll_panel_plain, t: 1, scroll: scroll, panel: create(:panel_awesome, author: scroll.author))\r
36         create(:scroll_panel_plain, t: 2, scroll: scroll, panel: create(:panel_wonderful, author: scroll.author))\r
37       end\r
38     end\r
39     factory :scroll_great_with_scroll_panels, traits: [:with_scroll_panels]\r
40   end\r
41   factory :scroll_diary, :class => Scroll do |i|\r
42     i.title '投稿した直後'\r
43     i.description ''\r
44     i.visible 1\r
45   end\r
46   factory :scroll006, :class => Scroll do |i|\r
47     i.title '投稿した直後'\r
48     i.description ''\r
49     i.visible 1\r
50     i.author_id 1\r
51   end\r
52   factory :scroll007, :class => Scroll do |i|\r
53     i.title '「はてなブックマーク」が、重すぎる'\r
54     i.description 'zzzz'\r
55     i.visible 1\r
56     i.author_id 1\r
57   end\r
58   factory :scroll008, :class => Scroll do |i|\r
59     i.title '投稿した直後2'\r
60     i.description 'qwe'\r
61     i.visible 1\r
62     i.author_id 1\r
63   end\r
64 end\r