How to use HTTP status code symbols in RSpec?

后端 未结 4 357
误落风尘
误落风尘 2020-12-29 20:30

I use HTTP status code symbols in code in a controller such as:

render json: {
    auth_token: user.authentication_t         


        
4条回答
  •  别那么骄傲
    2020-12-29 21:02

    With rspec-rails (as of rspec 3) it's possible to use

    expect(response).to have_http_status(:created)
    

    Update 2018-06-11:

    As of Rails 6, some of the matchers will be replaced (e. g. success by successful).

提交回复
热议问题