OSDN Git Service

t#32046:
[pettanr/pettanr.git] / spec / controllers / app_controller_spec.rb
index edb068b..200287b 100644 (file)
@@ -10,10 +10,10 @@ describe SystemController do
     context '要請の必要がないとき' do
       before do
         #要請の必要がない=管理者登録済み かつ ライセンス登録済み
-        Factory :admin
-        @sp = Factory :system_picture
-        @lg = Factory :license_group
-        @license = Factory :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
+        @admin = FactoryGirl.create :admin
+        @sp = FactoryGirl.create :system_picture
+        @lg = FactoryGirl.create :license_group
+        @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
       end
       it 'リクエスト通りのページを開く' do
         get :index
@@ -21,8 +21,8 @@ describe SystemController do
       end
       context 'userがサインインしているなら' do
         before do
-          @user = Factory( :user_yas)
-          @author = @user.author
+          @user = FactoryGirl.create( :user_yas)
+          @author = FactoryGirl.create :author, :user_id => @user.id
           sign_in @user
         end
         it 'userにサインイン中のアカウントをセットしている' do
@@ -34,20 +34,20 @@ describe SystemController do
           assigns(:author).should eq @author
         end
         it 'artistに絵師をセットしている' do
-          @artist = Factory :artist_yas, :author_id => @author.id
+          @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
           get :index
           assigns(:artist).should eq @artist
         end
-        it 'ただし、絵師登録されてなければ新規の絵師をセットしている' do
+        it 'ただし、絵師登録されてなければnilをセットしている' do
           get :index
-          assigns(:artist).should be_a_new(Artist)
+          assigns(:artist).should be_nil
         end
       end
       context 'userがサインインしていないなら' do
         before do
-          @user = Factory( :user_yas)
-          @author = @user.author
-          @artist = Factory :artist_yas, :author_id => @author.id
+          @user = FactoryGirl.create( :user_yas)
+          @author = FactoryGirl.create :author, :user_id => @user.id
+          @artist = FactoryGirl.create :artist_yas, :author_id => @author.id
         end
         it 'userが空になっている' do
           get :index
@@ -66,9 +66,9 @@ describe SystemController do
     #要請の必要がある=管理者がいない または ライセンスがない
     context '管理者がいないとき' do
       before do
-        @sp = Factory :system_picture
-        @lg = Factory :license_group
-        @license = Factory :license, :license_group_id => @lg.id, :system_picture_id => @sp.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
       end
       context '本機能を開こうとしているなら' do
         it '初期化要請ページに遷移する' do
@@ -97,7 +97,7 @@ describe SystemController do
     end
     context 'ライセンスがないとき' do
       before do
-        Factory :admin
+        @admin = FactoryGirl.create :admin
       end
       context '本機能を開こうとしているなら' do
         it '初期化要請ページに遷移する' do