- @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item6 = FactoryGirl.build :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- end
- it '既存のt1を2にシフトしてこれから挿入するt(1)が欠番になっている' do
- @item6.insert_shift
- l = SheetPanel.find(:all).map {|s| s.t }
- l.sort.should eq [0, 1, 3, 4, 5]
- end
- end
- context '先ほどのケース+他の用紙1件で挿入したとき' do
- before do
- @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
- @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
- @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
- @item6 = FactoryGirl.build :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+ @item = FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+ @item2 = FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+ @item3 = FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+ @item4 = FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+ @item5 = FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
+ @item6 = FactoryGirl.build :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel