OSDN Git Service

t#30558:fix auth filter
authoryasushiito <yas@pen-chan.jp>
Thu, 24 Jan 2013 22:50:38 +0000 (07:50 +0900)
committeryasushiito <yas@pen-chan.jp>
Thu, 24 Jan 2013 22:50:38 +0000 (07:50 +0900)
36 files changed:
app/controllers/application_controller.rb
app/controllers/artists_controller.rb
app/controllers/authors_controller.rb
app/controllers/balloons_controller.rb
app/controllers/comics_controller.rb
app/controllers/ground_colors_controller.rb
app/controllers/ground_pictures_controller.rb
app/controllers/original_pictures_controller.rb
app/controllers/panel_colors_controller.rb
app/controllers/panel_pictures_controller.rb
app/controllers/panels_controller.rb
app/controllers/pictures_controller.rb
app/controllers/resource_pictures_controller.rb
app/controllers/speech_balloon_templates_controller.rb
app/controllers/speech_balloons_controller.rb
app/controllers/speeches_controller.rb
app/controllers/stories_controller.rb
app/controllers/system_pictures_controller.rb
spec/controllers/artists_controller_spec.rb
spec/controllers/authors_controller_spec.rb
spec/controllers/balloons_controller_spec.rb
spec/controllers/comics_controller_spec.rb
spec/controllers/ground_colors_controller_spec.rb
spec/controllers/ground_pictures_controller_spec.rb
spec/controllers/home_controller_spec.rb
spec/controllers/original_pictures_controller_spec.rb
spec/controllers/panel_colors_controller_spec.rb
spec/controllers/panel_pictures_controller_spec.rb
spec/controllers/panels_controller_spec.rb
spec/controllers/pictures_controller_spec.rb
spec/controllers/resource_pictures_controller_spec.rb
spec/controllers/speech_balloon_templates_controller_spec.rb
spec/controllers/speech_balloons_controller_spec.rb
spec/controllers/speeches_controller_spec.rb
spec/controllers/stories_controller_spec.rb
spec/controllers/system_pictures_controller_spec.rb

index 0fb6577..ddc723e 100644 (file)
@@ -79,13 +79,15 @@ class ApplicationController < ActionController::Base
   end
       
   def authenticate_artist
-    if @admin or (@author and @author.artist?)
+    if @artist
       true
     else
       respond_to do |format|
         format.html { redirect_to main_app.new_artist_path, :status => :found }
         format.js { render "artists/new" }
-        format.json { render :text => {:error => I18n.t('devise.failure.unauthenticated')}.to_json, :status => :unauthorized }
+        format.json { 
+          raise ActiveRecord::Forbidden
+        }
       end
       false
     end
index b5b2956..032a98a 100644 (file)
@@ -2,9 +2,11 @@ class ArtistsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   else
     before_filter :authenticate_resource_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -24,7 +26,7 @@ class ArtistsController < ApplicationController
   # GET /artists/1
   # GET /artists/1.json
   def show
-    @ar = Artist.show(params[:id], @author)
+    @ar = Artist.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
       format.html # show.html.erb
index d5d0b5c..5e8632e 100644 (file)
@@ -2,9 +2,11 @@ class AuthorsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
+    before_filter :authenticate_author, :only => [:edit, :update]
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
+    before_filter :authenticate_author, :only => [:edit, :update]
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -20,7 +22,7 @@ class AuthorsController < ApplicationController
   end
 
   def show
-    @au = Author.show(params[:id], [@author, @admin])
+    @au = Author.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html
index cb01d58..d3c6727 100644 (file)
@@ -2,9 +2,11 @@ class BalloonsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
   
@@ -20,7 +22,7 @@ class BalloonsController < ApplicationController
   end
   
   def show
-    @balloon = Balloon.show(params[:id], [@author, @admin])
+    @balloon = Balloon.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
       format.json { render json: @balloon.to_json(Balloon.show_json_opt) }
index ec79f36..0539fe5 100644 (file)
@@ -2,9 +2,11 @@ class ComicsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   else
     before_filter :authenticate_reader, :only => [:top, :index, :show]
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -25,7 +27,7 @@ class ComicsController < ApplicationController
   end
 
   def show
-    @comic = Comic.show(params[:id], [@author, @admin])
+    @comic = Comic.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html # show.html.erb
index 39ecdda..da5244f 100644 (file)
@@ -2,9 +2,11 @@ class GroundColorsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
 
   # GET /ground_colors
@@ -21,7 +23,7 @@ class GroundColorsController < ApplicationController
   end
   
   def show
-    @ground_color = GroundColor.show(params[:id], [@author, @admin])
+    @ground_color = GroundColor.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
       format.json { render json: @ground_color.to_json(GroundColor.show_json_opt) }
index 8836779..f940c58 100644 (file)
@@ -2,9 +2,11 @@ class GroundPicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
 
   # GET /ground_pictures
@@ -21,7 +23,7 @@ class GroundPicturesController < ApplicationController
   end
 
   def show
-    @ground_picture = GroundPicture.show(params[:id], [@author, @admin])
+    @ground_picture = GroundPicture.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
       format.json { render json: @ground_picture.to_json(GroundPicture.show_json_opt) }
index fb6a7a3..d90de17 100644 (file)
@@ -3,8 +3,8 @@ class OriginalPicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   before_filter :authenticate_reader, :only => [:show, :history]
   before_filter :authenticate_user, :only => [:index, :new, :edit, :create, :update, :destroy]
+  before_filter :authenticate_artist, :only => [:index, :new, :edit, :create, :update, :destroy]
   before_filter :authenticate_admin!, :only => [:list, :browse]
