describe BalloonsController do
before do
+ SpeechBalloonTemplate.delete_all
@admin = FactoryGirl.create :admin
@user = FactoryGirl.create( :user_yas)
@author = FactoryGirl.create :author, :user_id => @user.id
@lg = FactoryGirl.create :license_group
@license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
- @speech_balloon_template = FactoryGirl.create :speech_balloon_template
+ @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
@panel = FactoryGirl.create :panel, :author_id => @author.id
end
if MagicNumber['run_mode'] == 1
describe '一覧表示に於いて' do
before do
- @sb = FactoryGirl.create :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
- @balloon = FactoryGirl.create :balloon, :speech_balloon_id => @sb.id, :system_picture_id => @sp.id
- @speech = FactoryGirl.create :speech, :speech_balloon_id => @sb.id
+ @sb = FactoryGirl.build :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
+ @speech = @sb.build_speech(
+ FactoryGirl.attributes_for(:speech, :writing_format_id => @writing_format.id)
+ )
+ @balloon = @sb.build_balloon(
+ FactoryGirl.attributes_for(:balloon, :system_picture_id => @sp.id)
+ )
+ @sb.boost
+ @sb.save!
sign_in @user
Balloon.stub(:list).and_return([@balloon, @balloon, @balloon])
end
describe '単体表示に於いて' do
before do
sign_in @user
- @sb = FactoryGirl.create :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
- @balloon = FactoryGirl.create :balloon, :speech_balloon_id => @sb.id, :system_picture_id => @sp.id
- @speech = FactoryGirl.create :speech, :speech_balloon_id => @sb.id
+ @sb = FactoryGirl.build :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
+ @speech = @sb.build_speech(
+ FactoryGirl.attributes_for(:speech, :writing_format_id => @writing_format.id)
+ )
+ @balloon = @sb.build_balloon(
+ FactoryGirl.attributes_for(:balloon, :system_picture_id => @sp.id)
+ )
+ @sb.boost
+ @sb.save!
Balloon.stub(:show).and_return(@balloon)
end
context 'つつがなく終わるとき' do
else
describe '一覧表示に於いて' do
before do
- @sb = FactoryGirl.create :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
- @balloon = FactoryGirl.create :balloon, :speech_balloon_id => @sb.id, :system_picture_id => @sp.id
- @speech = FactoryGirl.create :speech, :speech_balloon_id => @sb.id
+ @sb = FactoryGirl.build :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
+ @speech = @sb.build_speech(
+ FactoryGirl.attributes_for(:speech, :writing_format_id => @writing_format.id)
+ )
+ @balloon = @sb.build_balloon(
+ FactoryGirl.attributes_for(:balloon, :system_picture_id => @sp.id)
+ )
+ @sb.boost
+ @sb.save!
sign_in @user
Balloon.stub(:list).and_return([@balloon, @balloon, @balloon])
end
describe '単体表示に於いて' do
before do
sign_in @user
- @sb = FactoryGirl.create :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
- @balloon = FactoryGirl.create :balloon, :speech_balloon_id => @sb.id, :system_picture_id => @sp.id
- @speech = FactoryGirl.create :speech, :speech_balloon_id => @sb.id
+ @sb = FactoryGirl.build :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
+ @speech = @sb.build_speech(
+ FactoryGirl.attributes_for(:speech, :writing_format_id => @writing_format.id)
+ )
+ @balloon = @sb.build_balloon(
+ FactoryGirl.attributes_for(:balloon, :system_picture_id => @sp.id)
+ )
+ @sb.boost
+ @sb.save!
Balloon.stub(:show).and_return(@balloon)
end
context 'つつがなく終わるとき' do