describe OriginalPictureLicenseGroup do
before do
- Factory :admin
- @user = Factory( :user_yas)
- @author = @user.author
- @artist = Factory :artist_yas, :author_id => @author.id
- @other_user = Factory( :user_yas)
- @other_author = @other_user.author
- @other_artist = Factory :artist_yas, :author_id => @other_author.id
- @sp = Factory :system_picture
- @lg = Factory :license_group
- @license = Factory :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
- @op = Factory :original_picture, :artist_id => @artist.id
+ @admin = FactoryGirl.create :admin
+ @user = FactoryGirl.create( :user_yas)
+ @author = FactoryGirl.create :author, :user_id => @user.id
+ @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
+ @other_user = FactoryGirl.create( :user_yas)
+ @other_author = FactoryGirl.create :author, :user_id => @other_user.id
+ @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
+ @sp = FactoryGirl.create :system_picture
+ @lg = FactoryGirl.create :license_group
+ @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
+ @op = FactoryGirl.create :original_picture, :artist_id => @artist.id
end
describe '検証に於いて' do
before do
+ @ol = FactoryGirl.build :oplg, :original_picture_id => @op.id, :license_group_id => @lg.id
end
- it 'オーソドックスなデータなら通る' do
- @ol = Factory.build :oplg, :original_picture_id => @op.id, :license_group_id => @lg.id
- @ol.should be_valid
- end
-
- context 'original_picture_idを検証するとき' do
- before do
- @ol = Factory.build :oplg, :original_picture_id => @op.id, :license_group_id => @lg.id
+ context 'オーソドックスなデータのとき' do
+ it '下限データが通る' do
+ @ol.should be_valid
end
- it 'テストデータの確認' do
- @ol.original_picture_id = @op.id
+ it '上限データが通る' do
@ol.should be_valid
end
+ end
+
+ context 'original_picture_idを検証するとき' do
it 'nullなら失敗する' do
@ol.original_picture_id = nil
@ol.should_not be_valid
end
end
context 'license_group_idを検証するとき' do
- before do
- @ol = Factory.build :oplg, :original_picture_id => @op.id, :license_group_id => @lg.id
- end
- it 'テストデータの確認' do
- @ol.license_group_id = @lg.id
- @ol.should be_valid
- end
it 'nullなら失敗する' do
@ol.license_group_id = nil
@ol.should_not be_valid