OSDN Git Service

Merge branch 'v03_test' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v03_test
[pettanr/pettanr.git] / spec / models / license_spec.rb
index ea5a8d9..39fda16 100644 (file)
@@ -64,6 +64,17 @@ describe License do
         r.name.should eq @lc.name
       end
     end
         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
   
   #作成が
   end
   
   #作成が