OSDN Git Service

add test
[pettanr/pettanr.git] / spec / models / author_spec.rb
index 0a1954f..3bf3b45 100644 (file)
@@ -1,5 +1,35 @@
+# -*- encoding: utf-8 -*-
+#作家
 require 'spec_helper'
 
 describe Author do
-  pending "add some examples to (or delete) #{__FILE__}"
+  before do
+    Factory :admin
+    @user = Factory( :user_yas)
+    @author = @user.author
+  end
+
+  describe '自動補充に於いて' do
+    #作家はユーザ作成で自動作成されちゃってる
+    it '名前がno nameになっている' do
+      @author.name.should eq 'no name'
+    end
+  end
+  
+  describe '絵師作家判定に於いて' do
+    before do
+    end
+    context 'Trueのケース' do
+      it 'リンクされた絵師がある' do
+        artist = Factory :artist, :author_id => @author.id
+        @author.artist?.should eq true
+      end
+    end
+    context 'Falseのケース' do
+      it 'リンクされた絵師がない' do
+        @author.artist?.should eq false
+      end
+    end
+  end
+  
 end