@comic.should_not be_valid
end
end
+
context 'visibleを検証するとき' do
it 'nullなら失敗する' do
@comic.visible = nil
@comic.should_not be_valid
end
end
+
+ context 'author_idを検証するとき' do
+ it 'nullなら失敗する' do
+ @comic.author_id = nil
+ @comic.should_not be_valid
+ end
+ it '数値でなければ失敗する' do
+ @comic.author_id = 'a'
+ @comic.should_not be_valid
+ end
+ it '存在する作家でなければ失敗する' do
+ @comic.author_id = 0
+ @comic.should_not be_valid
+ end
+ end
+
end
describe '文字コード検証に於いて' do
@rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
@sbt = FactoryGirl.create :speech_balloon_template
@comic = FactoryGirl.create :comic, :author_id => @author.id, :visible => 1
- @story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id
+ @story = FactoryGirl.create :story, :comic_id => @comic.id
end
it 'ストーリーを含んでいる' do
r = Comic.list.to_json Comic.list_json_opt
@rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
@sbt = FactoryGirl.create :speech_balloon_template
@comic = FactoryGirl.create :comic, :author_id => @author.id, :visible => 1
- @story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id
+ @story = FactoryGirl.create :story, :comic_id => @comic.id
end
it 'ストーリーを含んでいる' do
r = Comic.show(@comic.id, @author).to_json Comic.show_json_opt
describe '削除に於いて' do
before do
@comic = FactoryGirl.create :comic, :author_id => @author.id
- @story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @comic.id
+ @story = FactoryGirl.create :story, :comic_id => @comic.id
@other_comic = FactoryGirl.create :comic, :author_id => @author.id
- @other_story = FactoryGirl.create :story, :author_id => @author.id, :comic_id => @other_comic.id
+ @other_story = FactoryGirl.create :story, :comic_id => @other_comic.id
end
context 'つつがなく終わるとき' do
it '自身を削除する' do