-  before_filter :authenticate_artist, :only => [:index, :show, :history, :new, :edit, :create, :update, :destroy]
   
   # GET /original_pictures
   # GET /original_pictures.json
index 2fe7885..eaaf34d 100644 (file)
@@ -2,9 +2,11 @@ class PanelColorsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
 
   # GET /ground_pictures
@@ -21,7 +23,7 @@ class PanelColorsController < ApplicationController
   end
   
   def show
-    @panel_color = PanelColor.show(params[:id], [@author, @admin])
+    @panel_color = PanelColor.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
       format.json { render json: @panel_color.to_json(PanelColor.show_json_opt) }
index 22f98d4..bf0cb61 100644 (file)
@@ -2,8 +2,11 @@ class PanelPicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_reader, :only => [:index, :show]
+    before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -21,7 +24,7 @@ class PanelPicturesController < ApplicationController
   end
 
   def show
-    @panel_picture = PanelPicture.show(params[:id], [@author, @admin])
+    @panel_picture = PanelPicture.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html
index 3a880ea..3757298 100644 (file)
@@ -2,9 +2,11 @@ class PanelsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -22,7 +24,7 @@ class PanelsController < ApplicationController
   end
 
   def show
-    @panel = Panel.show(params[:id], [@author, @admin])
+    @panel = Panel.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html # show.html.erb
index 12fc5f6..b8ab99d 100644 (file)
@@ -2,14 +2,16 @@ class PicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_user, :only => []
     before_filter :authenticate_resource_reader, :only => [:show, :credit, :search]
+    before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
   
   def show
-    @picture = Picture.show(params[:id], [@author, @admin, @demand_user])
+    @picture = Picture.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
       opt = {:type => @picture.mime_type, :disposition=>"inline"}
@@ -22,7 +24,7 @@ class PicturesController < ApplicationController
   end
   
   def credit
-    @picture = Picture.show(params[:id], [@author, @admin, @demand_user])
+    @picture = Picture.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
       format.html { render :layout => false } # show.html.erb
index 4f9479b..322abfe 100644 (file)
@@ -2,11 +2,11 @@ class ResourcePicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
-    before_filter :authenticate_artist, :only => [:new, :create, :destroy]
+    before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
   else
     before_filter :authenticate_resource_reader, :only => [:index, :show, :credit]
     before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
-    before_filter :authenticate_artist, :only => [:new, :create, :destroy]
+    before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -26,7 +26,7 @@ class ResourcePicturesController < ApplicationController
   # GET /resource_pictures/1
   # GET /resource_pictures/1.json
   def show
-    @resource_picture = ResourcePicture.show(params[:id], [@author, @admin, @demand_user])
+    @resource_picture = ResourcePicture.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
       opt = {:type => @resource_picture.mime_type, :disposition=>"inline"}
@@ -39,7 +39,7 @@ class ResourcePicturesController < ApplicationController
   end
   
   def credit
-    @resource_picture = ResourcePicture.show(params[:id], @author)
+    @resource_picture = ResourcePicture.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
       format.html { render :layout => false } # show.html.erb
index 607554b..051b9da 100644 (file)
@@ -22,7 +22,7 @@ class SpeechBalloonTemplatesController < ApplicationController
   # GET /speech_balloon_templates/1
   # GET /speech_balloon_templates/1.json
   def show
-    @speech_balloon_template = SpeechBalloonTemplate.show(params[:id], [@author, @admin])
+    @speech_balloon_template = SpeechBalloonTemplate.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html # show.html.erb
index 5d2d711..c34dd27 100644 (file)
@@ -2,9 +2,11 @@ class SpeechBalloonsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -20,7 +22,7 @@ class SpeechBalloonsController < ApplicationController
   end
   
   def show
-    @speech_balloon = SpeechBalloon.show(params[:id], [@author, @admin])
+    @speech_balloon = SpeechBalloon.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
       format.json { render json: @speech_balloon.to_json(SpeechBalloon.show_json_opt) }
index 48141d3..1095fdb 100644 (file)
@@ -2,9 +2,11 @@ class SpeechesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -20,7 +22,7 @@ class SpeechesController < ApplicationController
   end
   
   def show
-    @speech = Speech.show(params[:id], [@author, @admin])
+    @speech = Speech.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
       format.json { render json: @speech.to_json(Speech.show_json_opt) }
index ec4aefb..7d12912 100644 (file)
@@ -2,9 +2,11 @@ class StoriesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   else
     before_filter :authenticate_reader, :only => [:index, :show, :comic]
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
@@ -20,7 +22,7 @@ class StoriesController < ApplicationController
   end
 
   def show
-    @story = Story.show(params[:id], [@author, @admin])
+    @story = Story.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html # show.html.erb
@@ -29,7 +31,7 @@ class StoriesController < ApplicationController
   end
   
   def comic
-    @comic = Comic.show(params[:id], [@author, @admin])
+    @comic = Comic.show(params[:id], [@user, @admin])
     cnt = Story.count(:conditions => ['comic_id = ?', @comic.id]).to_i
     @offset = Story.offset cnt, params[:offset]
     @panel_count = Story.panel_count cnt, params[:count]
index 8523ed0..ae6a671 100644 (file)
@@ -2,9 +2,11 @@ class SystemPicturesController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
   if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   else
     before_filter :authenticate_resource_reader, :only => [:index, :show]
     before_filter :authenticate_user, :only => []
+    before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
 
@@ -24,7 +26,7 @@ class SystemPicturesController < ApplicationController
   # GET /system_pictures/1
   # GET /system_pictures/1.json
   def show
