OSDN Git Service

t#31326:drop color
[pettanr/pettanr.git] / spec / controllers / authors_controller_spec.rb
index 1522b75..0ad1f83 100644 (file)
@@ -880,13 +880,12 @@ if MagicNumber['run_mode'] == 1
     end
   end
   
-  describe '対象作家の選択色地一覧表示に於いて' do
+  describe '対象作家の色地一覧表示に於いて' do
     before do
       @other_user = FactoryGirl.create( :user_yas)
       @other_author = FactoryGirl.create :author, :user_id => @other_user.id
       @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-      @color = FactoryGirl.create :color
-      @gc = FactoryGirl.create :ground_color, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color
       @panel = FactoryGirl.create :panel, :author_id => @author.id
       GroundColor.stub(:himlist).and_return([@gc, @gc, @gc])
       sign_in @user
@@ -926,7 +925,7 @@ if MagicNumber['run_mode'] == 1
         Author.should_receive(:show).exactly(1)
         get :ground_colors, :id => @other_author.id
       end
-      it '選択色地モデルに他作家の選択色地一覧を問い合わせている' do
+      it '色地モデルに他作家の色地一覧を問い合わせている' do
         GroundColor.should_receive(:himlist).exactly(1)
         get :ground_colors, :id => @other_author.id
       end
@@ -945,7 +944,7 @@ if MagicNumber['run_mode'] == 1
           get :ground_colors, :id => @other_author.id, :format => :json
           lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
         end
-        it '選択色地モデルにjson一覧出力オプションを問い合わせている' do
+        it '色地モデルにjson一覧出力オプションを問い合わせている' do
           GroundColor.should_receive(:list_json_opt).exactly(1)
           get :ground_colors, :id => @other_author.id, :format => :json
         end
@@ -954,11 +953,11 @@ if MagicNumber['run_mode'] == 1
           json = JSON.parse response.body
           json.should have_at_least(3).items
         end
-        it 'リストの先頭くらいは選択色地っぽいものであって欲しい' do
+        it 'リストの先頭くらいは色地っぽいものであって欲しい' do
           get :ground_colors, :id => @other_author.id, :format => :json
           json = JSON.parse response.body
           json.first.has_key?("panel_id").should be_true
-          json.first.has_key?("color_id").should be_true
+          json.first.has_key?("code").should be_true
           json.first.has_key?("z").should be_true
         end
       end
@@ -1009,134 +1008,6 @@ if MagicNumber['run_mode'] == 1
     end
   end
   
