- end\r
- end\r
- end\r
- context '作家権限がないとき' do\r
- before do\r
- sign_out @user\r
- end\r
- context 'html形式' do\r
- it 'ステータスコード302 Foundを返す' do\r
- get :credit, :id => @rp.id\r
- response.status.should eq 302\r
- end\r
- it 'サインインページへ遷移する' do\r
- get :credit, :id => @rp.id\r
- response.body.should redirect_to '/users/sign_in'\r
- end\r
- end\r
- context 'json形式' do\r
- it 'ステータスコード401 Unauthorizedを返す' do\r
- get :credit, :id => @rp.id, :format => :json\r
- response.status.should eq 401\r
- end\r
- it '応答メッセージにUnauthorizedを返す' do\r
- get :credit, :id => @rp.id, :format => :json\r
- response.message.should match(/Unauthorized/)\r
- end\r
- end\r
- end\r
-=begin\r
- context '対象素材がないとき' do\r
- before do\r
- ResourcePicture.unstub(:show)\r
- end\r
- context 'html形式' do\r
- it '例外404 not_foundを返す' do\r
- lambda{\r
- get :show, :id => 0\r
- }.should raise_error(ActiveRecord::RecordNotFound)\r
- end\r
- end\r
- context 'json形式' do\r
- it '例外404 not_foundを返す' do\r
- lambda{ \r
- get :show, :id => 0, :format => :json\r
- }.should raise_error(ActiveRecord::RecordNotFound)\r
- end\r
- end\r
- end\r
-=end\r
+ end
+ end
+ end
+ context '作家権限がないとき' do
+ before do
+ sign_out @user
+ end
+ context 'html形式' do
+ it 'ステータスコード302 Foundを返す' do
+ get :credit, :id => @rp.id
+ response.status.should eq 302
+ end
+ it 'サインインページへ遷移する' do
+ get :credit, :id => @rp.id
+ response.body.should redirect_to '/users/sign_in'
+ end
+ end
+ context 'json形式' do
+ it 'ステータスコード401 Unauthorizedを返す' do
+ get :credit, :id => @rp.id, :format => :json
+ response.status.should eq 401
+ end
+ it '応答メッセージにUnauthorizedを返す' do
+ get :credit, :id => @rp.id, :format => :json
+ response.message.should match(/Unauthorized/)
+ end
+ end
+ end
+=begin
+ context '対象素材がないとき' do
+ before do
+ ResourcePicture.unstub(:show)
+ end
+ context 'html形式' do
+ it '例外404 not_foundを返す' do
+ lambda{
+ get :show, :id => 0
+ }.should raise_error(ActiveRecord::RecordNotFound)
+ end
+ end
+ context 'json形式' do
+ it '例外404 not_foundを返す' do
+ lambda{
+ get :show, :id => 0, :format => :json
+ }.should raise_error(ActiveRecord::RecordNotFound)
+ end
+ end
+ end
+=end