OSDN Git Service

fix test
[pettanr/pettanr.git] / spec / manifests / sheet_panel_spec.rb
index d3a7bd9..8fb0dad 100644 (file)
@@ -8,11 +8,11 @@ describe SheetPanel do
   end
   
   describe 'ペタナイズに於いて' do
-    it 'スクコマを閉じるためのバインダーである' do
-      expect(@model.ancestors.include?(Peta::Binder)).to eq true
+    it '用紙にぶら下がったコマ、つまり、エレメントである' do
+      expect(@model.ancestors.include?(Peta::Element)).to eq true
     end
-    it '親モデルは持たない' do
-      expect(@model.my_peta.parent_model_name).to be_blank
+    it '親モデルは用紙である' do
+      expect(@model.my_peta.parent_model_name).to eq 'sheet'
     end
     describe 'ブーストに於いて' do
       it '特筆すべき注意事項はない' do
@@ -26,14 +26,14 @@ describe SheetPanel do
     before do
       @controller = @model.my_controller
     end
-    it 'スクロールのためのコントローラである' do
-      expect(@model.item_name).to eq 'scroll'
+    it '紙コマのためのコントローラである' do
+      expect(@model.item_name).to eq 'sheet_panel'
     end
     describe 'actionに於いて' do
       before do
         @actions = @controller.actions
