OSDN Git Service

t#30558:fix auth filter
[pettanr/pettanr.git] / spec / controllers / artists_controller_spec.rb
index 2a6c289..d1f7a3a 100644 (file)
@@ -86,7 +86,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -111,7 +111,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
       before do
         sign_out @user
         sign_in @admin
@@ -121,7 +121,7 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
-    context 'ä½\9c家権é\99\90ã\81¯ã\81ªã\81\84ã\81\8cå\80\9fæ\89\8b権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81¯ã\81ªã\81\84ã\81\8cå\80\9fæ\89\8b権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
       before do
         sign_out @user
         sign_in @demand_user
@@ -131,6 +131,15 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      it 'ステータスコード200 OKを返す' do
+        get :index
+        response.should be_success 
+      end
+    end
   end
   
   describe '閲覧に於いて' do
@@ -173,7 +182,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -198,7 +207,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
       before do
         sign_out @user
         sign_in @admin
@@ -208,7 +217,7 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
-    context 'ä½\9c家権é\99\90ã\81¯ã\81ªã\81\84ã\81\8cå\80\9fæ\89\8b権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81¯ã\81ªã\81\84ã\81\8cå\80\9fæ\89\8b権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
       before do
         sign_out @user
         sign_in @demand_user
@@ -218,6 +227,15 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      it 'ステータスコード200 OKを返す' do
+        get :show, :id => @artist.id
+        response.should be_success 
+      end
+    end
 =begin
     context '対象作家がないとき' do
       context 'html形式' do
@@ -302,7 +320,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -337,7 +355,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
       before do
         sign_out @user
         sign_in @admin
@@ -353,6 +371,21 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      context 'html形式' do
+        it 'ステータスコード302 Foundを返す' do
+          get :new
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          get :new
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
   end
 
   describe '新規作成に於いて' do
@@ -417,7 +450,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -442,7 +475,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
       before do
         sign_out @user
         sign_in @admin
@@ -458,6 +491,21 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      context 'html形式' do
+        it 'ステータスコード302 Foundを返す' do
+          post :create, :artist => @attr
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          post :create, :artist => @attr
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
     context '検証、保存に失敗した' do
       before do
         Artist.any_instance.stub(:save).and_return(false)
@@ -520,7 +568,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -545,7 +593,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
       before do
         sign_out @user
         sign_in @admin
@@ -561,6 +609,21 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      context 'html形式' do
+        it 'ステータスコード302 Foundを返す' do
+          get :edit, :id => @artist.id
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          get :edit, :id => @artist.id
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
   end
 
   describe '更新に於いて' do
@@ -621,7 +684,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -642,7 +705,7 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81¯ã\81ªã\81\84ã\81\8c管ç\90\86è\80\85権é\99\90ã\81\8cã\81\82ã\82\8bã\81¨ã\81\8d' do
       before do
         sign_out @user
         sign_in @admin
@@ -658,6 +721,21 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      context 'html形式' do
+        it 'ステータスコード302 Foundを返す' do
+          put :update, :id => @artist.id, :artist => @attr
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          put :update, :id => @artist.id, :artist => @attr
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
     context '検証、保存に失敗したとき' do
       before do
         Artist.any_instance.stub(:save).and_return(false)
@@ -710,7 +788,7 @@ else
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -756,7 +834,7 @@ else
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -826,7 +904,7 @@ else
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -893,7 +971,7 @@ else
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -943,7 +1021,7 @@ else
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end
@@ -1000,7 +1078,7 @@ else
         end
       end
     end
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
         sign_out @user
       end