OSDN Git Service

fix test
[pettanr/pettanr.git] / spec / manifests / balloon_spec.rb
index 91b36c0..2ff1e83 100644 (file)
@@ -8,15 +8,38 @@ describe Balloon do
   end\r
   \r
   describe 'ペタナイズに於いて' do\r
-    it 'ã\82¹ã\82¯ã\82³ã\83\9eã\82\92é\96\89ã\81\98ã\82\8bã\81\9fã\82\81ã\81®ã\83\90ã\82¤ã\83³ã\83\80ã\83¼である' do\r
-      expect(@model.ancestors.include?(Peta::Binder)).to eq true\r
+    it 'ã\83\95ã\82­ã\83\80ã\82·ã\81®è¦\81ç´ ã\81¨ã\81\97ã\81¦å\88©ç\94¨ã\81\95ã\82\8cã\82\8bã\82¨ã\83¬ã\83¡ã\83³ã\83\88である' do\r
+      expect(@model.ancestors.include?(Peta::Element)).to eq true\r
     end\r
-    it '親モデルは持たない' do\r
-      expect(@model.my_peta.parent_model_name).to be_blank\r
+    it '親モデルはフキダシである' do\r
+      expect(@model.my_peta.parent_model_name).to eq 'speech_balloon'\r
     end\r
     describe 'ブーストに於いて' do\r
-      it '特筆すべき注意事項はない' do\r
-        expect(@model.my_peta.boost.keys).to be_empty\r
+      before do\r
+        @boosts = @model.my_peta.boost\r
+        @boosts_names = ['speech_balloon_template']\r
+      end\r
+      it 'これらのブーストが定義されている' do\r
+        set_boosts? @boosts, @boosts_names\r
+      end\r
+      describe 'フキダシテンプレートに於いて' do\r
+        before do\r
+          @mani = @boosts['speech_balloon_template']\r
+        end\r
+        it 'フキダシテンプレート' do\r
+          expect(@mani.level).to eq 'post'\r
+          expect(@mani.template_name).to eq 'speech_balloon_template'\r
+          expect(@mani.column_name_for_template_module).to eq 'speech_balloon_template_module_name'\r
+          expect(@mani.settings_column_name).to eq 'speech_balloon_template_settings'\r
+          expect(@mani.foreign_key).to eq 'speech_balloon_template_id'\r
+        end\r
+        it 'フキダシテンプレート' do\r
+          expect(@mani.item_name_for_extend_model).to eq 'balloon'\r
+          expect(@mani.setter_method_name).to eq 'balloon_extend='\r
+          expect(@mani.getter_method_name).to eq 'balloon_extend'\r
+          expect(@mani.extend_model_class_name).to eq 'Balloon'\r
+          expect(@mani.extend_module_name).to eq 'BalloonModule'\r
+        end\r
       end\r
     end\r
     \r
@@ -26,15 +49,15 @@ describe Balloon do
     before do\r
       @controller = @model.my_controller\r
     end\r
-    it 'ã\82¹ã\82¯ã\83­ã\83¼ã\83«のためのコントローラである' do\r
-      expect(@model.item_name).to eq 'scroll'\r
+    it 'ã\83\95ã\82­ã\83\80ã\82·æ\9e のためのコントローラである' do\r
+      expect(@model.item_name).to eq 'balloon'\r
     end\r
     describe 'actionに於いて' do\r
       before do\r
         @actions = @controller.actions\r
-        @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', \r
-          'count', 'count_by_author', 'count_by_panel', \r
-          'new', 'edit', 'create', 'update', 'destroy']\r
+        @actions_names = ['index', 'by_author', 'show', \r
+          'count', 'count_by_author', \r
+          'new', 'edit']\r
       end\r
       it 'これらのアクションが定義されている' do\r
         set_actions? @actions, @actions_names\r
@@ -49,8 +72,8 @@ describe Balloon do
           expect(@action.type).to eq 'list'\r
         end\r
         it 'マニフェストから設定を取り出している' do\r
-          # ã\82¹ã\82¯ã\83­ã\83¼ã\83«の公開リストを返すように定義している\r
-          set_list_action? @action, 'scroll', 'public'\r
+          # ã\83\95ã\82­ã\83\80ã\82·æ\9e の公開リストを返すように定義している\r
+          set_list_action? @action, 'balloon', 'public'\r
         end\r
       end\r
       describe 'by_authorに於いて' do\r