-        @actions_names = ['index', 'by_author', 'by_panel', 'play', 'show', 
-          'count', 'count_by_author', 'count_by_panel', 
+        @actions_names = ['index', 'by_author', 'by_sheet', 'by_panel', 'show', 
+          'count', 'count_by_author', 'count_by_sheet', 'count_by_panel', 
           'new', 'edit', 'create', 'update', 'destroy']
       end
       it 'これらのアクションが定義されている' do
@@ -49,8 +49,8 @@ describe SheetPanel do
           expect(@action.type).to eq 'list'
         end
         it 'マニフェストから設定を取り出している' do
-          # スクロールの公開リストを返すように定義している
-          set_list_action? @action, 'scroll', 'public'
+          # 紙コマの公開リストを返すように定義している
+          set_list_action? @action, 'sheet_panel', 'public'
         end
       end
       describe 'by_authorに於いて' do
@@ -61,8 +61,20 @@ describe SheetPanel do
           expect(@action.type).to eq 'list'
         end
         it 'マニフェストから設定を取り出している' do
-          # スクロールの作家フィルタリストを返すように定義している
-          set_list_action? @action, 'scroll', 'by_author'
+          # 紙コマの作家フィルタリストを返すように定義している
+          set_list_action? @action, 'sheet_panel', 'by_author'
+        end
+      end
+      describe 'by_sheetに於いて' do
+        before do
+          @action = @actions['by_sheet']
+        end
+        it 'listタイプのアクションである' do
+          expect(@action.type).to eq 'list'
+        end
+        it 'マニフェストから設定を取り出している' do
+          #紙コマの用紙フィルタリストを返すように定義している
+          set_list_action? @action, 'sheet_panel', 'by_sheet'
         end
       end
       describe 'by_panelに於いて' do
@@ -73,8 +85,16 @@ describe SheetPanel do
           expect(@action.type).to eq 'list'
         end
         it 'マニフェストから設定を取り出している' do
-          #スクロールのコマフィルタリストを返すように定義している
-          set_list_action? @action, 'scroll', 'by_panel'
+          #紙コマのコマフィルタリストを返すように定義している
+          set_list_action? @action, 'sheet_panel', 'by_panel'
+        end
+      end
+      describe 'showに於いて' do
+        before do
+          @action = @actions['show']
+        end
+        it 'showタイプのアクションである' do
+          expect(@action.type).to eq 'show'
         end
       end
       describe 'countに於いて' do
@@ -85,8 +105,8 @@ describe SheetPanel do
           expect(@action.type).to eq 'count'
         end
         it 'マニフェストから設定を取り出している' do
-          #スクロールの公開リストのカウントを返すように定義している
-          set_list_action? @action, 'scroll', 'public'
+          #紙コマの公開リストのカウントを返すように定義している
+          set_list_action? @action, 'sheet_panel', 'public'
         end
       end
       describe 'count_by_authorに於いて' do
@@ -97,8 +117,20 @@ describe SheetPanel do
           expect(@action.type).to eq 'count'
         end
         it 'マニフェストから設定を取り出している' do
-          # スクロールの作家フィルタリストのカウントを返すように定義している
-          set_list_action? @action, 'scroll', 'by_author'
+          # 紙コマの作家フィルタリストのカウントを返すように定義している
+          set_list_action? @action, 'sheet_panel', 'by_author'
+        end
+      end
+      describe 'count_by_sheetに於いて' do
+        before do
+          @action = @actions['count_by_sheet']
+        end
+        it 'countタイプのアクションである' do
+          expect(@action.type).to eq 'count'
+        end
+        it 'マニフェストから設定を取り出している' do
+          # 紙コマの用紙フィルタリストのカウントを返すように定義している
+          set_list_action? @action, 'sheet_panel', 'by_sheet'
         end
       end
       describe 'count_by_panelに於いて' do
@@ -109,8 +141,8 @@ describe SheetPanel do
           expect(@action.type).to eq 'count'
         end
         it 'マニフェストから設定を取り出している' do
-          # スクロールのコマフィルタリストのカウントを返すように定義している
-          set_list_action? @action, 'scroll', 'by_panel'
+          # 紙コマのコマフィルタリストのカウントを返すように定義している
+          set_list_action? @action, 'sheet_panel', 'by_panel'
         end
       end
       describe 'newに於いて' do
@@ -121,7 +153,7 @@ describe SheetPanel do
           expect(@action.type).to eq 'new'
         end
         it 'type' do
-          expect(@action.item_name).to eq 'scroll'
+          expect(@action.item_name).to eq 'sheet_panel'
         end
       end
       describe 'editに於いて' do
@@ -132,7 +164,7 @@ describe SheetPanel do
           expect(@action.type).to eq 'edit'
         end
         it 'type' do
-          expect(@action.item_name).to eq 'scroll'
+          expect(@action.item_name).to eq 'sheet_panel'
         end
       end
       describe 'createに於いて' do
@@ -143,7 +175,7 @@ describe SheetPanel do
           expect(@action.type).to eq 'create'
         end
         it 'type' do
-          expect(@action.item_name).to eq 'scroll'
+          expect(@action.item_name).to eq 'sheet_panel'
         end
       end
       describe 'updateに於いて' do
@@ -154,7 +186,7 @@ describe SheetPanel do
           expect(@action.type).to eq 'update'
         end
         it 'type' do
-          expect(@action.item_name).to eq 'scroll'
+          expect(@action.item_name).to eq 'sheet_panel'
         end
       end
       describe 'destroyに於いて' do
@@ -165,7 +197,7 @@ describe SheetPanel do
           expect(@action.type).to eq 'destroy'
         end
         it 'type' do
-          expect(@action.item_name).to eq 'scroll'
+          expect(@action.item_name).to eq 'sheet_panel'
         end
       end
     end
@@ -177,76 +209,61 @@ describe SheetPanel do
       @my_manifest = @model.my_manifest
     end
     it 'サポート機能が動作している' do
-      expect(@my_manifest.model_name).to eq 'scroll'
+      expect(@my_manifest.model_name).to eq 'sheet_panel'
       expect(@my_manifest.classify).to eq @model
-      expect(@my_manifest.table_name).to eq 'scrolls'
+      expect(@my_manifest.table_name).to eq 'sheet_panels'
     end
     
     describe 'associationsに於いて' do
       describe 'belongs_toに於いて' do
         before do
           @belongs_to = @my_manifest.associations.belongs_to
-          @names = ['author']
+          @names = ['sheet', 'panel']
         end
         it 'これらのモデルに所属している' do
           set_associations? @belongs_to, @names
         end
-        describe 'authorに於いて' do
+        describe 'sheetに於いて' do
           before do
-            @mani = @belongs_to['author']
+            @mani = @belongs_to['sheet']
           end
           it 'マニフェストから設定を取り出している' do
             # モデル名と外部キーが定義あるいはデフォルト値補充されている
-            expect(@mani.model_name).to eq 'author'
-            expect(@mani.id_column).to eq 'author_id'
+            expect(@mani.model_name).to eq 'sheet'
+            expect(@mani.id_column).to eq 'sheet_id'
           end
           it 'サポート機能が動作している' do
             # モデルを再現できている
-            expect(@mani.model).to eq Author
+            expect(@mani.model).to eq Sheet
           end
         end
-      end
-      describe 'has_manyに於いて' do
-        before do
-          @has_many = @model.my_manifest.associations.has_many
-          @names = ['scroll_panels', 'panels']
-        end
-        it 'これらのモデルを所持している' do
-          set_associations? @has_many, @names
-        end
-        describe 'scroll_panelsに於いて' do
-          before do
-            @mani = @has_many['scroll_panels']
-          end
-          it 'マニフェストから設定を取り出している' do
-            # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている
-            expect(@mani.model_name).to eq 'scroll_panel'
-            expect(@mani.foreign_key).to eq 'scroll_id'
-            expect(@mani.through).to be nil
-          end
-          it 'サポート機能が動作している' do
-            # モデルを再現できている, 中間モデルフラグ
-            expect(@mani.through?).to be false
-            expect(@mani.model).to eq ScrollPanel
-          end
+        it 'これらのモデルに所属している' do
+          set_associations? @belongs_to, @names
         end
-        describe 'panelsに於いて' do
+        describe 'panelに於いて' do
           before do
-            @mani = @has_many['panels']
+            @mani = @belongs_to['panel']
           end
           it 'マニフェストから設定を取り出している' do
-            # モデル名, 外部キーと中間モデルが定義あるいはデフォルト値補充されている
+            # モデル名と外部キーが定義あるいはデフォルト値補充されている
             expect(@mani.model_name).to eq 'panel'
-            expect(@mani.foreign_key).to eq 'scroll_id'
-            expect(@mani.through).to eq 'scroll_panels'
+            expect(@mani.id_column).to eq 'panel_id'
           end
           it 'サポート機能が動作している' do
-            # モデルを再現できている, 中間モデルフラグ
-            expect(@mani.through?).to be true
+            # モデルを再現できている
             expect(@mani.model).to eq Panel
           end
         end
       end
+      describe 'has_manyに於いて' do
+        before do
+          @has_many = @model.my_manifest.associations.has_many
+          @names = []
+        end
+        it 'これらのモデルを所持している' do
+          set_associations? @has_many, @names
+        end
+      end
     end
     
     describe 'attributesに於いて' do
@@ -255,35 +272,55 @@ describe SheetPanel do
       end
       it 'これらのカラムを定義している' do
         set_attributes? @attributes, 
-          ['id', 'title', 'description', 'visible', 'author_id', 
+          ['id', 'sheet_id', 'panel_id', 'x', 'y', 'z', 't', 'author_id', 
           'created_at', 'updated_at']
       end
-      describe 'titleに於いて' do
+      describe 'sheet_idに於いて' do
         before do
-          @attribute = @attributes['title']
+          @attribute = @attributes['sheet_id']
         end
-        it 'textタイプである' do
-          expect(@attribute.type).to eq 'text'
+        it 'numberタイプである' do
+          expect(@attribute.type).to eq 'number'
         end
       end
-      describe 'descriptionに於いて' do
+      describe 'panel_idに於いて' do
         before do
-          @attribute = @attributes['description']
+          @attribute = @attributes['panel_id']
         end
-        it 'textタイプである' do
-          expect(@attribute.type).to eq 'text'
+        it 'numberタイプである' do
+          expect(@attribute.type).to eq 'number'
         end
       end
-      describe 'visibleに於いて' do
+      describe 'xに於いて' do
         before do
-          @attribute = @attributes['visible']
+          @attribute = @attributes['x']
         end
         it 'numberタイプである' do
           expect(@attribute.type).to eq 'number'
         end
-        it '選択肢を定数から取得できるように定義している' do
-          expect(@attribute.source.type).to eq 'magic_number'
-          expect(@attribute.source.select_item_name).to eq 'scroll_visible_items'
+      end
+      describe 'yに於いて' do
+        before do
+          @attribute = @attributes['y']
+        end
+        it 'numberタイプである' do
+          expect(@attribute.type).to eq 'number'
+        end
+      end
+      describe 'zに於いて' do
+        before do
+          @attribute = @attributes['z']
+        end
+        it 'numberタイプである' do
+          expect(@attribute.type).to eq 'number'
+        end
+      end
+      describe 'tに於いて' do
+        before do
+          @attribute = @attributes['t']
+        end
+        it 'numberタイプである' do
+          expect(@attribute.type).to eq 'number'
         end
       end
       describe 'author_idに於いて' do