-    @system_picture = SystemPicture.show(params[:id], @author)
+    @system_picture = SystemPicture.show(params[:id], [@user, @admin, @demand_user])
     
     respond_to do |format|
       opt = {:type => @system_picture.mime_type, :disposition=>"inline"}
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
index dac4d6d..b0e6817 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,6 +121,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
@@ -165,7 +174,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
@@ -190,7 +199,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
@@ -200,6 +209,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 => @author.id
+        response.should be_success 
+      end
+    end
 =begin
     context '対象作家がないとき' do
       context 'html形式' do
@@ -285,7 +303,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 @new_user
       end
@@ -320,7 +338,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
@@ -336,6 +354,15 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      it 'ステータスコード200 OKを返す' do
+          get :new
+        response.should be_success 
+      end
+    end
   end
 
   describe '新規作成に於いて' do
@@ -401,7 +428,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 @new_user
       end
@@ -426,7 +453,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
@@ -505,7 +532,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
@@ -530,7 +557,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
@@ -546,6 +573,23 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @other_user = FactoryGirl.create( :user_yas)
+        @other_author = FactoryGirl.create :author, :user_id => @other_user.id
+        @author.destroy
+      end
+      context 'html形式' do
+        it 'ステータスコード302 Foundを返す' do
+          get :edit, :id => @other_author.id
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          get :edit, :id => @other_author.id
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
   end
 
   describe '更新に於いて' do
@@ -609,7 +653,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
@@ -630,7 +674,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
@@ -646,6 +690,23 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @other_user = FactoryGirl.create( :user_yas)
+        @other_author = FactoryGirl.create :author, :user_id => @other_user.id
+        @author.destroy
+      end
+      context 'html形式' do
+        it 'ステータスコード302 Foundを返す' do
+          get :update, :id => @other_author.id
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          get :update, :id => @other_author.id
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
     context '検証、保存に失敗したとき' do
       before do
         Author.any_instance.stub(:save).and_return(false)
@@ -698,7 +759,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
@@ -744,7 +805,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
@@ -815,7 +876,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 @new_user
       end
@@ -879,7 +940,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 @new_user
       end
@@ -929,7 +990,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
@@ -991,7 +1052,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
index fc48e41..381bc1a 100644 (file)
@@ -93,7 +93,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
@@ -118,7 +118,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
@@ -128,6 +128,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
@@ -175,7 +184,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
@@ -200,7 +209,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
@@ -210,6 +219,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 => @balloon.id
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -239,7 +257,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
@@ -288,7 +306,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
index 9f69a0d..087107f 100644 (file)
@@ -85,7 +85,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -110,7 +110,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -120,6 +120,17 @@ if MagicNumber['run_mode'] == 1
         response.should be_success \r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード200 OKを返す' do\r
+          get :index\r
+          response.should be_success \r
+        end\r
+      end\r
+    end\r
   end\r
   \r
   describe '単体表示に於いて' do\r
@@ -164,7 +175,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -189,7 +200,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -199,6 +210,17 @@ if MagicNumber['run_mode'] == 1
         response.should be_success \r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード200 OKを返す' do\r
+          get :show, :id => @comic.id\r
+          response.should be_success\r
+        end\r
+      end\r
+    end\r
 =begin\r
     context '対象コミックがないとき' do\r
       context 'html形式' do\r
@@ -302,7 +324,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -337,7 +359,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -353,6 +375,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          get :new, @attr\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          get :new, @attr\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
   end\r
 \r
   describe '新規作成に於いて' do\r
@@ -414,7 +451,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -439,7 +476,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -455,6 +492,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          post :create, :comic => @attr\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          post :create, :comic => @attr\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
     context '検証、保存に失敗した' do\r
       before do\r
         Comic.any_instance.stub(:save).and_return(false)\r
@@ -518,7 +570,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -543,7 +595,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -559,6 +611,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          get :edit, :id => @comic.id\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          get :edit, :id => @comic.id\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
   end\r
 \r
   describe '更新に於いて' do\r
@@ -620,7 +687,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -641,7 +708,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -657,6 +724,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          put :update, :id => @comic.id, :comic => @attr\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          put :update, :id => @comic.id, :comic => @attr\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
     context '検証、保存に失敗したとき' do\r
       before do\r
         Comic.any_instance.stub(:save).and_return(false)\r
@@ -741,7 +823,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -762,7 +844,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -778,6 +860,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          delete :destroy, :id => @comic.id\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          delete :destroy, :id => @comic.id\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
     context '削除に失敗したとき' do\r
       before do\r
         Comic.any_instance.stub(:destroy_with_story).and_return(false)\r
@@ -830,7 +927,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -877,7 +974,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -946,7 +1043,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -1013,7 +1110,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -1064,7 +1161,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -1122,7 +1219,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -1172,7 +1269,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
index fb689b8..be48636 100644 (file)
@@ -90,7 +90,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
@@ -115,7 +115,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
@@ -125,6 +125,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
@@ -170,7 +179,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
@@ -195,7 +204,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
@@ -205,6 +214,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 => @gc.id
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -232,7 +250,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
@@ -279,7 +297,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
index 10b68b3..aaf392e 100644 (file)
@@ -92,7 +92,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
@@ -117,7 +117,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
@@ -127,6 +127,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
@@ -172,7 +181,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
@@ -197,7 +206,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
@@ -207,6 +216,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 => @gp.id
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -234,7 +252,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
@@ -281,7 +299,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
index 292308c..feba48d 100644 (file)
@@ -742,9 +742,10 @@ if MagicNumber['run_mode'] == 1
         end
       end
       context 'json形式' do
