ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
546 B

  1. require "rails_helper"
  2. RSpec.describe "Users", type: :request do
  3. describe "POST /users" do
  4. it "creates guest user and returns code" do
  5. post "/users"
  6. expect(response).to have_http_status(:ok)
  7. expect(json["code"]).to be_present
  8. expect(json["user"]["role"]).to eq("guest")
  9. end
  10. end
  11. describe "POST /users/code/renew" do
  12. it "should be 401 when not logged in (recommended behavior)" do
  13. sign_out
  14. post "/users/code/renew"
  15. expect(response).to have_http_status(:unauthorized)
  16. end
  17. end
  18. end