OSDN Git Service

fix test
[pettanr/pettanr.git] / spec / manifests / original_picture_license_group_spec.rb
index b8e7b06..0faf646 100644 (file)
@@ -9,8 +9,8 @@ describe OriginalPictureLicenseGroup do
   end
   
   describe 'ペタナイズに於いて' do
-    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
-      expect(@model.ancestors.include?(Peta::Binder)).to eq true
+    it 'ã\82¢ã\82¤ã\83\86ã\83 である' do
+      expect(@model.ancestors.include?(Peta::Item)).to eq true
     end
     it '親モデルは持たない' do
       expect(@model.my_peta.parent_model_name).to be_blank
@@ -24,153 +24,6 @@ describe OriginalPictureLicenseGroup do
   end
   
   describe 'コントローラに於いて' do
-    before do
-      @controller = @model.my_controller
-    end
-    it 'スクロールのためのコントローラである' do
-      expect(@model.item_name).to eq 'scroll'
-    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', 
-          'new', 'edit', 'create', 'update', 'destroy']
-      end
-      it 'これらのアクションが定義されている' do
-        set_actions? @actions, @actions_names
-      end
-      describe 'baseに於いて' do
-      end
-      describe 'indexに於いて' do
-        before do
-          @action = @actions['index']
-        end
-        it 'listタイプのアクションである' do
-          expect(@action.type).to eq 'list'
-        end
-        it 'マニフェストから設定を取り出している' do
-          # スクロールの公開リストを返すように定義している
-          set_list_action? @action, 'scroll', 'public'
-        end
-      end
-      describe 'by_authorに於いて' do
-        before do
-          @action = @actions['by_author']
-        end
-        it 'listタイプのアクションである' do
-          expect(@action.type).to eq 'list'
-        end
-        it 'マニフェストから設定を取り出している' do
-          # スクロールの作家フィルタリストを返すように定義している
-          set_list_action? @action, 'scroll', 'by_author'
-        end
-      end
-      describe 'by_panelに於いて' do
-        before do
-          @action = @actions['by_panel']
-        end
-        it 'listタイプのアクションである' do
-          expect(@action.type).to eq 'list'
-        end
-        it 'マニフェストから設定を取り出している' do
-          #スクロールのコマフィルタリストを返すように定義している
-          set_list_action? @action, 'scroll', 'by_panel'
-        end
-      end
-      describe 'countに於いて' do
-        before do
-          @action = @actions['count']
-        end
-        it 'countタイプのアクションである' do
-          expect(@action.type).to eq 'count'
-        end
-        it 'マニフェストから設定を取り出している' do
-          #スクロールの公開リストのカウントを返すように定義している
-          set_list_action? @action, 'scroll', 'public'
-        end
-      end
-      describe 'count_by_authorに於いて' do
-        before do
-          @action = @actions['count_by_author']
-        end
-        it 'countタイプのアクションである' do
-          expect(@action.type).to eq 'count'
-        end
-        it 'マニフェストから設定を取り出している' do
-          # スクロールの作家フィルタリストのカウントを返すように定義している
-          set_list_action? @action, 'scroll', 'by_author'
-        end
-      end
-      describe 'count_by_panelに於いて' do
-        before do
-          @action = @actions['count_by_panel']
-        end
-        it 'countタイプのアクションである' do
-          expect(@action.type).to eq 'count'
-        end
-        it 'マニフェストから設定を取り出している' do
-          # スクロールのコマフィルタリストのカウントを返すように定義している
-          set_list_action? @action, 'scroll', 'by_panel'
-        end
-      end
-      describe 'newに於いて' do
-        before do
-          @action = @actions['new']
-        end
-        it 'newタイプのアクションである' do
-          expect(@action.type).to eq 'new'
-        end
-        it 'type' do
-          expect(@action.item_name).to eq 'scroll'
-        end
-      end
-      describe 'editに於いて' do
-        before do
-          @action = @actions['edit']
-        end
-        it 'editタイプのアクションである' do
-          expect(@action.type).to eq 'edit'
-        end
-        it 'type' do
-          expect(@action.item_name).to eq 'scroll'
-        end
-      end
-      describe 'createに於いて' do
-        before do
-          @action = @actions['create']
-        end
-        it 'createタイプのアクションである' do
-          expect(@action.type).to eq 'create'
-        end
-        it 'type' do
-          expect(@action.item_name).to eq 'scroll'
-        end
-      end
-      describe 'updateに於いて' do
-        before do
-          @action = @actions['update']
-        end
-        it 'updateタイプのアクションである' do
-          expect(@action.type).to eq 'update'
-        end
-        it 'type' do
-          expect(@action.item_name).to eq 'scroll'
-        end
-      end
-      describe 'destroyに於いて' do
-        before do
-          @action = @actions['destroy']
-        end
-        it 'destroyタイプのアクションである' do
-          expect(@action.type).to eq 'destroy'
-        end
-        it 'type' do
-          expect(@action.item_name).to eq 'scroll'
-        end
-      end
-    end
-    
   end
   
   describe 'モデルに於いて' do
