OSDN Git Service

t#29061/t#29089/t#29076:add mylist. modify panel picture
[pettanr/pettanr.git] / spec / controllers / comics_controller_spec.rb
index 8879610..4f937d8 100644 (file)
@@ -3,17 +3,17 @@ require 'spec_helper'
 
 describe ComicsController 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
-    @user = Factory :user_yas\r
+    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
+    @user = FactoryGirl.create :user_yas\r
     @author = @user.author    #ユーザ作成時に連動して作成される\r
   end\r
   \r
   describe '一覧表示に於いて' do\r
     before do\r
-      @comic = Factory :comic, :author_id => @user.author.id\r
+      @comic = FactoryGirl.create :comic, :author_id => @user.author.id\r
       Comic.stub(:list).and_return([@comic, @comic, @comic])\r
       sign_in @user\r
     end\r
@@ -108,7 +108,7 @@ describe ComicsController do
   \r
   describe '単体表示に於いて' do\r
     before do\r
-      @comic = Factory :comic, :author_id => @user.author.id, :title => 'normal'\r
+      @comic = FactoryGirl.create :comic, :author_id => @user.author.id, :title => 'normal'\r
       Comic.stub(:show).and_return(@comic)\r
       sign_in @user\r
     end\r
@@ -189,7 +189,7 @@ describe ComicsController do
       context 'html形式' do\r
         it '例外403 forbiddenを返す' do\r
           Comic.any_instance.stub(:visible?).with(any_args()).and_return(false)\r
-          hidden = Factory :hidden_comic, :author_id => @author.id\r
+          hidden = FactoryGirl.create :hidden_comic, :author_id => @author.id\r
           lambda{\r
             get :show, :id => hidden\r
           }.should raise_error(ActiveRecord::Forbidden)\r
@@ -198,7 +198,7 @@ describe ComicsController do
       context 'json形式' do\r
         it '例外403 forbiddenを返す' do\r
           Comic.any_instance.stub(:visible?).with(any_args()).and_return(false)\r
-          hidden = Factory :hidden_comic, :author_id => @author.id\r
+          hidden = FactoryGirl.create :hidden_comic, :author_id => @author.id\r
           lambda{\r
             get :show, :id => hidden, :format => :json\r
           }.should raise_error(ActiveRecord::Forbidden)\r
@@ -291,7 +291,7 @@ describe ComicsController do
   describe '新規作成に於いて' do\r
     before do\r
       sign_in @user\r
-      @attr = Factory.attributes_for(:comic, :author_id => @author.id, :title => 'normal')\r
+      @attr = FactoryGirl.attributes_for(:comic, :author_id => @author.id, :title => 'normal')\r
     end\r
     context 'つつがなく終わるとき' do\r
       it 'モデルに保存依頼する' do\r
@@ -390,7 +390,7 @@ describe ComicsController do
 \r
   describe '編集フォーム表示に於いて' do\r
     before do\r
-      @comic = Factory :comic, :author_id => @user.author.id\r
+      @comic = FactoryGirl.create :comic, :author_id => @user.author.id\r
       sign_in @user\r
       Comic.stub(:show).and_return(@comic)\r
     end\r
@@ -449,8 +449,8 @@ describe ComicsController do
 \r
   describe '更新に於いて' do\r
     before do\r
-      @comic = Factory :comic, :author => @author\r
-      @attr = Factory.attributes_for(:comic, :author_id => @author.id, :title => 'updated title', :visible => 0)\r
+      @comic = FactoryGirl.create :comic, :author => @author\r
+      @attr = FactoryGirl.attributes_for(:comic, :author_id => @author.id, :title => 'updated title', :visible => 0)\r
       sign_in @user\r
     end\r
     context '事前チェックしておく' do\r