-        it '応答メッセージにUnauthorizedを返す' do
-          get :resource_picture, :format => :json
-          response.message.should match(/Unauthorized/)
+        it '例外403 forbiddenを返す' do
+          lambda{
+            get :resource_picture, :format => :json
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -1115,7 +1116,7 @@ else
     end
     context '作家が絵師でないとき' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
index b28ba4d..fd6c341 100644 (file)
@@ -89,7 +89,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
@@ -114,7 +114,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
@@ -130,9 +130,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -145,9 +145,10 @@ if MagicNumber['run_mode'] == 1
         end
       end
       context 'json形式' do
-        it '応答メッセージにUnauthorizedを返す' do
-          get :index, :format => :json
-          response.message.should match(/Unauthorized/)
+        it '例外403 forbiddenを返す' do
+          lambda{
+            get :index, :format => :json
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -254,7 +255,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
@@ -279,7 +280,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
@@ -289,25 +290,13 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          get :show, :id => @pic.id
-          response.status.should eq 302
-        end
-        it '絵師登録ページへ遷移する' do
-          get :show, :id => @pic.id
-          response.should redirect_to new_artist_path
-        end
-      end
-      context 'json形式' do
-        it '応答メッセージにUnauthorizedを返す' do
-          get :show, :id => @pic.id, :format => :json
-          response.message.should match(/Unauthorized/)
-        end
+      it 'ステータスコード200 OKを返す' do
+        get :show, :id => @pic.id
+        response.should be_success 
       end
     end
 =begin
@@ -402,7 +391,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
@@ -427,7 +416,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
@@ -437,25 +426,13 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          get :history, :id => @op.id
-          response.status.should eq 302
-        end
-        it '絵師登録ページへ遷移する' do
-          get :history, :id => @op.id
-          response.should redirect_to new_artist_path
-        end
-      end
-      context 'json形式' do
-        it '応答メッセージにUnauthorizedを返す' do
-          get :history, :id => @op.id, :format => :json
-          response.message.should match(/Unauthorized/)
-        end
+      it 'ステータスコード200 OKを返す' do
+        get :history, :id => @op.id
+        response.should be_success 
       end
     end
   end
@@ -504,7 +481,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
@@ -529,7 +506,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
@@ -545,9 +522,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -559,20 +536,11 @@ if MagicNumber['run_mode'] == 1
           response.should redirect_to new_artist_path
         end
       end
-      context 'js形式' do
-        it 'ステータスコード200 Okを返す' do
-          get :new, :format => :js
-          response.status.should eq 200
-        end
-        it '絵師登録部分テンプレートartists/new.jsを描画する' do
-          get :new, :format => :js
-          response.should render_template("artists/new")
-        end
-      end
       context 'json形式' do
-        it '応答メッセージにUnauthorizedを返す' do
-          get :new, :format => :json
-          response.message.should match(/Unauthorized/)
+        it '例外403 forbiddenを返す' do
+          lambda{
+            get :new, :format => :json
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -651,7 +619,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
@@ -679,7 +647,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
@@ -695,9 +663,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -713,9 +681,11 @@ if MagicNumber['run_mode'] == 1
         before do
           @attr.merge!({:format => :json})
         end
-        it '応答メッセージにUnauthorizedを返す' do
-          post :create, @attr
-          response.message.should match(/Unauthorized/)
+        it '例外403 forbiddenを返す' do
+          @attr.merge!({:format => :json})
+          lambda{
+            post :create, @attr
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -819,7 +789,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
@@ -844,7 +814,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
@@ -860,9 +830,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -874,14 +844,11 @@ if MagicNumber['run_mode'] == 1
           response.should redirect_to new_artist_path
         end
       end
-      context 'js形式' do
-        it 'ステータスコード200 Okを返す' do
-          get :edit, :id => @pic.id, :format => :js
-          response.status.should eq 200
-        end
-        it '絵師登録部分テンプレートartists/new.jsを描画する' do
-          get :edit, :id => @pic.id, :format => :js
-          response.should render_template("artists/new")
+      context 'json形式' do
+        it '例外403 forbiddenを返す' do
+          lambda{
+            get :edit, :id => @pic.id, :format => :json
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -947,7 +914,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
@@ -972,7 +939,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
@@ -988,9 +955,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -1003,9 +970,10 @@ if MagicNumber['run_mode'] == 1
         end
       end
       context 'json形式' do
-        it '応答メッセージにUnauthorizedを返す' do
-          put :update, :id => @op.id, :original_picture => @attr, :format => :json
-          response.message.should match(/Unauthorized/)
+        it '例外403 forbiddenを返す' do
+          lambda{
+            put :update, :id => @op.id, :original_picture => @attr, :format => :json
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -1111,7 +1079,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
@@ -1132,7 +1100,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
@@ -1148,9 +1116,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -1163,9 +1131,10 @@ if MagicNumber['run_mode'] == 1
         end
       end
       context 'json形式' do
-        it '応答メッセージにUnauthorizedを返す' do
-          delete :destroy, :id => @op.id, :format => :json
-          response.message.should match(/Unauthorized/)
+        it '例外403 forbiddenを返す' do
+          lambda{
+            delete :destroy, :id => @op.id, :format => :json
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -1221,7 +1190,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
@@ -1272,7 +1241,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
@@ -1326,7 +1295,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
@@ -1385,7 +1354,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
@@ -1447,7 +1416,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
@@ -1501,7 +1470,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
@@ -1562,7 +1531,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
@@ -1587,28 +1556,6 @@ else
         end
       end
     end
-    context '作家が絵師でないとき' do
-      before do
-        Author.any_instance.stub(:artist?).and_return(false)
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          put :update, :id => @op.id, :original_picture => @attr
-          response.status.should eq 302
-        end
-        it '絵師登録ページへ遷移する' do
-          put :update, :id => @op.id, :original_picture => @attr
-          response.should redirect_to new_artist_path
-        end
-      end
-      context 'json形式' do
-        it '例外403 forbiddenを返す' do
-          lambda{
-            put :update, :id => @op.id, :original_picture => @attr, :format => :json
-          }.should raise_error(ActiveRecord::Forbidden)
-        end
-      end
-    end
     context '検証、保存に失敗した' do
       before do
         PettanImager.stub(:load).with("abc\ndef\nghi").and_return(@imager)
@@ -1685,7 +1632,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
index e77f91a..d13900d 100644 (file)
@@ -89,7 +89,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
@@ -114,7 +114,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
@@ -124,6 +124,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
@@ -169,7 +178,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
@@ -194,7 +203,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
@@ -204,6 +213,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 => @pc.id
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -231,7 +249,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
@@ -278,7 +296,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
index 5e48351..043c31c 100644 (file)
@@ -93,7 +93,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
@@ -118,7 +118,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
@@ -128,6 +128,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,6 +217,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 => @panel_picture.id
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -235,7 +253,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
@@ -282,7 +300,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
index 1463f15..0231c39 100644 (file)
@@ -88,7 +88,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -113,7 +113,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -123,12 +123,21 @@ if MagicNumber['run_mode'] == 1
         response.should be_success \r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      it 'ステータスコード200 OKを返す' do\r
+        get :index\r
+        response.should be_success \r
+      end\r
+    end\r
   end\r
   \r
   describe '単体表示に於いて' do\r
     before do\r
       @panel = FactoryGirl.create :panel, :author_id => @user.author.id\r
-      Panel.stub(:show).with(@panel.id.to_s, [@author, nil]).and_return(@panel)\r
+      Panel.stub(:show).with(@panel.id.to_s, [@user, nil]).and_return(@panel)\r
       Panel.stub(:show).with(@panel.id.to_s, [nil, @admin]).and_return(@panel)\r
       sign_in @user\r
     end\r
@@ -171,7 +180,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -196,7 +205,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -206,6 +215,15 @@ if MagicNumber['run_mode'] == 1
         response.should be_success \r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      it 'ステータスコード200 OKを返す' do\r
+          get :show, :id => @panel.id\r
+        response.should be_success \r
+      end\r
+    end\r
 =begin\r
     context '対象コマがないとき' do\r
       context 'html形式' do\r
@@ -310,7 +328,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -335,7 +353,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -351,6 +369,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          get :new\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          get :new\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
   end\r
   \r
   describe '新規作成に於いて' do\r
@@ -426,7 +459,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -451,7 +484,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -467,6 +500,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          post :create, :panel => @attr\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          post :create, :panel => @attr\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
     context '検証、保存に失敗した' do\r
       before do\r
         Panel.any_instance.stub(:store).and_return(false)\r
@@ -534,7 +582,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -559,7 +607,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -575,6 +623,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          get :edit, :id => @panel.id\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          get :edit, :id => @panel.id\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
   end\r
 \r
   describe '更新に於いて' do\r
@@ -645,7 +708,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -670,7 +733,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -686,6 +749,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          put :update, :id => @panel.id, :panel => @attr\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          put :update, :id => @panel.id, :panel => @attr\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
     context '検証、保存に失敗した' do\r
       before do\r
         Panel.any_instance.stub(:store).and_return(false)\r
@@ -754,7 +832,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -779,7 +857,7 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
-    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\r
+    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\r
       before do\r
         sign_out @user\r
         sign_in @admin\r
@@ -795,6 +873,21 @@ if MagicNumber['run_mode'] == 1
         end\r
       end\r
     end\r
+    context 'ユーザだが作家登録していないとき' do\r
+      before do\r
+        @author.destroy\r
+      end\r
+      context 'html形式' do\r
+        it 'ステータスコード302 Foundを返す' do\r
+          delete :destroy, :id => @panel.id\r
+          response.status.should eq 302\r
+        end\r
+        it '作家登録ページへ遷移する' do\r
+          delete :destroy, :id => @panel.id\r
+          response.body.should redirect_to new_author_path\r
+        end\r
+      end\r
+    end\r
     context '削除に失敗したとき' do\r
       before do\r
         Panel.any_instance.stub(:destroy_with_elements).and_return(false)\r
@@ -857,7 +950,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -887,8 +980,9 @@ else
   describe '単体表示に於いて' do\r
     before do\r
       @panel = FactoryGirl.create :panel, :author_id => @user.author.id\r
-      Panel.stub(:show).with(@panel.id.to_s, @author).and_return(@panel)\r
-      Panel.stub(:show).with(@panel.id.to_s, nil).and_return(@panel)\r
+      Panel.stub(:show).with(@panel.id.to_s, [nil, nil]).and_return(@panel)\r
+      Panel.stub(:show).with(@panel.id.to_s, [@user, nil]).and_return(@panel)\r
+      Panel.stub(:show).with(@panel.id.to_s, [nil, @admin]).and_return(@panel)\r
       sign_in @user\r
     end\r
     context 'つつがなく終わるとき' do\r
@@ -913,7 +1007,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -987,7 +1081,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -1045,7 +1139,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -1100,7 +1194,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -1159,7 +1253,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
@@ -1210,7 +1304,7 @@ else
         end\r
       end\r
     end\r
-    context 'ä½\9c家権é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
+    context 'ã\83¦ã\83¼ã\82¶æ¨©é\99\90ã\81\8cã\81ªã\81\84ã\81¨ã\81\8d' do\r
       before do\r
         sign_out @user\r
       end\r
index 23dbd0f..b7cd668 100644 (file)
@@ -20,7 +20,7 @@ if MagicNumber['run_mode'] == 1
     before do
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
       sign_in @user
-      Picture.stub(:show).with(@p.id.to_s, [@author, nil, nil]).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [@user, nil, nil]).and_return(@p)
       Picture.stub(:show).with(@p.id.to_s, [nil, @admin, nil]).and_return(@p)
       Picture.stub(:show).with(@p.id.to_s, [nil, nil, @demand_user]).and_return(@p)
     end
@@ -92,7 +92,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
@@ -117,7 +117,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
@@ -127,7 +127,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
@@ -137,6 +137,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 => @p.id
+        response.should be_success 
+      end
+    end
 =begin
     context '対象素材がないとき' do
       before do
@@ -184,7 +193,7 @@ if MagicNumber['run_mode'] == 1
     before do
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
       sign_in @user
-      Picture.stub(:show).with(@p.id.to_s, [@author, nil, nil]).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [@user, nil, nil]).and_return(@p)
       Picture.stub(:show).with(@p.id.to_s, [nil, @admin, nil]).and_return(@p)
       Picture.stub(:show).with(@p.id.to_s, [nil, nil, @demand_user]).and_return(@p)
     end
@@ -220,7 +229,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
@@ -245,7 +254,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
@@ -255,7 +264,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
@@ -265,6 +274,15 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      it 'ステータスコード200 OKを返す' do
+        get :credit, :id => @p.id
+        response.should be_success 
+      end
+    end
 =begin
     context '対象素材がないとき' do
       before do
@@ -337,7 +355,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
@@ -362,7 +380,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
@@ -372,7 +390,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
@@ -382,6 +400,15 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      it 'ステータスコード200 OKを返す' do
+        get :search, :md5 => 'a'*32
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -389,8 +416,10 @@ else
     before do
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
       sign_in @user
-      Picture.stub(:show).with(@p.id.to_s, @author).and_return(@p)
-      Picture.stub(:show).with(@p.id.to_s, nil).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [nil, nil, nil]).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [@user, nil, nil]).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [nil, @admin, nil]).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [nil, nil, @demand_user]).and_return(@p)
     end
     context 'つつがなく終わるとき as json' do
       it 'ステータスコード200 OKを返す' do
@@ -410,7 +439,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
@@ -437,8 +466,10 @@ else
     before do
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
       sign_in @user
-      Picture.stub(:show).with(@p.id.to_s, @author).and_return(@p)
-      Picture.stub(:show).with(@p.id.to_s, nil).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [nil, nil, nil]).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [@user, nil, nil]).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [nil, @admin, nil]).and_return(@p)
+      Picture.stub(:show).with(@p.id.to_s, [nil, nil, @demand_user]).and_return(@p)
     end
     context 'つつがなく終わるとき' do
       it 'ステータスコード200 OKを返す' do
