FIX: username route was broken
This commit is contained in:
parent
51679ef6b2
commit
ab6843dcde
|
@ -326,7 +326,7 @@ Discourse::Application.routes.draw do
|
|||
get "users/:username/messages/group/:group_name/archive" => "user_actions#private_messages", constraints: {username: USERNAME_ROUTE_FORMAT, group_name: USERNAME_ROUTE_FORMAT}
|
||||
|
||||
get "users/:username.json" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}, defaults: {format: :json}
|
||||
get "users/:username" => "users#show", as: 'user', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get "users/:username" => "users#show", as: 'user', constraints: {username: USERNAME_ROUTE_FORMAT, format: /(json|html)/}
|
||||
put "users/:username" => "users#update", constraints: {username: USERNAME_ROUTE_FORMAT}, defaults: { format: :json }
|
||||
get "users/:username/emails" => "users#check_emails", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get "users/:username/preferences" => "users#preferences", constraints: {username: USERNAME_ROUTE_FORMAT}, as: :email_preferences
|
||||
|
|
|
@ -3,6 +3,29 @@ require 'rails_helper'
|
|||
RSpec.describe "Users" do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
describe "viewing a user" do
|
||||
|
||||
it "should be able to view a user" do
|
||||
get "/users/#{user.username}"
|
||||
|
||||
expect(response).to be_success
|
||||
expect(response.body).to include(user.username)
|
||||
end
|
||||
|
||||
describe 'when username contains a period' do
|
||||
before do
|
||||
user.update!(username: 'test.test')
|
||||
end
|
||||
|
||||
it "should be able to view a user" do
|
||||
get "/users/#{user.username}"
|
||||
|
||||
expect(response).to be_success
|
||||
expect(response.body).to include(user.username)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "updating a user" do
|
||||
before do
|
||||
sign_in(user)
|
||||
|
|
Loading…
Reference in New Issue