OSDN Git Service

fix peta spec
[pettanr/pettanr.git] / spec / factories / speech_balloon_template.rb
index 9047331..ac97ed3 100644 (file)
 # -*- encoding: utf-8 -*-\r
 FactoryGirl.define do\r
-  factory :speech_balloon_template001, :class => SpeechBalloonTemplate do |i|\r
+  factory :speech_balloon_template_circle, :class => SpeechBalloonTemplate do |i|\r
     i.name 'circle@pettan.com'\r
     i.module_name 'CircleSpeechBalloon'\r
     i.caption '楕円'\r
     i.t 0\r
-    i.system_picture_id 41\r
-    i.settings '{"speech_balloon":{"quotes":"\u300c \u300d \u300e \u300f","default_width":200,"default_height":200,"default_font_size":1.0,"default_text_align":0,"default_fore_color":0,"default_r":140,"r_step":22.5},"0":{"balloon":{"system_picture_id":25},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"1":{"balloon":{"system_picture_id":26},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"2":{"balloon":{"system_picture_id":27},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"3":{"balloon":{"system_picture_id":28},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"4":{"balloon":{"system_picture_id":29},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"5":{"balloon":{"system_picture_id":30},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"6":{"balloon":{"system_picture_id":31},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"7":{"balloon":{"system_picture_id":32},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"8":{"balloon":{"system_picture_id":33},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"9":{"balloon":{"system_picture_id":34},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"10":{"balloon":{"system_picture_id":35},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"11":{"balloon":{"system_picture_id":36},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"12":{"balloon":{"system_picture_id":37},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"13":{"balloon":{"system_picture_id":38},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"14":{"balloon":{"system_picture_id":39},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}},"15":{"balloon":{"system_picture_id":40},"speech":{"x_rate":20,"y_rate":20,"width_rate":60,"height_rate":60}}}'\r
+    trait :with_system_picture do\r
+      after(:build) do |speech_balloon_template, evaluator|\r
+        icon = SystemPicture.find_by_md5('ca30a88b2e03bd149860325d5f3770a7') || \r
+          create(:system_picture_circle_icon)\r
+        speech_balloon_template.system_picture_id = icon.id\r
+        balloon0 = SystemPicture.find_by_md5('67d7c8acd3c52cb6e9abf7deb23be11d') || \r
+          create(:system_picture_circle_balloon_0)\r
+        balloon1 = SystemPicture.find_by_md5('58634a962f2126d6bc9119e843a07ed9') || \r
+          create(:system_picture_circle_balloon_1)\r
+        balloon2 = SystemPicture.find_by_md5('3e0d2528d0b58fb32414593a04daa7b3') || \r
+          create(:system_picture_circle_balloon_2)\r
+        balloon3 = SystemPicture.find_by_md5('dd3590336d7b69f2e85fc0c1b629d64a') || \r
+          create(:system_picture_circle_balloon_3)\r
+        balloon4 = SystemPicture.find_by_md5('a04f3ea06f95e33358ac57645031512d') || \r
+          create(:system_picture_circle_balloon_4)\r
+        balloon5 = SystemPicture.find_by_md5('d76cf38c3de4df74ae9f8bc76911a5a9') || \r
+          create(:system_picture_circle_balloon_5)\r
+        balloon6 = SystemPicture.find_by_md5('51974b0cc1d0283be6cda04114927dc5') || \r
+          create(:system_picture_circle_balloon_6)\r
+        balloon7 = SystemPicture.find_by_md5('68af2004a103a389d2c83b2cfcd98b22') || \r
+          create(:system_picture_circle_balloon_7)\r
+        balloon8 = SystemPicture.find_by_md5('9feac91d55ef144bad8389ee4f0751ac') || \r
+          create(:system_picture_circle_balloon_8)\r
+        balloon9 = SystemPicture.find_by_md5('50fb44750f5506cc9ed0783d92f58f00') || \r
+          create(:system_picture_circle_balloon_9)\r
+        balloon10 = SystemPicture.find_by_md5('bb65ca8d549401f6cc0bd6228cf6b79b') || \r
+          create(:system_picture_circle_balloon_10)\r
+        balloon11 = SystemPicture.find_by_md5('a6d32cb9218abc587fa732a21c94883e') || \r
+          create(:system_picture_circle_balloon_11)\r
+        balloon12 = SystemPicture.find_by_md5('b0aba72c940b80e9e32b87bd48ca2635') || \r
+          create(:system_picture_circle_balloon_12)\r
+        balloon13 = SystemPicture.find_by_md5('b886601235032b7006c23ba8bf309f74') || \r
+          create(:system_picture_circle_balloon_13)\r
+        balloon14 = SystemPicture.find_by_md5('e98e6b7bba74f8d166f0f69303b14a19') || \r
+          create(:system_picture_circle_balloon_14)\r
+        balloon15 = SystemPicture.find_by_md5('6756b435ba777f66dfea8e34d2e94567') || \r
+          create(:system_picture_circle_balloon_15)\r
+        speech_balloon_template.settings = {\r
+          "speech_balloon" => {\r
+            "quotes" => "\u300c \u300d \u300e \u300f",\r
+            "default_width" => 200,\r
+            "default_height" => 200,\r
+            "default_font_size" => 1.0,\r
+            "default_text_align" => 0,\r
+            "default_fore_color" => 0,\r
+            "default_r" => 140,\r
+            "r_step" => 22.5\r
+          },\r
+          "0" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon0.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "1" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon1.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "2" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon2.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "3" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon3.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "4" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon4.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "5" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon5.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "6" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon6.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "7" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon7.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "8" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon8.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "9" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon9.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "10" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon10.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "11" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon11.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "12" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon12.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "13" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon13.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "14" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon14.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          },\r
+          "15" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon15.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 20,\r
+              "y_rate" => 20,\r
+              "width_rate" => 60,\r
+              "height_rate" => 60\r
+            }\r
+          }\r
+        }.to_json\r
+      end\r
+    end\r
+    factory :speech_balloon_template_circle_with_system_picture, traits: [:with_system_picture]\r
   end\r
