OSDN Git Service

t#31725:add panel inspire
[pettanr/pettanr.git] / spec / models / panel_spec.rb
index 7542b20..ec82c05 100644 (file)
@@ -786,54 +786,14 @@ describe Panel do
   end\r
   describe 'コマ部品に於いて' do\r
     before do\r
-      #コマを作成しておく。\r
-      @panel = FactoryGirl.create :panel, :author_id => @author.id\r
-      @pp = FactoryGirl.create :panel_picture, :panel_id => @panel.id, :t => 1, :width => @p.width, :height => @p.height\r
-      @sb = @panel.speech_balloons.create(\r
-        FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 0)\r
-      )\r
-      @gc = @panel.ground_colors.create(\r
-        FactoryGirl.attributes_for(:ground_color, :panel_id => @panel.id, :t => 2)\r
-      )\r
-      @gp = @panel.ground_pictures.create(\r
-        FactoryGirl.attributes_for(:ground_picture, :panel_id => @panel.id, :picture_id => @p.id, :t => 3)\r
-      )\r
-      @panel.reload\r
     end\r
     context 'つつがなく終わるとき' do\r
       it 'コマ部品集合を利用している' do\r
-        Panel.any_instance.stub(:parts_element).with(any_args).and_return([])\r
-        Panel.any_instance.should_receive(:parts_element).with(any_args).exactly(1)\r
         r = @panel.parts\r
       end\r
     end\r
     it 'リストを返している' do\r
       r = @panel.parts\r
-      r.is_a?(Array).should be_true\r
-      r.size.should eq 4\r
-    end\r
-    it 'tでソートしている' do\r
-      r = @panel.parts\r
-      r[0].should eq @sb\r
-      r[1].should eq @pp\r
-      r[2].should eq @gc\r
-      r[3].should eq @gp\r
-    end\r
-    context 'さらに末尾にフキダシを追加したとき' do\r
-      before do\r
-        @sb2 = @panel.speech_balloons.create(\r
-          FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 4)\r
-        )\r
-        @panel.reload\r
-      end\r
-      it 'tでソートしている' do\r
-        r = @panel.parts\r
-        r[0].should eq @sb\r
-        r[1].should eq @pp\r
-        r[2].should eq @gc\r
-        r[3].should eq @gp\r
-        r[4].should eq @sb2\r
-      end\r
     end\r
   end\r
   \r
@@ -923,6 +883,22 @@ describe Panel do
       r[2].should eq @gc\r
       r[3].should eq @gp\r
     end\r
+    context 'さらに末尾にフキダシを追加したとき' do\r
+      before do\r
+        @sb2 = @panel.speech_balloons.create(\r
+          FactoryGirl.attributes_for(:speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @sbt.id, :t => 4)\r
+        )\r
+        @panel.reload\r
+      end\r
+      it 'tでソートしている' do\r
+        r = @panel.panel_elements\r
+        r[0].should eq @sb\r
+        r[1].should eq @pp\r
+        r[2].should eq @gc\r
+        r[3].should eq @gp\r
+        r[4].should eq @sb2\r
+      end\r
+    end\r
   end\r
   describe 'コマ要素のjson出力に於いて' do\r
     before do\r