@@ -458,7 +489,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
@@ -509,7 +540,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
index 1835a8d..0115ac8 100644 (file)
@@ -95,7 +95,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
@@ -120,7 +120,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
@@ -130,7 +130,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
@@ -140,6 +140,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
@@ -147,7 +156,7 @@ if MagicNumber['run_mode'] == 1
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
       @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
       sign_in @user
-      ResourcePicture.stub(:show).with(@rp.id.to_s, [@author, nil, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [@user, nil, nil]).and_return(@rp)
       ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, @admin, nil]).and_return(@rp)
       ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, nil, @demand_user]).and_return(@rp)
     end
@@ -249,7 +258,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
@@ -274,7 +283,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
@@ -284,7 +293,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
@@ -294,6 +303,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 => @rp.id
+        response.should be_success 
+      end
+    end
 =begin
     context '対象素材がないとき' do
       before do
@@ -366,8 +384,9 @@ if MagicNumber['run_mode'] == 1
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
       @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
       sign_in @user
-      ResourcePicture.stub(:show).with(@rp.id.to_s, @author).and_return(@rp)
-      ResourcePicture.stub(:show).with(@rp.id.to_s, nil).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [@user, nil, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, @admin, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, nil, @demand_user]).and_return(@rp)
     end
     context 'つつがなく終わるとき' do
       it '素材モデルに単体取得を問い合わせている' do