-  factory :speech_balloon_template002, :class => SpeechBalloonTemplate do |i|\r
+  factory :speech_balloon_template_plain, :class => SpeechBalloonTemplate do |i|\r
     i.name 'plain@pettan.com'\r
     i.module_name 'PlainSpeechBalloon'\r
     i.caption '透明'\r
     i.t 1\r
-    i.system_picture_id 43\r
-    i.settings '{"speech_balloon":{"quotes":"\u300c \u300d \u300e \u300f","default_width":150,"default_height":150,"default_font_size":1.0,"default_text_align":0,"default_fore_color":0},"all":{"balloon":{"system_picture_id":42},"speech":{"x_rate":0,"y_rate":0,"width_rate":100,"height_rate":100}}}'\r
+    trait :with_system_picture do\r
+      after(:build) do |speech_balloon_template, evaluator|\r
+        icon = SystemPicture.find_by_md5('d6b95a015cafe40f05f0a26b4ac3c51e') || \r
+          create(:system_picture_plain_icon)\r
+        speech_balloon_template.system_picture_id = icon.id\r
+        balloon0 = SystemPicture.find_by_md5('8197e42069aab7d15983425e6c121503') || \r
+          create(:system_picture_plain_balloon_0)\r
+        speech_balloon_template.settings = {\r
+          "speech_balloon" => {\r
+            "quotes" => "\u300c \u300d \u300e \u300f",\r
+            "default_width" => 150,\r
+            "default_height" => 150,\r
+            "default_font_size" => 1.0,\r
+            "default_text_align" => 0,\r
+            "default_fore_color" => 0\r
+          },\r
+          "all" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon0.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 0,\r
+              "y_rate" => 0,\r
+              "width_rate" => 100,\r
+              "height_rate" => 100\r
+            }\r
+          }\r
+        }.to_json\r
+      end\r
+    end\r
+    factory :speech_balloon_template_plain_with_system_picture, traits: [:with_system_picture]\r
   end\r