@@ -61,20 +84,8 @@ describe Balloon do
           expect(@action.type).to eq 'list'\r
         end\r
         it 'マニフェストから設定を取り出している' do\r
-          # スクロールの作家フィルタリストを返すように定義している\r
-          set_list_action? @action, 'scroll', 'by_author'\r
-        end\r
-      end\r
-      describe 'by_panelに於いて' do\r
-        before do\r
-          @action = @actions['by_panel']\r
-        end\r
-        it 'listタイプのアクションである' do\r
-          expect(@action.type).to eq 'list'\r
-        end\r
-        it 'マニフェストから設定を取り出している' do\r
-          #スクロールのコマフィルタリストを返すように定義している\r
-          set_list_action? @action, 'scroll', 'by_panel'\r
+          # フキダシ枠の作家フィルタリストを返すように定義している\r
+          set_list_action? @action, 'balloon', 'by_author'\r
         end\r
       end\r
       describe 'countに於いて' do\r
@@ -85,8 +96,8 @@ describe Balloon do
           expect(@action.type).to eq 'count'\r
         end\r
         it 'マニフェストから設定を取り出している' do\r
-          #ã\82¹ã\82¯ã\83­ã\83¼ã\83«の公開リストのカウントを返すように定義している\r
-          set_list_action? @action, 'scroll', 'public'\r
+          #ã\83\95ã\82­ã\83\80ã\82·æ\9e の公開リストのカウントを返すように定義している\r
+          set_list_action? @action, 'balloon', 'public'\r
         end\r
       end\r
       describe 'count_by_authorに於いて' do\r
@@ -97,20 +108,8 @@ describe Balloon do
           expect(@action.type).to eq 'count'\r
         end\r
         it 'マニフェストから設定を取り出している' do\r
-          # スクロールの作家フィルタリストのカウントを返すように定義している\r
-          set_list_action? @action, 'scroll', 'by_author'\r
-        end\r
-      end\r
-      describe 'count_by_panelに於いて' do\r
-        before do\r
-          @action = @actions['count_by_panel']\r
-        end\r
-        it 'countタイプのアクションである' do\r
-          expect(@action.type).to eq 'count'\r
-        end\r
-        it 'マニフェストから設定を取り出している' do\r
-          # スクロールのコマフィルタリストのカウントを返すように定義している\r
-          set_list_action? @action, 'scroll', 'by_panel'\r
+          # フキダシ枠の作家フィルタリストのカウントを返すように定義している\r
+          set_list_action? @action, 'balloon', 'by_author'\r
         end\r
       end\r
       describe 'newに於いて' do\r
@@ -121,7 +120,7 @@ describe Balloon do
           expect(@action.type).to eq 'new'\r
         end\r
         it 'type' do\r
-          expect(@action.item_name).to eq 'scroll'\r
+          expect(@action.item_name).to eq 'balloon'\r
         end\r
       end\r
       describe 'editに於いて' do\r
@@ -132,40 +131,7 @@ describe Balloon do
           expect(@action.type).to eq 'edit'\r
         end\r
         it 'type' do\r
-          expect(@action.item_name).to eq 'scroll'\r
-        end\r
-      end\r
-      describe 'createに於いて' do\r
-        before do\r
-          @action = @actions['create']\r
-        end\r
-        it 'createタイプのアクションである' do\r
-          expect(@action.type).to eq 'create'\r
-        end\r
-        it 'type' do\r
-          expect(@action.item_name).to eq 'scroll'\r
-        end\r
-      end\r
-      describe 'updateに於いて' do\r
-        before do\r
-          @action = @actions['update']\r
-        end\r
-        it 'updateタイプのアクションである' do\r
-          expect(@action.type).to eq 'update'\r
-        end\r
-        it 'type' do\r
-          expect(@action.item_name).to eq 'scroll'\r
-        end\r
-      end\r
-      describe 'destroyに於いて' do\r
-        before do\r
-          @action = @actions['destroy']\r
-        end\r
-        it 'destroyタイプのアクションである' do\r
-          expect(@action.type).to eq 'destroy'\r
-        end\r
-        it 'type' do\r
-          expect(@action.item_name).to eq 'scroll'\r
+          expect(@action.item_name).to eq 'balloon'\r
         end\r
       end\r
     end\r