@@ -178,74 +31,56 @@ describe OriginalPictureLicenseGroup do
       @my_manifest = @model.my_manifest
     end
     it 'サポート機能が動作している' do
-      expect(@my_manifest.model_name).to eq 'scroll'
+      expect(@my_manifest.model_name).to eq 'original_picture_license_group'
       expect(@my_manifest.classify).to eq @model
-      expect(@my_manifest.table_name).to eq 'scrolls'
+      expect(@my_manifest.table_name).to eq 'original_picture_license_groups'
     end
     
     describe 'associationsに於いて' do
       describe 'belongs_toに於いて' do
         before do
           @belongs_to = @my_manifest.associations.belongs_to
-          @names = ['author']
+          @names = ['original_picture', 'license_group']
         end
         it 'これらのモデルに所属している' do
           set_associations? @belongs_to, @names
         end
-        describe 'authorに於いて' do
+        describe 'original_pictureに於いて' do
           before do
-            @mani = @belongs_to['author']
+            @mani = @belongs_to['original_picture']
           end
           it 'マニフェストから設定を取り出している' do
             # モデル名と外部キーが定義あるいはデフォルト値補充されている
-            expect(@mani.model_name).to eq 'author'
-            expect(@mani.id_column).to eq 'author_id'
+            expect(@mani.model_name).to eq 'original_picture'
+            expect(@mani.id_column).to eq 'original_picture_id'
           end
           it 'サポート機能が動作している' do
             # モデルを再現できている
-            expect(@mani.model).to eq Author
+            expect(@mani.model).to eq OriginalPicture
           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
+        describe 'license_groupに於いて' do
           before do
-            @mani = @has_many['scroll_panels']
+            @mani = @belongs_to['license_group']
           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
+            # モデル名と外部キーが定義あるいはデフォルト値補充されている
+            expect(@mani.model_name).to eq 'license_group'
+            expect(@mani.id_column).to eq 'license_group_id'
           end
           it 'サポート機能が動作している' do
-            # モデルを再現できている, 中間モデルフラグ
-            expect(@mani.through?).to be false
-            expect(@mani.model).to eq ScrollPanel
+            # モデルを再現できている
+            expect(@mani.model).to eq LicenseGroup
           end
         end
-        describe 'panelsに於いて' do
-          before do
-            @mani = @has_many['panels']
-          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'
-          end
-          it 'サポート機能が動作している' do
-            # モデルを再現できている, 中間モデルフラグ
-            expect(@mani.through?).to be true
-            expect(@mani.model).to eq Panel
-          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
@@ -256,40 +91,20 @@ describe OriginalPictureLicenseGroup do
       end
       it 'これらのカラムを定義している' do
         set_attributes? @attributes, 
-          ['id', 'title', 'description', 'visible', 'author_id', 
+          ['id', 'original_picture_id', 'license_group_id', 
           'created_at', 'updated_at']
       end
-      describe 'titleに於いて' do
-        before do
-          @attribute = @attributes['title']
-        end
-        it 'textタイプである' do
-          expect(@attribute.type).to eq 'text'
-        end
-      end
-      describe 'descriptionに於いて' do
-        before do
-          @attribute = @attributes['description']
-        end
-        it 'textタイプである' do
-          expect(@attribute.type).to eq 'text'
-        end
-      end
-      describe 'visibleに於いて' do
+      describe 'original_picture_idに於いて' do
         before do
-          @attribute = @attributes['visible']
+          @attribute = @attributes['original_picture_id']
         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
       end
-      describe 'author_idに於いて' do
+      describe 'license_group_idに於いて' do
         before do
-          @attribute = @attributes['author_id']
+          @attribute = @attributes['license_group_id']
         end
         it 'numberタイプである' do
           expect(@attribute.type).to eq 'number'