-  describe '対象作家の指定色地一覧表示に於いて' do
-    before do
-      @other_user = FactoryGirl.create( :user_yas)
-      @other_author = FactoryGirl.create :author, :user_id => @other_user.id
-      @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      PanelColor.stub(:himlist).and_return([@pc, @pc, @pc])
-      sign_in @user
-    end
-    context 'パラメータpageについて' do
-      it '@pageに値が入る' do
-        get :panel_colors, :id => @other_author.id, :page => 5
-        assigns(:page).should eq 5
-      end
-      it '省略されると@pageに1値が入る' do
-        get :panel_colors, :id => @other_author.id
-        assigns(:page).should eq 1
-      end
-      it '与えられたpage_sizeがセットされている' do
-        get :panel_colors, :id => @other_author.id, :page_size => 15
-        assigns(:page_size).should eq 15
-      end
-      it '省略されると@page_sizeにデフォルト値が入る' do
-        get :panel_colors, :id => @other_author.id
-        assigns(:page_size).should eq Author.default_panel_color_page_size
-      end
-      it '最大を超えると@page_sizeにデフォルト最大値が入る' do
-        get :panel_colors, :id => @other_author.id, :page_size => 1500
-        assigns(:page_size).should eq Author.panel_color_max_page_size
-      end
-      it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
-        get :panel_colors, :id => @other_author.id, :page_size => 0
-        assigns(:page_size).should eq Author.panel_color_page_size
-      end
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors, :id => @other_author.id
-        response.should be_success 
-      end
-      it '作家モデルに単体取得を問い合わせている' do
-        Author.should_receive(:show).exactly(1)
-        get :panel_colors, :id => @other_author.id
-      end
-      it '指定色地モデルに他作家の指定色地一覧を問い合わせている' do
-        PanelColor.should_receive(:himlist).exactly(1)
-        get :panel_colors, :id => @other_author.id
-      end
-      it '@panel_colorsにリストを取得している' do
-        get :panel_colors, :id => @other_author.id
-        assigns(:panel_colors).should have_at_least(3).items
-      end
-      context 'html形式' do
-        it 'panel_colorsテンプレートを描画する' do
-          get :panel_colors, :id => @other_author.id
-          response.should render_template("panel_colors")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it '指定色地モデルにjson一覧出力オプションを問い合わせている' do
-          PanelColor.should_receive(:list_json_opt).exactly(1)
-          get :panel_colors, :id => @other_author.id, :format => :json
-        end
-        it 'データがリスト構造になっている' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          json = JSON.parse response.body
-          json.should have_at_least(3).items
-        end
-        it 'リストの先頭くらいは指定色地っぽいものであって欲しい' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          json = JSON.parse response.body
-          json.first.has_key?("panel_id").should be_true
-          json.first.has_key?("code").should be_true
-          json.first.has_key?("z").should be_true
-        end
-      end
-    end
-    context 'ユーザ権限がないとき' do
-      before do
-        sign_out @user
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          get :panel_colors, :id => @other_author.id
-          response.status.should eq 302
-        end
-        it 'サインインページへ遷移する' do
-          get :panel_colors, :id => @other_author.id
-          response.should redirect_to '/users/sign_in'
-        end
-      end
-      context 'json形式' do
-        it 'ステータスコード401 Unauthorizedを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          response.status.should eq 401
-        end
-        it '応答メッセージにUnauthorizedを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          response.message.should match(/Unauthorized/)
-        end
-      end
-    end
-    context 'ユーザ権限はないが管理者権限があるとき' do
-      before do
-        sign_out @user
-        sign_in @admin
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors, :id => @other_author.id
-        response.should be_success 
-      end
-    end
-    context 'ユーザだが作家登録していないとき' do
-      before do
-        @author.destroy
-      end
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors, :id => @other_author.id
-        response.should be_success 
-      end
-    end
-  end
-  
   describe '作家数取得に於いて' do
     before do
       Author.should_receive(:visible_count).and_return(3)
@@ -1983,13 +1854,12 @@ else
     end
   end
   
-  describe '対象作家の選択色地一覧表示に於いて' do
+  describe '対象作家の色地一覧表示に於いて' do
     before do
       @other_user = FactoryGirl.create( :user_yas)
       @other_author = FactoryGirl.create :author, :user_id => @other_user.id
       @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-      @color = FactoryGirl.create :color
-      @gc = FactoryGirl.create :ground_color, :color_id => @color.id
+      @gc = FactoryGirl.create :ground_color
       @panel = FactoryGirl.create :panel, :author_id => @author.id
       GroundColor.stub(:himlist).and_return([@gc, @gc, @gc])
       sign_in @user
@@ -2031,53 +1901,6 @@ else
     end
   end
   
-  describe '対象作家の指定色地一覧表示に於いて' do
-    before do
-      @other_user = FactoryGirl.create( :user_yas)
-      @other_author = FactoryGirl.create :author, :user_id => @other_user.id
-      @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
-      PanelColor.stub(:himlist).and_return([@pc, @pc, @pc])
-      sign_in @user
-    end
-    context 'つつがなく終わるとき' do
-      it 'ステータスコード200 OKを返す' do
-        get :panel_colors, :id => @other_author.id
-        response.should be_success 
-      end
-      context 'html形式' do
-        it 'panel_colorsテンプレートを描画する' do
-          get :panel_colors, :id => @other_author.id
-          response.should render_template("panel_colors")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-    context 'ユーザ権限がないとき' do
-      before do
-        sign_out @user
-      end
-      context 'html形式' do
-        it 'panel_colorsテンプレートを描画する' do
-          get :panel_colors, :id => @other_author.id
-          response.should render_template("panel_colors")
-        end
-      end
-      context 'json形式' do
-        it 'jsonデータを返す' do
-          get :panel_colors, :id => @other_author.id, :format => :json
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-      end
-    end
-  end
-  
   describe '作家数取得に於いて' do
     before do
       Author.should_receive(:visible_count).and_return(3)