-  factory :speech_balloon_template003, :class => SpeechBalloonTemplate do |i|\r
+  factory :speech_balloon_template_square, :class => SpeechBalloonTemplate do |i|\r
     i.name 'square@pettan.com'\r
     i.module_name 'SquareSpeechBalloon'\r
     i.caption '長方形'\r
     i.t 2\r
-    i.system_picture_id 45\r
-    i.settings '{"speech_balloon":{"quotes":"\u300c \u300d \u300e \u300f","default_width":150,"default_height":150,"default_font_size":1.0,"default_text_align":3,"default_fore_color":0},"all":{"balloon":{"system_picture_id":44},"speech":{"x_rate":5,"y_rate":5,"width_rate":90,"height_rate":90}}}'\r
+    trait :with_system_picture do\r
+      after(:build) do |speech_balloon_template, evaluator|\r
+        icon = SystemPicture.find_by_md5('6f683574166286bb65d8ffa25a0af17f') || \r
+          create(:system_picture_square_icon)\r
+        speech_balloon_template.system_picture_id = icon.id\r
+        balloon0 = SystemPicture.find_by_md5('8159134d0af4b24ef21f30048f018ab1') || \r
+          create(:system_picture_square_balloon_0)\r
+        speech_balloon_template.settings = {\r
+          "speech_balloon" => {\r
+            "quotes" => "\u300c \u300d \u300e \u300f",\r
+            "default_width" => 150,\r
+            "default_height" => 150,\r
+            "default_font_size" => 1.0,\r
+            "default_text_align" => 3,\r
+            "default_fore_color" => 0\r
+          },\r
+          "all" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon0.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 5,\r
+              "y_rate" => 5,\r
+              "width_rate" => 90,\r
+              "height_rate" => 90\r
+            }\r
+          }\r
+        }.to_json\r
+      end\r
+    end\r
+    factory :speech_balloon_template_square_with_system_picture, traits: [:with_system_picture]\r
   end\r
-  factory :speech_balloon_template004, :class => SpeechBalloonTemplate do |i|\r
+  factory :speech_balloon_template_test, :class => SpeechBalloonTemplate do |i|\r
     i.name 'test@pettan.com'\r
     i.module_name 'TestSpeechBalloon'\r
     i.caption 'テスト'\r
     i.t 3\r
-    i.system_picture_id 47\r
-    i.settings '{"speech_balloon":{"quotes":"\u300c \u300d \u300e \u300f","default_width":150,"default_height":150,"default_font_size":1.0,"default_text_align":3,"default_fore_color":0},"all":{"balloon":{"system_picture_id":46},"speech":{"x_rate":5,"y_rate":5,"width_rate":90,"height_rate":90}}}'\r
+    trait :with_system_picture do\r
+      after(:build) do |speech_balloon_template, evaluator|\r
+        icon = SystemPicture.find_by_md5('a33a8a440701a6d3d68bc4df4687ab6d') || \r
+          create(:system_picture_test_icon)\r
+        speech_balloon_template.system_picture_id = icon.id\r
+        balloon0 = SystemPicture.find_by_md5('604a977cf756a4e8b2b74d05c3d647d2') || \r
+          create(:system_picture_test_balloon_0)\r
+        speech_balloon_template.settings = {\r
+          "speech_balloon" => {\r
+            "quotes" => "\u300c \u300d \u300e \u300f",\r
+            "default_width" => 150,\r
+            "default_height" => 150,\r
+            "default_font_size" => 1.0,\r
+            "default_text_align" => 3,\r
+            "default_fore_color" => 0\r
+          },\r
+          "all" => {\r
+            "balloon" => {\r
+              "system_picture_id" => balloon0.id\r
+            },\r
+            "speech" => {\r
+              "x_rate" => 5,\r
+              "y_rate" => 5,\r
+              "width_rate" => 90,\r
+              "height_rate" => 90\r
+            }\r
+          }\r
+        }.to_json\r
+      end\r
+    end\r
+    factory :speech_balloon_template_test_with_system_picture, traits: [:with_system_picture]\r
   end\r
 end\r