@@ -177,76 +143,72 @@ describe Balloon do
       @my_manifest = @model.my_manifest\r
     end\r
     it 'サポート機能が動作している' do\r
-      expect(@my_manifest.model_name).to eq 'scroll'\r
+      expect(@my_manifest.model_name).to eq 'balloon'\r
       expect(@my_manifest.classify).to eq @model\r
-      expect(@my_manifest.table_name).to eq 'scrolls'\r
+      expect(@my_manifest.table_name).to eq 'balloons'\r
     end\r
     \r
     describe 'associationsに於いて' do\r
       describe 'belongs_toに於いて' do\r
         before do\r
           @belongs_to = @my_manifest.associations.belongs_to\r
-          @names = ['author']\r
+          @names = ['speech_balloon', 'system_picture', 'speech_balloon_template']\r
         end\r
         it 'これらのモデルに所属している' do\r
           set_associations? @belongs_to, @names\r
         end\r
-        describe 'authorに於いて' do\r
+        describe 'speech_balloonに於いて' do\r
           before do\r
-            @mani = @belongs_to['author']\r
+            @mani = @belongs_to['speech_balloon']\r
           end\r
           it 'マニフェストから設定を取り出している' do\r
             # モデル名と外部キーが定義あるいはデフォルト値補充されている\r
-            expect(@mani.model_name).to eq 'author'\r
-            expect(@mani.id_column).to eq 'author_id'\r
+            expect(@mani.model_name).to eq 'speech_balloon'\r
+            expect(@mani.id_column).to eq 'speech_balloon_id'\r
           end\r
           it 'サポート機能が動作している' do\r
             # モデルを再現できている\r
-            expect(@mani.model).to eq Author\r
+            expect(@mani.model).to eq SpeechBalloon\r
           end\r
         end\r
-      end\r
-      describe 'has_manyに於いて' do\r
-        before do\r
-          @has_many = @model.my_manifest.associations.has_many\r
-          @names = ['scroll_panels', 'panels']\r
-        end\r
-        it 'これらのモデルを所持している' do\r
-          set_associations? @has_many, @names\r
-        end\r
-        describe 'scroll_panelsに於いて' do\r
+        describe 'system_pictureに於いて' do\r
           before do\r
-            @mani = @has_many['scroll_panels']\r
+            @mani = @belongs_to['system_picture']\r
           end\r
           it 'マニフェストから設定を取り出している' do\r
-            # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている\r
-            expect(@mani.model_name).to eq 'scroll_panel'\r
-            expect(@mani.foreign_key).to eq 'scroll_id'\r
-            expect(@mani.through).to be nil\r
+            # モデル名と外部キーが定義あるいはデフォルト値補充されている\r
+            expect(@mani.model_name).to eq 'system_picture'\r
+            expect(@mani.id_column).to eq 'system_picture_id'\r
           end\r
           it 'サポート機能が動作している' do\r
-            # モデルを再現できている, 中間モデルフラグ\r
-            expect(@mani.through?).to be false\r
-            expect(@mani.model).to eq ScrollPanel\r
+            # モデルを再現できている\r
+            expect(@mani.model).to eq SystemPicture\r
           end\r
         end\r
-        describe 'panelsに於いて' do\r
+        describe 'speech_balloon_templateに於いて' do\r
           before do\r
-            @mani = @has_many['panels']\r
+            @mani = @belongs_to['speech_balloon_template']\r
           end\r
           it 'マニフェストから設定を取り出している' do\r
-            # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている\r
-            expect(@mani.model_name).to eq 'panel'\r
-            expect(@mani.foreign_key).to eq 'scroll_id'\r
-            expect(@mani.through).to eq 'scroll_panels'\r
+            # モデル名と外部キーが定義あるいはデフォルト値補充されている\r
+            expect(@mani.model_name).to eq 'speech_balloon_template'\r
+            expect(@mani.id_column).to eq 'speech_balloon_template_id'\r
           end\r
           it 'サポート機能が動作している' do\r
-            # モデルを再現できている, 中間モデルフラグ\r
-            expect(@mani.through?).to be true\r
-            expect(@mani.model).to eq Panel\r
+            # モデルを再現できている\r
+            expect(@mani.model).to eq SpeechBalloonTemplate\r
           end\r
         end\r
       end\r
