OSDN Git Service

fix panel test
[pettanr/pettanr.git] / spec / models / panel_spec.rb
index 2b07d60..fd63b14 100644 (file)
@@ -11,7 +11,8 @@ describe Panel do
     @other_user = Factory( :user_yas)
     @other_author = @other_user.author
     @other_artist = Factory :artist_yas, :author_id => @other_author.id
-    
+    @op = Factory :original_picture, :artist_id => @artist.id, :license_id => @license.id\r
+    @rp = Factory :resource_picture, :original_picture_id => @op.id, :license_id => @license.id
   end\r
   
   describe '検証に於いて' do
@@ -55,7 +56,7 @@ describe Panel do
         @panel = Factory.build :panel, :author_id => @author.id, :comic_id => @comic.id
       end
       it 'テストデータの確認' do
-        @panel.resource_picture_id = 1
+        @panel.resource_picture_id = @rp.id
         @panel.should be_valid
       end
       it 'nullなら通る' do
@@ -66,10 +67,6 @@ describe Panel do
         @panel.resource_picture_id = 'a'
         @panel.should_not be_valid
       end
-      it '存在する素材でなければ失敗する' do
-        @panel.resource_picture_id = 0
-        @panel.should_not be_valid
-      end
     end
     context 'widthを検証するとき' do
       before do
@@ -446,11 +443,15 @@ describe Panel do
           end
       it 'フキダシを含んでいる' do
         r = Panel.show_include_opt
-        r.has_key?(:balloons).should be_true\r
+        r.has_key?(:speech_balloons).should be_true\r
       end
+        it 'フキダシはフキダシ枠を含んでいる' do
+          r = Panel.show_include_opt
+          r[:speech_balloons].has_key?(:balloons).should be_true\r
+        end
         it 'フキダシはセリフを含んでいる' do
           r = Panel.show_include_opt
-          r[:balloons].has_key?(:speeches).should be_true\r
+          r[:speech_balloons].has_key?(:speeches).should be_true\r
         end
       it '作家を含んでいる' do
         r = Panel.show_include_opt
@@ -498,12 +499,16 @@ describe Panel do
           r[:panel_pictures][:resource_picture].has_key?(:license).should be_true\r
         end
     it 'フキダシを含んでいる' do
-      r = Panel.show_json_include_opt[:include]
-      r.has_key?(:balloons).should be_true\r
+      r = Panel.show_include_opt
+      r.has_key?(:speech_balloons).should be_true\r
     end
+      it 'フキダシはフキダシ枠を含んでいる' do
+        r = Panel.show_include_opt
+        r[:speech_balloons].has_key?(:balloons).should be_true\r
+      end
       it 'フキダシはセリフを含んでいる' do
-        r = Panel.show_json_include_opt[:include]
-        r[:balloons].has_key?(:speeches).should be_true\r
+        r = Panel.show_include_opt
+        r[:speech_balloons].has_key?(:speeches).should be_true\r
       end
     it '作家を含んでいる' do
       r = Panel.show_json_include_opt[:include]
@@ -606,12 +611,16 @@ describe Panel do
           r[:panel_pictures][:resource_picture].has_key?(:license).should be_true\r
         end
     it 'フキダシを含んでいる' do
-      r = Panel.list_opt[:include]
-      r.has_key?(:balloons).should be_true\r
+      r = Panel.show_include_opt
+      r.has_key?(:speech_balloons).should be_true\r
     end
+      it 'フキダシはフキダシ枠を含んでいる' do
+        r = Panel.show_include_opt
+        r[:speech_balloons].has_key?(:balloons).should be_true\r
+      end
       it 'フキダシはセリフを含んでいる' do
-        r = Panel.list_opt[:include]
-        r[:balloons].has_key?(:speeches).should be_true\r
+        r = Panel.show_include_opt
+        r[:speech_balloons].has_key?(:speeches).should be_true\r
       end
     it '作家を含んでいる' do
       r = Panel.list_opt[:include]
@@ -648,12 +657,16 @@ describe Panel do
           r[:panel_pictures][:resource_picture].has_key?(:license).should be_true\r
         end
     it 'フキダシを含んでいる' do
-      r = Panel.list_json_opt[:include]
-      r.has_key?(:balloons).should be_true\r
+      r = Panel.show_include_opt
+      r.has_key?(:speech_balloons).should be_true\r
     end
+      it 'フキダシはフキダシ枠を含んでいる' do
+        r = Panel.show_include_opt
+        r[:speech_balloons].has_key?(:balloons).should be_true\r
+      end
       it 'フキダシはセリフを含んでいる' do
-        r = Panel.list_json_opt[:include]
-        r[:balloons].has_key?(:speeches).should be_true\r
+        r = Panel.show_include_opt
+        r[:speech_balloons].has_key?(:speeches).should be_true\r
       end
     it '作家を含んでいる' do
       r = Panel.list_json_opt[:include]