OSDN Git Service

merge i18n
[pettanr/pettanr.git] / spec / controllers / comics_controller_spec.rb
index 6bcc595..9efd0e0 100644 (file)
@@ -306,6 +306,16 @@ describe ComicsController do
           response.message.should match(/Unauthorized/)\r
         end\r
       end\r
+      context 'json形式' do\r
+        it 'ステータスコード401 Unauthorizedを返す' do\r
+          get :new, :format => :json\r
+          response.status.should eq 401\r
+        end\r
+        it '応答メッセージにUnauthorizedを返す' do\r
+          get :new, :format => :json\r
+          response.message.should match(/Unauthorized/)\r
+        end\r
+      end\r
     end\r
   end\r
 \r
@@ -317,19 +327,19 @@ describe ComicsController do
     context '事前チェックしておく' do\r
       it 'コミックモデルにデフォルト値補充を依頼している' do\r
         Comic.any_instance.should_receive(:supply_default).exactly(1)\r
-        post :create, :artist => @attr\r
+        post :create, :comic => @attr\r
       end\r
       it 'コミックモデルにカラム値復元を依頼している' do\r
         Comic.any_instance.should_receive(:attributes=).exactly(1)\r
-        post :create, :artist => @attr\r
+        post :create, :comic => @attr\r
       end\r
       it 'コミックモデルに上書き補充を依頼している' do\r
         Comic.any_instance.should_receive(:overwrite).exactly(1)\r
-        post :create, :artist => @attr\r
+        post :create, :comic => @attr\r
       end\r
       it 'モデルに保存依頼する' do\r
         Comic.any_instance.should_receive(:save).exactly(1)\r
-        post :create, :artist => @attr\r
+        post :create, :comic => @attr\r
       end\r
     end\r
     context 'つつがなく終わるとき' do\r