OSDN Git Service

t#30102#30122:update i18n pictures
[pettanr/pettanr.git] / spec / controllers / system_pictures_controller_spec.rb
index e8cc013..701325d 100644 (file)
@@ -284,156 +284,4 @@ describe SystemPicturesController do
 =end
   end
   
-  describe '新規作成フォーム表示に於いて' do
-    before do
-      sign_in @user
-      sign_in @admin
-    end
-    context 'つつがなく終わるとき' do
-      context 'html形式' do
-        it 'ステータスコード200 OKを返す' do
-          get :new
-          response.should be_success 
-        end
-        it 'ページテンプレートnewを描画する' do
-          get :new
-          response.should render_template("new")
-        end
-      end
-    end
-    context '管理者権限がないとき' do
-      before do
-        sign_out @admin
-      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 '/admins/sign_in'
-        end
-      end
-    end
-  end
-
-  describe '新規作成に於いて' do
-    before do
-      sign_in @admin
-      sign_in @user
-      @attr = {:system_picture => {:file => "abc\ndef\nghi"}}
-      @imager = ImagerTest.load("abc\ndef\nghi")
-    end
-    context '事前チェックしておく' do
-      before do
-        PettanImager.stub(:load).with(any_args).and_return(@imager)
-        SystemPicture.any_instance.stub(:store).with(@imager).and_return(true)
-      end
-      it "画像ライブラリをロードしている" do
-        PettanImager.should_receive(:load).with(any_args).exactly(1)
-        post :create, @attr
-      end
-      it 'システム画像モデルに保存依頼する' do
-        SystemPicture.should_receive(:store).with(@imager).exactly(1)
-        post :create, @attr
-      end
-    end
-    context 'つつがなく終わるとき' do
-      before do
-        PettanImager.stub(:load).with(any_args).and_return(@imager)
-        SystemPicture.stub(:store).with(@imager).and_return(@sp)
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          post :create, @attr
-          response.status.should eq 302
-        end
-        it '作成されたシステム画像の表示ページへ遷移する' do
-          post :create, @attr
-          response.should redirect_to(SystemPicture.last)
-        end
-      end
-      context 'json形式' do
-        before do
-          @attr.merge!({:format => :json})
-        end
-        it 'ステータスコード200 OKを返す' do
-          post :create, @attr
-          response.should be_success 
-        end
-        it '作成されたシステム画像をjsonデータで返す' do
-          post :create, @attr
-          lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
-        end
-        it 'システム画像モデルにjson単体出力オプションを問い合わせている' do
-          SystemPicture.should_receive(:show_json_opt).exactly(1)
-          post :create, @attr
-        end
-        it 'データがアレになっている' do
-          post :create, @attr
-          json = JSON.parse response.body
-          json["ext"].should match(/png/)
-          json["md5"].should be_true
-          json["width"].should be_true
-        end
-      end
-    end
-    context '管理者権限がないとき' do
-      before do
-        sign_out @admin
-      end
-      context 'html形式' do
-        it 'ステータスコード302 Foundを返す' do
-          post :create, @attr
-          response.status.should eq 302
-        end
-        it 'サインインページへ遷移する' do
-          post :create, @attr
-          response.body.should redirect_to '/admins/sign_in'
-        end
-      end
-      context 'json形式' do
-        before do
-          @attr.merge!({:format => :json})
-        end
-        it 'ステータスコード401 Unauthorizedを返す' do
-          post :create, @attr
-          response.status.should eq 401
-        end
-        it '応答メッセージにUnauthorizedを返す' do
-          post :create, @attr
-          response.message.should match(/Unauthorized/)
-        end
-      end
-    end
-    context '検証、保存に失敗した' do
-      before do
-        SystemPicture.stub(:store).and_return(nil)
-      end
-      context 'html形式' do
-        it 'ステータスコード200 OKを返す' do
-          post :create, @attr
-          response.status.should eq 200
-        end
-        it '新規ページを描画する' do
-          post :create, @attr
-          response.should render_template("new")
-        end
-      end
-      context 'json形式' do
-        before do
-          @attr.merge!({:format => :json})
-        end
-        it 'ステータスコード422 unprocessable_entity を返す' do
-          post :create, @attr
-          response.status.should eq 422
-        end
-        it '応答メッセージUnprocessable Entityを返す' do
-          post :create, @attr
-          response.message.should match(/Unprocessable/)
-        end
-      end
-    end
-  end
 end