# -*- encoding: utf-8 -*-
require 'spec_helper'
-#ã\82¹ã\83\88ã\83¼ã\83ªã\83¼
+#ã\82¹ã\82¯ã\82³ã\83\9e
describe ScrollPanel do
before do
@admin = FactoryGirl.create :admin
@sp = FactoryGirl.create :system_picture
@lg = FactoryGirl.create :license_group
@license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
+ SpeechBalloonTemplate.delete_all
@speech_balloon_template = FactoryGirl.create :speech_balloon_template, "name" => "circle@pettan.com", "classname" => "CircleSpeechBalloon", "caption" => "cc", "system_picture_id" => @sp.id, "settings" => '{}'
@writing_format = FactoryGirl.create :writing_format
@user = FactoryGirl.create( :user_yas)
@scroll_panel.scroll_id = 'a'
@scroll_panel.should_not be_valid
end
- it 'å\98å\9c¨ã\81\99ã\82\8bã\82³ã\83\9fã\83\83ã\82¯でなければ失敗する' do
+ it 'å\98å\9c¨ã\81\99ã\82\8bã\82¹ã\82¯ã\83ã\83¼ã\83«でなければ失敗する' do
@scroll_panel.scroll_id = 0
@scroll_panel.should_not be_valid
end
MagicNumber['run_mode'] = 1
ScrollPanel.any_instance.stub(:reader_role_check).and_return(true)
end
- it 'è\87ªèº«ã\81®ã\82³ã\83\9fã\83\83ã\82¯に所持判定を問い合わせしている' do
+ it 'è\87ªèº«ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«に所持判定を問い合わせしている' do
Scroll.any_instance.stub(:own?).and_return(true)
Scroll.any_instance.should_receive(:own?).with(any_args).exactly(1)
r = @scroll_panel.visible?([@author])
end
- it 'è\87ªèº«ã\81®ã\82³ã\83\9fã\83\83ã\82¯に閲覧許可を問い合わせしている' do
+ it 'è\87ªèº«ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«に閲覧許可を問い合わせしている' do
Scroll.any_instance.stub(:own?).and_return(false)
Scroll.any_instance.stub(:visible?).and_return(true)
Scroll.any_instance.should_receive(:visible?).with(any_args).exactly(1)
MagicNumber['run_mode'] = 1
ScrollPanel.any_instance.stub(:reader_role_check).and_return(true)
end
- it 'è\87ªå\88\86ã\81®ã\82³ã\83\9fã\83\83ã\82¯ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼なら許可する' do
+ it 'è\87ªå\88\86ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«ã\81®ã\82¹ã\82¯ã\82³ã\83\9eなら許可する' do
Scroll.any_instance.stub(:own?).and_return(true)
Scroll.any_instance.stub(:visible).and_return(0)
r = @scroll_panel.visible?([@author])
r.should be_true
end
- it 'ä»\96人ã\81®é\9d\9eå\85¬é\96\8bã\82³ã\83\9fã\83\83ã\82¯ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼なら許可しない' do
+ it 'ä»\96人ã\81®é\9d\9eå\85¬é\96\8bã\82¹ã\82¯ã\83ã\83¼ã\83«ã\81®ã\82¹ã\82¯ã\82³ã\83\9eなら許可しない' do
Scroll.any_instance.stub(:own?).and_return(false)
Scroll.any_instance.stub(:visible).and_return(0)
r = @scroll_panel.visible?([@author])
r.should be_false
end
- it 'ä»\96人ã\81®ã\82³ã\83\9fã\83\83ã\82¯ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼でも公開なら許可する' do
+ it 'ä»\96人ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«ã\81®ã\82¹ã\82¯ã\82³ã\83\9eでも公開なら許可する' do
Scroll.any_instance.stub(:own?).and_return(false)
Scroll.any_instance.stub(:visible).and_return(1)
r = @scroll_panel.visible?([@author])
c.should eq [@scroll_panel]
end
it 't順で並んでいる' do
- #å\85¬é\96\8bã\82³ã\83\9fã\83\83ã\82¯ã\81®å\85¬é\96\8bã\82³ã\83\9eã\81¯(ä»\96人ã\81®ã\82³ã\83\9fã\83\83ã\82¯であっても)含んでいる
+ #å\85¬é\96\8bã\82¹ã\82¯ã\83ã\83¼ã\83«ã\81®å\85¬é\96\8bã\82³ã\83\9eã\81¯(ä»\96人ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«であっても)含んでいる
v = FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id, :t => 1
c = ScrollPanel.play_list @scroll, @author
c.should eq [ @scroll_panel, v]
c.should eq [@scroll_panel]
end
it '時系列で並んでいる' do
- #å\85¬é\96\8bã\82³ã\83\9fã\83\83ã\82¯のScrollPanelは(他人のScrollPanelであっても)含んでいる
+ #å\85¬é\96\8bã\82¹ã\82¯ã\83ã\83¼ã\83«のScrollPanelは(他人のScrollPanelであっても)含んでいる
v = FactoryGirl.create :scroll_panel, :author_id => @other_author.id, :scroll_id => @other_scroll.id, :panel_id => @other_panel.id, :t => 0, :updated_at => Time.now + 100
c = ScrollPanel.list
c.should eq [ v, @scroll_panel]
end
- it 'é\9d\9eå\85¬é\96\8bã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼ã\81¯(è\87ªå\88\86ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼であっても)含まない' do
+ it 'é\9d\9eå\85¬é\96\8bã\81®ã\82¹ã\82¯ã\82³ã\83\9eã\81¯(è\87ªå\88\86ã\81®ã\82¹ã\82¯ã\82³ã\83\9eであっても)含まない' do
h = FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @hidden_scroll.id, :panel_id => @panel.id, :t => 0
c = ScrollPanel.list
c.should eq [ @scroll_panel]
end
end
- describe 'è\87ªå\88\86ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼一覧取得に於いて' do
+ describe 'è\87ªå\88\86ã\81®ã\82¹ã\82¯ã\82³ã\83\9e一覧取得に於いて' do
before do
@scroll = FactoryGirl.create :scroll, :author_id => @author.id, :visible => 1
@panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
sl = ScrollPanel.mylist @author
sl.should eq [ns, @scroll_panel]
end
- it 'ä»\96人ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼ã\81¯ã\82³ã\83\9eã\82³ã\83\9fã\83\83ã\82¯ともに公開でも含まない' do
+ it 'ä»\96人ã\81®ã\82¹ã\82¯ã\82³ã\83\9eã\81¯ã\82³ã\83\9eã\82¹ã\82¯ã\83ã\83¼ã\83«ともに公開でも含まない' do
so = FactoryGirl.create :scroll_panel, :author_id => @other_author.id, :scroll_id => @other_scroll.id, :panel_id => @other_panel.id
sl = ScrollPanel.mylist @author
sl.should eq [@scroll_panel]
end
- it 'è\87ªå\88\86ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼ã\81¯ã\82³ã\83\9eã\82³ã\83\9fã\83\83ã\82¯ともに非公開でも含んでいる' do
+ it 'è\87ªå\88\86ã\81®ã\82¹ã\82¯ã\82³ã\83\9eã\81¯ã\82³ã\83\9eã\82¹ã\82¯ã\83ã\83¼ã\83«ともに非公開でも含んでいる' do
hs = FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @hscroll.id, :panel_id => @hpanel.id, :updated_at => Time.now + 100
sl = ScrollPanel.mylist @author
sl.should eq [hs, @scroll_panel]
end
end
- describe 'ä»\96ä½\9c家ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼一覧取得に於いて' do
+ describe 'ä»\96ä½\9c家ã\81®ã\82¹ã\82¯ã\82³ã\83\9e一覧取得に於いて' do
before do
@scroll = FactoryGirl.create :scroll, :author_id => @author.id, :visible => 1
@panel = FactoryGirl.create :panel, :author_id => @author.id, :publish => 1
r = ScrollPanel.himlist @other_author
r.should eq [ns, @other_scroll_panel]
end
- it 'å\85¬é\96\8bã\82³ã\83\9fã\83\83ã\82¯ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼' do
+ it 'å\85¬é\96\8bã\82¹ã\82¯ã\83ã\83¼ã\83«ã\81®ã\82¹ã\82¯ã\82³ã\83\9e' do
@hscroll = FactoryGirl.create :scroll, :author_id => @other_author.id, :visible => 0
ns = FactoryGirl.create :scroll_panel, :author_id => @other_author.id, :scroll_id => @hscroll.id, :panel_id => @other_panel.id, :t => 1, :updated_at => Time.now + 100
r = ScrollPanel.himlist @other_author
end
end
- describe 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼一覧ページ制御に於いて' do
+ describe 'ã\82¹ã\82¯ã\82³ã\83\9e一覧ページ制御に於いて' do
before do
ScrollPanel.stub(:count).with(any_args).and_return(100)
end
r = ScrollPanel.list_paginate
r.is_a?(Kaminari::PaginatableArray).should be_true
end
- it 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼一覧の取得条件を利用している' do
+ it 'ã\82¹ã\82¯ã\82³ã\83\9e一覧の取得条件を利用している' do
ScrollPanel.stub(:list_where).with(any_args).and_return('')
ScrollPanel.should_receive(:list_where).with(any_args).exactly(1)
r = ScrollPanel.list_paginate
end
end
- describe 'è\87ªå\88\86ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼一覧ページ制御に於いて' do
+ describe 'è\87ªå\88\86ã\81®ã\82¹ã\82¯ã\82³ã\83\9e一覧ページ制御に於いて' do
before do
ScrollPanel.stub(:count).with(any_args).and_return(100)
end
r = ScrollPanel.mylist_paginate @author
r.is_a?(Kaminari::PaginatableArray).should be_true
end
- it 'è\87ªå\88\86ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼一覧の取得条件を利用している' do
+ it 'è\87ªå\88\86ã\81®ã\82¹ã\82¯ã\82³ã\83\9e一覧の取得条件を利用している' do
ScrollPanel.stub(:mylist_where).with(any_args).and_return('')
ScrollPanel.should_receive(:mylist_where).with(any_args).exactly(1)
r = ScrollPanel.mylist_paginate @author
end
end
- describe 'ä»\96ä½\9c家ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼一覧ページ制御に於いて' do
+ describe 'ä»\96ä½\9c家ã\81®ã\82¹ã\82¯ã\82³ã\83\9e一覧ページ制御に於いて' do
before do
ScrollPanel.stub(:count).with(any_args).and_return(100)
end
r = ScrollPanel.himlist_paginate @other_author
r.is_a?(Kaminari::PaginatableArray).should be_true
end
- it 'ä»\96ä½\9c家ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼一覧の取得条件を利用している' do
+ it 'ä»\96ä½\9c家ã\81®ã\82¹ã\82¯ã\82³ã\83\9e一覧の取得条件を利用している' do
ScrollPanel.stub(:himlist_where).with(any_args).and_return('')
ScrollPanel.should_receive(:himlist_where).with(any_args).exactly(1)
r = ScrollPanel.himlist_paginate @other_author
r = ScrollPanel.list_opt
r.should have(3).items
end
- it 'ã\82³ã\83\9fã\83\83ã\82¯を含んでいる' do
+ it 'ã\82¹ã\82¯ã\83ã\83¼ã\83«を含んでいる' do
r = ScrollPanel.list_opt
r.has_key?(:scroll).should be_true
end
- it 'ã\82³ã\83\9fã\83\83ã\82¯は作家を含んでいる' do
+ it 'ã\82¹ã\82¯ã\83ã\83¼ã\83«は作家を含んでいる' do
r = ScrollPanel.list_opt
r[:scroll].has_key?(:author).should be_true
end
r = ScrollPanel.show @scroll_panel.id, @author
end
end
- it 'æ\8c\87å®\9aã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼を返す' do
+ it 'æ\8c\87å®\9aã\81®ã\82¹ã\82¯ã\82³ã\83\9eを返す' do
l = ScrollPanel.show @scroll_panel.id, @author
l.should eq @scroll_panel
end
- context 'ä»\96人ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼を開こうとしたとき' do
+ context 'ä»\96人ã\81®ã\82¹ã\82¯ã\82³ã\83\9eを開こうとしたとき' do
it '403Forbidden例外を返す' do
ScrollPanel.any_instance.stub(:visible?).with(@other_author).and_return(false)
lambda{
}.should raise_error(ActiveRecord::Forbidden)
end
end
- context 'å\98å\9c¨ã\81\97ã\81ªã\81\84ã\82¹ã\83\88ã\83¼ã\83ªã\83¼を開こうとしたとき' do
+ context 'å\98å\9c¨ã\81\97ã\81ªã\81\84ã\82¹ã\82¯ã\82³ã\83\9eを開こうとしたとき' do
it '404RecordNotFound例外を返す' do
lambda{
ScrollPanel.show 110, @author
r = ScrollPanel.edit @scroll_panel.id, @author
end
end
- it 'æ\8c\87å®\9aã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼を返す' do
+ it 'æ\8c\87å®\9aã\81®ã\82¹ã\82¯ã\82³ã\83\9eを返す' do
l = ScrollPanel.edit @scroll_panel.id, @author
l.should eq @scroll_panel
end
- context 'ä»\96人ã\81®ã\82¹ã\83\88ã\83¼ã\83ªã\83¼を開こうとしたとき' do
+ context 'ä»\96人ã\81®ã\82¹ã\82¯ã\82³ã\83\9eを開こうとしたとき' do
it '403Forbidden例外を返す' do
ScrollPanel.any_instance.stub(:own?).and_return(false)
lambda{
}.should raise_error(ActiveRecord::Forbidden)
end
end
- context 'å\98å\9c¨ã\81\97ã\81ªã\81\84ã\82¹ã\83\88ã\83¼ã\83ªã\83¼を開こうとしたとき' do
+ context 'å\98å\9c¨ã\81\97ã\81ªã\81\84ã\82¹ã\82¯ã\82³ã\83\9eを開こうとしたとき' do
it '404RecordNotFound例外を返す' do
lambda{
ScrollPanel.edit 110, @author
r = ScrollPanel.show_opt[:include]
r.should have(3).items
end
- it 'ã\82³ã\83\9fã\83\83ã\82¯を含んでいる' do
+ it 'ã\82¹ã\82¯ã\83ã\83¼ã\83«を含んでいる' do
r = ScrollPanel.show_opt[:include]
r.has_key?(:scroll).should be_true
end
- it 'ã\82³ã\83\9fã\83\83ã\82¯は作家を含んでいる' do
+ it 'ã\82¹ã\82¯ã\83ã\83¼ã\83«は作家を含んでいる' do
r = ScrollPanel.show_opt[:include]
r[:scroll].has_key?(:author).should be_true
end
describe 'json単体取得オプションに於いて' do
end
- describe 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼のjson出力に於いて' do
+ describe 'ã\82¹ã\82¯ã\82³ã\83\9eのjson出力に於いて' do
before do
#コマを作成しておく。
@panel = FactoryGirl.create :panel, :author_id => @author.id
end
end
- describe 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼リストのjson出力に於いて' do
+ describe 'ã\82¹ã\82¯ã\82³ã\83\9eリストのjson出力に於いて' do
before do
@panel = FactoryGirl.create :panel, :author_id => @author.id
@scroll = FactoryGirl.create :scroll, :author_id => @author.id
ScrollPanel.any_instance.stub(:scroll_panel_as_json).with(@author).and_return('{"s": 5}')
end
context 'つつがなく終わるとき' do
- it 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼のjson出力を依頼している' do
+ it 'ã\82¹ã\82¯ã\82³ã\83\9eのjson出力を依頼している' do
ScrollPanel.any_instance.should_receive(:scroll_panel_as_json).with(@author).exactly(1)
r = ScrollPanel.list_as_json_text [@scroll_panel], @author
end
j = JSON.parse r
j.is_a?(Array).should be_true
end
- it 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼を含んでいる' do
+ it 'ã\82¹ã\82¯ã\82³ã\83\9eを含んでいる' do
r = ScrollPanel.list_as_json_text [@scroll_panel], @author
j = JSON.parse r
j.first.has_key?('s').should be_true
@panel = FactoryGirl.create :panel, :author_id => @author.id
end
- context 'ã\82³ã\83\9fã\83\83ã\82¯初のコマなら' do
+ context 'ã\82¹ã\82¯ã\83ã\83¼ã\83«初のコマなら' do
it '0を補充値とする' do
@scroll_panel = FactoryGirl.build :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id
@scroll_panel.t = nil
r.should eq 0
end
end
- context 'ã\82³ã\83\9fã\83\83ã\82¯に一個コマがあるとき' do
+ context 'ã\82¹ã\82¯ã\83ã\83¼ã\83«に一個コマがあるとき' do
it '1を補充値とする' do
FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id, :t => 0
@scroll_panel = FactoryGirl.build :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id
r.should eq 1
end
end
- context 'ã\82³ã\83\9fã\83\83ã\82¯に2個コマがあるとき' do
+ context 'ã\82¹ã\82¯ã\83ã\83¼ã\83«に2個コマがあるとき' do
it '2を補充値とする' do
FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id, :t => 0
FactoryGirl.create :scroll_panel, :author_id => @author.id, :scroll_id => @scroll.id, :panel_id => @panel.id, :t => 1
@c2scroll_panel = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll2.id, :panel_id => @panel.id, :author_id => @author.id
end
context 'つつがなく終わるとき' do
- it 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼ã\81\8bã\82\89å\90\8cä¸\80ã\82³ã\83\9fã\83\83ã\82¯のtだけを収集している' do
+ it 'ã\82¹ã\82¯ã\82³ã\83\9eã\81\8bã\82\89å\90\8cä¸\80ã\82¹ã\82¯ã\83ã\83¼ã\83«のtだけを収集している' do
r = ScrollPanel.collect_t @scroll_panel
r.should eq [0]
end
end
context '複数コマのとき' do
- it 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼ã\81\8bã\82\89å\90\8cä¸\80ã\82³ã\83\9fã\83\83ã\82¯のtだけを収集している' do
+ it 'ã\82¹ã\82¯ã\82³ã\83\9eã\81\8bã\82\89å\90\8cä¸\80ã\82¹ã\82¯ã\83ã\83¼ã\83«のtだけを収集している' do
@scroll_panel2 = FactoryGirl.create :scroll_panel, :t => 1, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
r = ScrollPanel.collect_t @scroll_panel
r.sort.should eq [0, 1]
end
end
- context 'è¤\87æ\95°ã\82³ã\83\9eã\81§ã\83¨ã\82½ã\81®ã\82³ã\83\9fã\83\83ã\82¯も混じっているとき' do
- it 'ã\82¹ã\83\88ã\83¼ã\83ªã\83¼ã\81\8bã\82\89å\90\8cä¸\80ã\82³ã\83\9fã\83\83ã\82¯のtだけを収集している' do
+ context 'è¤\87æ\95°ã\82³ã\83\9eã\81§ã\83¨ã\82½ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«も混じっているとき' do
+ it 'ã\82¹ã\82¯ã\82³ã\83\9eã\81\8bã\82\89å\90\8cä¸\80ã\82¹ã\82¯ã\83ã\83¼ã\83«のtだけを収集している' do
@scroll_panel2 = FactoryGirl.create :scroll_panel, :t => 1, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
r = ScrollPanel.collect_t @scroll_panel
r.sort.should eq [0, 1]
l.sort.should eq [0, 1, 3, 4, 5]
end
end
- context 'å\85\88ã\81»ã\81©ã\81®ã\82±ã\83¼ã\82¹+ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯1件で挿入したとき' do
+ context 'å\85\88ã\81»ã\81©ã\81®ã\82±ã\83¼ã\82¹+ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«1件で挿入したとき' do
before do
@scroll2 = FactoryGirl.create :scroll, :author_id => @author.id
@scroll_panelc2 = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll2.id, :panel_id => @panel.id, :author_id => @author.id
l = ScrollPanel.find(:all, :conditions => ['scroll_id = ?', @scroll.id]).map {|s| s.t }
l.sort.should eq [0, 1, 3, 4, 5]
end
- it 'ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯に影響がない' do
+ it 'ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«に影響がない' do
ot = @scroll_panelc2.t
@scroll_panel6.insert_shift
@scroll_panelc2.reload
@scroll_panel3.t.should eq 3
end
end
- context 'å\85\88ã\81»ã\81©ã\81®ã\82±ã\83¼ã\82¹+ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯1件で挿入したとき' do
+ context 'å\85\88ã\81»ã\81©ã\81®ã\82±ã\83¼ã\82¹+ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«1件で挿入したとき' do
before do
@scroll2 = FactoryGirl.create :scroll, :author_id => @author.id
@scroll_panelc2 = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll2.id, :panel_id => @panel.id, :author_id => @author.id
@scroll_panel3.reload
@scroll_panel3.t.should eq 3
end
- it 'ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯に影響がない' do
+ it 'ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«に影響がない' do
@scroll_panel4.lesser_shift @ot
@scroll_panelc2.reload
@scroll_panelc2.t.should eq 0
@scroll_panel4.t.should eq 2
end
end
- context 'å\85\88ã\81»ã\81©ã\81®ã\82±ã\83¼ã\82¹+ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯1件で挿入したとき' do
+ context 'å\85\88ã\81»ã\81©ã\81®ã\82±ã\83¼ã\82¹+ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«1件で挿入したとき' do
before do
@scroll2 = FactoryGirl.create :scroll, :author_id => @author.id
@scroll_panelc2 = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll2.id, :panel_id => @panel.id, :author_id => @author.id
@scroll_panel4.reload
@scroll_panel4.t.should eq 2
end
- it 'ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯に影響がない' do
+ it 'ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«に影響がない' do
@scroll_panel2.higher_shift @ot
@scroll_panelc2.reload
@scroll_panelc2.t.should eq 0
r.should be_true
end
end
- context 'ã\82³ã\83\9fã\83\83ã\82¯で引っかかるとき' do
+ context 'ã\82¹ã\82¯ã\83ã\83¼ã\83«で引っかかるとき' do
it 'falseを返す' do
Panel.any_instance.stub(:usable?).with(any_args).and_return(true)
Scroll.any_instance.stub(:own?).with(any_args).and_return(false)
r.should be_false
end
end
- context 'ã\82³ã\83\9fã\83\83ã\82¯またはコマが指定されていなかったとき' do
+ context 'ã\82¹ã\82¯ã\83ã\83¼ã\83«またはコマが指定されていなかったとき' do
it 'nilを返す' do
Scroll.any_instance.stub(:own?).with(any_args).and_return(true)
@scroll_panel.panel_id = nil
end
end
#入れ替えテストと同じテストを実施。こちらはシフトだけでなく本尊も更新されている
- context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯1件で2に挿入したとき' do
+ context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«1件で2に挿入したとき' do
before do
@scroll2 = FactoryGirl.create :scroll, :author_id => @author.id
@scroll_panelc2 = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll2.id, :panel_id => @panel.id, :author_id => @author.id
@scroll_panel6.reload
@scroll_panel6.t.should eq 2
end
- it 'ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯に影響がない' do
+ it 'ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«に影響がない' do
@ot = @scroll_panelc2.t
@scroll_panel6.store
@scroll_panelc2.reload
@scroll_panelc2.t.should eq @ot
end
end
- context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯1件で3を1に移動したとき' do
+ context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«1件で3を1に移動したとき' do
before do
@scroll2 = FactoryGirl.create :scroll, :author_id => @author.id
@scroll_panelc2 = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll2.id, :panel_id => @panel.id, :author_id => @author.id
@scroll_panel4.reload
@scroll_panel4.t.should eq 1
end
- it 'ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯に影響がない' do
+ it 'ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«に影響がない' do
@scroll_panel4.store @ot
@scroll_panelc2.reload
@scroll_panelc2.t.should eq 0
end
end
- context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯1件で1を3に移動したとき' do
+ context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«1件で1を3に移動したとき' do
before do
@scroll2 = FactoryGirl.create :scroll, :author_id => @author.id
@scroll_panelc2 = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll2.id, :panel_id => @panel.id, :author_id => @author.id
@scroll_panel4.reload
@scroll_panel4.t.should eq 2
end
- it 'ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯に影響がない' do
+ it 'ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«に影響がない' do
@scroll_panel2.store @ot
@scroll_panelc2.reload
@scroll_panelc2.t.should eq 0
end
end
#ロールバックテスト。入れ替えが直接DBをいじるので、すべてのケースで確実にロールバックを確認する
- context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯1件で2に挿入したが保存に失敗したとき' do
+ context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«1件で2に挿入したが保存に失敗したとき' do
before do
ScrollPanel.any_instance.stub(:save).with(any_args).and_return(false)
@scroll2 = FactoryGirl.create :scroll, :author_id => @author.id
r.should be_false
end
end
- context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82³ã\83\9fã\83\83ã\82¯1件で3を1に移動したがシリアルチェックに失敗したとき' do
+ context 'ã\83\86ã\83¼ã\83\96ã\83«ã\81«5件(t:0,1,2,3,4)+ä»\96ã\81®ã\82¹ã\82¯ã\83ã\83¼ã\83«1件で3を1に移動したがシリアルチェックに失敗したとき' do
before do
ScrollPanel.stub(:validate_t).with(any_args).and_return(false)
@scroll2 = FactoryGirl.create :scroll, :author_id => @author.id