Ȥ Blog

Ruby,C#

2009ǯ03

ǥ(13)

饸(ɾά)äƤǥ쎣(4)Τ13ɤߤޤ
ꥫʸؤäƺޤǹʤΤʤäޤԤϤƤʤäΤǤ򤤤Ǥ
򤤡ƤʤƸȤˤɤޤƤ롢ȤΤϻǤ򤤡ȤɾǤ
Ǹ4礦ɿ޽ۤͽѤߤˤʤäΤϤΤǤ˹Ԥ֤ʤ
轵ޤDZӤƤޤ⡢

ȥǥ1 (ϥ䥫ʸNV)
//Artist ٥å
, 819 ˼
ɾ

2009-03-05

ڡBOOKץǡ١
⸷缫αĤߤ֤륫ե˥꡼ʥࡦȥ饹ϡƤϤˬ줿ǫŲꤤʤ⡢¤ˤäƷ򶯤줿ϡ̡äƤޤꡢƤν㥷Ȥᤰ礤ϢΩäƿʿƧ߽ФդǤΤġ褫켡ޤǤطʤˡʹ֤γƣư


󥿥륵С

satoyansoft.comۥƥ󥰤Ƥ󥿥륵С󤹤뤳Ȥˤޤ
ɤбⰭΤDz۲ʤʤ⤦ʬǴȤȤǼǻĤȤˤޤ
ɥᥤΰܹԤˤ³ɬפʤᡢ2֤餤ꤽǤ
⤷桼䤤碌褬狼ʤȤϲƤˤ䤤碌
support@satoyansoft.com


Rspec

ApplicationController
rescue_action_in_public, resuce_action_locally񤭤ơ
Ȥ404ơɤ֤褦ʽ硢ºݤRspecdzǧ褦Ȥȡñ㳰ȯФǥƥȤˤʤޤ
ɤresuce_in_**** ¹ԤƤʤ͡
RspecΥɥȤǤäݤ꤬뤫ɤõƤ顢ޤ
̾⡢use_rails_error_handling
ǡνͤɤʤäƤ뤫ºݤ˼¹ԤƥǥХåϤȤϤꡢfalseˤʤäƤޤ
ʤΤǡuse_rails_error_handling!() 򥵥˼¹ԤƤäƤߤȡ̵ƥȤǤޤ
ͤޤǤˡ¸ɤϰʲΤ褦ˤʤޤ

rescue_action_*** 򥪡С饤ɤHTTPơɤ404֤褦ѹ
class ApplicationController < ActionController::Base
def rescue_action_in_public (ex)
return render(:text => ex.message, :status => 404)
end

def rescue_action_locally(ex)
return render(:text => ex.message, :status => 404)
end
end



ǡȤꤢ㳰ȯ륢
class MainController < ApplicationController
def index
raise 'hoge error'
end
end


ºݤ404֤äƤ뤫ɤΥƥ
describe MainController do
before() do
controller.use_rails_error_handling!
get :index
end

it "404֤äƤϤ" do
response.code.should == "404"
end
end


before֥å controller.use_rails_error_handling! ƤӽФƤФresuce_action_**ƤФ褦Ǥ



ץե

Ȥ

C#ɻŻRubyФʳȯԡ
ǶDockerȤؿȤAngularJS˥ϥޤäƤ롣
¢ȤĮȤȤ˽ס

QR
QR
  • 饤֥ɥ֥