X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=spec%2Fmodels%2Flicense_spec.rb;fp=spec%2Fmodels%2Flicense_spec.rb;h=39fda16bdb4c8d6c0ba355bf78792675368d9fb9;hp=ea5a8d9d005eb0458213bed35452c2fa0cc85427;hb=278f86183f2474b2c4d219b724e76cbe07ed63dc;hpb=cd9653c66c4883c5e9a483fc47f0ddf77ed837be diff --git a/spec/models/license_spec.rb b/spec/models/license_spec.rb index ea5a8d9d..39fda16b 100644 --- a/spec/models/license_spec.rb +++ b/spec/models/license_spec.rb @@ -64,6 +64,17 @@ describe License do r.name.should eq @lc.name end end + #コモンライセンスとオリジナルライセンスをまたいだUrl重複チェックはここでやるよりない + #コモンライセンスが新規オブジェクトなのにライセンスが取得できるのは、 + #そのUrlがオリジナルライセンスから登録されているということ + context '新規でユニークチェックするとき' do + it 'ライセンスの全体エラーに重複メッセージを入れて返す' do + cl = Factory.build(:common_license, :url => 'http://domain.no') + License.stub(:find_by_url).with(any_args).and_return(@lc) + r = License.update_license cl + r.errors[:base].should_not be_empty + end + end end #作成が