OSDN Git Service

t#30200:update i18n devise
[pettanr/pettanr.git] / spec / controllers / comics_controller_spec.rb
index 37b885e..6bcc595 100644 (file)
@@ -4,12 +4,12 @@ require 'spec_helper'
 \r
 describe ComicsController do\r
   before do\r
-    FactoryGirl.create :admin\r
+    @admin =FactoryGirl.create :admin\r
     @sp = FactoryGirl.create :system_picture\r
     @lg = FactoryGirl.create :license_group\r
     @license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id\r
     @user = FactoryGirl.create :user_yas\r
-    @author = @user.author    #ユーザ作成時に連動して作成される\r
+    @author = FactoryGirl.create :author, :user_id => @user.id\r
   end\r
   \r
   describe '一覧表示に於いて' do\r
@@ -68,10 +68,10 @@ describe ComicsController do
           get :index, :format => :json\r
           lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)\r
         end\r
-        it 'コミックモデルにjson一覧出力オプションを問い合わせている' do
-          Comic.should_receive(:list_json_opt).exactly(1)
-          get :index, :format => :json
-        end
+        it 'コミックモデルにjson一覧出力オプションを問い合わせている' do\r
+          Comic.should_receive(:list_json_opt).exactly(1)\r
+          get :index, :format => :json\r
+        end\r
         it 'データがリスト構造になっている' do\r
           get :index, :format => :json\r
           json = JSON.parse response.body\r
@@ -142,10 +142,10 @@ describe ComicsController do
           get :show, :id => @comic.id, :format => :json\r
           lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)\r
         end\r
-        it 'コミックモデルにjson単体出力オプションを問い合わせている' do
-          Comic.should_receive(:show_json_opt).exactly(1)
-          get :show, :id => @comic.id, :format => :json
-        end
+        it 'コミックモデルにjson単体出力オプションを問い合わせている' do\r
+          Comic.should_receive(:show_json_opt).exactly(1)\r
+          get :show, :id => @comic.id, :format => :json\r
+        end\r
         it 'データがアレになっている' do\r
           get :show, :id => @comic.id, :format => :json\r
           json = JSON.parse response.body\r
@@ -271,16 +271,16 @@ describe ComicsController do
           response.should render_template("new")\r
         end\r
       end\r
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :new, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it 'コミックモデルにjson単体出力オプションを問い合わせている' do
-          Comic.should_receive(:show_json_opt).exactly(1)
-          get :new, :format => :json
-        end
-      end
+      context 'json形式' do\r
+        it 'jsonデータを返す' do\r
+          get :new, :format => :json\r
+          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)\r
+        end\r
+        it 'コミックモデルにjson単体出力オプションを問い合わせている' do\r
+          Comic.should_receive(:show_json_opt).exactly(1)\r
+          get :new, :format => :json\r
+        end\r
+      end\r
     end\r
     context '作家権限がないとき' do\r
       before do\r
@@ -318,7 +318,7 @@ describe ComicsController do
       it 'コミックモデルにデフォルト値補充を依頼している' do\r
         Comic.any_instance.should_receive(:supply_default).exactly(1)\r
         post :create, :artist => @attr\r
-      end
+      end\r
       it 'コミックモデルにカラム値復元を依頼している' do\r
         Comic.any_instance.should_receive(:attributes=).exactly(1)\r
         post :create, :artist => @attr\r