1 # -*- encoding: utf-8 -*-
5 describe StandardLicense do
8 @user = Factory( :user_yas)
10 @artist = Factory :artist_yas, :author_id => @author.id
11 @other_user = Factory( :user_yas)
12 @other_author = @other_user.author
13 @other_artist = Factory :artist_yas, :author_id => @other_author.id
14 @sp = Factory :system_picture
15 @lg = Factory :license_group
16 @license = Factory :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
17 @op = Factory :original_picture, :artist_id => @artist.id
24 it 'オーソドックスなデータなら通る' do
25 @sl = Factory.build :standard_license, :license_id => @license.id
29 context 'license_idを検証するとき' do
31 @sl = Factory.build :standard_license, :license_id => @license.id
34 @sl.license_id = @license.id
39 @sl.should_not be_valid
43 @sl.should_not be_valid
45 it '存在するライセンスグループでなければ失敗する' do
47 @sl.should_not be_valid
50 context 'artist_nameを検証するとき' do
52 @sl = Factory.build :standard_license, :license_id => @license.id
60 @sl.should_not be_valid
66 @sl = StandardLicense.new
68 @sl.supply_default @artist
69 @sl.artist_name.should eq @artist.name
72 describe 'クレジットデータに於いて' do
74 @sl = Factory.build :standard_license, :license_id => @license.id
80 }.should_not raise_error
82 it 'system_picture_idを含んでいて値はライセンスに割り当てたシステム画像になっている' do
83 r = JSON.parse @sl.credit
84 r.has_key?('system_picture_id').should be_true
85 r['system_picture_id'].should eq @sl.license.system_picture_id