+      describe 'has_manyに於いて' do\r
+        before do\r
+          @has_many = @model.my_manifest.associations.has_many\r
+          @names = []\r
+        end\r
+        it 'これらのモデルを所持している' do\r
+          set_associations? @has_many, @names\r
+        end\r
+      end\r
     end\r
     \r
     describe 'attributesに於いて' do\r
@@ -255,45 +217,91 @@ describe Balloon do
       end\r
       it 'これらのカラムを定義している' do\r
         set_attributes? @attributes, \r
-          ['id', 'title', 'description', 'visible', 'author_id', \r
+          ['id', 'speech_balloon_id', 'speech_balloon_template_id', 'speech_balloon_template_module_name', \r
+          'system_picture_id', 'x', 'y', 'width', 'height', 'r', \r
+          'speech_balloon_template_settings', \r
           'created_at', 'updated_at']\r
       end\r
-      describe 'titleに於いて' do\r
+      describe 'speech_balloon_idに於いて' do\r
         before do\r
-          @attribute = @attributes['title']\r
+          @attribute = @attributes['speech_balloon_id']\r
         end\r
-        it 'textタイプである' do\r
-          expect(@attribute.type).to eq 'text'\r
+        it 'numberタイプである' do\r
+          expect(@attribute.type).to eq 'number'\r
+        end\r
+      end\r
+      describe 'speech_balloon_template_idに於いて' do\r
+        before do\r
+          @attribute = @attributes['speech_balloon_template_id']\r
+        end\r
+        it 'numberタイプである' do\r
+          expect(@attribute.type).to eq 'number'\r
         end\r
       end\r
-      describe 'descriptionに於いて' do\r
+      describe 'speech_balloon_template_module_nameに於いて' do\r
         before do\r
-          @attribute = @attributes['description']\r
+          @attribute = @attributes['speech_balloon_template_module_name']\r
         end\r
         it 'textタイプである' do\r
           expect(@attribute.type).to eq 'text'\r
         end\r
       end\r
-      describe 'visibleに於いて' do\r
+      describe 'system_picture_idに於いて' do\r
         before do\r
-          @attribute = @attributes['visible']\r
+          @attribute = @attributes['system_picture_id']\r
         end\r
         it 'numberタイプである' do\r
           expect(@attribute.type).to eq 'number'\r
         end\r
-        it '選択肢を定数から取得できるように定義している' do\r
-          expect(@attribute.source.type).to eq 'magic_number'\r
-          expect(@attribute.source.select_item_name).to eq 'scroll_visible_items'\r
+      end\r
+      describe 'xに於いて' do\r
+        before do\r
+          @attribute = @attributes['x']\r
+        end\r
+        it 'numberタイプである' do\r
+          expect(@attribute.type).to eq 'number'\r
         end\r
       end\r
-      describe 'author_idに於いて' do\r
+      describe 'yに於いて' do\r
         before do\r
-          @attribute = @attributes['author_id']\r
+          @attribute = @attributes['y']\r
         end\r
         it 'numberタイプである' do\r
           expect(@attribute.type).to eq 'number'\r
         end\r
       end\r
+      describe 'widthに於いて' do\r
+        before do\r
+          @attribute = @attributes['width']\r
+        end\r
+        it 'numberタイプである' do\r
+          expect(@attribute.type).to eq 'number'\r
+        end\r
+      end\r
+      describe 'heightに於いて' do\r
+        before do\r
+          @attribute = @attributes['height']\r
+        end\r
+        it 'numberタイプである' do\r
+          expect(@attribute.type).to eq 'number'\r
+        end\r
+      end\r
+      describe 'rに於いて' do\r
+        before do\r
+          @attribute = @attributes['r']\r
+        end\r
+        it 'numberタイプである' do\r
+          expect(@attribute.type).to eq 'number'\r
+        end\r
+      end\r
+      describe 'speech_balloon_template_settingsに於いて' do\r
+        before do\r
+          @attribute = @attributes['speech_balloon_template_settings']\r
+        end\r
+        it 'textタイプである' do\r
+          expect(@attribute.type).to eq 'text'\r
+        end\r
+      end\r
     end\r
     \r
   end\r