@@ -410,7 +429,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
@@ -435,7 +454,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
@@ -445,7 +464,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
@@ -455,6 +474,15 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      it 'ステータスコード200 OKを返す' do
+        get :credit, :id => @rp.id
+        response.should be_success 
+      end
+    end
 =begin
     context '対象素材がないとき' do
       before do
@@ -597,7 +625,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
@@ -625,7 +653,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
@@ -641,7 +669,7 @@ if MagicNumber['run_mode'] == 1
         end
       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
@@ -657,9 +685,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -885,7 +913,7 @@ if MagicNumber['run_mode'] == 1
         }.should_not change(ResourcePicture, :count)
       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
@@ -913,7 +941,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
@@ -929,7 +957,7 @@ if MagicNumber['run_mode'] == 1
         end
       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
@@ -945,9 +973,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -960,12 +988,11 @@ if MagicNumber['run_mode'] == 1
         end
       end
       context 'json形式' do
-        before do
+        it '例外403 forbiddenを返す' do
           @attr.merge!({:format => :json})
-        end
-        it '応答メッセージにUnauthorizedを返す' do
-          post :create, @attr
-          response.message.should match(/Unauthorized/)
+          lambda{
+            post :create, @attr
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -1054,7 +1081,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
@@ -1075,7 +1102,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
@@ -1091,7 +1118,7 @@ if MagicNumber['run_mode'] == 1
         end
       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
@@ -1107,9 +1134,9 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
-    context 'ä½\9c家ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
+    context 'ã\83¦ã\83¼ã\82¶ã\81\8c絵師ã\81§ã\81ªã\81\84ã\81¨ã\81\8d' do
       before do
-        Author.any_instance.stub(:artist?).and_return(false)
+        @artist.destroy
       end
       context 'html形式' do
         it 'ステータスコード302 Foundを返す' do
@@ -1122,9 +1149,10 @@ if MagicNumber['run_mode'] == 1
         end
       end
       context 'json形式' do
-        it '応答メッセージにUnauthorizedを返す' do
-          delete :destroy, :id => @rp.id, :format => :json
-          response.message.should match(/Unauthorized/)
+        it '例外403 forbiddenを返す' do
+          lambda{
+            delete :destroy, :id => @rp.id, :format => :json
+          }.should raise_error(ActiveRecord::Forbidden)
         end
       end
     end
@@ -1185,7 +1213,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
@@ -1217,8 +1245,10 @@ else
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
       @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
       sign_in @user
-      ResourcePicture.stub(:show).with(@rp.id.to_s, @author).and_return(@rp)
-      ResourcePicture.stub(:show).with(@rp.id.to_s, nil).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, nil, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [@user, nil, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, @admin, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, nil, @demand_user]).and_return(@rp)
     end
     context 'つつがなく終わるとき' do
       context 'html形式' do
@@ -1242,7 +1272,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
@@ -1293,8 +1323,10 @@ else
       @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
       @rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
       sign_in @user
-      ResourcePicture.stub(:show).with(@rp.id.to_s, @author).and_return(@rp)
-      ResourcePicture.stub(:show).with(@rp.id.to_s, nil).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, nil, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [@user, nil, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, @admin, nil]).and_return(@rp)
+      ResourcePicture.stub(:show).with(@rp.id.to_s, [nil, nil, @demand_user]).and_return(@rp)
     end
     context 'つつがなく終わるとき' do
       context 'html形式' do
@@ -1318,7 +1350,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
@@ -1392,7 +1424,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
@@ -1472,6 +1504,21 @@ else
         end
       end
     end
+    context 'ユーザ権限がないとき' do
+      before do
+        sign_out @user
+      end
+      context 'html形式' do
+        it 'ステータスコード302 Foundを返す' do
+          post :create, @newattr
+          response.status.should eq 302
+        end
+        it 'サインインページへ遷移する' do
+          post :create, @newattr
+          response.body.should redirect_to '/users/sign_in'
+        end
+      end
+    end
   end
   
   describe '削除に於いて' do
@@ -1505,7 +1552,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
index afad3fa..08eb32f 100644 (file)
@@ -65,7 +65,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
@@ -90,7 +90,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
@@ -100,12 +100,21 @@ 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
     before do
       sign_in @user
-      SpeechBalloonTemplate.stub(:show).with(@sbt.id.to_s, [@author, nil]).and_return(@sbt)
+      SpeechBalloonTemplate.stub(:show).with(@sbt.id.to_s, [@user, nil]).and_return(@sbt)
       SpeechBalloonTemplate.stub(:show).with(@sbt.id.to_s, [nil, @admin]).and_return(@sbt)
     end
     context 'つつがなく終わるとき' do
@@ -147,7 +156,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
@@ -172,7 +181,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
@@ -182,6 +191,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 => @sbt.id
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -212,7 +230,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
@@ -242,8 +260,9 @@ else
   describe '単体表示に於いて' do
     before do
       sign_in @user
-      SpeechBalloonTemplate.stub(:show).with(@sbt.id.to_s, @author).and_return(@sbt)
-      SpeechBalloonTemplate.stub(:show).with(@sbt.id.to_s, nil).and_return(@sbt)
+      SpeechBalloonTemplate.stub(:show).with(@sbt.id.to_s, [nil, nil]).and_return(@sbt)
+      SpeechBalloonTemplate.stub(:show).with(@sbt.id.to_s, [@user, nil]).and_return(@sbt)
+      SpeechBalloonTemplate.stub(:show).with(@sbt.id.to_s, [nil, @admin]).and_return(@sbt)
     end
     context 'つつがなく終わるとき' do
       context 'html形式' do
@@ -267,7 +286,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
index f6f0e45..3c555a0 100644 (file)
@@ -90,7 +90,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
@@ -115,7 +115,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
@@ -125,6 +125,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
@@ -170,7 +179,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
@@ -195,7 +204,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
@@ -205,6 +214,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 => @sb.id
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -232,7 +250,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
@@ -279,7 +297,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
index 00277ba..abb4ba2 100644 (file)
@@ -93,7 +93,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
@@ -118,7 +118,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
@@ -128,6 +128,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
@@ -175,7 +184,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
@@ -200,7 +209,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
@@ -210,6 +219,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 => @speech.id
+        response.should be_success 
+      end
+    end
   end
   
 else
@@ -239,7 +257,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
@@ -288,7 +306,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
index 3b8345f..0268c4e 100644 (file)
@@ -88,7 +88,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
@@ -113,7 +113,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
@@ -123,20 +123,29 @@ 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
     before do
       sign_in @user
       @story = FactoryGirl.create :story, :t => 0, :comic_id => @comic.id, :panel_id => @panel.id, :author_id => @author.id
-      Comic.stub(:show).with(@comic.id.to_s, [@author, nil]).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [@user, nil]).and_return(@comic)
       Comic.stub(:show).with(@comic.id.to_s, [nil, @admin]).and_return(@comic)
-      Story.stub(:show).with(@story.id.to_s, [@author, nil]).and_return(@story)
+      Story.stub(:show).with(@story.id.to_s, [@user, nil]).and_return(@story)
       Story.stub(:show).with(@story.id.to_s, [nil, @admin]).and_return(@story)
     end
     context 'つつがなく終わるとき' do
       it 'ストーリーモデルに単体取得を問い合わせている' do
-        Story.should_receive(:show).with(@story.id.to_s, [@author, nil]).exactly(1)
+        Story.should_receive(:show).with(@story.id.to_s, [@user, nil]).exactly(1)
         get :show, :id => @story.id
       end
       it '@storyにアレを取得している' do
@@ -175,7 +184,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
@@ -200,7 +209,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
@@ -210,12 +219,21 @@ 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 => @story.id
+        response.should be_success 
+      end
+    end
   end
   
   describe '閲覧に於いて' do
     before do
       @story = FactoryGirl.create :story, :t => 0, :comic_id => @comic.id, :panel_id => @panel.id, :author_id => @author.id
-      Comic.stub(:show).with(@comic.id.to_s, [@author, nil]).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [@user, nil]).and_return(@comic)
       Comic.stub(:show).with(@comic.id.to_s, [nil, @admin]).and_return(@comic)
       Story.stub(:count).and_return(10)
       Story.stub(:play_list).with(any_args).and_return([@story, @story, @story])
@@ -249,7 +267,7 @@ if MagicNumber['run_mode'] == 1
     end
     context '事前チェックする' do
       it 'コミックモデルに単体取得を問い合わせている' do
-        Comic.should_receive(:show).with(@comic.id.to_s, [@author, nil]).exactly(1)
+        Comic.should_receive(:show).with(@comic.id.to_s, [@user, nil]).exactly(1)
         get :comic, :id => @comic.id
       end
       it 'ストーリーモデルにプレイリスト取得を問い合わせている' do
@@ -299,7 +317,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
@@ -324,7 +342,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
@@ -334,6 +352,15 @@ if MagicNumber['run_mode'] == 1
         response.should be_success 
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      it 'ステータスコード200 OKを返す' do
+        get :comic, :id => @comic.id
+        response.should be_success 
+      end
+    end
   end
 
   describe '新規作成フォーム表示に於いて' do
@@ -391,7 +418,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
@@ -416,7 +443,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
@@ -432,6 +459,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
@@ -504,7 +546,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
@@ -529,7 +571,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
@@ -545,6 +587,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, :story => @attr
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          post :create, :story => @attr
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
     context '検証、保存に失敗した' do
       before do
         Story.any_instance.stub(:store).and_return(false)
@@ -612,7 +669,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
@@ -637,7 +694,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
@@ -653,6 +710,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 => @story.id
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          get :edit, :id => @story.id
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
   end
 
   describe '更新に於いて' do
@@ -705,7 +777,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
@@ -730,7 +802,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
@@ -746,6 +818,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 => @story.id, :story => @attr
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          put :update, :id => @story.id, :story => @attr
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
     context '検証、保存に失敗した' do
       before do
         Story.any_instance.stub(:store).and_return(false)
@@ -822,7 +909,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
@@ -847,7 +934,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
@@ -863,6 +950,21 @@ if MagicNumber['run_mode'] == 1
         end
       end
     end
+    context 'ユーザだが作家登録していないとき' do
+      before do
+        @author.destroy
+      end
+      context 'html形式' do
+        it 'ステータスコード302 Foundを返す' do
+          delete :destroy, :id => @story.id
+          response.status.should eq 302
+        end
+        it '作家登録ページへ遷移する' do
+          delete :destroy, :id => @story.id
+          response.body.should redirect_to new_author_path
+        end
+      end
+    end
     context '削除に失敗したとき' do
       before do
         Story.any_instance.stub(:destroy_and_shorten).with(any_args()).and_return(false)
@@ -921,7 +1023,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
@@ -948,10 +1050,12 @@ else
     before do
       sign_in @user
       @story = FactoryGirl.create :story, :t => 0, :comic_id => @comic.id, :panel_id => @panel.id, :author_id => @author.id
-      Comic.stub(:show).with(@comic.id.to_s, @author).and_return(@comic)
-      Comic.stub(:show).with(@comic.id.to_s, nil).and_return(@comic)
-      Story.stub(:show).with(@story.id.to_s, @author).and_return(@story)
-      Story.stub(:show).with(@story.id.to_s, nil).and_return(@story)
+      Comic.stub(:show).with(@comic.id.to_s, [nil, nil]).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [@user, nil]).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [nil, @admin]).and_return(@comic)
+      Story.stub(:show).with(@story.id.to_s, [nil, nil]).and_return(@story)
+      Story.stub(:show).with(@story.id.to_s, [@user, nil]).and_return(@story)
+      Story.stub(:show).with(@story.id.to_s, [nil, @admin]).and_return(@story)
     end
     context 'つつがなく終わるとき' do
       context 'html形式' do
@@ -975,7 +1079,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
@@ -1005,8 +1109,9 @@ else
   describe '閲覧に於いて' do
     before do
       @story = FactoryGirl.create :story, :t => 0, :comic_id => @comic.id, :panel_id => @panel.id, :author_id => @author.id
-      Comic.stub(:show).with(@comic.id.to_s, @author).and_return(@comic)
-      Comic.stub(:show).with(@comic.id.to_s, nil).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [nil, nil]).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [@user, nil]).and_return(@comic)
+      Comic.stub(:show).with(@comic.id.to_s, [nil, @admin]).and_return(@comic)
       Story.stub(:count).and_return(10)
       Story.stub(:play_list).with(any_args).and_return([@story, @story, @story])
       sign_in @user
@@ -1033,7 +1138,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
@@ -1096,7 +1201,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
@@ -1153,7 +1258,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
@@ -1208,7 +1313,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
@@ -1262,7 +1367,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
@@ -1316,7 +1421,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
index 0db0485..b8bd139 100644 (file)
@@ -91,7 +91,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
@@ -116,7 +116,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
@@ -126,7 +126,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
@@ -237,7 +237,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
@@ -262,7 +262,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
@@ -272,7 +272,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
@@ -354,7 +354,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
@@ -404,7 +404,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